From dbee687a75797e0be5f8484030d11ea22e18b63c Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Wed, 17 Jun 2020 01:22:28 -0400 Subject: [PATCH] Add only one 5GC scenario (call-flow) --- configs/5gc.yaml.in | 4 +- configs/minimal.yaml.in | 4 +- configs/open5gs/amf.yaml.in | 4 +- lib/asn1c/util/conv.c | 14 +- lib/asn1c/util/meson.build | 1 + lib/asn1c/util/message.c | 79 + lib/asn1c/util/message.h | 42 + lib/core/ogs-3gpp-types.c | 122 +- lib/core/ogs-3gpp-types.h | 71 +- lib/core/ogs-macros.h | 10 +- lib/crypt/meson.build | 1 + lib/crypt/ogs-base64.c | 162 + lib/crypt/ogs-base64.h | 46 + lib/crypt/ogs-crypt.h | 1 + lib/crypt/ogs-kdf.c | 15 +- lib/crypt/ogs-kdf.h | 4 - lib/dbi/subscription.c | 85 +- lib/dbi/subscription.h | 11 +- lib/gtp/ogs-gtp.h | 3 - lib/nas/5gs/conv.c | 20 +- lib/nas/5gs/conv.h | 2 +- lib/nas/5gs/decoder.c | 992 +++-- lib/nas/5gs/encoder.c | 1140 ++--- lib/nas/5gs/ies.c | 10 +- lib/nas/5gs/ies.h | 2 +- lib/nas/5gs/message.h | 516 +-- lib/nas/5gs/support/cache/nas-msg-103.py | 2 +- lib/nas/5gs/support/cache/nas-msg-193.py | 22 +- lib/nas/5gs/support/cache/nas-msg-194.py | 20 +- lib/nas/5gs/support/cache/nas-msg-195.py | 9 +- lib/nas/5gs/support/cache/nas-msg-197.py | 2 +- lib/nas/5gs/support/cache/nas-msg-198.py | 12 +- lib/nas/5gs/support/cache/nas-msg-199.py | 16 - lib/nas/5gs/support/cache/nas-msg-201.py | 16 +- lib/nas/5gs/support/cache/nas-msg-202.py | 5 +- lib/nas/5gs/support/cache/nas-msg-203.py | 12 +- lib/nas/5gs/support/cache/nas-msg-204.py | 2 +- lib/nas/5gs/support/cache/nas-msg-205.py | 11 +- lib/nas/5gs/support/cache/nas-msg-209.py | 5 +- lib/nas/5gs/support/cache/nas-msg-210.py | 12 +- lib/nas/5gs/support/cache/nas-msg-211.py | 6 +- lib/nas/5gs/support/cache/nas-msg-212.py | 2 +- lib/nas/5gs/support/cache/nas-msg-214.py | 3 +- lib/nas/5gs/support/nas-message.py | 55 +- lib/nas/5gs/support/type-list.py | 10 +- lib/nas/5gs/types.c | 198 +- lib/nas/5gs/types.h | 225 +- lib/nas/common/types.h | 34 +- lib/nas/eps/types.h | 23 +- lib/ngap/message.c | 43 +- lib/ngap/message.h | 6 +- lib/ngap/ogs-ngap.h | 1 + lib/s1ap/message.c | 39 +- lib/s1ap/message.h | 2 +- lib/s1ap/ogs-s1ap.h | 1 + lib/sbi/client.c | 92 +- lib/sbi/client.h | 5 + lib/sbi/context.c | 34 +- lib/sbi/context.h | 35 +- lib/sbi/contrib/multipart_parser.c | 309 ++ lib/sbi/contrib/multipart_parser.h | 45 + lib/sbi/conv.c | 57 +- lib/sbi/conv.h | 10 +- lib/sbi/meson.build | 3 + lib/sbi/message.c | 1609 +++++-- lib/sbi/message.h | 133 +- lib/sbi/nnrf-build.c | 14 +- lib/sbi/ogs-sbi.h | 15 + lib/sbi/openapi/.openapi-generator-ignore | 1 - .../templates/apiKey.c.mustache | 2 +- .../templates/binary.c.mustache | 6 +- .../templates/binary.h.mustache | 4 +- .../templates/model-body.mustache | 43 +- .../templates/model-header.mustache | 1 + lib/sbi/openapi/include/binary.h | 4 +- lib/sbi/openapi/meson.build | 180 + .../openapi/model/access_and_mobility_data.c | 82 +- .../openapi/model/access_and_mobility_data.h | 5 +- .../access_and_mobility_subscription_data.c | 123 +- .../access_and_mobility_subscription_data.h | 1 + lib/sbi/openapi/model/access_right_status.c | 34 + lib/sbi/openapi/model/access_right_status.h | 1 + lib/sbi/openapi/model/access_tech.c | 34 + lib/sbi/openapi/model/access_tech.h | 1 + lib/sbi/openapi/model/acknowledge_info.c | 34 + lib/sbi/openapi/model/acknowledge_info.h | 1 + lib/sbi/openapi/model/acs_info.c | 34 + lib/sbi/openapi/model/acs_info.h | 1 + lib/sbi/openapi/model/acs_info_rm.c | 34 + lib/sbi/openapi/model/acs_info_rm.h | 1 + .../openapi/model/additional_qos_flow_info.c | 85 + .../openapi/model/additional_qos_flow_info.h | 37 + .../openapi/model/additional_snssai_data.c | 36 +- .../openapi/model/additional_snssai_data.h | 1 + lib/sbi/openapi/model/af_event.c | 34 + lib/sbi/openapi/model/af_event.h | 1 + .../openapi/model/af_event_exposure_data.c | 34 + .../openapi/model/af_event_exposure_data.h | 1 + lib/sbi/openapi/model/af_external.c | 34 + lib/sbi/openapi/model/af_external.h | 1 + lib/sbi/openapi/model/af_non_external.c | 34 + lib/sbi/openapi/model/af_non_external.h | 1 + lib/sbi/openapi/model/allowed_nssai.c | 166 + lib/sbi/openapi/model/allowed_nssai.h | 42 + lib/sbi/openapi/model/allowed_snssai.c | 188 + lib/sbi/openapi/model/allowed_snssai.h | 44 + lib/sbi/openapi/model/am_policy_data.c | 34 + lib/sbi/openapi/model/am_policy_data.h | 1 + lib/sbi/openapi/model/ambr.c | 34 + lib/sbi/openapi/model/ambr.h | 1 + lib/sbi/openapi/model/ambr_rm.c | 34 + lib/sbi/openapi/model/ambr_rm.h | 1 + .../model/amf3_gpp_access_registration.c | 65 +- .../model/amf3_gpp_access_registration.h | 5 +- ...mf3_gpp_access_registration_modification.c | 38 +- ...mf3_gpp_access_registration_modification.h | 1 + lib/sbi/openapi/model/amf_cond.c | 34 + lib/sbi/openapi/model/amf_cond.h | 1 + lib/sbi/openapi/model/amf_dereg_info.c | 34 + lib/sbi/openapi/model/amf_dereg_info.h | 1 + lib/sbi/openapi/model/amf_event.c | 302 ++ lib/sbi/openapi/model/amf_event.h | 52 + lib/sbi/openapi/model/amf_event_area.c | 133 + lib/sbi/openapi/model/amf_event_area.h | 42 + lib/sbi/openapi/model/amf_event_mode.c | 153 + lib/sbi/openapi/model/amf_event_mode.h | 43 + .../openapi/model/amf_event_subscription.c | 378 ++ .../openapi/model/amf_event_subscription.h | 62 + lib/sbi/openapi/model/amf_event_trigger.c | 85 + lib/sbi/openapi/model/amf_event_trigger.h | 36 + lib/sbi/openapi/model/amf_event_type.c | 85 + lib/sbi/openapi/model/amf_event_type.h | 36 + lib/sbi/openapi/model/amf_info.c | 34 + lib/sbi/openapi/model/amf_info.h | 1 + .../model/amf_non3_gpp_access_registration.c | 59 +- .../model/amf_non3_gpp_access_registration.h | 5 +- ...on3_gpp_access_registration_modification.c | 36 +- ...on3_gpp_access_registration_modification.h | 1 + .../model/amf_status_change_notification.c | 140 + .../model/amf_status_change_notification.h | 39 + .../amf_status_change_subscription_data.c | 160 + .../amf_status_change_subscription_data.h | 41 + lib/sbi/openapi/model/amf_status_info.c | 206 + lib/sbi/openapi/model/amf_status_info.h | 46 + lib/sbi/openapi/model/amf_subscription_info.c | 34 + lib/sbi/openapi/model/amf_subscription_info.h | 1 + lib/sbi/openapi/model/an_node_type.c | 34 + lib/sbi/openapi/model/an_node_type.h | 1 + lib/sbi/openapi/model/apn_rate_status.c | 181 + lib/sbi/openapi/model/apn_rate_status.h | 46 + lib/sbi/openapi/model/app_descriptor.c | 34 + lib/sbi/openapi/model/app_descriptor.h | 1 + lib/sbi/openapi/model/app_port_id.c | 34 + lib/sbi/openapi/model/app_port_id.h | 1 + .../model/application_data_change_notif.c | 34 + .../model/application_data_change_notif.h | 1 + lib/sbi/openapi/model/application_data_subs.c | 34 + lib/sbi/openapi/model/application_data_subs.h | 1 + lib/sbi/openapi/model/area.c | 34 + lib/sbi/openapi/model/area.h | 1 + lib/sbi/openapi/model/area_of_validity.c | 140 + lib/sbi/openapi/model/area_of_validity.h | 39 + lib/sbi/openapi/model/arp.c | 76 +- lib/sbi/openapi/model/arp.h | 9 +- lib/sbi/openapi/model/assign_ebi_data.c | 226 + lib/sbi/openapi/model/assign_ebi_data.h | 46 + lib/sbi/openapi/model/assign_ebi_error.c | 143 + lib/sbi/openapi/model/assign_ebi_error.h | 42 + lib/sbi/openapi/model/assign_ebi_failed.c | 159 + lib/sbi/openapi/model/assign_ebi_failed.h | 41 + lib/sbi/openapi/model/assigned_ebi_data.c | 257 ++ lib/sbi/openapi/model/assigned_ebi_data.h | 46 + lib/sbi/openapi/model/association_type.c | 34 + lib/sbi/openapi/model/association_type.h | 1 + lib/sbi/openapi/model/atom.c | 36 +- lib/sbi/openapi/model/atom.h | 1 + lib/sbi/openapi/model/atsss_capability.c | 38 +- lib/sbi/openapi/model/atsss_capability.h | 1 + lib/sbi/openapi/model/ausf_info.c | 34 + lib/sbi/openapi/model/ausf_info.h | 1 + lib/sbi/openapi/model/auth_event.c | 34 + lib/sbi/openapi/model/auth_event.h | 1 + lib/sbi/openapi/model/authentication_info.c | 34 + lib/sbi/openapi/model/authentication_info.h | 1 + .../model/authentication_info_request.c | 34 + .../model/authentication_info_request.h | 1 + .../model/authentication_info_result.c | 34 + .../model/authentication_info_result.h | 1 + .../model/authentication_subscription.c | 36 +- .../model/authentication_subscription.h | 1 + lib/sbi/openapi/model/authentication_vector.c | 34 + lib/sbi/openapi/model/authentication_vector.h | 1 + lib/sbi/openapi/model/authorization_data.c | 34 + lib/sbi/openapi/model/authorization_data.h | 1 + lib/sbi/openapi/model/av5_g_he_aka.c | 34 + lib/sbi/openapi/model/av5_g_he_aka.h | 1 + lib/sbi/openapi/model/av5g_aka.c | 34 + lib/sbi/openapi/model/av5g_aka.h | 1 + lib/sbi/openapi/model/av_eap_aka_prime.c | 34 + lib/sbi/openapi/model/av_eap_aka_prime.h | 1 + lib/sbi/openapi/model/av_eps_aka.c | 34 + lib/sbi/openapi/model/av_eps_aka.h | 1 + lib/sbi/openapi/model/av_ims_gba_eap_aka.c | 34 + lib/sbi/openapi/model/av_ims_gba_eap_aka.h | 1 + lib/sbi/openapi/model/backup_amf_info.c | 34 + lib/sbi/openapi/model/backup_amf_info.h | 1 + lib/sbi/openapi/model/battery_indication.c | 40 +- lib/sbi/openapi/model/battery_indication.h | 1 + lib/sbi/openapi/model/battery_indication_rm.c | 40 +- lib/sbi/openapi/model/battery_indication_rm.h | 1 + lib/sbi/openapi/model/bdt_data.c | 34 + lib/sbi/openapi/model/bdt_data.h | 1 + lib/sbi/openapi/model/bdt_policy_data.c | 34 + lib/sbi/openapi/model/bdt_policy_data.h | 1 + lib/sbi/openapi/model/bdt_policy_data_patch.c | 34 + lib/sbi/openapi/model/bdt_policy_data_patch.h | 1 + lib/sbi/openapi/model/bsf_info.c | 34 + lib/sbi/openapi/model/bsf_info.h | 1 + lib/sbi/openapi/model/cag_ack_data.c | 34 + lib/sbi/openapi/model/cag_ack_data.h | 1 + lib/sbi/openapi/model/cag_data.c | 34 + lib/sbi/openapi/model/cag_data.h | 1 + lib/sbi/openapi/model/cag_info.c | 36 +- lib/sbi/openapi/model/cag_info.h | 1 + lib/sbi/openapi/model/cause.c | 85 + lib/sbi/openapi/model/cause.h | 36 + lib/sbi/openapi/model/change_item.c | 34 + lib/sbi/openapi/model/change_item.h | 1 + lib/sbi/openapi/model/charging_information.c | 34 + lib/sbi/openapi/model/charging_information.h | 1 + lib/sbi/openapi/model/chf_info.c | 34 + lib/sbi/openapi/model/chf_info.h | 1 + lib/sbi/openapi/model/chf_service_info.c | 34 + lib/sbi/openapi/model/chf_service_info.h | 1 + lib/sbi/openapi/model/ciphering_algorithm.c | 30 + lib/sbi/openapi/model/ciphering_algorithm.h | 31 + lib/sbi/openapi/model/civic_address.c | 34 + lib/sbi/openapi/model/civic_address.h | 1 + lib/sbi/openapi/model/cm_info.c | 34 + lib/sbi/openapi/model/cm_info.h | 1 + lib/sbi/openapi/model/cm_info_report.c | 34 + lib/sbi/openapi/model/cm_info_report.h | 1 + lib/sbi/openapi/model/cm_state.c | 34 + lib/sbi/openapi/model/cm_state.h | 1 + lib/sbi/openapi/model/cn_assisted_ran_para.c | 243 ++ lib/sbi/openapi/model/cn_assisted_ran_para.h | 55 + lib/sbi/openapi/model/cnf.c | 34 + lib/sbi/openapi/model/cnf.h | 1 + lib/sbi/openapi/model/cnf_unit.c | 34 + lib/sbi/openapi/model/cnf_unit.h | 1 + .../model/communication_characteristics.c | 34 + .../model/communication_characteristics.h | 1 + lib/sbi/openapi/model/complex_query.c | 34 + lib/sbi/openapi/model/complex_query.h | 1 + .../model/configuration_parameters_eutra.c | 34 + .../model/configuration_parameters_eutra.h | 1 + .../model/configuration_parameters_nr.c | 34 + .../model/configuration_parameters_nr.h | 1 + lib/sbi/openapi/model/configured_snssai.c | 138 + lib/sbi/openapi/model/configured_snssai.h | 41 + lib/sbi/openapi/model/confirmation_data.c | 34 + lib/sbi/openapi/model/confirmation_data.h | 1 + .../model/confirmation_data_response.c | 34 + .../model/confirmation_data_response.h | 1 + lib/sbi/openapi/model/context_data_set_name.c | 34 + lib/sbi/openapi/model/context_data_set_name.h | 1 + lib/sbi/openapi/model/context_data_sets.c | 34 + lib/sbi/openapi/model/context_data_sets.h | 1 + lib/sbi/openapi/model/core_network_type.c | 34 + lib/sbi/openapi/model/core_network_type.h | 1 + lib/sbi/openapi/model/data_change_notify.c | 34 + lib/sbi/openapi/model/data_change_notify.h | 1 + lib/sbi/openapi/model/data_filter.c | 34 + lib/sbi/openapi/model/data_filter.h | 1 + lib/sbi/openapi/model/data_ind.c | 34 + lib/sbi/openapi/model/data_ind.h | 1 + lib/sbi/openapi/model/data_set_id.c | 34 + lib/sbi/openapi/model/data_set_id.h | 1 + lib/sbi/openapi/model/data_set_name.c | 34 + lib/sbi/openapi/model/data_set_name.h | 1 + .../model/datalink_reporting_configuration.c | 34 + .../model/datalink_reporting_configuration.h | 1 + .../openapi/model/ddd_traffic_descriptor.c | 34 + .../openapi/model/ddd_traffic_descriptor.h | 1 + lib/sbi/openapi/model/ddn_failure_subs.c | 154 + lib/sbi/openapi/model/ddn_failure_subs.h | 41 + .../model/default_notification_subscription.c | 55 +- .../model/default_notification_subscription.h | 5 +- lib/sbi/openapi/model/deregistration_data.c | 34 + lib/sbi/openapi/model/deregistration_data.h | 1 + lib/sbi/openapi/model/deregistration_reason.c | 34 + lib/sbi/openapi/model/deregistration_reason.h | 1 + .../openapi/model/dl_data_delivery_status.c | 34 + .../openapi/model/dl_data_delivery_status.h | 1 + lib/sbi/openapi/model/dnai_change_type.c | 34 + lib/sbi/openapi/model/dnai_change_type.h | 1 + lib/sbi/openapi/model/dnai_information.c | 148 + lib/sbi/openapi/model/dnai_information.h | 42 + lib/sbi/openapi/model/dnf.c | 34 + lib/sbi/openapi/model/dnf.h | 1 + lib/sbi/openapi/model/dnf_unit.c | 34 + lib/sbi/openapi/model/dnf_unit.h | 1 + lib/sbi/openapi/model/dnn_configuration.c | 42 +- lib/sbi/openapi/model/dnn_configuration.h | 1 + lib/sbi/openapi/model/dnn_info.c | 42 +- lib/sbi/openapi/model/dnn_info.h | 1 + .../model/dnn_route_selection_descriptor.c | 84 +- .../model/dnn_route_selection_descriptor.h | 1 + lib/sbi/openapi/model/dnn_selection_mode.c | 85 + lib/sbi/openapi/model/dnn_selection_mode.h | 36 + lib/sbi/openapi/model/dnn_smf_info_item.c | 34 + lib/sbi/openapi/model/dnn_smf_info_item.h | 1 + lib/sbi/openapi/model/dnn_upf_info_item.c | 59 +- lib/sbi/openapi/model/dnn_upf_info_item.h | 1 + lib/sbi/openapi/model/domain_name_protocol.c | 34 + lib/sbi/openapi/model/domain_name_protocol.h | 1 + lib/sbi/openapi/model/dynamic5_qi.c | 244 ++ lib/sbi/openapi/model/dynamic5_qi.h | 51 + lib/sbi/openapi/model/eap_session.c | 34 + lib/sbi/openapi/model/eap_session.h | 1 + lib/sbi/openapi/model/ebi_arp_mapping.c | 138 + lib/sbi/openapi/model/ebi_arp_mapping.h | 41 + lib/sbi/openapi/model/ec_restriction.c | 34 + lib/sbi/openapi/model/ec_restriction.h | 1 + lib/sbi/openapi/model/ec_restriction_data.c | 38 +- lib/sbi/openapi/model/ec_restriction_data.h | 1 + lib/sbi/openapi/model/ecgi.c | 34 + lib/sbi/openapi/model/ecgi.h | 1 + lib/sbi/openapi/model/edrx_parameters.c | 55 +- lib/sbi/openapi/model/edrx_parameters.h | 5 +- lib/sbi/openapi/model/ee_profile_data.c | 34 + lib/sbi/openapi/model/ee_profile_data.h | 1 + lib/sbi/openapi/model/ee_subscription.c | 34 + lib/sbi/openapi/model/ee_subscription.h | 1 + lib/sbi/openapi/model/ellipsoid_arc.c | 34 + lib/sbi/openapi/model/ellipsoid_arc.h | 1 + lib/sbi/openapi/model/ellipsoid_arc_all_of.c | 34 + lib/sbi/openapi/model/ellipsoid_arc_all_of.h | 1 + lib/sbi/openapi/model/emergency_info.c | 34 + lib/sbi/openapi/model/emergency_info.h | 1 + .../enhanced_coverage_restriction_data.c | 34 + .../enhanced_coverage_restriction_data.h | 1 + lib/sbi/openapi/model/eps_bearer_info.c | 157 + lib/sbi/openapi/model/eps_bearer_info.h | 42 + .../model/eps_interworking_indication.c | 85 + .../model/eps_interworking_indication.h | 36 + lib/sbi/openapi/model/eps_interworking_info.c | 34 + lib/sbi/openapi/model/eps_interworking_info.h | 1 + lib/sbi/openapi/model/eps_iwk_pgw.c | 34 + lib/sbi/openapi/model/eps_iwk_pgw.h | 1 + lib/sbi/openapi/model/eps_pdn_cnx_info.c | 147 + lib/sbi/openapi/model/eps_pdn_cnx_info.h | 42 + lib/sbi/openapi/model/eth_flow_description.c | 34 + lib/sbi/openapi/model/eth_flow_description.h | 1 + lib/sbi/openapi/model/eutra_location.c | 36 +- lib/sbi/openapi/model/eutra_location.h | 1 + lib/sbi/openapi/model/event_id.c | 34 + lib/sbi/openapi/model/event_id.h | 1 + lib/sbi/openapi/model/event_report_mode.c | 34 + lib/sbi/openapi/model/event_report_mode.h | 1 + lib/sbi/openapi/model/event_type.c | 34 + lib/sbi/openapi/model/event_type.h | 1 + lib/sbi/openapi/model/exemption_ind.c | 142 + lib/sbi/openapi/model/exemption_ind.h | 42 + lib/sbi/openapi/model/expected_ue_behavior.c | 165 + lib/sbi/openapi/model/expected_ue_behavior.h | 41 + lib/sbi/openapi/model/expected_ue_behaviour.c | 34 + lib/sbi/openapi/model/expected_ue_behaviour.h | 1 + .../model/expected_ue_behaviour_data.c | 34 + .../model/expected_ue_behaviour_data.h | 1 + .../model/exposure_data_change_notification.c | 34 + .../model/exposure_data_change_notification.h | 1 + .../model/exposure_data_subscription.c | 34 + .../model/exposure_data_subscription.h | 1 + lib/sbi/openapi/model/external_client_type.c | 34 + lib/sbi/openapi/model/external_client_type.h | 1 + .../openapi/model/external_unrelated_class.c | 34 + .../openapi/model/external_unrelated_class.h | 1 + lib/sbi/openapi/model/flow_direction.c | 34 + lib/sbi/openapi/model/flow_direction.h | 1 + lib/sbi/openapi/model/flow_info.c | 34 + lib/sbi/openapi/model/flow_info.h | 1 + lib/sbi/openapi/model/frame_route_info.c | 34 + lib/sbi/openapi/model/frame_route_info.h | 1 + lib/sbi/openapi/model/g_nb_id.c | 34 + lib/sbi/openapi/model/g_nb_id.h | 1 + lib/sbi/openapi/model/gad_shape.c | 34 + lib/sbi/openapi/model/gad_shape.h | 1 + .../openapi/model/gbr_qos_flow_information.c | 247 ++ .../openapi/model/gbr_qos_flow_information.h | 51 + lib/sbi/openapi/model/geographic_area.c | 34 + lib/sbi/openapi/model/geographic_area.h | 1 + .../openapi/model/geographical_coordinates.c | 34 + .../openapi/model/geographical_coordinates.h | 1 + lib/sbi/openapi/model/global_ran_node_id.c | 34 + lib/sbi/openapi/model/global_ran_node_id.h | 1 + lib/sbi/openapi/model/gmlc_info.c | 34 + lib/sbi/openapi/model/gmlc_info.h | 1 + lib/sbi/openapi/model/group_identifiers.c | 34 + lib/sbi/openapi/model/group_identifiers.h | 1 + lib/sbi/openapi/model/guami.c | 34 + lib/sbi/openapi/model/guami.h | 1 + lib/sbi/openapi/model/guami_list_cond.c | 34 + lib/sbi/openapi/model/guami_list_cond.h | 1 + lib/sbi/openapi/model/hfc_node_id.c | 34 + lib/sbi/openapi/model/hfc_node_id.h | 1 + lib/sbi/openapi/model/ho_state.c | 85 + lib/sbi/openapi/model/ho_state.h | 36 + lib/sbi/openapi/model/hsmf_update_data.c | 1485 +++++++ lib/sbi/openapi/model/hsmf_update_data.h | 167 + lib/sbi/openapi/model/hsmf_update_error.c | 216 + lib/sbi/openapi/model/hsmf_update_error.h | 50 + lib/sbi/openapi/model/hsmf_updated_data.c | 287 ++ lib/sbi/openapi/model/hsmf_updated_data.h | 55 + lib/sbi/openapi/model/hss_auth_type.c | 34 + lib/sbi/openapi/model/hss_auth_type.h | 1 + .../model/hss_authentication_info_request.c | 34 + .../model/hss_authentication_info_request.h | 1 + .../model/hss_authentication_info_result.c | 34 + .../model/hss_authentication_info_result.h | 1 + .../model/hss_authentication_vectors.c | 34 + .../model/hss_authentication_vectors.h | 1 + lib/sbi/openapi/model/hss_av_type.c | 34 + lib/sbi/openapi/model/hss_av_type.h | 1 + lib/sbi/openapi/model/hss_info.c | 34 + lib/sbi/openapi/model/hss_info.h | 1 + lib/sbi/openapi/model/id_translation_result.c | 34 + lib/sbi/openapi/model/id_translation_result.h | 1 + lib/sbi/openapi/model/identity_data.c | 34 + lib/sbi/openapi/model/identity_data.h | 1 + lib/sbi/openapi/model/identity_range.c | 34 + lib/sbi/openapi/model/identity_range.h | 1 + lib/sbi/openapi/model/ims_vo_ps.c | 34 + lib/sbi/openapi/model/ims_vo_ps.h | 1 + lib/sbi/openapi/model/imsi_range.c | 34 + lib/sbi/openapi/model/imsi_range.h | 1 + .../indirect_data_forwarding_tunnel_info.c | 188 + .../indirect_data_forwarding_tunnel_info.h | 46 + lib/sbi/openapi/model/inline_object.c | 585 +++ lib/sbi/openapi/model/inline_object.h | 73 + lib/sbi/openapi/model/inline_object_1.c | 137 + lib/sbi/openapi/model/inline_object_1.h | 41 + lib/sbi/openapi/model/inline_object_2.c | 165 + lib/sbi/openapi/model/inline_object_2.h | 43 + lib/sbi/openapi/model/inline_object_3.c | 137 + lib/sbi/openapi/model/inline_object_3.h | 41 + lib/sbi/openapi/model/inline_object_4.c | 137 + lib/sbi/openapi/model/inline_object_4.h | 41 + lib/sbi/openapi/model/inline_response_200.c | 34 + lib/sbi/openapi/model/inline_response_200.h | 1 + lib/sbi/openapi/model/integrity_algorithm.c | 30 + lib/sbi/openapi/model/integrity_algorithm.h | 31 + .../openapi/model/interface_upf_info_item.c | 34 + .../openapi/model/interface_upf_info_item.h | 1 + .../openapi/model/internal_group_id_range.c | 34 + .../openapi/model/internal_group_id_range.h | 1 + lib/sbi/openapi/model/invalid_param.c | 34 + lib/sbi/openapi/model/invalid_param.h | 1 + lib/sbi/openapi/model/ip_address.c | 34 + lib/sbi/openapi/model/ip_address.h | 1 + lib/sbi/openapi/model/ip_end_point.c | 34 + lib/sbi/openapi/model/ip_end_point.h | 1 + lib/sbi/openapi/model/iptv_config_data.c | 34 + lib/sbi/openapi/model/iptv_config_data.h | 1 + .../openapi/model/iptv_config_data_patch.c | 34 + .../openapi/model/iptv_config_data_patch.h | 1 + lib/sbi/openapi/model/ipv4_address_range.c | 34 + lib/sbi/openapi/model/ipv4_address_range.h | 1 + lib/sbi/openapi/model/ipv6_prefix_range.c | 34 + lib/sbi/openapi/model/ipv6_prefix_range.h | 1 + lib/sbi/openapi/model/key_amf.c | 136 + lib/sbi/openapi/model/key_amf.h | 41 + lib/sbi/openapi/model/key_amf_type.c | 30 + lib/sbi/openapi/model/key_amf_type.h | 31 + lib/sbi/openapi/model/ladn_info.c | 134 + lib/sbi/openapi/model/ladn_info.h | 41 + lib/sbi/openapi/model/lcs_client_external.c | 34 + lib/sbi/openapi/model/lcs_client_external.h | 1 + .../openapi/model/lcs_client_group_external.c | 34 + .../openapi/model/lcs_client_group_external.h | 1 + .../openapi/model/lcs_client_non_external.c | 34 + .../openapi/model/lcs_client_non_external.h | 1 + lib/sbi/openapi/model/lcs_mo_data.c | 34 + lib/sbi/openapi/model/lcs_mo_data.h | 1 + lib/sbi/openapi/model/lcs_privacy.c | 34 + lib/sbi/openapi/model/lcs_privacy.h | 1 + lib/sbi/openapi/model/lcs_privacy_data.c | 34 + lib/sbi/openapi/model/lcs_privacy_data.h | 1 + .../model/limit_id_to_monitoring_key.c | 34 + .../model/limit_id_to_monitoring_key.h | 1 + lib/sbi/openapi/model/link.c | 34 + lib/sbi/openapi/model/link.h | 1 + lib/sbi/openapi/model/links_value_schema.c | 34 + lib/sbi/openapi/model/links_value_schema.h | 1 + lib/sbi/openapi/model/lmf_info.c | 59 +- lib/sbi/openapi/model/lmf_info.h | 1 + lib/sbi/openapi/model/location_accuracy.c | 34 + lib/sbi/openapi/model/location_accuracy.h | 1 + lib/sbi/openapi/model/location_area.c | 34 + lib/sbi/openapi/model/location_area.h | 1 + lib/sbi/openapi/model/location_filter.c | 85 + lib/sbi/openapi/model/location_filter.h | 36 + lib/sbi/openapi/model/location_info.c | 34 + lib/sbi/openapi/model/location_info.h | 1 + .../model/location_reporting_configuration.c | 36 +- .../model/location_reporting_configuration.h | 1 + lib/sbi/openapi/model/lpi.c | 34 + lib/sbi/openapi/model/lpi.h | 1 + lib/sbi/openapi/model/lte_v2x_auth.c | 34 + lib/sbi/openapi/model/lte_v2x_auth.h | 1 + lib/sbi/openapi/model/ma_release_indication.c | 85 + lib/sbi/openapi/model/ma_release_indication.h | 36 + .../model/max_integrity_protected_data_rate.c | 85 + .../model/max_integrity_protected_data_rate.h | 36 + lib/sbi/openapi/model/maximum_latency.c | 34 + lib/sbi/openapi/model/maximum_latency.h | 1 + lib/sbi/openapi/model/maximum_response_time.c | 34 + lib/sbi/openapi/model/maximum_response_time.h | 1 + lib/sbi/openapi/model/mm_context.c | 436 ++ lib/sbi/openapi/model/mm_context.h | 67 + lib/sbi/openapi/model/mme_capabilities.c | 123 + lib/sbi/openapi/model/mme_capabilities.h | 40 + .../openapi/model/mo_exception_data_flag.c | 85 + .../openapi/model/mo_exception_data_flag.h | 36 + lib/sbi/openapi/model/mo_exp_data_counter.c | 129 + lib/sbi/openapi/model/mo_exp_data_counter.h | 40 + .../model/model_5_g_vn_group_configuration.c | 34 + .../model/model_5_g_vn_group_configuration.h | 1 + .../openapi/model/model_5_g_vn_group_data.c | 59 +- .../openapi/model/model_5_g_vn_group_data.h | 1 + .../openapi/model/modification_notification.c | 34 + .../openapi/model/modification_notification.h | 1 + .../openapi/model/monitoring_configuration.c | 36 +- .../openapi/model/monitoring_configuration.h | 1 + .../openapi/model/multicast_access_control.c | 34 + .../openapi/model/multicast_access_control.h | 1 + lib/sbi/openapi/model/n1_message_container.c | 180 + lib/sbi/openapi/model/n1_message_container.h | 46 + .../openapi/model/n1_message_notification.c | 198 + .../openapi/model/n1_message_notification.h | 48 + .../model/n1_n2_message_transfer_cause.c | 30 + .../model/n1_n2_message_transfer_cause.h | 31 + .../model/n1_n2_message_transfer_error.c | 138 + .../model/n1_n2_message_transfer_error.h | 42 + .../model/n1_n2_message_transfer_req_data.c | 462 ++ .../model/n1_n2_message_transfer_req_data.h | 79 + .../model/n1_n2_message_transfer_rsp_data.c | 131 + .../model/n1_n2_message_transfer_rsp_data.h | 41 + .../openapi/model/n1_n2_msg_txfr_err_detail.c | 147 + .../openapi/model/n1_n2_msg_txfr_err_detail.h | 43 + .../n1_n2_msg_txfr_failure_notification.c | 136 + .../n1_n2_msg_txfr_failure_notification.h | 41 + lib/sbi/openapi/model/n2_info_container.c | 207 + lib/sbi/openapi/model/n2_info_container.h | 51 + lib/sbi/openapi/model/n2_info_content.c | 154 + lib/sbi/openapi/model/n2_info_content.h | 44 + .../model/n2_info_notification_rsp_data.c | 109 + .../model/n2_info_notification_rsp_data.h | 39 + lib/sbi/openapi/model/n2_info_notify_reason.c | 30 + lib/sbi/openapi/model/n2_info_notify_reason.h | 31 + lib/sbi/openapi/model/n2_information_class.c | 61 +- lib/sbi/openapi/model/n2_information_class.h | 12 +- .../model/n2_information_notification.c | 352 ++ .../model/n2_information_notification.h | 60 + .../model/n2_information_transfer_error.c | 138 + .../model/n2_information_transfer_error.h | 42 + .../model/n2_information_transfer_req_data.c | 255 ++ .../model/n2_information_transfer_req_data.h | 50 + .../model/n2_information_transfer_result.c | 30 + .../model/n2_information_transfer_result.h | 31 + .../model/n2_information_transfer_rsp_data.c | 155 + .../model/n2_information_transfer_rsp_data.h | 44 + lib/sbi/openapi/model/n2_interface_amf_info.c | 34 + lib/sbi/openapi/model/n2_interface_amf_info.h | 1 + lib/sbi/openapi/model/n2_ran_information.c | 114 + lib/sbi/openapi/model/n2_ran_information.h | 39 + lib/sbi/openapi/model/n2_sm_info_type.c | 30 + lib/sbi/openapi/model/n2_sm_info_type.h | 31 + lib/sbi/openapi/model/n2_sm_information.c | 200 + lib/sbi/openapi/model/n2_sm_information.h | 48 + lib/sbi/openapi/model/n3ga_location.c | 34 + lib/sbi/openapi/model/n3ga_location.h | 1 + lib/sbi/openapi/model/n4_information.c | 167 + lib/sbi/openapi/model/n4_information.h | 45 + lib/sbi/openapi/model/n4_message_type.c | 85 + lib/sbi/openapi/model/n4_message_type.h | 36 + lib/sbi/openapi/model/nas_security_mode.c | 137 + lib/sbi/openapi/model/nas_security_mode.h | 42 + lib/sbi/openapi/model/ncgi.c | 34 + lib/sbi/openapi/model/ncgi.h | 1 + lib/sbi/openapi/model/nef_info.c | 34 + lib/sbi/openapi/model/nef_info.h | 1 + lib/sbi/openapi/model/network_area_info.c | 34 + lib/sbi/openapi/model/network_area_info.h | 1 + lib/sbi/openapi/model/network_area_info_2.c | 34 + lib/sbi/openapi/model/network_area_info_2.h | 1 + .../model/network_node_diameter_address.c | 34 + .../model/network_node_diameter_address.h | 1 + lib/sbi/openapi/model/network_slice_cond.c | 34 + lib/sbi/openapi/model/network_slice_cond.h | 1 + lib/sbi/openapi/model/nf_group_cond.c | 34 + lib/sbi/openapi/model/nf_group_cond.h | 1 + lib/sbi/openapi/model/nf_info.c | 34 + lib/sbi/openapi/model/nf_info.h | 1 + lib/sbi/openapi/model/nf_instance_id_cond.c | 34 + lib/sbi/openapi/model/nf_instance_id_cond.h | 1 + lib/sbi/openapi/model/nf_profile.c | 44 +- lib/sbi/openapi/model/nf_profile.h | 1 + lib/sbi/openapi/model/nf_service.c | 36 +- lib/sbi/openapi/model/nf_service.h | 1 + lib/sbi/openapi/model/nf_service_set_cond.c | 34 + lib/sbi/openapi/model/nf_service_set_cond.h | 1 + lib/sbi/openapi/model/nf_service_version.c | 34 + lib/sbi/openapi/model/nf_service_version.h | 1 + lib/sbi/openapi/model/nf_set_cond.c | 34 + lib/sbi/openapi/model/nf_set_cond.h | 1 + lib/sbi/openapi/model/nf_type_cond.c | 34 + lib/sbi/openapi/model/nf_type_cond.h | 1 + lib/sbi/openapi/model/ng_ap_cause.c | 133 + lib/sbi/openapi/model/ng_ap_cause.h | 40 + lib/sbi/openapi/model/ng_ksi.c | 135 + lib/sbi/openapi/model/ng_ksi.h | 41 + lib/sbi/openapi/model/ng_ran_target_id.c | 143 + lib/sbi/openapi/model/ng_ran_target_id.h | 42 + lib/sbi/openapi/model/ngap_ie_type.c | 30 + lib/sbi/openapi/model/ngap_ie_type.h | 31 + lib/sbi/openapi/model/nidd_information.c | 34 + lib/sbi/openapi/model/nidd_information.h | 1 + lib/sbi/openapi/model/non_dynamic5_qi.c | 161 + lib/sbi/openapi/model/non_dynamic5_qi.h | 44 + .../model/non_external_unrelated_class.c | 34 + .../model/non_external_unrelated_class.h | 1 + .../non_ue_n2_info_subscription_create_data.c | 267 ++ .../non_ue_n2_info_subscription_create_data.h | 51 + ...non_ue_n2_info_subscription_created_data.c | 151 + ...non_ue_n2_info_subscription_created_data.h | 43 + lib/sbi/openapi/model/notif_condition.c | 34 + lib/sbi/openapi/model/notif_condition.h | 1 + lib/sbi/openapi/model/notification_cause.c | 85 + lib/sbi/openapi/model/notification_cause.h | 36 + lib/sbi/openapi/model/notification_control.c | 85 + lib/sbi/openapi/model/notification_control.h | 36 + lib/sbi/openapi/model/notification_data.c | 34 + lib/sbi/openapi/model/notification_data.h | 1 + lib/sbi/openapi/model/notification_item.c | 34 + lib/sbi/openapi/model/notification_item.h | 1 + lib/sbi/openapi/model/notify_item.c | 34 + lib/sbi/openapi/model/notify_item.h | 1 + lib/sbi/openapi/model/nr_location.c | 34 + lib/sbi/openapi/model/nr_location.h | 1 + lib/sbi/openapi/model/nr_v2x_auth.c | 34 + lib/sbi/openapi/model/nr_v2x_auth.h | 1 + lib/sbi/openapi/model/nrf_info.c | 34 + lib/sbi/openapi/model/nrf_info.h | 1 + lib/sbi/openapi/model/nrppa_information.c | 159 + lib/sbi/openapi/model/nrppa_information.h | 43 + lib/sbi/openapi/model/nsi_information.c | 170 + lib/sbi/openapi/model/nsi_information.h | 44 + lib/sbi/openapi/model/nssai.c | 34 + lib/sbi/openapi/model/nssai.h | 1 + lib/sbi/openapi/model/nssai_ack_data.c | 34 + lib/sbi/openapi/model/nssai_ack_data.h | 1 + lib/sbi/openapi/model/nssai_mapping.c | 143 + lib/sbi/openapi/model/nssai_mapping.h | 41 + lib/sbi/openapi/model/nwdaf_event.c | 34 + lib/sbi/openapi/model/nwdaf_event.h | 1 + lib/sbi/openapi/model/nwdaf_info.c | 34 + lib/sbi/openapi/model/nwdaf_info.h | 1 + lib/sbi/openapi/model/odb_data.c | 34 + lib/sbi/openapi/model/odb_data.h | 1 + lib/sbi/openapi/model/odb_packet_services.c | 34 + lib/sbi/openapi/model/odb_packet_services.h | 1 + lib/sbi/openapi/model/operator_managed.c | 34 + lib/sbi/openapi/model/operator_managed.h | 1 + .../model/operator_specific_data_container.c | 34 + .../model/operator_specific_data_container.h | 1 + lib/sbi/openapi/model/parameter_over_pc5.c | 36 +- lib/sbi/openapi/model/parameter_over_pc5.h | 1 + lib/sbi/openapi/model/parameter_over_uu.c | 34 + lib/sbi/openapi/model/parameter_over_uu.h | 1 + lib/sbi/openapi/model/partial_record_method.c | 85 + lib/sbi/openapi/model/partial_record_method.h | 36 + lib/sbi/openapi/model/patch_item.c | 34 + lib/sbi/openapi/model/patch_item.h | 1 + lib/sbi/openapi/model/patch_result.c | 34 + lib/sbi/openapi/model/patch_result.h | 1 + lib/sbi/openapi/model/pc5_flow_bit_rates.c | 34 + lib/sbi/openapi/model/pc5_flow_bit_rates.h | 1 + lib/sbi/openapi/model/pc5_qo_s_para.c | 34 + lib/sbi/openapi/model/pc5_qo_s_para.h | 1 + lib/sbi/openapi/model/pc5_qos_flow_item.c | 34 + lib/sbi/openapi/model/pc5_qos_flow_item.h | 1 + lib/sbi/openapi/model/pc5_qos_mapping.c | 34 + lib/sbi/openapi/model/pc5_qos_mapping.h | 1 + lib/sbi/openapi/model/pcf_info.c | 36 +- lib/sbi/openapi/model/pcf_info.h | 1 + lib/sbi/openapi/model/pcscf_info.c | 34 + lib/sbi/openapi/model/pcscf_info.h | 1 + .../model/pcscf_restoration_notification.c | 34 + .../model/pcscf_restoration_notification.h | 1 + lib/sbi/openapi/model/pdu_session.c | 34 + lib/sbi/openapi/model/pdu_session.h | 1 + lib/sbi/openapi/model/pdu_session_context.c | 611 +++ lib/sbi/openapi/model/pdu_session_context.h | 87 + .../openapi/model/pdu_session_create_data.c | 1399 +++++++ .../openapi/model/pdu_session_create_data.h | 168 + .../openapi/model/pdu_session_create_error.c | 197 + .../openapi/model/pdu_session_create_error.h | 48 + .../openapi/model/pdu_session_created_data.c | 833 ++++ .../openapi/model/pdu_session_created_data.h | 109 + .../model/pdu_session_management_data.c | 55 +- .../model/pdu_session_management_data.h | 5 +- .../openapi/model/pdu_session_notify_item.c | 114 + .../openapi/model/pdu_session_notify_item.h | 39 + lib/sbi/openapi/model/pdu_session_status.c | 34 + lib/sbi/openapi/model/pdu_session_status.h | 1 + lib/sbi/openapi/model/pdu_session_type.c | 61 +- lib/sbi/openapi/model/pdu_session_type.h | 12 +- lib/sbi/openapi/model/pdu_session_types.c | 80 +- lib/sbi/openapi/model/pdu_session_types.h | 5 +- lib/sbi/openapi/model/pei_update_info.c | 34 + lib/sbi/openapi/model/pei_update_info.h | 1 + lib/sbi/openapi/model/periodicity.c | 34 + lib/sbi/openapi/model/periodicity.h | 1 + .../openapi/model/pfd_change_notification.c | 38 +- .../openapi/model/pfd_change_notification.h | 1 + lib/sbi/openapi/model/pfd_content.c | 34 + lib/sbi/openapi/model/pfd_content.h | 1 + lib/sbi/openapi/model/pfd_data.c | 34 + lib/sbi/openapi/model/pfd_data.h | 1 + lib/sbi/openapi/model/pfd_data_for_app.c | 34 + lib/sbi/openapi/model/pfd_data_for_app.h | 1 + lib/sbi/openapi/model/pfd_data_for_app_ext.c | 34 + lib/sbi/openapi/model/pfd_data_for_app_ext.h | 1 + .../model/pfd_data_for_app_ext_all_of.c | 34 + .../model/pfd_data_for_app_ext_all_of.h | 1 + lib/sbi/openapi/model/pgw_info.c | 34 + lib/sbi/openapi/model/pgw_info.h | 1 + lib/sbi/openapi/model/plmn_ec_info.c | 38 +- lib/sbi/openapi/model/plmn_ec_info.h | 1 + lib/sbi/openapi/model/plmn_id.c | 34 + lib/sbi/openapi/model/plmn_id.h | 1 + lib/sbi/openapi/model/plmn_id_nid.c | 34 + lib/sbi/openapi/model/plmn_id_nid.h | 1 + lib/sbi/openapi/model/plmn_operator_class.c | 34 + lib/sbi/openapi/model/plmn_operator_class.h | 1 + lib/sbi/openapi/model/plmn_range.c | 34 + lib/sbi/openapi/model/plmn_range.h | 1 + lib/sbi/openapi/model/plmn_rat_served.c | 34 + lib/sbi/openapi/model/plmn_rat_served.h | 1 + .../model/plmn_route_selection_descriptor.c | 34 + .../model/plmn_route_selection_descriptor.h | 1 + lib/sbi/openapi/model/plmn_snssai.c | 34 + lib/sbi/openapi/model/plmn_snssai.h | 1 + lib/sbi/openapi/model/point.c | 34 + lib/sbi/openapi/model/point.h | 1 + lib/sbi/openapi/model/point_all_of.c | 34 + lib/sbi/openapi/model/point_all_of.h | 1 + lib/sbi/openapi/model/point_altitude.c | 34 + lib/sbi/openapi/model/point_altitude.h | 1 + lib/sbi/openapi/model/point_altitude_all_of.c | 34 + lib/sbi/openapi/model/point_altitude_all_of.h | 1 + .../model/point_altitude_uncertainty.c | 34 + .../model/point_altitude_uncertainty.h | 1 + .../model/point_altitude_uncertainty_all_of.c | 34 + .../model/point_altitude_uncertainty_all_of.h | 1 + .../openapi/model/point_uncertainty_circle.c | 34 + .../openapi/model/point_uncertainty_circle.h | 1 + .../model/point_uncertainty_circle_all_of.c | 34 + .../model/point_uncertainty_circle_all_of.h | 1 + .../openapi/model/point_uncertainty_ellipse.c | 34 + .../openapi/model/point_uncertainty_ellipse.h | 1 + .../model/point_uncertainty_ellipse_all_of.c | 34 + .../model/point_uncertainty_ellipse_all_of.h | 1 + .../model/policy_data_change_notification.c | 34 + .../model/policy_data_change_notification.h | 1 + .../openapi/model/policy_data_subscription.c | 34 + .../openapi/model/policy_data_subscription.h | 1 + lib/sbi/openapi/model/policy_req_trigger.c | 30 + lib/sbi/openapi/model/policy_req_trigger.h | 31 + lib/sbi/openapi/model/polygon.c | 34 + lib/sbi/openapi/model/polygon.h | 1 + lib/sbi/openapi/model/polygon_all_of.c | 34 + lib/sbi/openapi/model/polygon_all_of.h | 1 + lib/sbi/openapi/model/pp_active_time.c | 34 + lib/sbi/openapi/model/pp_active_time.h | 1 + lib/sbi/openapi/model/pp_data.c | 34 + lib/sbi/openapi/model/pp_data.h | 1 + .../openapi/model/pp_dl_packet_count_ext.c | 34 + .../openapi/model/pp_dl_packet_count_ext.h | 1 + lib/sbi/openapi/model/pp_maximum_latency.c | 34 + lib/sbi/openapi/model/pp_maximum_latency.h | 1 + .../openapi/model/pp_maximum_response_time.c | 34 + .../openapi/model/pp_maximum_response_time.h | 1 + lib/sbi/openapi/model/pp_subs_reg_timer.c | 34 + lib/sbi/openapi/model/pp_subs_reg_timer.h | 1 + lib/sbi/openapi/model/pppp_to_pdb.c | 34 + lib/sbi/openapi/model/pppp_to_pdb.h | 1 + lib/sbi/openapi/model/preemption_capability.c | 61 +- lib/sbi/openapi/model/preemption_capability.h | 12 +- .../openapi/model/preemption_vulnerability.c | 61 +- .../openapi/model/preemption_vulnerability.h | 12 +- lib/sbi/openapi/model/preferred_search.c | 36 +- lib/sbi/openapi/model/preferred_search.h | 1 + lib/sbi/openapi/model/presence_info.c | 34 + lib/sbi/openapi/model/presence_info.h | 1 + lib/sbi/openapi/model/presence_state.c | 34 + lib/sbi/openapi/model/presence_state.h | 1 + lib/sbi/openapi/model/privacy_parameter.c | 34 + lib/sbi/openapi/model/privacy_parameter.h | 1 + lib/sbi/openapi/model/problem_details.c | 34 + lib/sbi/openapi/model/problem_details.h | 1 + lib/sbi/openapi/model/problem_details_2.c | 34 + lib/sbi/openapi/model/problem_details_2.h | 1 + lib/sbi/openapi/model/provisioned_data_sets.c | 34 + lib/sbi/openapi/model/provisioned_data_sets.h | 1 + lib/sbi/openapi/model/psa_indication.c | 85 + lib/sbi/openapi/model/psa_indication.h | 36 + lib/sbi/openapi/model/psa_information.c | 192 + lib/sbi/openapi/model/psa_information.h | 45 + lib/sbi/openapi/model/ptw_parameters.c | 34 + lib/sbi/openapi/model/ptw_parameters.h | 1 + lib/sbi/openapi/model/pws_error_data.c | 109 + lib/sbi/openapi/model/pws_error_data.h | 38 + lib/sbi/openapi/model/pws_information.c | 201 + lib/sbi/openapi/model/pws_information.h | 47 + lib/sbi/openapi/model/pws_response_data.c | 207 + lib/sbi/openapi/model/pws_response_data.h | 45 + lib/sbi/openapi/model/qos_flow_access_type.c | 85 + lib/sbi/openapi/model/qos_flow_access_type.h | 36 + .../model/qos_flow_add_modify_request_item.c | 214 + .../model/qos_flow_add_modify_request_item.h | 50 + lib/sbi/openapi/model/qos_flow_item.c | 133 + lib/sbi/openapi/model/qos_flow_item.h | 41 + lib/sbi/openapi/model/qos_flow_notify_item.c | 138 + lib/sbi/openapi/model/qos_flow_notify_item.h | 41 + lib/sbi/openapi/model/qos_flow_profile.c | 253 ++ lib/sbi/openapi/model/qos_flow_profile.h | 56 + .../model/qos_flow_release_request_item.c | 147 + .../model/qos_flow_release_request_item.h | 42 + lib/sbi/openapi/model/qos_flow_setup_item.c | 219 + lib/sbi/openapi/model/qos_flow_setup_item.h | 50 + lib/sbi/openapi/model/qos_flow_usage_report.c | 207 + lib/sbi/openapi/model/qos_flow_usage_report.h | 46 + lib/sbi/openapi/model/qos_resource_type.c | 85 + lib/sbi/openapi/model/qos_resource_type.h | 36 + .../model/radio_parameter_not_served.c | 34 + .../model/radio_parameter_not_served.h | 1 + lib/sbi/openapi/model/rat_selector.c | 30 + lib/sbi/openapi/model/rat_selector.h | 31 + lib/sbi/openapi/model/rat_type.c | 61 +- lib/sbi/openapi/model/rat_type.h | 12 +- lib/sbi/openapi/model/ref_to_binary_data.c | 110 + lib/sbi/openapi/model/ref_to_binary_data.h | 38 + .../openapi/model/reflective_qo_s_attribute.c | 85 + .../openapi/model/reflective_qo_s_attribute.h | 36 + .../model/registration_context_container.c | 539 +++ .../model/registration_context_container.h | 75 + lib/sbi/openapi/model/registration_reason.c | 34 + lib/sbi/openapi/model/registration_reason.h | 1 + lib/sbi/openapi/model/release_data.c | 320 ++ lib/sbi/openapi/model/release_data.h | 57 + lib/sbi/openapi/model/released_data.c | 133 + lib/sbi/openapi/model/released_data.h | 42 + lib/sbi/openapi/model/report_item.c | 34 + lib/sbi/openapi/model/report_item.h | 1 + lib/sbi/openapi/model/reporting_options.c | 34 + lib/sbi/openapi/model/reporting_options.h | 1 + lib/sbi/openapi/model/request_indication.c | 85 + lib/sbi/openapi/model/request_indication.h | 36 + lib/sbi/openapi/model/request_type.c | 85 + lib/sbi/openapi/model/request_type.h | 36 + lib/sbi/openapi/model/resource_item.c | 34 + lib/sbi/openapi/model/resource_item.h | 1 + lib/sbi/openapi/model/resource_status.c | 85 + lib/sbi/openapi/model/resource_status.h | 36 + lib/sbi/openapi/model/restriction_type.c | 34 + lib/sbi/openapi/model/restriction_type.h | 1 + .../openapi/model/resynchronization_info.c | 34 + .../openapi/model/resynchronization_info.h | 1 + lib/sbi/openapi/model/rg_auth_ctx.c | 36 +- lib/sbi/openapi/model/rg_auth_ctx.h | 1 + .../openapi/model/rg_authentication_info.c | 34 + .../openapi/model/rg_authentication_info.h | 1 + lib/sbi/openapi/model/rm_info.c | 34 + lib/sbi/openapi/model/rm_info.h | 1 + lib/sbi/openapi/model/rm_state.c | 34 + lib/sbi/openapi/model/rm_state.h | 1 + .../openapi/model/roaming_charging_profile.c | 159 + .../openapi/model/roaming_charging_profile.h | 42 + lib/sbi/openapi/model/roaming_odb.c | 34 + lib/sbi/openapi/model/roaming_odb.h | 1 + lib/sbi/openapi/model/route_information.c | 34 + lib/sbi/openapi/model/route_information.h | 1 + lib/sbi/openapi/model/route_to_location.c | 34 + lib/sbi/openapi/model/route_to_location.h | 1 + lib/sbi/openapi/model/sbi_binding_level.c | 30 + lib/sbi/openapi/model/sbi_binding_level.h | 31 + lib/sbi/openapi/model/sc_type.c | 30 + lib/sbi/openapi/model/sc_type.h | 31 + .../model/scheduled_communication_time.c | 34 + .../model/scheduled_communication_time.h | 1 + .../model/scheduled_communication_time_rm.c | 34 + .../model/scheduled_communication_time_rm.h | 1 + .../model/scheduled_communication_type.c | 34 + .../model/scheduled_communication_type.h | 1 + .../model/scheduled_communication_type_rm.c | 34 + .../model/scheduled_communication_type_rm.h | 1 + lib/sbi/openapi/model/sdm_subs_modification.c | 34 + lib/sbi/openapi/model/sdm_subs_modification.h | 1 + lib/sbi/openapi/model/sdm_subscription.c | 38 +- lib/sbi/openapi/model/sdm_subscription.h | 1 + lib/sbi/openapi/model/seaf_data.c | 220 + lib/sbi/openapi/model/seaf_data.h | 50 + lib/sbi/openapi/model/search_result.c | 34 + lib/sbi/openapi/model/search_result.h | 1 + .../openapi/model/secondary_rat_usage_info.c | 211 + .../openapi/model/secondary_rat_usage_info.h | 45 + .../model/secondary_rat_usage_report.c | 166 + .../model/secondary_rat_usage_report.h | 42 + lib/sbi/openapi/model/send_mo_data_req_data.c | 186 + lib/sbi/openapi/model/send_mo_data_req_data.h | 48 + lib/sbi/openapi/model/sequence_number.c | 34 + lib/sbi/openapi/model/sequence_number.h | 1 + .../service_application_server_address.c | 34 + .../service_application_server_address.h | 1 + .../openapi/model/service_area_restriction.c | 34 + .../openapi/model/service_area_restriction.h | 1 + .../openapi/model/service_id_to_frequency.c | 34 + .../openapi/model/service_id_to_frequency.h | 1 + .../openapi/model/service_id_to_layer2_id.c | 34 + .../openapi/model/service_id_to_layer2_id.h | 1 + lib/sbi/openapi/model/service_id_to_pppr.c | 34 + lib/sbi/openapi/model/service_id_to_pppr.h | 1 + lib/sbi/openapi/model/service_name_cond.c | 34 + lib/sbi/openapi/model/service_name_cond.h | 1 + .../openapi/model/service_parameter_data.c | 34 + .../openapi/model/service_parameter_data.h | 1 + .../openapi/model/service_to_pdu_session.c | 76 +- .../openapi/model/service_to_pdu_session.h | 9 +- lib/sbi/openapi/model/service_to_tx.c | 34 + lib/sbi/openapi/model/service_to_tx.h | 1 + .../model/service_type_unrelated_class.c | 34 + .../model/service_type_unrelated_class.h | 1 + .../session_management_subscription_data.c | 34 + .../session_management_subscription_data.h | 1 + lib/sbi/openapi/model/shared_data.c | 34 + lib/sbi/openapi/model/shared_data.h | 1 + lib/sbi/openapi/model/slrb_configurations.c | 34 + lib/sbi/openapi/model/slrb_configurations.h | 1 + lib/sbi/openapi/model/sm_context.c | 931 +++++ lib/sbi/openapi/model/sm_context.h | 120 + .../openapi/model/sm_context_create_data.c | 1609 +++++++ .../openapi/model/sm_context_create_data.h | 191 + .../openapi/model/sm_context_create_error.c | 158 + .../openapi/model/sm_context_create_error.h | 44 + .../openapi/model/sm_context_created_data.c | 391 ++ .../openapi/model/sm_context_created_data.h | 68 + .../openapi/model/sm_context_release_data.c | 303 ++ .../openapi/model/sm_context_release_data.h | 61 + .../openapi/model/sm_context_released_data.c | 133 + .../openapi/model/sm_context_released_data.h | 42 + .../openapi/model/sm_context_retrieve_data.c | 200 + .../openapi/model/sm_context_retrieve_data.h | 47 + .../openapi/model/sm_context_retrieved_data.c | 201 + .../openapi/model/sm_context_retrieved_data.h | 49 + .../model/sm_context_status_notification.c | 261 ++ .../model/sm_context_status_notification.h | 55 + lib/sbi/openapi/model/sm_context_type.c | 85 + lib/sbi/openapi/model/sm_context_type.h | 36 + .../openapi/model/sm_context_update_data.c | 1307 ++++++ .../openapi/model/sm_context_update_data.h | 158 + .../openapi/model/sm_context_update_error.c | 227 + .../openapi/model/sm_context_update_error.h | 52 + .../openapi/model/sm_context_updated_data.c | 632 +++ .../openapi/model/sm_context_updated_data.h | 77 + lib/sbi/openapi/model/sm_policy_data.c | 34 + lib/sbi/openapi/model/sm_policy_data.h | 1 + lib/sbi/openapi/model/sm_policy_data_patch.c | 34 + lib/sbi/openapi/model/sm_policy_data_patch.h | 1 + lib/sbi/openapi/model/sm_policy_dnn_data.c | 48 +- lib/sbi/openapi/model/sm_policy_dnn_data.h | 1 + .../openapi/model/sm_policy_dnn_data_patch.c | 34 + .../openapi/model/sm_policy_dnn_data_patch.h | 1 + lib/sbi/openapi/model/sm_policy_snssai_data.c | 34 + lib/sbi/openapi/model/sm_policy_snssai_data.h | 1 + .../model/sm_policy_snssai_data_patch.c | 34 + .../model/sm_policy_snssai_data_patch.h | 1 + .../openapi/model/small_data_rate_status.c | 181 + .../openapi/model/small_data_rate_status.h | 46 + .../model/small_data_rate_status_info.c | 168 + .../model/small_data_rate_status_info.h | 44 + lib/sbi/openapi/model/smf_change_indication.c | 30 + lib/sbi/openapi/model/smf_change_indication.h | 31 + lib/sbi/openapi/model/smf_change_info.c | 159 + lib/sbi/openapi/model/smf_change_info.h | 41 + lib/sbi/openapi/model/smf_info.c | 34 + lib/sbi/openapi/model/smf_info.h | 1 + lib/sbi/openapi/model/smf_registration.c | 38 +- lib/sbi/openapi/model/smf_registration.h | 1 + lib/sbi/openapi/model/smf_registration_info.c | 34 + lib/sbi/openapi/model/smf_registration_info.h | 1 + .../model/smf_selection_subscription_data.c | 34 + .../model/smf_selection_subscription_data.h | 1 + .../model/sms_management_subscription_data.c | 46 +- .../model/sms_management_subscription_data.h | 1 + lib/sbi/openapi/model/sms_subscription_data.c | 36 +- lib/sbi/openapi/model/sms_subscription_data.h | 1 + lib/sbi/openapi/model/sms_support.c | 61 +- lib/sbi/openapi/model/sms_support.h | 12 +- lib/sbi/openapi/model/smsf_info.c | 34 + lib/sbi/openapi/model/smsf_info.h | 1 + lib/sbi/openapi/model/smsf_registration.c | 34 + lib/sbi/openapi/model/smsf_registration.h | 1 + lib/sbi/openapi/model/snssai.c | 34 + lib/sbi/openapi/model/snssai.h | 1 + lib/sbi/openapi/model/snssai_info.c | 34 + lib/sbi/openapi/model/snssai_info.h | 1 + .../model/snssai_route_selection_descriptor.c | 34 + .../model/snssai_route_selection_descriptor.h | 1 + lib/sbi/openapi/model/snssai_smf_info_item.c | 34 + lib/sbi/openapi/model/snssai_smf_info_item.h | 1 + lib/sbi/openapi/model/snssai_upf_info_item.c | 36 +- lib/sbi/openapi/model/snssai_upf_info_item.h | 1 + lib/sbi/openapi/model/sor_data.c | 34 + lib/sbi/openapi/model/sor_data.h | 1 + lib/sbi/openapi/model/sor_info.c | 34 + lib/sbi/openapi/model/sor_info.h | 1 + lib/sbi/openapi/model/sor_update_info.c | 34 + lib/sbi/openapi/model/sor_update_info.h | 1 + .../openapi/model/sponsor_connectivity_data.c | 34 + .../openapi/model/sponsor_connectivity_data.h | 1 + lib/sbi/openapi/model/ssc_mode.c | 61 +- lib/sbi/openapi/model/ssc_mode.h | 12 +- lib/sbi/openapi/model/ssc_modes.c | 80 +- lib/sbi/openapi/model/ssc_modes.h | 5 +- lib/sbi/openapi/model/stationary_indication.c | 34 + lib/sbi/openapi/model/stationary_indication.h | 1 + .../openapi/model/stationary_indication_rm.c | 34 + .../openapi/model/stationary_indication_rm.h | 1 + lib/sbi/openapi/model/status_change.c | 30 + lib/sbi/openapi/model/status_change.h | 31 + lib/sbi/openapi/model/status_info.c | 183 + lib/sbi/openapi/model/status_info.h | 48 + lib/sbi/openapi/model/status_notification.c | 162 + lib/sbi/openapi/model/status_notification.h | 45 + lib/sbi/openapi/model/steering_container.c | 34 + lib/sbi/openapi/model/steering_container.h | 1 + lib/sbi/openapi/model/steering_info.c | 34 + lib/sbi/openapi/model/steering_info.h | 1 + lib/sbi/openapi/model/stored_search_result.c | 34 + lib/sbi/openapi/model/stored_search_result.h | 1 + .../openapi/model/subscribed_default_qos.c | 34 + .../openapi/model/subscribed_default_qos.h | 1 + lib/sbi/openapi/model/subscribed_event.c | 34 + lib/sbi/openapi/model/subscribed_event.h | 1 + lib/sbi/openapi/model/subscription_data.c | 34 + lib/sbi/openapi/model/subscription_data.h | 1 + .../openapi/model/subscription_data_sets.c | 34 + .../openapi/model/subscription_data_sets.h | 1 + .../model/subscription_data_subscriptions.c | 34 + .../model/subscription_data_subscriptions.h | 1 + .../openapi/model/suggested_packet_num_dl.c | 34 + .../openapi/model/suggested_packet_num_dl.h | 1 + lib/sbi/openapi/model/supi_range.c | 34 + lib/sbi/openapi/model/supi_range.h | 1 + lib/sbi/openapi/model/supported_gad_shapes.c | 34 + lib/sbi/openapi/model/supported_gad_shapes.h | 1 + lib/sbi/openapi/model/tac_range.c | 34 + lib/sbi/openapi/model/tac_range.h | 1 + lib/sbi/openapi/model/tai.c | 34 + lib/sbi/openapi/model/tai.h | 1 + lib/sbi/openapi/model/tai_range.c | 34 + lib/sbi/openapi/model/tai_range.h | 1 + lib/sbi/openapi/model/temporal_validity.c | 34 + lib/sbi/openapi/model/temporal_validity.h | 1 + lib/sbi/openapi/model/time_period.c | 34 + lib/sbi/openapi/model/time_period.h | 1 + lib/sbi/openapi/model/time_window.c | 34 + lib/sbi/openapi/model/time_window.h | 1 + lib/sbi/openapi/model/tmbr.c | 34 + lib/sbi/openapi/model/tmbr.h | 1 + lib/sbi/openapi/model/tngf_info.c | 34 + lib/sbi/openapi/model/tngf_info.h | 1 + lib/sbi/openapi/model/trace_data.c | 34 + lib/sbi/openapi/model/trace_data.h | 1 + lib/sbi/openapi/model/trace_data_response.c | 34 + lib/sbi/openapi/model/trace_data_response.h | 1 + lib/sbi/openapi/model/trace_depth.c | 34 + lib/sbi/openapi/model/trace_depth.h | 1 + lib/sbi/openapi/model/traffic_descriptor.c | 179 + lib/sbi/openapi/model/traffic_descriptor.h | 44 + lib/sbi/openapi/model/traffic_influ_data.c | 42 +- lib/sbi/openapi/model/traffic_influ_data.h | 1 + .../openapi/model/traffic_influ_data_notif.c | 34 + .../openapi/model/traffic_influ_data_notif.h | 1 + .../openapi/model/traffic_influ_data_patch.c | 42 +- .../openapi/model/traffic_influ_data_patch.h | 1 + lib/sbi/openapi/model/traffic_influ_sub.c | 34 + lib/sbi/openapi/model/traffic_influ_sub.h | 1 + lib/sbi/openapi/model/traffic_profile.c | 34 + lib/sbi/openapi/model/traffic_profile.h | 1 + lib/sbi/openapi/model/traffic_profile_rm.c | 34 + lib/sbi/openapi/model/traffic_profile_rm.h | 1 + .../openapi/model/transfer_mo_data_req_data.c | 186 + .../openapi/model/transfer_mo_data_req_data.h | 48 + .../openapi/model/transfer_mt_data_add_info.c | 104 + .../openapi/model/transfer_mt_data_add_info.h | 38 + .../openapi/model/transfer_mt_data_error.c | 293 ++ .../openapi/model/transfer_mt_data_error.h | 57 + .../openapi/model/transfer_mt_data_req_data.c | 114 + .../openapi/model/transfer_mt_data_req_data.h | 39 + lib/sbi/openapi/model/transfer_policy.c | 34 + lib/sbi/openapi/model/transfer_policy.h | 1 + lib/sbi/openapi/model/transfer_reason.c | 30 + lib/sbi/openapi/model/transfer_reason.h | 31 + lib/sbi/openapi/model/transport_protocol.c | 34 + lib/sbi/openapi/model/transport_protocol.h | 1 + lib/sbi/openapi/model/trigger.c | 219 + lib/sbi/openapi/model/trigger.h | 50 + lib/sbi/openapi/model/trigger_category.c | 85 + lib/sbi/openapi/model/trigger_category.h | 36 + lib/sbi/openapi/model/trigger_request.c | 34 + lib/sbi/openapi/model/trigger_request.h | 1 + lib/sbi/openapi/model/trigger_type.c | 85 + lib/sbi/openapi/model/trigger_type.h | 36 + lib/sbi/openapi/model/tunnel_info.c | 171 + lib/sbi/openapi/model/tunnel_info.h | 45 + lib/sbi/openapi/model/twif_info.c | 34 + lib/sbi/openapi/model/twif_info.h | 1 + lib/sbi/openapi/model/udm_info.c | 34 + lib/sbi/openapi/model/udm_info.h | 1 + lib/sbi/openapi/model/udr_info.c | 34 + lib/sbi/openapi/model/udr_info.h | 1 + lib/sbi/openapi/model/udsf_info.c | 34 + lib/sbi/openapi/model/udsf_info.h | 1 + lib/sbi/openapi/model/ue_auth.c | 34 + lib/sbi/openapi/model/ue_auth.h | 1 + lib/sbi/openapi/model/ue_authentication_ctx.c | 34 + lib/sbi/openapi/model/ue_authentication_ctx.h | 1 + lib/sbi/openapi/model/ue_context.c | 1354 ++++++ lib/sbi/openapi/model/ue_context.h | 139 + .../openapi/model/ue_context_create_data.c | 334 ++ .../openapi/model/ue_context_create_data.h | 59 + .../openapi/model/ue_context_create_error.c | 138 + .../openapi/model/ue_context_create_error.h | 42 + .../openapi/model/ue_context_created_data.c | 287 ++ .../openapi/model/ue_context_created_data.h | 51 + .../openapi/model/ue_context_in_smf_data.c | 34 + .../openapi/model/ue_context_in_smf_data.h | 1 + .../openapi/model/ue_context_in_smsf_data.c | 34 + .../openapi/model/ue_context_in_smsf_data.h | 1 + lib/sbi/openapi/model/ue_context_release.c | 153 + lib/sbi/openapi/model/ue_context_release.h | 43 + .../model/ue_context_transfer_req_data.c | 205 + .../model/ue_context_transfer_req_data.h | 50 + .../model/ue_context_transfer_rsp_data.c | 182 + .../model/ue_context_transfer_rsp_data.h | 46 + .../model/ue_context_transfer_status.c | 30 + .../model/ue_context_transfer_status.h | 31 + lib/sbi/openapi/model/ue_id.c | 34 + lib/sbi/openapi/model/ue_id.h | 1 + .../ue_n1_n2_info_subscription_create_data.c | 231 + .../ue_n1_n2_info_subscription_create_data.h | 53 + .../ue_n1_n2_info_subscription_created_data.c | 130 + .../ue_n1_n2_info_subscription_created_data.h | 40 + lib/sbi/openapi/model/ue_policy_section.c | 34 + lib/sbi/openapi/model/ue_policy_section.h | 1 + lib/sbi/openapi/model/ue_policy_set.c | 36 +- lib/sbi/openapi/model/ue_policy_set.h | 1 + lib/sbi/openapi/model/ue_policy_set_patch.c | 36 +- lib/sbi/openapi/model/ue_policy_set_patch.h | 1 + lib/sbi/openapi/model/ue_reachability.c | 34 + lib/sbi/openapi/model/ue_reachability.h | 1 + .../model/ue_reg_status_update_req_data.c | 223 + .../model/ue_reg_status_update_req_data.h | 46 + .../model/ue_reg_status_update_rsp_data.c | 105 + .../model/ue_reg_status_update_rsp_data.h | 38 + lib/sbi/openapi/model/ulcl_bp_information.c | 105 + lib/sbi/openapi/model/ulcl_bp_information.h | 38 + .../model/unavailable_access_indication.c | 85 + .../model/unavailable_access_indication.h | 36 + lib/sbi/openapi/model/uncertainty_ellipse.c | 34 + lib/sbi/openapi/model/uncertainty_ellipse.h | 1 + lib/sbi/openapi/model/unrelated_class.c | 34 + lib/sbi/openapi/model/unrelated_class.h | 1 + lib/sbi/openapi/model/up_cnx_state.c | 85 + lib/sbi/openapi/model/up_cnx_state.h | 36 + lib/sbi/openapi/model/up_confidentiality.c | 34 + lib/sbi/openapi/model/up_confidentiality.h | 1 + lib/sbi/openapi/model/up_integrity.c | 34 + lib/sbi/openapi/model/up_integrity.h | 1 + lib/sbi/openapi/model/up_interface_type.c | 34 + lib/sbi/openapi/model/up_interface_type.h | 1 + lib/sbi/openapi/model/up_security.c | 34 + lib/sbi/openapi/model/up_security.h | 1 + lib/sbi/openapi/model/updated_item.c | 34 + lib/sbi/openapi/model/updated_item.h | 1 + lib/sbi/openapi/model/upf_cond.c | 34 + lib/sbi/openapi/model/upf_cond.h | 1 + lib/sbi/openapi/model/upf_info.c | 65 +- lib/sbi/openapi/model/upf_info.h | 1 + lib/sbi/openapi/model/upu_data.c | 34 + lib/sbi/openapi/model/upu_data.h | 1 + lib/sbi/openapi/model/upu_data_2.c | 34 + lib/sbi/openapi/model/upu_data_2.h | 1 + lib/sbi/openapi/model/upu_info.c | 34 + lib/sbi/openapi/model/upu_info.h | 1 + lib/sbi/openapi/model/usage_mon_data.c | 34 + lib/sbi/openapi/model/usage_mon_data.h | 1 + lib/sbi/openapi/model/usage_mon_data_limit.c | 34 + lib/sbi/openapi/model/usage_mon_data_limit.h | 1 + lib/sbi/openapi/model/usage_mon_data_scope.c | 34 + lib/sbi/openapi/model/usage_mon_data_scope.h | 1 + lib/sbi/openapi/model/usage_mon_level.c | 34 + lib/sbi/openapi/model/usage_mon_level.h | 1 + lib/sbi/openapi/model/usage_threshold.c | 34 + lib/sbi/openapi/model/usage_threshold.h | 1 + lib/sbi/openapi/model/user_identifier.c | 34 + lib/sbi/openapi/model/user_identifier.h | 1 + lib/sbi/openapi/model/user_location.c | 34 + lib/sbi/openapi/model/user_location.h | 1 + lib/sbi/openapi/model/v2x_context.c | 197 + lib/sbi/openapi/model/v2x_context.h | 49 + lib/sbi/openapi/model/v2x_rat_type.c | 34 + lib/sbi/openapi/model/v2x_rat_type.h | 1 + lib/sbi/openapi/model/valid_time_period.c | 34 + lib/sbi/openapi/model/valid_time_period.h | 1 + .../openapi/model/vendor_specific_feature.c | 34 + .../openapi/model/vendor_specific_feature.h | 1 + lib/sbi/openapi/model/vgmlc_address.c | 34 + lib/sbi/openapi/model/vgmlc_address.h | 1 + lib/sbi/openapi/model/vn_group_data.c | 34 + lib/sbi/openapi/model/vn_group_data.h | 1 + lib/sbi/openapi/model/volume_timed_report.c | 183 + lib/sbi/openapi/model/volume_timed_report.h | 44 + lib/sbi/openapi/model/vplmn_qos.c | 232 + lib/sbi/openapi/model/vplmn_qos.h | 52 + lib/sbi/openapi/model/vsmf_update_data.c | 778 ++++ lib/sbi/openapi/model/vsmf_update_data.h | 94 + lib/sbi/openapi/model/vsmf_update_error.c | 386 ++ lib/sbi/openapi/model/vsmf_update_error.h | 65 + lib/sbi/openapi/model/vsmf_updated_data.c | 716 ++++ lib/sbi/openapi/model/vsmf_updated_data.h | 78 + lib/sbi/openapi/model/w_agf_info.c | 34 + lib/sbi/openapi/model/w_agf_info.h | 1 + lib/sbi/openapi/src/apiKey.c | 2 +- lib/sbi/openapi/src/binary.c | 65 + lib/sbi/path.c | 99 +- lib/sbi/path.h | 12 +- lib/sbi/sbi-private.h | 25 - lib/sbi/server.c | 9 +- lib/sbi/support/generator.sh | 2 + .../modified/TS29502_Nsmf_PDUSession.yaml | 3720 +++++++++++++++++ .../modified/TS29518_Namf_Communication.yaml | 114 +- .../modified/TS29531_Nnssf_NSSelection.yaml | 322 ++ .../support/modified/TS29571_CommonData.yaml | 30 +- .../TS32291_Nchf_ConvergedCharging.yaml | 1261 ++++++ .../standard/TS29502_Nsmf_PDUSession.yaml | 3720 +++++++++++++++++ .../TS29507_Npcf_AMPolicyControl.yaml | 586 +++ .../TS29531_Nnssf_NSSAIAvailability.yaml | 503 +++ .../standard/TS29531_Nnssf_NSSelection.yaml | 322 ++ .../TS32291_Nchf_ConvergedCharging.yaml | 1261 ++++++ src/amf/amf-sm.c | 206 +- src/amf/amf-sm.h | 9 - src/amf/context.c | 269 +- src/amf/context.h | 118 +- src/amf/gmm-build.c | 421 +- src/amf/gmm-build.h | 12 +- src/amf/gmm-handler.c | 247 +- src/amf/gmm-handler.h | 7 +- src/amf/gmm-sm.c | 394 +- src/amf/gsm-sm.c | 360 -- src/amf/init.c | 3 + src/amf/meson.build | 7 +- src/amf/namf-handler.c | 152 + src/amf/namf-handler.h | 36 + src/amf/nas-path.c | 269 +- src/amf/nas-path.h | 39 +- src/amf/nas-security.c | 21 +- src/amf/nausf-build.c | 11 +- src/amf/nausf-build.h | 5 +- src/amf/nausf-handler.c | 1 - src/amf/ngap-build.c | 481 +-- src/amf/ngap-build.h | 29 +- src/amf/ngap-handler.c | 567 +-- src/amf/ngap-handler.h | 21 +- src/amf/ngap-path.c | 25 +- src/amf/ngap-path.h | 10 +- src/amf/ngap-sm.c | 34 +- src/amf/nnrf-handler.c | 66 +- src/amf/nnrf-handler.h | 3 +- src/amf/nsmf-build.c | 165 + src/amf/nsmf-build.h | 38 + src/amf/nsmf-handler.c | 175 + src/amf/nsmf-handler.h | 40 + src/amf/nudm-build.c | 107 + src/amf/nudm-build.h | 37 + src/amf/sbi-path.c | 132 +- src/amf/sbi-path.h | 11 +- src/amf/timer.c | 12 +- src/amf/timer.h | 3 + src/ausf/ausf-sm.c | 42 +- src/ausf/context.c | 17 +- src/ausf/context.h | 16 +- src/ausf/nausf-handler.c | 13 +- src/ausf/nnrf-handler.c | 37 +- src/ausf/nnrf-handler.h | 2 +- src/ausf/nudm-build.c | 8 +- src/ausf/nudm-build.h | 4 +- src/ausf/nudm-handler.c | 8 +- src/ausf/sbi-path.c | 128 +- src/ausf/sbi-path.h | 11 +- src/ausf/timer.c | 2 +- src/ausf/ue-sm.c | 6 +- src/mme/emm-build.c | 2 +- src/mme/esm-build.c | 6 +- src/mme/s1ap-sm.c | 8 +- src/nrf/nnrf-build.c | 4 +- src/nrf/nnrf-handler.c | 8 +- src/nrf/nrf-sm.c | 17 +- src/nrf/sbi-path.c | 1 + src/pcrf/pcrf-rx-path.c | 4 +- src/pgw/pgw-context.c | 4 +- src/pgw/pgw-ipfw.c | 4 +- src/smf/context.c | 439 +- src/smf/context.h | 90 +- src/smf/event.c | 10 + src/smf/event.h | 19 + src/smf/gsm-build.c | 134 + src/smf/gsm-build.h | 39 + src/smf/gsm-handler.c | 64 + src/smf/gsm-handler.h | 37 + src/smf/gsm-sm.c | 241 ++ src/smf/gx-handler.c | 2 +- src/smf/meson.build | 26 +- src/smf/n4-build.c | 138 +- src/smf/n4-handler.c | 98 +- src/smf/n4-handler.h | 16 +- src/smf/namf-build.c | 112 + src/smf/namf-build.h | 36 + src/smf/nas-path.c | 364 ++ src/smf/nas-path.h | 65 + src/smf/ngap-build.c | 139 + src/smf/ngap-build.h | 36 + src/smf/ngap-handler.c | 107 + src/smf/ngap-handler.h | 36 + src/smf/ngap-path.c | 41 + src/smf/ngap-path.h | 35 + src/smf/nnrf-handler.c | 40 +- src/smf/nnrf-handler.h | 3 +- src/smf/nsmf-handler.c | 258 ++ src/smf/nsmf-handler.h | 40 + src/smf/nudm-build.c | 47 + src/smf/nudm-build.h | 35 + src/smf/nudm-handler.c | 242 ++ src/smf/nudm-handler.h | 35 + src/smf/pfcp-path.c | 7 +- src/smf/pfcp-path.h | 3 +- src/smf/pfcp-sm.c | 18 +- src/smf/sbi-path.c | 113 +- src/smf/sbi-path.h | 16 + src/smf/smf-sm.c | 206 +- src/smf/smf-sm.h | 5 + src/smf/timer.c | 2 +- src/udm/context.c | 27 +- src/udm/context.h | 26 +- src/udm/nnrf-handler.c | 36 +- src/udm/nnrf-handler.h | 3 +- src/udm/nudm-handler.c | 181 +- src/udm/nudm-handler.h | 8 +- src/udm/nudr-build.c | 106 +- src/udm/nudr-build.h | 10 +- src/udm/nudr-handler.c | 177 +- src/udm/nudr-handler.h | 4 + src/udm/sbi-path.c | 129 +- src/udm/sbi-path.h | 10 +- src/udm/timer.c | 2 +- src/udm/udm-sm.c | 67 +- src/udm/ue-sm.c | 142 +- src/udr/nudr-handler.c | 462 +- src/udr/nudr-handler.h | 4 + src/udr/sbi-path.c | 4 +- src/udr/udr-sm.c | 46 +- src/upf/context.c | 4 +- src/upf/gtp-path.c | 6 +- src/upf/n4-handler.c | 155 +- src/upf/rule-match.c | 4 +- tests/app/5gc-init.c | 18 +- tests/common/context.c | 9 +- tests/common/context.h | 41 +- tests/common/gmm-build.c | 126 +- tests/common/gmm-build.h | 4 + tests/common/gmm-handler.c | 35 + tests/common/gmm-handler.h | 4 + tests/common/gsm-build.c | 67 + tests/common/gsm-build.h | 34 + tests/common/gsm-handler.c | 52 + tests/common/gsm-handler.h | 35 + tests/common/gtpu.c | 164 + tests/common/gtpu.h | 8 + tests/common/meson.build | 8 +- tests/common/nas-path.c | 46 +- tests/common/nas-path.h | 5 +- tests/common/nas-security.c | 21 +- tests/common/ngap-build.c | 324 +- tests/common/ngap-build.h | 10 + tests/common/ngap-handler.c | 192 +- tests/common/ngap-handler.h | 7 + tests/common/ngap-path.c | 16 +- tests/common/test-common.h | 3 + tests/crypt/abts-main.c | 2 + tests/crypt/base64-test.c | 73 + tests/crypt/meson.build | 1 + tests/minimal/minimal-test.c | 200 +- 1415 files changed, 86635 insertions(+), 5877 deletions(-) create mode 100644 lib/asn1c/util/message.c create mode 100644 lib/asn1c/util/message.h create mode 100644 lib/crypt/ogs-base64.c create mode 100644 lib/crypt/ogs-base64.h create mode 100644 lib/sbi/contrib/multipart_parser.c create mode 100644 lib/sbi/contrib/multipart_parser.h create mode 100644 lib/sbi/openapi/model/additional_qos_flow_info.c create mode 100644 lib/sbi/openapi/model/additional_qos_flow_info.h create mode 100644 lib/sbi/openapi/model/allowed_nssai.c create mode 100644 lib/sbi/openapi/model/allowed_nssai.h create mode 100644 lib/sbi/openapi/model/allowed_snssai.c create mode 100644 lib/sbi/openapi/model/allowed_snssai.h create mode 100644 lib/sbi/openapi/model/amf_event.c create mode 100644 lib/sbi/openapi/model/amf_event.h create mode 100644 lib/sbi/openapi/model/amf_event_area.c create mode 100644 lib/sbi/openapi/model/amf_event_area.h create mode 100644 lib/sbi/openapi/model/amf_event_mode.c create mode 100644 lib/sbi/openapi/model/amf_event_mode.h create mode 100644 lib/sbi/openapi/model/amf_event_subscription.c create mode 100644 lib/sbi/openapi/model/amf_event_subscription.h create mode 100644 lib/sbi/openapi/model/amf_event_trigger.c create mode 100644 lib/sbi/openapi/model/amf_event_trigger.h create mode 100644 lib/sbi/openapi/model/amf_event_type.c create mode 100644 lib/sbi/openapi/model/amf_event_type.h create mode 100644 lib/sbi/openapi/model/amf_status_change_notification.c create mode 100644 lib/sbi/openapi/model/amf_status_change_notification.h create mode 100644 lib/sbi/openapi/model/amf_status_change_subscription_data.c create mode 100644 lib/sbi/openapi/model/amf_status_change_subscription_data.h create mode 100644 lib/sbi/openapi/model/amf_status_info.c create mode 100644 lib/sbi/openapi/model/amf_status_info.h create mode 100644 lib/sbi/openapi/model/apn_rate_status.c create mode 100644 lib/sbi/openapi/model/apn_rate_status.h create mode 100644 lib/sbi/openapi/model/area_of_validity.c create mode 100644 lib/sbi/openapi/model/area_of_validity.h create mode 100644 lib/sbi/openapi/model/assign_ebi_data.c create mode 100644 lib/sbi/openapi/model/assign_ebi_data.h create mode 100644 lib/sbi/openapi/model/assign_ebi_error.c create mode 100644 lib/sbi/openapi/model/assign_ebi_error.h create mode 100644 lib/sbi/openapi/model/assign_ebi_failed.c create mode 100644 lib/sbi/openapi/model/assign_ebi_failed.h create mode 100644 lib/sbi/openapi/model/assigned_ebi_data.c create mode 100644 lib/sbi/openapi/model/assigned_ebi_data.h create mode 100644 lib/sbi/openapi/model/cause.c create mode 100644 lib/sbi/openapi/model/cause.h create mode 100644 lib/sbi/openapi/model/ciphering_algorithm.c create mode 100644 lib/sbi/openapi/model/ciphering_algorithm.h create mode 100644 lib/sbi/openapi/model/cn_assisted_ran_para.c create mode 100644 lib/sbi/openapi/model/cn_assisted_ran_para.h create mode 100644 lib/sbi/openapi/model/configured_snssai.c create mode 100644 lib/sbi/openapi/model/configured_snssai.h create mode 100644 lib/sbi/openapi/model/ddn_failure_subs.c create mode 100644 lib/sbi/openapi/model/ddn_failure_subs.h create mode 100644 lib/sbi/openapi/model/dnai_information.c create mode 100644 lib/sbi/openapi/model/dnai_information.h create mode 100644 lib/sbi/openapi/model/dnn_selection_mode.c create mode 100644 lib/sbi/openapi/model/dnn_selection_mode.h create mode 100644 lib/sbi/openapi/model/dynamic5_qi.c create mode 100644 lib/sbi/openapi/model/dynamic5_qi.h create mode 100644 lib/sbi/openapi/model/ebi_arp_mapping.c create mode 100644 lib/sbi/openapi/model/ebi_arp_mapping.h create mode 100644 lib/sbi/openapi/model/eps_bearer_info.c create mode 100644 lib/sbi/openapi/model/eps_bearer_info.h create mode 100644 lib/sbi/openapi/model/eps_interworking_indication.c create mode 100644 lib/sbi/openapi/model/eps_interworking_indication.h create mode 100644 lib/sbi/openapi/model/eps_pdn_cnx_info.c create mode 100644 lib/sbi/openapi/model/eps_pdn_cnx_info.h create mode 100644 lib/sbi/openapi/model/exemption_ind.c create mode 100644 lib/sbi/openapi/model/exemption_ind.h create mode 100644 lib/sbi/openapi/model/expected_ue_behavior.c create mode 100644 lib/sbi/openapi/model/expected_ue_behavior.h create mode 100644 lib/sbi/openapi/model/gbr_qos_flow_information.c create mode 100644 lib/sbi/openapi/model/gbr_qos_flow_information.h create mode 100644 lib/sbi/openapi/model/ho_state.c create mode 100644 lib/sbi/openapi/model/ho_state.h create mode 100644 lib/sbi/openapi/model/hsmf_update_data.c create mode 100644 lib/sbi/openapi/model/hsmf_update_data.h create mode 100644 lib/sbi/openapi/model/hsmf_update_error.c create mode 100644 lib/sbi/openapi/model/hsmf_update_error.h create mode 100644 lib/sbi/openapi/model/hsmf_updated_data.c create mode 100644 lib/sbi/openapi/model/hsmf_updated_data.h create mode 100644 lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.c create mode 100644 lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.h create mode 100644 lib/sbi/openapi/model/inline_object.c create mode 100644 lib/sbi/openapi/model/inline_object.h create mode 100644 lib/sbi/openapi/model/inline_object_1.c create mode 100644 lib/sbi/openapi/model/inline_object_1.h create mode 100644 lib/sbi/openapi/model/inline_object_2.c create mode 100644 lib/sbi/openapi/model/inline_object_2.h create mode 100644 lib/sbi/openapi/model/inline_object_3.c create mode 100644 lib/sbi/openapi/model/inline_object_3.h create mode 100644 lib/sbi/openapi/model/inline_object_4.c create mode 100644 lib/sbi/openapi/model/inline_object_4.h create mode 100644 lib/sbi/openapi/model/integrity_algorithm.c create mode 100644 lib/sbi/openapi/model/integrity_algorithm.h create mode 100644 lib/sbi/openapi/model/key_amf.c create mode 100644 lib/sbi/openapi/model/key_amf.h create mode 100644 lib/sbi/openapi/model/key_amf_type.c create mode 100644 lib/sbi/openapi/model/key_amf_type.h create mode 100644 lib/sbi/openapi/model/ladn_info.c create mode 100644 lib/sbi/openapi/model/ladn_info.h create mode 100644 lib/sbi/openapi/model/location_filter.c create mode 100644 lib/sbi/openapi/model/location_filter.h create mode 100644 lib/sbi/openapi/model/ma_release_indication.c create mode 100644 lib/sbi/openapi/model/ma_release_indication.h create mode 100644 lib/sbi/openapi/model/max_integrity_protected_data_rate.c create mode 100644 lib/sbi/openapi/model/max_integrity_protected_data_rate.h create mode 100644 lib/sbi/openapi/model/mm_context.c create mode 100644 lib/sbi/openapi/model/mm_context.h create mode 100644 lib/sbi/openapi/model/mme_capabilities.c create mode 100644 lib/sbi/openapi/model/mme_capabilities.h create mode 100644 lib/sbi/openapi/model/mo_exception_data_flag.c create mode 100644 lib/sbi/openapi/model/mo_exception_data_flag.h create mode 100644 lib/sbi/openapi/model/mo_exp_data_counter.c create mode 100644 lib/sbi/openapi/model/mo_exp_data_counter.h create mode 100644 lib/sbi/openapi/model/n1_message_container.c create mode 100644 lib/sbi/openapi/model/n1_message_container.h create mode 100644 lib/sbi/openapi/model/n1_message_notification.c create mode 100644 lib/sbi/openapi/model/n1_message_notification.h create mode 100644 lib/sbi/openapi/model/n1_n2_message_transfer_cause.c create mode 100644 lib/sbi/openapi/model/n1_n2_message_transfer_cause.h create mode 100644 lib/sbi/openapi/model/n1_n2_message_transfer_error.c create mode 100644 lib/sbi/openapi/model/n1_n2_message_transfer_error.h create mode 100644 lib/sbi/openapi/model/n1_n2_message_transfer_req_data.c create mode 100644 lib/sbi/openapi/model/n1_n2_message_transfer_req_data.h create mode 100644 lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.c create mode 100644 lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.h create mode 100644 lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.c create mode 100644 lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.h create mode 100644 lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.c create mode 100644 lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.h create mode 100644 lib/sbi/openapi/model/n2_info_container.c create mode 100644 lib/sbi/openapi/model/n2_info_container.h create mode 100644 lib/sbi/openapi/model/n2_info_content.c create mode 100644 lib/sbi/openapi/model/n2_info_content.h create mode 100644 lib/sbi/openapi/model/n2_info_notification_rsp_data.c create mode 100644 lib/sbi/openapi/model/n2_info_notification_rsp_data.h create mode 100644 lib/sbi/openapi/model/n2_info_notify_reason.c create mode 100644 lib/sbi/openapi/model/n2_info_notify_reason.h create mode 100644 lib/sbi/openapi/model/n2_information_notification.c create mode 100644 lib/sbi/openapi/model/n2_information_notification.h create mode 100644 lib/sbi/openapi/model/n2_information_transfer_error.c create mode 100644 lib/sbi/openapi/model/n2_information_transfer_error.h create mode 100644 lib/sbi/openapi/model/n2_information_transfer_req_data.c create mode 100644 lib/sbi/openapi/model/n2_information_transfer_req_data.h create mode 100644 lib/sbi/openapi/model/n2_information_transfer_result.c create mode 100644 lib/sbi/openapi/model/n2_information_transfer_result.h create mode 100644 lib/sbi/openapi/model/n2_information_transfer_rsp_data.c create mode 100644 lib/sbi/openapi/model/n2_information_transfer_rsp_data.h create mode 100644 lib/sbi/openapi/model/n2_ran_information.c create mode 100644 lib/sbi/openapi/model/n2_ran_information.h create mode 100644 lib/sbi/openapi/model/n2_sm_info_type.c create mode 100644 lib/sbi/openapi/model/n2_sm_info_type.h create mode 100644 lib/sbi/openapi/model/n2_sm_information.c create mode 100644 lib/sbi/openapi/model/n2_sm_information.h create mode 100644 lib/sbi/openapi/model/n4_information.c create mode 100644 lib/sbi/openapi/model/n4_information.h create mode 100644 lib/sbi/openapi/model/n4_message_type.c create mode 100644 lib/sbi/openapi/model/n4_message_type.h create mode 100644 lib/sbi/openapi/model/nas_security_mode.c create mode 100644 lib/sbi/openapi/model/nas_security_mode.h create mode 100644 lib/sbi/openapi/model/ng_ap_cause.c create mode 100644 lib/sbi/openapi/model/ng_ap_cause.h create mode 100644 lib/sbi/openapi/model/ng_ksi.c create mode 100644 lib/sbi/openapi/model/ng_ksi.h create mode 100644 lib/sbi/openapi/model/ng_ran_target_id.c create mode 100644 lib/sbi/openapi/model/ng_ran_target_id.h create mode 100644 lib/sbi/openapi/model/ngap_ie_type.c create mode 100644 lib/sbi/openapi/model/ngap_ie_type.h create mode 100644 lib/sbi/openapi/model/non_dynamic5_qi.c create mode 100644 lib/sbi/openapi/model/non_dynamic5_qi.h create mode 100644 lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.c create mode 100644 lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.h create mode 100644 lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.c create mode 100644 lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.h create mode 100644 lib/sbi/openapi/model/notification_cause.c create mode 100644 lib/sbi/openapi/model/notification_cause.h create mode 100644 lib/sbi/openapi/model/notification_control.c create mode 100644 lib/sbi/openapi/model/notification_control.h create mode 100644 lib/sbi/openapi/model/nrppa_information.c create mode 100644 lib/sbi/openapi/model/nrppa_information.h create mode 100644 lib/sbi/openapi/model/nsi_information.c create mode 100644 lib/sbi/openapi/model/nsi_information.h create mode 100644 lib/sbi/openapi/model/nssai_mapping.c create mode 100644 lib/sbi/openapi/model/nssai_mapping.h create mode 100644 lib/sbi/openapi/model/partial_record_method.c create mode 100644 lib/sbi/openapi/model/partial_record_method.h create mode 100644 lib/sbi/openapi/model/pdu_session_context.c create mode 100644 lib/sbi/openapi/model/pdu_session_context.h create mode 100644 lib/sbi/openapi/model/pdu_session_create_data.c create mode 100644 lib/sbi/openapi/model/pdu_session_create_data.h create mode 100644 lib/sbi/openapi/model/pdu_session_create_error.c create mode 100644 lib/sbi/openapi/model/pdu_session_create_error.h create mode 100644 lib/sbi/openapi/model/pdu_session_created_data.c create mode 100644 lib/sbi/openapi/model/pdu_session_created_data.h create mode 100644 lib/sbi/openapi/model/pdu_session_notify_item.c create mode 100644 lib/sbi/openapi/model/pdu_session_notify_item.h create mode 100644 lib/sbi/openapi/model/policy_req_trigger.c create mode 100644 lib/sbi/openapi/model/policy_req_trigger.h create mode 100644 lib/sbi/openapi/model/psa_indication.c create mode 100644 lib/sbi/openapi/model/psa_indication.h create mode 100644 lib/sbi/openapi/model/psa_information.c create mode 100644 lib/sbi/openapi/model/psa_information.h create mode 100644 lib/sbi/openapi/model/pws_error_data.c create mode 100644 lib/sbi/openapi/model/pws_error_data.h create mode 100644 lib/sbi/openapi/model/pws_information.c create mode 100644 lib/sbi/openapi/model/pws_information.h create mode 100644 lib/sbi/openapi/model/pws_response_data.c create mode 100644 lib/sbi/openapi/model/pws_response_data.h create mode 100644 lib/sbi/openapi/model/qos_flow_access_type.c create mode 100644 lib/sbi/openapi/model/qos_flow_access_type.h create mode 100644 lib/sbi/openapi/model/qos_flow_add_modify_request_item.c create mode 100644 lib/sbi/openapi/model/qos_flow_add_modify_request_item.h create mode 100644 lib/sbi/openapi/model/qos_flow_item.c create mode 100644 lib/sbi/openapi/model/qos_flow_item.h create mode 100644 lib/sbi/openapi/model/qos_flow_notify_item.c create mode 100644 lib/sbi/openapi/model/qos_flow_notify_item.h create mode 100644 lib/sbi/openapi/model/qos_flow_profile.c create mode 100644 lib/sbi/openapi/model/qos_flow_profile.h create mode 100644 lib/sbi/openapi/model/qos_flow_release_request_item.c create mode 100644 lib/sbi/openapi/model/qos_flow_release_request_item.h create mode 100644 lib/sbi/openapi/model/qos_flow_setup_item.c create mode 100644 lib/sbi/openapi/model/qos_flow_setup_item.h create mode 100644 lib/sbi/openapi/model/qos_flow_usage_report.c create mode 100644 lib/sbi/openapi/model/qos_flow_usage_report.h create mode 100644 lib/sbi/openapi/model/qos_resource_type.c create mode 100644 lib/sbi/openapi/model/qos_resource_type.h create mode 100644 lib/sbi/openapi/model/rat_selector.c create mode 100644 lib/sbi/openapi/model/rat_selector.h create mode 100644 lib/sbi/openapi/model/ref_to_binary_data.c create mode 100644 lib/sbi/openapi/model/ref_to_binary_data.h create mode 100644 lib/sbi/openapi/model/reflective_qo_s_attribute.c create mode 100644 lib/sbi/openapi/model/reflective_qo_s_attribute.h create mode 100644 lib/sbi/openapi/model/registration_context_container.c create mode 100644 lib/sbi/openapi/model/registration_context_container.h create mode 100644 lib/sbi/openapi/model/release_data.c create mode 100644 lib/sbi/openapi/model/release_data.h create mode 100644 lib/sbi/openapi/model/released_data.c create mode 100644 lib/sbi/openapi/model/released_data.h create mode 100644 lib/sbi/openapi/model/request_indication.c create mode 100644 lib/sbi/openapi/model/request_indication.h create mode 100644 lib/sbi/openapi/model/request_type.c create mode 100644 lib/sbi/openapi/model/request_type.h create mode 100644 lib/sbi/openapi/model/resource_status.c create mode 100644 lib/sbi/openapi/model/resource_status.h create mode 100644 lib/sbi/openapi/model/roaming_charging_profile.c create mode 100644 lib/sbi/openapi/model/roaming_charging_profile.h create mode 100644 lib/sbi/openapi/model/sbi_binding_level.c create mode 100644 lib/sbi/openapi/model/sbi_binding_level.h create mode 100644 lib/sbi/openapi/model/sc_type.c create mode 100644 lib/sbi/openapi/model/sc_type.h create mode 100644 lib/sbi/openapi/model/seaf_data.c create mode 100644 lib/sbi/openapi/model/seaf_data.h create mode 100644 lib/sbi/openapi/model/secondary_rat_usage_info.c create mode 100644 lib/sbi/openapi/model/secondary_rat_usage_info.h create mode 100644 lib/sbi/openapi/model/secondary_rat_usage_report.c create mode 100644 lib/sbi/openapi/model/secondary_rat_usage_report.h create mode 100644 lib/sbi/openapi/model/send_mo_data_req_data.c create mode 100644 lib/sbi/openapi/model/send_mo_data_req_data.h create mode 100644 lib/sbi/openapi/model/sm_context.c create mode 100644 lib/sbi/openapi/model/sm_context.h create mode 100644 lib/sbi/openapi/model/sm_context_create_data.c create mode 100644 lib/sbi/openapi/model/sm_context_create_data.h create mode 100644 lib/sbi/openapi/model/sm_context_create_error.c create mode 100644 lib/sbi/openapi/model/sm_context_create_error.h create mode 100644 lib/sbi/openapi/model/sm_context_created_data.c create mode 100644 lib/sbi/openapi/model/sm_context_created_data.h create mode 100644 lib/sbi/openapi/model/sm_context_release_data.c create mode 100644 lib/sbi/openapi/model/sm_context_release_data.h create mode 100644 lib/sbi/openapi/model/sm_context_released_data.c create mode 100644 lib/sbi/openapi/model/sm_context_released_data.h create mode 100644 lib/sbi/openapi/model/sm_context_retrieve_data.c create mode 100644 lib/sbi/openapi/model/sm_context_retrieve_data.h create mode 100644 lib/sbi/openapi/model/sm_context_retrieved_data.c create mode 100644 lib/sbi/openapi/model/sm_context_retrieved_data.h create mode 100644 lib/sbi/openapi/model/sm_context_status_notification.c create mode 100644 lib/sbi/openapi/model/sm_context_status_notification.h create mode 100644 lib/sbi/openapi/model/sm_context_type.c create mode 100644 lib/sbi/openapi/model/sm_context_type.h create mode 100644 lib/sbi/openapi/model/sm_context_update_data.c create mode 100644 lib/sbi/openapi/model/sm_context_update_data.h create mode 100644 lib/sbi/openapi/model/sm_context_update_error.c create mode 100644 lib/sbi/openapi/model/sm_context_update_error.h create mode 100644 lib/sbi/openapi/model/sm_context_updated_data.c create mode 100644 lib/sbi/openapi/model/sm_context_updated_data.h create mode 100644 lib/sbi/openapi/model/small_data_rate_status.c create mode 100644 lib/sbi/openapi/model/small_data_rate_status.h create mode 100644 lib/sbi/openapi/model/small_data_rate_status_info.c create mode 100644 lib/sbi/openapi/model/small_data_rate_status_info.h create mode 100644 lib/sbi/openapi/model/smf_change_indication.c create mode 100644 lib/sbi/openapi/model/smf_change_indication.h create mode 100644 lib/sbi/openapi/model/smf_change_info.c create mode 100644 lib/sbi/openapi/model/smf_change_info.h create mode 100644 lib/sbi/openapi/model/status_change.c create mode 100644 lib/sbi/openapi/model/status_change.h create mode 100644 lib/sbi/openapi/model/status_info.c create mode 100644 lib/sbi/openapi/model/status_info.h create mode 100644 lib/sbi/openapi/model/status_notification.c create mode 100644 lib/sbi/openapi/model/status_notification.h create mode 100644 lib/sbi/openapi/model/traffic_descriptor.c create mode 100644 lib/sbi/openapi/model/traffic_descriptor.h create mode 100644 lib/sbi/openapi/model/transfer_mo_data_req_data.c create mode 100644 lib/sbi/openapi/model/transfer_mo_data_req_data.h create mode 100644 lib/sbi/openapi/model/transfer_mt_data_add_info.c create mode 100644 lib/sbi/openapi/model/transfer_mt_data_add_info.h create mode 100644 lib/sbi/openapi/model/transfer_mt_data_error.c create mode 100644 lib/sbi/openapi/model/transfer_mt_data_error.h create mode 100644 lib/sbi/openapi/model/transfer_mt_data_req_data.c create mode 100644 lib/sbi/openapi/model/transfer_mt_data_req_data.h create mode 100644 lib/sbi/openapi/model/transfer_reason.c create mode 100644 lib/sbi/openapi/model/transfer_reason.h create mode 100644 lib/sbi/openapi/model/trigger.c create mode 100644 lib/sbi/openapi/model/trigger.h create mode 100644 lib/sbi/openapi/model/trigger_category.c create mode 100644 lib/sbi/openapi/model/trigger_category.h create mode 100644 lib/sbi/openapi/model/trigger_type.c create mode 100644 lib/sbi/openapi/model/trigger_type.h create mode 100644 lib/sbi/openapi/model/tunnel_info.c create mode 100644 lib/sbi/openapi/model/tunnel_info.h create mode 100644 lib/sbi/openapi/model/ue_context.c create mode 100644 lib/sbi/openapi/model/ue_context.h create mode 100644 lib/sbi/openapi/model/ue_context_create_data.c create mode 100644 lib/sbi/openapi/model/ue_context_create_data.h create mode 100644 lib/sbi/openapi/model/ue_context_create_error.c create mode 100644 lib/sbi/openapi/model/ue_context_create_error.h create mode 100644 lib/sbi/openapi/model/ue_context_created_data.c create mode 100644 lib/sbi/openapi/model/ue_context_created_data.h create mode 100644 lib/sbi/openapi/model/ue_context_release.c create mode 100644 lib/sbi/openapi/model/ue_context_release.h create mode 100644 lib/sbi/openapi/model/ue_context_transfer_req_data.c create mode 100644 lib/sbi/openapi/model/ue_context_transfer_req_data.h create mode 100644 lib/sbi/openapi/model/ue_context_transfer_rsp_data.c create mode 100644 lib/sbi/openapi/model/ue_context_transfer_rsp_data.h create mode 100644 lib/sbi/openapi/model/ue_context_transfer_status.c create mode 100644 lib/sbi/openapi/model/ue_context_transfer_status.h create mode 100644 lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.c create mode 100644 lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.h create mode 100644 lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.c create mode 100644 lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.h create mode 100644 lib/sbi/openapi/model/ue_reg_status_update_req_data.c create mode 100644 lib/sbi/openapi/model/ue_reg_status_update_req_data.h create mode 100644 lib/sbi/openapi/model/ue_reg_status_update_rsp_data.c create mode 100644 lib/sbi/openapi/model/ue_reg_status_update_rsp_data.h create mode 100644 lib/sbi/openapi/model/ulcl_bp_information.c create mode 100644 lib/sbi/openapi/model/ulcl_bp_information.h create mode 100644 lib/sbi/openapi/model/unavailable_access_indication.c create mode 100644 lib/sbi/openapi/model/unavailable_access_indication.h create mode 100644 lib/sbi/openapi/model/up_cnx_state.c create mode 100644 lib/sbi/openapi/model/up_cnx_state.h create mode 100644 lib/sbi/openapi/model/v2x_context.c create mode 100644 lib/sbi/openapi/model/v2x_context.h create mode 100644 lib/sbi/openapi/model/volume_timed_report.c create mode 100644 lib/sbi/openapi/model/volume_timed_report.h create mode 100644 lib/sbi/openapi/model/vplmn_qos.c create mode 100644 lib/sbi/openapi/model/vplmn_qos.h create mode 100644 lib/sbi/openapi/model/vsmf_update_data.c create mode 100644 lib/sbi/openapi/model/vsmf_update_data.h create mode 100644 lib/sbi/openapi/model/vsmf_update_error.c create mode 100644 lib/sbi/openapi/model/vsmf_update_error.h create mode 100644 lib/sbi/openapi/model/vsmf_updated_data.c create mode 100644 lib/sbi/openapi/model/vsmf_updated_data.h create mode 100644 lib/sbi/openapi/src/binary.c create mode 100644 lib/sbi/support/modified/TS29502_Nsmf_PDUSession.yaml create mode 100644 lib/sbi/support/modified/TS29531_Nnssf_NSSelection.yaml create mode 100644 lib/sbi/support/modified/TS32291_Nchf_ConvergedCharging.yaml create mode 100644 lib/sbi/support/standard/TS29502_Nsmf_PDUSession.yaml create mode 100644 lib/sbi/support/standard/TS29507_Npcf_AMPolicyControl.yaml create mode 100644 lib/sbi/support/standard/TS29531_Nnssf_NSSAIAvailability.yaml create mode 100644 lib/sbi/support/standard/TS29531_Nnssf_NSSelection.yaml create mode 100644 lib/sbi/support/standard/TS32291_Nchf_ConvergedCharging.yaml delete mode 100644 src/amf/gsm-sm.c create mode 100644 src/amf/namf-handler.c create mode 100644 src/amf/namf-handler.h create mode 100644 src/amf/nsmf-build.c create mode 100644 src/amf/nsmf-build.h create mode 100644 src/amf/nsmf-handler.c create mode 100644 src/amf/nsmf-handler.h create mode 100644 src/amf/nudm-build.c create mode 100644 src/amf/nudm-build.h create mode 100644 src/smf/gsm-build.c create mode 100644 src/smf/gsm-build.h create mode 100644 src/smf/gsm-handler.c create mode 100644 src/smf/gsm-handler.h create mode 100644 src/smf/gsm-sm.c create mode 100644 src/smf/namf-build.c create mode 100644 src/smf/namf-build.h create mode 100644 src/smf/nas-path.c create mode 100644 src/smf/nas-path.h create mode 100644 src/smf/ngap-build.c create mode 100644 src/smf/ngap-build.h create mode 100644 src/smf/ngap-handler.c create mode 100644 src/smf/ngap-handler.h create mode 100644 src/smf/ngap-path.c create mode 100644 src/smf/ngap-path.h create mode 100644 src/smf/nsmf-handler.c create mode 100644 src/smf/nsmf-handler.h create mode 100644 src/smf/nudm-build.c create mode 100644 src/smf/nudm-build.h create mode 100644 src/smf/nudm-handler.c create mode 100644 src/smf/nudm-handler.h create mode 100644 tests/common/gsm-build.c create mode 100644 tests/common/gsm-build.h create mode 100644 tests/common/gsm-handler.c create mode 100644 tests/common/gsm-handler.h create mode 100644 tests/crypt/base64-test.c diff --git a/configs/5gc.yaml.in b/configs/5gc.yaml.in index 5ec0e7ee3..a6f1ac97e 100644 --- a/configs/5gc.yaml.in +++ b/configs/5gc.yaml.in @@ -28,8 +28,8 @@ amf: s_nssai: - sst: 1 security: - integrity_order : [ EIA1, EIA2, EIA0 ] - ciphering_order : [ EEA0, EEA1, EEA2 ] + integrity_order : [ NIA1, NIA2, NIA0 ] + ciphering_order : [ NEA0, NEA1, NEA2 ] network_name: full: Open5GS amf_name: open5gs-amf0 diff --git a/configs/minimal.yaml.in b/configs/minimal.yaml.in index 1881aa797..867031906 100644 --- a/configs/minimal.yaml.in +++ b/configs/minimal.yaml.in @@ -32,8 +32,8 @@ amf: - sst: 1 sd: 112233 security: - integrity_order : [ EIA2, EIA1 ] - ciphering_order : [ EEA2, EEA1, EEA0 ] + integrity_order : [ NIA2, NIA1 ] + ciphering_order : [ NEA0, NEA1, NEA2 ] network_name: full: Open5GS amf_name: open5gs-amf0 diff --git a/configs/open5gs/amf.yaml.in b/configs/open5gs/amf.yaml.in index ed88a5c8f..860690974 100644 --- a/configs/open5gs/amf.yaml.in +++ b/configs/open5gs/amf.yaml.in @@ -86,8 +86,8 @@ amf: s_nssai: - sst: 1 security: - integrity_order : [ EIA1, EIA2, EIA0 ] - ciphering_order : [ EEA0, EEA1, EEA2 ] + integrity_order : [ NIA1, NIA2, NIA0 ] + ciphering_order : [ NEA0, NEA1, NEA2 ] network_name: full: Open5GS amf_name: open5gs-amf0 diff --git a/lib/asn1c/util/conv.c b/lib/asn1c/util/conv.c index f02e910bd..5f0ae6b9a 100644 --- a/lib/asn1c/util/conv.c +++ b/lib/asn1c/util/conv.c @@ -136,15 +136,16 @@ int ogs_asn_BIT_STRING_to_ip(BIT_STRING_t *bit_string, ogs_ip_t *ip) memcpy(&ip->both.addr, bit_string->buf, OGS_IPV4_LEN); memcpy(&ip->both.addr6, bit_string->buf+OGS_IPV4_LEN, OGS_IPV6_LEN); ogs_debug(" IPv4[%s] IPv6[%s]", - INET_NTOP(&ip->both.addr, buf), INET6_NTOP(&ip->both.addr6, buf2)); + OGS_INET_NTOP(&ip->both.addr, buf), + OGS_INET6_NTOP(&ip->both.addr6, buf2)); } else if (bit_string->size == OGS_IPV4_LEN) { ip->ipv4 = 1; memcpy(&ip->addr, bit_string->buf, OGS_IPV4_LEN); - ogs_debug(" IPv4[%s]", INET_NTOP(&ip->addr, buf)); + ogs_debug(" IPv4[%s]", OGS_INET_NTOP(&ip->addr, buf)); } else if (bit_string->size == OGS_IPV6_LEN) { ip->ipv6 = 1; memcpy(&ip->addr6, bit_string->buf, OGS_IPV6_LEN); - ogs_debug(" IPv6[%s]", INET_NTOP(&ip->addr6, buf)); + ogs_debug(" IPv6[%s]", OGS_INET_NTOP(&ip->addr6, buf)); } else ogs_assert_if_reached(); @@ -165,17 +166,18 @@ int ogs_asn_ip_to_BIT_STRING(ogs_ip_t *ip, BIT_STRING_t *bit_string) memcpy(bit_string->buf, &ip->both.addr, OGS_IPV4_LEN); memcpy(bit_string->buf+OGS_IPV4_LEN, &ip->both.addr6, OGS_IPV6_LEN); ogs_debug(" IPv4[%s] IPv6[%s]", - INET_NTOP(&ip->both.addr, buf), INET6_NTOP(&ip->both.addr6, buf2)); + OGS_INET_NTOP(&ip->both.addr, buf), + OGS_INET6_NTOP(&ip->both.addr6, buf2)); } else if (ip->ipv4) { bit_string->size = OGS_IPV4_LEN; bit_string->buf = CALLOC(bit_string->size, sizeof(uint8_t)); memcpy(bit_string->buf, &ip->addr, OGS_IPV4_LEN); - ogs_debug(" IPv4[%s]", INET_NTOP(&ip->addr, buf)); + ogs_debug(" IPv4[%s]", OGS_INET_NTOP(&ip->addr, buf)); } else if (ip->ipv6) { bit_string->size = OGS_IPV6_LEN; bit_string->buf = CALLOC(bit_string->size, sizeof(uint8_t)); memcpy(bit_string->buf, &ip->addr6, OGS_IPV6_LEN); - ogs_debug(" IPv6[%s]", INET_NTOP(&ip->addr6, buf)); + ogs_debug(" IPv6[%s]", OGS_INET_NTOP(&ip->addr6, buf)); } else ogs_assert_if_reached(); diff --git a/lib/asn1c/util/meson.build b/lib/asn1c/util/meson.build index 322b7b4ac..3752ec2e3 100644 --- a/lib/asn1c/util/meson.build +++ b/lib/asn1c/util/meson.build @@ -17,6 +17,7 @@ libasn1c_util_sources = files(''' conv.c + message.c '''.split()) libasn1c_util_inc = include_directories('.') diff --git a/lib/asn1c/util/message.c b/lib/asn1c/util/message.c new file mode 100644 index 000000000..664a1b888 --- /dev/null +++ b/lib/asn1c/util/message.c @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "message.h" + +ogs_pkbuf_t *ogs_asn_encode(const asn_TYPE_descriptor_t *td, void *sptr) +{ + asn_enc_rval_t enc_ret = {0}; + ogs_pkbuf_t *pkbuf = NULL; + + ogs_assert(td); + ogs_assert(sptr); + + pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN); + ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN); + + enc_ret = aper_encode_to_buffer(td, NULL, + sptr, pkbuf->data, OGS_MAX_SDU_LEN); + ogs_asn_free(td, sptr); + + if (enc_ret.encoded < 0) { + ogs_error("Failed to encode ASN-PDU [%d]", (int)enc_ret.encoded); + ogs_pkbuf_free(pkbuf); + return NULL; + } + + ogs_pkbuf_trim(pkbuf, (enc_ret.encoded >> 3)); + + return pkbuf; +} + +int ogs_asn_decode(const asn_TYPE_descriptor_t *td, + void *struct_ptr, size_t struct_size, ogs_pkbuf_t *pkbuf) +{ + asn_dec_rval_t dec_ret = {0}; + + ogs_assert(td); + ogs_assert(struct_ptr); + ogs_assert(struct_size); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); + ogs_assert(pkbuf->len); + + memset(struct_ptr, 0, struct_size); + dec_ret = aper_decode(NULL, td, (void **)&struct_ptr, + pkbuf->data, pkbuf->len, 0, 0); + + if (dec_ret.code != RC_OK) { + ogs_warn("Failed to decode ASN-PDU [code:%d,consumed:%d]", + dec_ret.code, (int)dec_ret.consumed); + return OGS_ERROR; + } + + return OGS_OK; +} + +void ogs_asn_free(const asn_TYPE_descriptor_t *td, void *sptr) +{ + ogs_assert(td); + ogs_assert(sptr); + + ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); +} diff --git a/lib/asn1c/util/message.h b/lib/asn1c/util/message.h new file mode 100644 index 000000000..05d156498 --- /dev/null +++ b/lib/asn1c/util/message.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef OGS_ASN_MESSAGE_H +#define OGS_ASN_MESSAGE_H + +#include "ogs-core.h" + +#include "asn_internal.h" +#include "constr_TYPE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_pkbuf_t *ogs_asn_encode(const asn_TYPE_descriptor_t *td, void *sptr); +int ogs_asn_decode(const asn_TYPE_descriptor_t *td, + void *struct_ptr, size_t struct_size, ogs_pkbuf_t *pkbuf); +void ogs_asn_free(const asn_TYPE_descriptor_t *td, void *sptr); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/lib/core/ogs-3gpp-types.c b/lib/core/ogs-3gpp-types.c index 9bc5e7967..9031c0325 100644 --- a/lib/core/ogs-3gpp-types.c +++ b/lib/core/ogs-3gpp-types.c @@ -64,14 +64,43 @@ void *ogs_plmn_id_build(ogs_plmn_id_t *plmn_id, return plmn_id; } -char *ogs_plmn_id_string(ogs_plmn_id_t *plmn_id) +char *ogs_serving_network_name_from_plmn_id(ogs_plmn_id_t *plmn_id) { ogs_assert(plmn_id); - return ogs_msprintf("5G:mnc%03d.mcc%03d.3gppnetwork.org", ogs_plmn_id_mnc(plmn_id), ogs_plmn_id_mcc(plmn_id)); } +char *ogs_plmn_id_mcc_string(ogs_plmn_id_t *plmn_id) +{ + ogs_assert(plmn_id); + return ogs_msprintf("%03d", ogs_plmn_id_mcc(plmn_id)); +} + +char *ogs_plmn_id_mnc_string(ogs_plmn_id_t *plmn_id) +{ + ogs_assert(plmn_id); + if (ogs_plmn_id_mnc_len(plmn_id) == 2) + return ogs_msprintf("%02d", ogs_plmn_id_mnc(plmn_id)); + else + return ogs_msprintf("%03d", ogs_plmn_id_mnc(plmn_id)); +} + +char *ogs_plmn_id_to_string(ogs_plmn_id_t *plmn_id, char *buf) +{ + ogs_assert(plmn_id); + ogs_assert(buf); + + if (ogs_plmn_id_mnc_len(plmn_id) == 2) + ogs_snprintf(buf, OGS_PLMNIDSTRLEN, "%03d%02d", + ogs_plmn_id_mcc(plmn_id), ogs_plmn_id_mnc(plmn_id)); + else + ogs_snprintf(buf, OGS_PLMNIDSTRLEN, "%03d%03d", + ogs_plmn_id_mcc(plmn_id), ogs_plmn_id_mnc(plmn_id)); + + return buf; +} + uint32_t ogs_amf_id_hexdump(ogs_amf_id_t *amf_id) { uint32_t hex; @@ -142,6 +171,29 @@ ogs_amf_id_t *ogs_amf_id_build(ogs_amf_id_t *amf_id, return amf_id; } +char *ogs_s_nssai_sd_to_string(ogs_uint24_t sd) +{ + if (sd.v != OGS_S_NSSAI_NO_SD_VALUE) + return ogs_msprintf("%06x", sd.v); + else + return NULL; +} + +ogs_uint24_t ogs_s_nssai_sd_from_string(const char *hex) +{ + ogs_uint24_t sd; + char hexbuf[sizeof(ogs_uint24_t)]; + + sd.v = OGS_S_NSSAI_NO_SD_VALUE; + if (hex == NULL) + return sd; + + OGS_HEX(hex, strlen(hex), hexbuf); + memcpy(&sd, hexbuf, 3); + + return ogs_be24toh(sd); +} + char *ogs_supi_from_suci(char *suci) { #define MAX_SUCI_TOKEN 16 @@ -185,7 +237,24 @@ char *ogs_supi_from_suci(char *suci) return supi; } -char *ogs_ueid_from_supi(char *supi) +char *ogs_supi_get_type(char *supi) +{ + char *saveptr = NULL; + char *p, *tmp; + char *type = NULL; + + ogs_assert(supi); + tmp = ogs_strdup(supi); + + p = strtok_r(tmp, "-", &saveptr); + ogs_assert(p); + type = ogs_strdup(p); + + ogs_free(tmp); + return type; +} + +char *ogs_supi_get_id(char *supi) { char *saveptr = NULL; char *p, *tmp; @@ -360,3 +429,50 @@ int ogs_ip_to_sockaddr(ogs_ip_t *ip, uint16_t port, ogs_sockaddr_t **list) return OGS_OK; } + +void ogs_sockaddr_to_ip( + ogs_sockaddr_t *addr, ogs_sockaddr_t *addr6, ogs_ip_t *ip) +{ + ogs_assert(ip); + ogs_assert(addr || addr6); + + memset(ip, 0, sizeof(ogs_ip_t)); + + if (addr && addr6) { + ip->ipv4 = 1; + ip->ipv6 = 1; + ip->len = OGS_IPV4V6_LEN; + ip->both.addr = addr->sin.sin_addr.s_addr; + memcpy(ip->both.addr6, addr6->sin6.sin6_addr.s6_addr, OGS_IPV6_LEN); + } else if (addr) { + ip->ipv4 = 1; + ip->len = OGS_IPV4_LEN; + ip->addr = addr->sin.sin_addr.s_addr; + } else if (addr6) { + ip->ipv6 = 1; + ip->len = OGS_IPV6_LEN; + memcpy(ip->addr6, addr6->sin6.sin6_addr.s6_addr, OGS_IPV6_LEN); + } else + ogs_assert_if_reached(); +} + +char *ogs_ipv4_to_string(uint32_t addr) +{ + char *buf = NULL; + + buf = ogs_calloc(1, OGS_ADDRSTRLEN); + ogs_assert(buf); + + return (char*)OGS_INET_NTOP(&addr, buf); +} + +char *ogs_ipv6_to_string(uint8_t *addr6) +{ + char *buf = NULL; + ogs_assert(addr6); + + buf = ogs_calloc(1, OGS_ADDRSTRLEN); + ogs_assert(buf); + + return (char *)OGS_INET6_NTOP(addr6, buf); +} diff --git a/lib/core/ogs-3gpp-types.h b/lib/core/ogs-3gpp-types.h index 08f9b3362..3d2c5b92c 100644 --- a/lib/core/ogs-3gpp-types.h +++ b/lib/core/ogs-3gpp-types.h @@ -31,6 +31,9 @@ extern "C" { #define OGS_MAX_NUM_OF_SESS 4 /* Num of APN(Session) per UE */ #define OGS_MAX_NUM_OF_RULE 4 /* Num of Rule per Session */ +/* Num of PacketFilter per Bearer(GTP) or QoS(NAS-5GS) */ +#define OGS_MAX_NUM_OF_PACKET_FILTER 16 + #define OGS_MAX_SDU_LEN 8192 #define OGS_PLMN_ID_LEN 3 #define OGS_MAX_PLMN_ID_BCD_LEN 6 @@ -65,6 +68,11 @@ extern "C" { (((((x) % 10) << 4) & 0xf0) | (((x) / 10) & 0x0f)) #define OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0 +#define OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED 0 + +#define OGS_ACCESS_TYPE_3GPP 1 +#define OGS_ACCESS_TYPE_NON_3GPP 2 +#define OGS_ACCESS_TYPE_BOTH_3GPP_AND_NON_3GPP 3 typedef struct ogs_uint24_s { uint32_t v:24; @@ -127,7 +135,12 @@ uint16_t ogs_plmn_id_mnc_len(ogs_plmn_id_t *plmn_id); void *ogs_plmn_id_build(ogs_plmn_id_t *plmn_id, uint16_t mcc, uint16_t mnc, uint16_t mnc_len); -char *ogs_plmn_id_string(ogs_plmn_id_t *plmn_id); +char *ogs_serving_network_name_from_plmn_id(ogs_plmn_id_t *plmn_id); +char *ogs_plmn_id_mcc_string(ogs_plmn_id_t *plmn_id); +char *ogs_plmn_id_mnc_string(ogs_plmn_id_t *plmn_id); + +#define OGS_PLMNIDSTRLEN (sizeof(ogs_plmn_id_t)*2+1) +char *ogs_plmn_id_to_string(ogs_plmn_id_t *plmn_id, char *buf); /************************************ * AMF_ID Structure */ @@ -154,7 +167,8 @@ ogs_amf_id_t *ogs_amf_id_build(ogs_amf_id_t *amf_id, /************************************ * SUPI/SUCI */ char *ogs_supi_from_suci(char *suci); -char *ogs_ueid_from_supi(char *supi); +char *ogs_supi_get_type(char *supi); +char *ogs_supi_get_id(char *supi); /************************************ * TAI Structure */ @@ -181,13 +195,16 @@ typedef struct ogs_nr_cgi_s { /************************************ * S-NSSAI Structure */ -#define OGS_MAX_NUM_OF_S_NSSAI 8 +#define OGS_MAX_NUM_OF_S_NSSAI 16 #define OGS_S_NSSAI_NO_SD_VALUE 0xffffff typedef struct ogs_s_nssai_s { uint8_t sst; ogs_uint24_t sd; } __attribute__ ((packed)) ogs_s_nssai_t; +char *ogs_s_nssai_sd_to_string(ogs_uint24_t sd); +ogs_uint24_t ogs_s_nssai_sd_from_string(const char *hex); + /************************************************** * Common Structure * S1AP : 9.2.2.1 Transport Layer Address, See 36.414 @@ -211,6 +228,10 @@ ED3(uint8_t ipv4:1;, } ogs_ip_t; int ogs_ip_to_sockaddr(ogs_ip_t *ip, uint16_t port, ogs_sockaddr_t **list); +void ogs_sockaddr_to_ip( + ogs_sockaddr_t *addr, ogs_sockaddr_t *addr6, ogs_ip_t *ip); +char *ogs_ipv4_to_string(uint32_t addr); +char *ogs_ipv6_to_string(uint8_t *addr6); /************************************************** * 8.14 PDN Address Allocation (PAA) */ @@ -220,14 +241,14 @@ int ogs_ip_to_sockaddr(ogs_ip_t *ip, uint16_t port, ogs_sockaddr_t **list); typedef struct ogs_paa_s { ED2(uint8_t spare:5;, /* 8.34 PDN Type */ -#define OGS_GTP_PDN_TYPE_IPV4 1 -#define OGS_GTP_PDN_TYPE_IPV6 2 -#define OGS_GTP_PDN_TYPE_IPV4V6 3 -#define OGS_GTP_PDN_TYPE_NON_IP 4 -#define OGS_PFCP_PDN_TYPE_IPV4 OGS_GTP_PDN_TYPE_IPV4 -#define OGS_PFCP_PDN_TYPE_IPV6 OGS_GTP_PDN_TYPE_IPV6 -#define OGS_PFCP_PDN_TYPE_IPV4V6 OGS_GTP_PDN_TYPE_IPV4V6 -#define OGS_PFCP_PDN_TYPE_NONIP OGS_GTP_PDN_TYPE_NONIP +#define OGS_GTP_PDN_TYPE_IPV4 OGS_PDU_SESSION_TYPE_IPV4 +#define OGS_GTP_PDN_TYPE_IPV6 OGS_PDU_SESSION_TYPE_IPV6 +#define OGS_GTP_PDN_TYPE_IPV4V6 OGS_PDU_SESSION_TYPE_IPV4V6 +#define OGS_GTP_PDN_TYPE_NON_IP OGS_PDU_SESSION_TYPE_NONIP +#define OGS_PFCP_PDN_TYPE_IPV4 OGS_PDU_SESSION_TYPE_IPV4 +#define OGS_PFCP_PDN_TYPE_IPV6 OGS_PDU_SESSION_TYPE_IPV6 +#define OGS_PFCP_PDN_TYPE_IPV4V6 OGS_PDU_SESSION_TYPE_IPV4V6 +#define OGS_PFCP_PDN_TYPE_NONIP OGS_PDU_SESSION_TYPE_NONIP uint8_t pdn_type:3;) union { /* GTP_PDN_TYPE_IPV4 */ @@ -383,19 +404,33 @@ typedef struct ogs_pcc_rule_s { /********************************** * PDN Structure */ typedef struct ogs_pdn_s { - uint32_t context_identifier; - char apn[OGS_MAX_APN_LEN+1]; + uint32_t context_identifier; + char apn[OGS_MAX_APN_LEN+1]; #define OGS_DIAM_PDN_TYPE_IPV4 0 #define OGS_DIAM_PDN_TYPE_IPV6 1 #define OGS_DIAM_PDN_TYPE_IPV4V6 2 #define OGS_DIAM_PDN_TYPE_IPV4_OR_IPV6 3 - uint8_t pdn_type; +#define OGS_PDU_SESSION_TYPE_IPV4 1 +#define OGS_PDU_SESSION_TYPE_IPV6 2 +#define OGS_PDU_SESSION_TYPE_IPV4V6 3 +#define OGS_PDU_SESSION_TYPE_UNSTRUCTURED 4 +#define OGS_PDU_SESSION_TYPE_ETHERNET 5 + uint8_t pdn_type; - ogs_qos_t qos; - ogs_bitrate_t ambr; /* APN-AMBR */ +#define OGS_SSC_MODE_1 1 +#define OGS_SSC_MODE_2 2 +#define OGS_SSC_MODE_3 3 + uint8_t ssc_mode; - ogs_paa_t paa; - ogs_ip_t pgw_ip; + ogs_qos_t qos; + ogs_bitrate_t ambr; /* APN-AMBR */ + + ogs_paa_t paa; + struct { + uint32_t addr; + uint8_t addr6[OGS_IPV6_LEN]; + } ue_ip; + ogs_ip_t pgw_ip; } ogs_pdn_t; int ogs_fqdn_build(char *dst, char *src, int len); diff --git a/lib/core/ogs-macros.h b/lib/core/ogs-macros.h index abe974026..edec277b4 100644 --- a/lib/core/ogs-macros.h +++ b/lib/core/ogs-macros.h @@ -70,6 +70,12 @@ extern "C" { #define OGS_GNUC_NORETURN #endif +#if __GNUC__ > 6 +#define OGS_GNUC_FALLTHROUGH __attribute__ ((fallthrough)) +#else +#define OGS_GNUC_FALLTHROUGH +#endif + #if defined(_WIN32) #define htole16(x) (x) #define htole32(x) (x) @@ -147,9 +153,9 @@ extern "C" { #define OGS_PASTE(n1, n2) OGS_PASTE_HELPER(n1, n2) #define OGS_PASTE_HELPER(n1, n2) n1##n2 -#define INET_NTOP(src, dst) \ +#define OGS_INET_NTOP(src, dst) \ inet_ntop(AF_INET, (void *)(uintptr_t)(src), (dst), INET_ADDRSTRLEN) -#define INET6_NTOP(src, dst) \ +#define OGS_INET6_NTOP(src, dst) \ inet_ntop(AF_INET6, (void *)(src), (dst), INET6_ADDRSTRLEN) #define ogs_max(x , y) (((x) > (y)) ? (x) : (y)) diff --git a/lib/crypt/meson.build b/lib/crypt/meson.build index 512fb7bca..2f35c3a35 100644 --- a/lib/crypt/meson.build +++ b/lib/crypt/meson.build @@ -42,6 +42,7 @@ libcrypt_sources = files(''' kasumi.c ogs-kdf.c + ogs-base64.c '''.split()) libcrypt_inc = include_directories('.') diff --git a/lib/crypt/ogs-base64.c b/lib/crypt/ogs-base64.c new file mode 100644 index 000000000..e319a5b6a --- /dev/null +++ b/lib/crypt/ogs-base64.c @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ogs-crypt.h" + +/* aaaack but it's fast and const should make it shared text page. */ +static const unsigned char pr2six[256] = +{ + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64, + 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, + 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 +}; + +int ogs_base64_decode_len(const char *bufcoded) +{ + int nbytesdecoded; + register const unsigned char *bufin; + register size_t nprbytes; + + bufin = (const unsigned char *) bufcoded; + while (pr2six[*(bufin++)] <= 63); + + nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; + nbytesdecoded = (((int)nprbytes + 3) / 4) * 3; + + return nbytesdecoded + 1; +} + +int ogs_base64_decode(char *bufplain, const char *bufcoded) +{ + int len; + + len = ogs_base64_decode_binary((unsigned char *) bufplain, bufcoded); + bufplain[len] = '\0'; + return len; +} + +/* This is the same as ogs_base64_decode() except: + * - no \0 is appended + */ +int ogs_base64_decode_binary(unsigned char *bufplain, const char *bufcoded) +{ + int nbytesdecoded; + register const unsigned char *bufin; + register unsigned char *bufout; + register size_t nprbytes; + + bufin = (const unsigned char *) bufcoded; + while (pr2six[*(bufin++)] <= 63); + nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; + nbytesdecoded = (((int)nprbytes + 3) / 4) * 3; + + bufout = (unsigned char *) bufplain; + bufin = (const unsigned char *) bufcoded; + + while (nprbytes > 4) { + *(bufout++) = + (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); + *(bufout++) = + (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); + *(bufout++) = + (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); + bufin += 4; + nprbytes -= 4; + } + + /* Note: (nprbytes == 1) would be an error, so just ignore that case */ + if (nprbytes > 1) { + *(bufout++) = + (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); + } + if (nprbytes > 2) { + *(bufout++) = + (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); + } + if (nprbytes > 3) { + *(bufout++) = + (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); + } + + nbytesdecoded -= (4 - (int)nprbytes) & 3; + return nbytesdecoded; +} + +static const char basis_64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +int ogs_base64_encode_len(int len) +{ + return ((len + 2) / 3 * 4) + 1; +} + +int ogs_base64_encode(char *encoded, const char *string, int len) +{ + return ogs_base64_encode_binary( + encoded, (const unsigned char *) string, len); +} + +/* This is the same as ogs_base64_encode() except on EBCDIC machines, where + * the conversion of the input to ascii is left out. + */ +int ogs_base64_encode_binary( + char *encoded, const unsigned char *string, int len) +{ + int i; + char *p; + + p = encoded; + for (i = 0; i < len - 2; i += 3) { + *p++ = basis_64[(string[i] >> 2) & 0x3F]; + *p++ = basis_64[((string[i] & 0x3) << 4) | + ((int) (string[i + 1] & 0xF0) >> 4)]; + *p++ = basis_64[((string[i + 1] & 0xF) << 2) | + ((int) (string[i + 2] & 0xC0) >> 6)]; + *p++ = basis_64[string[i + 2] & 0x3F]; + } + if (i < len) { + *p++ = basis_64[(string[i] >> 2) & 0x3F]; + if (i == (len - 1)) { + *p++ = basis_64[((string[i] & 0x3) << 4)]; + *p++ = '='; + } + else { + *p++ = basis_64[((string[i] & 0x3) << 4) | + ((int) (string[i + 1] & 0xF0) >> 4)]; + *p++ = basis_64[((string[i + 1] & 0xF) << 2)]; + } + *p++ = '='; + } + + *p++ = '\0'; + return (int)(p - encoded); +} diff --git a/lib/crypt/ogs-base64.h b/lib/crypt/ogs-base64.h new file mode 100644 index 000000000..64dd7c0b6 --- /dev/null +++ b/lib/crypt/ogs-base64.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(OGS_CRYPT_INSIDE) && !defined(OGS_CRYPT_COMPILATION) +#error "This header cannot be included directly." +#endif + +#ifndef OGS_BASE64_H +#define OGS_BASE64_H + +#ifdef __cplusplus +extern "C" { +#endif + +int ogs_base64_decode_len(const char *coded_src); +int ogs_base64_decode(char *plain_dst, const char *coded_src); +int ogs_base64_decode_binary( + unsigned char *plain_dst, const char *coded_src); + +int ogs_base64_encode_len(int len); +int ogs_base64_encode( + char *coded_dst, const char *plain_src, int len_plain_src); +int ogs_base64_encode_binary( + char *coded_dst, const unsigned char *plain_src, int len_plain_src); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_BASE64_H */ diff --git a/lib/crypt/ogs-crypt.h b/lib/crypt/ogs-crypt.h index a27132ada..e924ac3a6 100644 --- a/lib/crypt/ogs-crypt.h +++ b/lib/crypt/ogs-crypt.h @@ -37,6 +37,7 @@ #include "crypt/kasumi.h" #include "crypt/ogs-kdf.h" +#include "crypt/ogs-base64.h" #undef OGS_CRYPT_INSIDE diff --git a/lib/crypt/ogs-kdf.c b/lib/crypt/ogs-kdf.c index 2fa4e851d..12e1cadb4 100644 --- a/lib/crypt/ogs-kdf.c +++ b/lib/crypt/ogs-kdf.c @@ -184,7 +184,6 @@ void ogs_kdf_kamf(char *supi, uint8_t *abba, uint8_t abba_len, uint8_t *kseaf, uint8_t *kamf) { kdf_param_t param; - char *ueid = NULL; ogs_assert(supi); ogs_assert(abba); @@ -192,19 +191,17 @@ void ogs_kdf_kamf(char *supi, uint8_t *abba, uint8_t abba_len, ogs_assert(kseaf); ogs_assert(kamf); - ueid = ogs_ueid_from_supi(supi); - ogs_assert(ueid); - memset(param, 0, sizeof(param)); - param[0].buf = (uint8_t *)ueid; - param[0].len = strlen(ueid); + param[0].buf = (uint8_t *)ogs_supi_get_id(supi); + ogs_assert(param[0].buf); + param[0].len = strlen((char *)param[0].buf); param[1].buf = abba; param[1].len = abba_len; ogs_kdf_common(kseaf, OGS_SHA256_DIGEST_SIZE, FC_FOR_KAMF_DERIVATION, param, kamf); - ogs_free(ueid); + ogs_free(param[0].buf); } /* TS33.501 Annex A.8 : Algorithm key derivation functions */ @@ -241,8 +238,8 @@ void ogs_kdf_kgnb_and_kn3iwf(uint8_t *kamf, uint32_t ul_count, ul_count = htobe32(ul_count); param[0].buf = (uint8_t *)&ul_count; param[0].len = 4; - param[0].buf = &access_type_distinguisher; - param[0].len = 1; + param[1].buf = &access_type_distinguisher; + param[1].len = 1; ogs_kdf_common(kamf, OGS_SHA256_DIGEST_SIZE, FC_FOR_KGNB_KN3IWF_DERIVATION, param, kgnb); diff --git a/lib/crypt/ogs-kdf.h b/lib/crypt/ogs-kdf.h index 20a93f90b..e45aa239b 100644 --- a/lib/crypt/ogs-kdf.h +++ b/lib/crypt/ogs-kdf.h @@ -70,10 +70,6 @@ void ogs_kdf_kamf(char *supi, uint8_t *abba, uint8_t abba_len, void ogs_kdf_nas_5gs(uint8_t algorithm_type_distinguishers, uint8_t algorithm_identity, uint8_t *kamf, uint8_t *knas); -/* Access Type Distinguishers */ -#define OGS_KDF_ACCESS_TYPE_3GPP 0x01 -#define OGS_KDF_ACCESS_TYPE_NON_3GPP 0x02 - /* TS33.501 Annex A.9 KgNB and Kn3iwf derivation function */ void ogs_kdf_kgnb_and_kn3iwf(uint8_t *kamf, uint32_t ul_count, uint8_t access_type_distinguisher, uint8_t *kgnb); diff --git a/lib/dbi/subscription.c b/lib/dbi/subscription.c index eb5b70fe4..416072e1d 100644 --- a/lib/dbi/subscription.c +++ b/lib/dbi/subscription.c @@ -19,8 +19,7 @@ #include "ogs-dbi.h" -int ogs_dbi_auth_info(const char *id_type, const char *ue_id, - ogs_dbi_auth_info_t *auth_info) +int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info) { int rv = OGS_OK; mongoc_cursor_t *cursor = NULL; @@ -33,11 +32,18 @@ int ogs_dbi_auth_info(const char *id_type, const char *ue_id, char *utf8 = NULL; uint32_t length = 0; - ogs_assert(id_type); - ogs_assert(ue_id); + char *supi_type = NULL; + char *supi_id = NULL; + + ogs_assert(supi); ogs_assert(auth_info); - query = BCON_NEW(id_type, BCON_UTF8(ue_id)); + supi_type = ogs_supi_get_type(supi); + ogs_assert(supi_type); + supi_id = ogs_supi_get_id(supi); + ogs_assert(supi_id); + + query = BCON_NEW(supi_type, BCON_UTF8(supi_id)); #if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5 cursor = mongoc_collection_find_with_opts( ogs_mongoc()->collection.subscriber, query, NULL, NULL); @@ -47,7 +53,7 @@ int ogs_dbi_auth_info(const char *id_type, const char *ue_id, #endif if (!mongoc_cursor_next(cursor, &document)) { - ogs_warn("Cannot find IMSI in DB : %s-%s", id_type, ue_id); + ogs_warn("[%s] Cannot find IMSI in DB", supi); rv = OGS_ERROR; goto out; @@ -97,23 +103,30 @@ out: if (query) bson_destroy(query); if (cursor) mongoc_cursor_destroy(cursor); + ogs_free(supi_type); + ogs_free(supi_id); + return rv; } -int ogs_dbi_update_sqn(const char *id_type, const char *ue_id, uint64_t sqn) +int ogs_dbi_update_sqn(char *supi, uint64_t sqn) { int rv = OGS_OK; bson_t *query = NULL; bson_t *update = NULL; bson_error_t error; - char printable_rand[OGS_KEYSTRLEN(OGS_RAND_LEN)]; - ogs_assert(id_type); - ogs_assert(ue_id); - ogs_hex_to_ascii(rand, - OGS_RAND_LEN, printable_rand, sizeof(printable_rand)); + char *supi_type = NULL; + char *supi_id = NULL; - query = BCON_NEW(id_type, BCON_UTF8(ue_id)); + ogs_assert(supi); + + supi_type = ogs_supi_get_type(supi); + ogs_assert(supi_type); + supi_id = ogs_supi_get_id(supi); + ogs_assert(supi_id); + + query = BCON_NEW(supi_type, BCON_UTF8(supi_id)); update = BCON_NEW("$set", "{", "security.sqn", BCON_INT64(sqn), @@ -129,10 +142,13 @@ int ogs_dbi_update_sqn(const char *id_type, const char *ue_id, uint64_t sqn) if (query) bson_destroy(query); if (update) bson_destroy(update); + ogs_free(supi_type); + ogs_free(supi_id); + return rv; } -int ogs_dbi_increment_sqn(const char *id_type, const char *ue_id) +int ogs_dbi_increment_sqn(char *supi) { int rv = OGS_OK; bson_t *query = NULL; @@ -140,10 +156,17 @@ int ogs_dbi_increment_sqn(const char *id_type, const char *ue_id) bson_error_t error; uint64_t max_sqn = OGS_MAX_SQN; - ogs_assert(id_type); - ogs_assert(ue_id); + char *supi_type = NULL; + char *supi_id = NULL; - query = BCON_NEW(id_type, BCON_UTF8(ue_id)); + ogs_assert(supi); + + supi_type = ogs_supi_get_type(supi); + ogs_assert(supi_type); + supi_id = ogs_supi_get_id(supi); + ogs_assert(supi_id); + + query = BCON_NEW(supi_type, BCON_UTF8(supi_id)); update = BCON_NEW("$inc", "{", "security.sqn", BCON_INT64(32), @@ -173,10 +196,13 @@ out: if (query) bson_destroy(query); if (update) bson_destroy(update); + ogs_free(supi_type); + ogs_free(supi_id); + return rv; } -int ogs_dbi_subscription_data(const char *id_type, const char *ue_id, +int ogs_dbi_subscription_data(char *supi, ogs_dbi_subscription_data_t *subscription_data) { int rv = OGS_OK; @@ -189,11 +215,18 @@ int ogs_dbi_subscription_data(const char *id_type, const char *ue_id, const char *utf8 = NULL; uint32_t length = 0; - ogs_assert(id_type); - ogs_assert(ue_id); - ogs_assert(subscription_data); + char *supi_type = NULL; + char *supi_id = NULL; - query = BCON_NEW(id_type, BCON_UTF8(ue_id)); + ogs_assert(subscription_data); + ogs_assert(supi); + + supi_type = ogs_supi_get_type(supi); + ogs_assert(supi_type); + supi_id = ogs_supi_get_id(supi); + ogs_assert(supi_id); + + query = BCON_NEW(supi_type, BCON_UTF8(supi_id)); #if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5 cursor = mongoc_collection_find_with_opts( ogs_mongoc()->collection.subscriber, query, NULL, NULL); @@ -203,7 +236,7 @@ int ogs_dbi_subscription_data(const char *id_type, const char *ue_id, #endif if (!mongoc_cursor_next(cursor, &document)) { - ogs_error("Cannot find IMSI in DB : %s-%s", id_type, ue_id); + ogs_error("[%s] Cannot find IMSI in DB", supi); rv = OGS_ERROR; goto out; @@ -384,6 +417,7 @@ int ogs_dbi_subscription_data(const char *id_type, const char *ue_id, OGS_GTP_PDN_TYPE_IPV4; } pdn->paa.both.addr = ipsub.sub[0]; + pdn->ue_ip.addr = ipsub.sub[0]; } } else if (!strcmp(child3_key, "addr6") && BSON_ITER_HOLDS_UTF8(&child3_iter)) { @@ -402,6 +436,8 @@ int ogs_dbi_subscription_data(const char *id_type, const char *ue_id, } memcpy(&(pdn->paa.both.addr6), ipsub.sub, OGS_IPV6_LEN); + memcpy(pdn->ue_ip.addr6, + ipsub.sub, OGS_IPV6_LEN); } } @@ -418,5 +454,8 @@ out: if (query) bson_destroy(query); if (cursor) mongoc_cursor_destroy(cursor); + ogs_free(supi_type); + ogs_free(supi_id); + return rv; } diff --git a/lib/dbi/subscription.h b/lib/dbi/subscription.h index 0448a16ba..c583e8248 100644 --- a/lib/dbi/subscription.h +++ b/lib/dbi/subscription.h @@ -28,7 +28,7 @@ extern "C" { #endif -#define OGS_DBI_UE_ID_TYPE_IMSI "imsi" +#define OGS_DBI_SUPI_TYPE_IMSI "imsi" typedef struct ogs_dbi_subscription_data_s { #define OGS_DBI_ACCESS_RESTRICTION_UTRAN_NOT_ALLOWED (1) @@ -66,12 +66,11 @@ typedef struct ogs_dbi_auth_info_s { uint64_t sqn; } ogs_dbi_auth_info_t; -int ogs_dbi_auth_info(const char *id_type, const char *ue_id, - ogs_dbi_auth_info_t *auth_info); -int ogs_dbi_update_sqn(const char *id_type, const char *ue_id, uint64_t sqn); -int ogs_dbi_increment_sqn(const char *id_type, const char *ue_id); +int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info); +int ogs_dbi_update_sqn(char *supi, uint64_t sqn); +int ogs_dbi_increment_sqn(char *supi); -int ogs_dbi_subscription_data(const char *id_type, const char *ue_id, +int ogs_dbi_subscription_data(char *supi, ogs_dbi_subscription_data_t *subscription_data); #ifdef __cplusplus diff --git a/lib/gtp/ogs-gtp.h b/lib/gtp/ogs-gtp.h index 31b5a5440..5063a50b9 100644 --- a/lib/gtp/ogs-gtp.h +++ b/lib/gtp/ogs-gtp.h @@ -25,9 +25,6 @@ #define OGS_GTPV1_U_UDP_PORT 2152 #define OGS_GTPV2_C_UDP_PORT 2123 -/* Num of PacketFilter per Bearer */ -#define OGS_MAX_NUM_OF_PACKET_FILTER 16 - #define OGS_GTP_INSIDE #include "gtp/message.h" diff --git a/lib/nas/5gs/conv.c b/lib/nas/5gs/conv.c index 739f29c08..e760c32db 100644 --- a/lib/nas/5gs/conv.c +++ b/lib/nas/5gs/conv.c @@ -51,14 +51,14 @@ void ogs_nas_5gs_imsi_to_bcd( p = ogs_slprintf(p, last, "%s", tmp); } -char *ogs_nas_5gs_ueid_from_mobile_identity( +char *ogs_nas_5gs_suci_from_mobile_identity( ogs_nas_5gs_mobile_identity_t *mobile_identity) { ogs_nas_5gs_mobile_identity_imsi_t *mobile_identity_imsi = NULL; ogs_plmn_id_t plmn_id; char tmp[OGS_MAX_IMSI_BCD_LEN+1]; char routing_indicator[5]; - char *ueid = NULL; + char *suci = NULL; ogs_assert(mobile_identity); @@ -66,18 +66,18 @@ char *ogs_nas_5gs_ueid_from_mobile_identity( (ogs_nas_5gs_mobile_identity_imsi_t *)mobile_identity->buffer; ogs_assert(mobile_identity_imsi); - ueid = ogs_msprintf("suci-%d-", mobile_identity_imsi->h.supi_format); - ogs_assert(ueid); + suci = ogs_msprintf("suci-%d-", mobile_identity_imsi->h.supi_format); + ogs_assert(suci); ogs_nas_to_plmn_id(&plmn_id, &mobile_identity_imsi->nas_plmn_id); if (ogs_plmn_id_mnc_len(&plmn_id) == 2) { - ueid = ogs_mstrcatf(ueid, "%03d-%02d-", + suci = ogs_mstrcatf(suci, "%03d-%02d-", ogs_plmn_id_mcc(&plmn_id), ogs_plmn_id_mnc(&plmn_id)); - ogs_assert(ueid); + ogs_assert(suci); } else { - ueid = ogs_mstrcatf(ueid, "%03d-%03d-", + suci = ogs_mstrcatf(suci, "%03d-%03d-", ogs_plmn_id_mcc(&plmn_id), ogs_plmn_id_mnc(&plmn_id)); - ogs_assert(ueid); + ogs_assert(suci); } memset(routing_indicator, 0, sizeof(routing_indicator)); @@ -101,11 +101,11 @@ char *ogs_nas_5gs_ueid_from_mobile_identity( ogs_buffer_to_bcd(mobile_identity_imsi->scheme_output, mobile_identity->length - 8, tmp); - ueid = ogs_mstrcatf(ueid, "%s-%d-%d-%s", + suci = ogs_mstrcatf(suci, "%s-%d-%d-%s", routing_indicator, mobile_identity_imsi->protection_scheme_id, mobile_identity_imsi->home_network_pki_value, tmp); - return ueid; + return suci; } diff --git a/lib/nas/5gs/conv.h b/lib/nas/5gs/conv.h index 2e2e7688b..43cfea499 100644 --- a/lib/nas/5gs/conv.h +++ b/lib/nas/5gs/conv.h @@ -33,7 +33,7 @@ extern "C" { void ogs_nas_5gs_imsi_to_bcd( ogs_nas_5gs_mobile_identity_t *mobile_identity, char *bcd); -char *ogs_nas_5gs_ueid_from_mobile_identity( +char *ogs_nas_5gs_suci_from_mobile_identity( ogs_nas_5gs_mobile_identity_t *mobile_identity); #ifdef __cplusplus diff --git a/lib/nas/5gs/decoder.c b/lib/nas/5gs/decoder.c index aa190539b..af76d2693 100644 --- a/lib/nas/5gs/decoder.c +++ b/lib/nas/5gs/decoder.c @@ -28,7 +28,7 @@ /******************************************************************************* * This file had been created by nas-message.py script v0.2.0 * Please do not modify this file but regenerate it via script. - * Created on: 2020-06-03 23:05:14.877346 by acetcom + * Created on: 2020-06-15 13:46:04.094836 by acetcom * from 24501-g41.docx ******************************************************************************/ @@ -102,6 +102,8 @@ int ogs_nas_5gs_decode_registration_request(ogs_nas_5gs_message_t *message, ogs_ switch(type) { case OGS_NAS_5GS_REGISTRATION_REQUEST_NON_CURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_key_set_identifier(®istration_request->non_current_native_nas_key_set_identifier, pkbuf); ogs_assert(size >= 0); registration_request->presencemask |= OGS_NAS_5GS_REGISTRATION_REQUEST_NON_CURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT; @@ -150,6 +152,8 @@ int ogs_nas_5gs_decode_registration_request(ogs_nas_5gs_message_t *message, ogs_ decoded += size; break; case OGS_NAS_5GS_REGISTRATION_REQUEST_MICO_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_mico_indication(®istration_request->mico_indication, pkbuf); ogs_assert(size >= 0); registration_request->presencemask |= OGS_NAS_5GS_REGISTRATION_REQUEST_MICO_INDICATION_PRESENT; @@ -198,6 +202,8 @@ int ogs_nas_5gs_decode_registration_request(ogs_nas_5gs_message_t *message, ogs_ decoded += size; break; case OGS_NAS_5GS_REGISTRATION_REQUEST_PAYLOAD_CONTAINER_TYPE_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_payload_container_type(®istration_request->payload_container_type, pkbuf); ogs_assert(size >= 0); registration_request->presencemask |= OGS_NAS_5GS_REGISTRATION_REQUEST_PAYLOAD_CONTAINER_TYPE_PRESENT; @@ -210,6 +216,8 @@ int ogs_nas_5gs_decode_registration_request(ogs_nas_5gs_message_t *message, ogs_ decoded += size; break; case OGS_NAS_5GS_REGISTRATION_REQUEST_NETWORK_SLICING_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_network_slicing_indication(®istration_request->network_slicing_indication, pkbuf); ogs_assert(size >= 0); registration_request->presencemask |= OGS_NAS_5GS_REGISTRATION_REQUEST_NETWORK_SLICING_INDICATION_PRESENT; @@ -282,13 +290,15 @@ int ogs_nas_5gs_decode_registration_request(ogs_nas_5gs_message_t *message, ogs_ decoded += size; break; case OGS_NAS_5GS_REGISTRATION_REQUEST_N5GC_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_n5gc_indication(®istration_request->n5gc_indication, pkbuf); ogs_assert(size >= 0); registration_request->presencemask |= OGS_NAS_5GS_REGISTRATION_REQUEST_N5GC_INDICATION_PRESENT; decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -384,12 +394,16 @@ int ogs_nas_5gs_decode_registration_accept(ogs_nas_5gs_message_t *message, ogs_p decoded += size; break; case OGS_NAS_5GS_REGISTRATION_ACCEPT_MICO_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_mico_indication(®istration_accept->mico_indication, pkbuf); ogs_assert(size >= 0); registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_MICO_INDICATION_PRESENT; decoded += size; break; case OGS_NAS_5GS_REGISTRATION_ACCEPT_NETWORK_SLICING_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_network_slicing_indication(®istration_accept->network_slicing_indication, pkbuf); ogs_assert(size >= 0); registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_NETWORK_SLICING_INDICATION_PRESENT; @@ -444,6 +458,8 @@ int ogs_nas_5gs_decode_registration_accept(ogs_nas_5gs_message_t *message, ogs_p decoded += size; break; case OGS_NAS_5GS_REGISTRATION_ACCEPT_NSSAI_INCLUSION_MODE_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_nssai_inclusion_mode(®istration_accept->nssai_inclusion_mode, pkbuf); ogs_assert(size >= 0); registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_NSSAI_INCLUSION_MODE_PRESENT; @@ -462,6 +478,8 @@ int ogs_nas_5gs_decode_registration_accept(ogs_nas_5gs_message_t *message, ogs_p decoded += size; break; case OGS_NAS_5GS_REGISTRATION_ACCEPT_NON_3GPP_NW_POLICIES_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_non_3gpp_nw_provided_policies(®istration_accept->non_3gpp_nw_policies, pkbuf); ogs_assert(size >= 0); registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_NON_3GPP_NW_POLICIES_PRESENT; @@ -504,6 +522,8 @@ int ogs_nas_5gs_decode_registration_accept(ogs_nas_5gs_message_t *message, ogs_p decoded += size; break; case OGS_NAS_5GS_REGISTRATION_ACCEPT_UE_RADIO_CAPABILITY_ID_DELETION_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_ue_radio_capability_id_deletion_indication(®istration_accept->ue_radio_capability_id_deletion_indication, pkbuf); ogs_assert(size >= 0); registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_UE_RADIO_CAPABILITY_ID_DELETION_INDICATION_PRESENT; @@ -540,7 +560,7 @@ int ogs_nas_5gs_decode_registration_accept(ogs_nas_5gs_message_t *message, ogs_p decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -572,7 +592,7 @@ int ogs_nas_5gs_decode_registration_complete(ogs_nas_5gs_message_t *message, ogs decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -626,7 +646,7 @@ int ogs_nas_5gs_decode_registration_reject(ogs_nas_5gs_message_t *message, ogs_p decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -693,7 +713,7 @@ int ogs_nas_5gs_decode_deregistration_request_to_ue(ogs_nas_5gs_message_t *messa decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -751,7 +771,7 @@ int ogs_nas_5gs_decode_service_request(ogs_nas_5gs_message_t *message, ogs_pkbuf decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -805,7 +825,7 @@ int ogs_nas_5gs_decode_service_reject(ogs_nas_5gs_message_t *message, ogs_pkbuf_ decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -861,7 +881,7 @@ int ogs_nas_5gs_decode_service_accept(ogs_nas_5gs_message_t *message, ogs_pkbuf_ decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -887,6 +907,8 @@ int ogs_nas_5gs_decode_configuration_update_command(ogs_nas_5gs_message_t *messa switch(type) { case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_CONFIGURATION_UPDATE_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_configuration_update_indication(&configuration_update_command->configuration_update_indication, pkbuf); ogs_assert(size >= 0); configuration_update_command->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_CONFIGURATION_UPDATE_INDICATION_PRESENT; @@ -953,12 +975,16 @@ int ogs_nas_5gs_decode_configuration_update_command(ogs_nas_5gs_message_t *messa decoded += size; break; case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_MICO_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_mico_indication(&configuration_update_command->mico_indication, pkbuf); ogs_assert(size >= 0); configuration_update_command->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_MICO_INDICATION_PRESENT; decoded += size; break; case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_NETWORK_SLICING_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_network_slicing_indication(&configuration_update_command->network_slicing_indication, pkbuf); ogs_assert(size >= 0); configuration_update_command->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_NETWORK_SLICING_INDICATION_PRESENT; @@ -983,6 +1009,8 @@ int ogs_nas_5gs_decode_configuration_update_command(ogs_nas_5gs_message_t *messa decoded += size; break; case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_SMS_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_sms_indication(&configuration_update_command->sms_indication, pkbuf); ogs_assert(size >= 0); configuration_update_command->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_SMS_INDICATION_PRESENT; @@ -1007,6 +1035,8 @@ int ogs_nas_5gs_decode_configuration_update_command(ogs_nas_5gs_message_t *messa decoded += size; break; case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_UE_RADIO_CAPABILITY_ID_DELETION_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_ue_radio_capability_id_deletion_indication(&configuration_update_command->ue_radio_capability_id_deletion_indication, pkbuf); ogs_assert(size >= 0); configuration_update_command->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_UE_RADIO_CAPABILITY_ID_DELETION_INDICATION_PRESENT; @@ -1025,7 +1055,7 @@ int ogs_nas_5gs_decode_configuration_update_command(ogs_nas_5gs_message_t *messa decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1061,6 +1091,8 @@ int ogs_nas_5gs_decode_configuration_update_complete(ogs_nas_5gs_message_t *mess decoded += size; break; case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PAYLOAD_CONTAINER_TYPE_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_payload_container_type(&configuration_update_complete->payload_container_type, pkbuf); ogs_assert(size >= 0); configuration_update_complete->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PAYLOAD_CONTAINER_TYPE_PRESENT; @@ -1072,6 +1104,12 @@ int ogs_nas_5gs_decode_configuration_update_complete(ogs_nas_5gs_message_t *mess configuration_update_complete->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PAYLOAD_CONTAINER_PRESENT; decoded += size; break; + case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_ID_TYPE: + size = ogs_nas_5gs_decode_pdu_session_identity_2(&configuration_update_complete->pdu_session_id, pkbuf); + ogs_assert(size >= 0); + configuration_update_complete->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_ID_PRESENT; + decoded += size; + break; case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_STATUS_TYPE: size = ogs_nas_5gs_decode_pdu_session_status(&configuration_update_complete->pdu_session_status, pkbuf); ogs_assert(size >= 0); @@ -1079,6 +1117,8 @@ int ogs_nas_5gs_decode_configuration_update_complete(ogs_nas_5gs_message_t *mess decoded += size; break; case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_RELEASE_ASSISTANCE_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_release_assistance_indication(&configuration_update_complete->release_assistance_indication, pkbuf); ogs_assert(size >= 0); configuration_update_complete->presencemask |= OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_RELEASE_ASSISTANCE_INDICATION_PRESENT; @@ -1103,7 +1143,7 @@ int ogs_nas_5gs_decode_configuration_update_complete(ogs_nas_5gs_message_t *mess decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1155,7 +1195,7 @@ int ogs_nas_5gs_decode_authentication_request(ogs_nas_5gs_message_t *message, og decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1193,7 +1233,7 @@ int ogs_nas_5gs_decode_authentication_response(ogs_nas_5gs_message_t *message, o decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1225,7 +1265,7 @@ int ogs_nas_5gs_decode_authentication_reject(ogs_nas_5gs_message_t *message, ogs decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1261,7 +1301,7 @@ int ogs_nas_5gs_decode_authentication_failure(ogs_nas_5gs_message_t *message, og decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1301,7 +1341,7 @@ int ogs_nas_5gs_decode_authentication_result(ogs_nas_5gs_message_t *message, ogs decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1369,6 +1409,8 @@ int ogs_nas_5gs_decode_security_mode_command(ogs_nas_5gs_message_t *message, ogs switch(type) { case OGS_NAS_5GS_SECURITY_MODE_COMMAND_IMEISV_REQUEST_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_imeisv_request(&security_mode_command->imeisv_request, pkbuf); ogs_assert(size >= 0); security_mode_command->presencemask |= OGS_NAS_5GS_SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT; @@ -1405,7 +1447,7 @@ int ogs_nas_5gs_decode_security_mode_command(ogs_nas_5gs_message_t *message, ogs decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1449,7 +1491,7 @@ int ogs_nas_5gs_decode_security_mode_complete(ogs_nas_5gs_message_t *message, og decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1526,7 +1568,7 @@ int ogs_nas_5gs_decode_notification_response(ogs_nas_5gs_message_t *message, ogs decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1559,6 +1601,12 @@ int ogs_nas_5gs_decode_ul_nas_transport(ogs_nas_5gs_message_t *message, ogs_pkbu decoded += size; switch(type) { + case OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_TYPE: + size = ogs_nas_5gs_decode_pdu_session_identity_2(&ul_nas_transport->pdu_session_id, pkbuf); + ogs_assert(size >= 0); + ul_nas_transport->presencemask |= OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT; + decoded += size; + break; case OGS_NAS_5GS_UL_NAS_TRANSPORT_OLD_PDU_SESSION_ID_TYPE: size = ogs_nas_5gs_decode_pdu_session_identity_2(&ul_nas_transport->old_pdu_session_id, pkbuf); ogs_assert(size >= 0); @@ -1566,6 +1614,8 @@ int ogs_nas_5gs_decode_ul_nas_transport(ogs_nas_5gs_message_t *message, ogs_pkbu decoded += size; break; case OGS_NAS_5GS_UL_NAS_TRANSPORT_REQUEST_TYPE_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_request_type(&ul_nas_transport->request_type, pkbuf); ogs_assert(size >= 0); ul_nas_transport->presencemask |= OGS_NAS_5GS_UL_NAS_TRANSPORT_REQUEST_TYPE_PRESENT; @@ -1590,19 +1640,23 @@ int ogs_nas_5gs_decode_ul_nas_transport(ogs_nas_5gs_message_t *message, ogs_pkbu decoded += size; break; case OGS_NAS_5GS_UL_NAS_TRANSPORT_MA_PDU_SESSION_INFORMATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_ma_pdu_session_information(&ul_nas_transport->ma_pdu_session_information, pkbuf); ogs_assert(size >= 0); ul_nas_transport->presencemask |= OGS_NAS_5GS_UL_NAS_TRANSPORT_MA_PDU_SESSION_INFORMATION_PRESENT; decoded += size; break; case OGS_NAS_5GS_UL_NAS_TRANSPORT_RELEASE_ASSISTANCE_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); size = ogs_nas_5gs_decode_release_assistance_indication(&ul_nas_transport->release_assistance_indication, pkbuf); ogs_assert(size >= 0); ul_nas_transport->presencemask |= OGS_NAS_5GS_UL_NAS_TRANSPORT_RELEASE_ASSISTANCE_INDICATION_PRESENT; decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1635,6 +1689,12 @@ int ogs_nas_5gs_decode_dl_nas_transport(ogs_nas_5gs_message_t *message, ogs_pkbu decoded += size; switch(type) { + case OGS_NAS_5GS_DL_NAS_TRANSPORT_PDU_SESSION_ID_TYPE: + size = ogs_nas_5gs_decode_pdu_session_identity_2(&dl_nas_transport->pdu_session_id, pkbuf); + ogs_assert(size >= 0); + dl_nas_transport->presencemask |= OGS_NAS_5GS_DL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT; + decoded += size; + break; case OGS_NAS_5GS_DL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE: size = ogs_nas_5gs_decode_additional_information(&dl_nas_transport->additional_information, pkbuf); ogs_assert(size >= 0); @@ -1654,7 +1714,7 @@ int ogs_nas_5gs_decode_dl_nas_transport(ogs_nas_5gs_message_t *message, ogs_pkbu decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1670,7 +1730,7 @@ int ogs_nas_5gs_decode_pdu_session_establishment_request(ogs_nas_5gs_message_t * ogs_trace("[NAS] Decode PDU_SESSION_ESTABLISHMENT_REQUEST\n"); - size = ogs_nas_5gs_decode_control_plane_service_type(&pdu_session_establishment_request->control_plane_service_type, pkbuf); + size = ogs_nas_5gs_decode_integrity_protection_maximum_data_rate(&pdu_session_establishment_request->integrity_protection_maximum_data_rate, pkbuf); ogs_assert(size >= 0); decoded += size; @@ -1683,56 +1743,80 @@ int ogs_nas_5gs_decode_pdu_session_establishment_request(ogs_nas_5gs_message_t * decoded += size; switch(type) { - case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_CIOT_SMALL_DATA_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_ciot_small_data_container(&pdu_session_establishment_request->ciot_small_data_container, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_pdu_session_type(&pdu_session_establishment_request->pdu_session_type, pkbuf); ogs_assert(size >= 0); - pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_CIOT_SMALL_DATA_CONTAINER_PRESENT; + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE_TYPE: - size = ogs_nas_5gs_decode_payload_container_type(&pdu_session_establishment_request->payload_container_type, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_ssc_mode(&pdu_session_establishment_request->ssc_mode, pkbuf); ogs_assert(size >= 0); - pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE_PRESENT; + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_payload_container(&pdu_session_establishment_request->payload_container, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_5GSM_CAPABILITY_TYPE: + size = ogs_nas_5gs_decode_5gsm_capability(&pdu_session_establishment_request->gsm_capability, pkbuf); ogs_assert(size >= 0); - pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_PRESENT; + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_5GSM_CAPABILITY_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_STATUS_TYPE: - size = ogs_nas_5gs_decode_pdu_session_status(&pdu_session_establishment_request->pdu_session_status, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE: + size = ogs_nas_5gs_decode_maximum_number_of_supported_packet_filters(&pdu_session_establishment_request->maximum_number_of_supported_packet_filters, pkbuf); ogs_assert(size >= 0); - pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_STATUS_PRESENT; + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_RELEASE_ASSISTANCE_INDICATION_TYPE: - size = ogs_nas_5gs_decode_release_assistance_indication(&pdu_session_establishment_request->release_assistance_indication, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_always_on_pdu_session_requested(&pdu_session_establishment_request->always_on_pdu_session_requested, pkbuf); ogs_assert(size >= 0); - pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_RELEASE_ASSISTANCE_INDICATION_PRESENT; + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UPLINK_DATA_STATUS_TYPE: - size = ogs_nas_5gs_decode_uplink_data_status(&pdu_session_establishment_request->uplink_data_status, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SM_PDU_DN_REQUEST_CONTAINER_TYPE: + size = ogs_nas_5gs_decode_sm_pdu_dn_request_container(&pdu_session_establishment_request->sm_pdu_dn_request_container, pkbuf); ogs_assert(size >= 0); - pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UPLINK_DATA_STATUS_PRESENT; + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SM_PDU_DN_REQUEST_CONTAINER_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_NAS_MESSAGE_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_message_container(&pdu_session_establishment_request->nas_message_container, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: + size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_establishment_request->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); - pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT; + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ADDITIONAL_INFORMATION_TYPE: - size = ogs_nas_5gs_decode_additional_information(&pdu_session_establishment_request->additional_information, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE: + size = ogs_nas_5gs_decode_header_compression_configuration(&pdu_session_establishment_request->header_compression_configuration, pkbuf); ogs_assert(size >= 0); - pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ADDITIONAL_INFORMATION_PRESENT; + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_DS_TT_ETHERNET_PORT_MAC_ADDRESS_TYPE: + size = ogs_nas_5gs_decode_ds_tt_ethernet_port_mac_address(&pdu_session_establishment_request->ds_tt_ethernet_port_mac_address, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_DS_TT_ETHERNET_PORT_MAC_ADDRESS_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UE_DS_TT_RESIDENCE_TIME_TYPE: + size = ogs_nas_5gs_decode_ue_ds_tt_residence_time(&pdu_session_establishment_request->ue_ds_tt_residence_time, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UE_DS_TT_RESIDENCE_TIME_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE: + size = ogs_nas_5gs_decode_port_management_information_container(&pdu_session_establishment_request->port_management_information_container, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT; decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1748,64 +1832,15 @@ int ogs_nas_5gs_decode_pdu_session_establishment_accept(ogs_nas_5gs_message_t *m ogs_trace("[NAS] Decode PDU_SESSION_ESTABLISHMENT_ACCEPT\n"); - size = ogs_nas_5gs_decode_s_nssai(&pdu_session_establishment_accept->s_nssai, pkbuf); + size = ogs_nas_5gs_decode_pdu_session_type(&pdu_session_establishment_accept->selected_pdu_session_type, pkbuf); ogs_assert(size >= 0); decoded += size; - size = ogs_nas_5gs_decode_eap_message(&pdu_session_establishment_accept->eap_message, pkbuf); + size = ogs_nas_5gs_decode_qos_rules(&pdu_session_establishment_accept->authorized_qos_rules, pkbuf); ogs_assert(size >= 0); decoded += size; - return decoded; -} - -int ogs_nas_5gs_decode_pdu_session_establishment_reject(ogs_nas_5gs_message_t *message, ogs_pkbuf_t *pkbuf) -{ - ogs_nas_5gs_pdu_session_establishment_reject_t *pdu_session_establishment_reject = &message->gsm.pdu_session_establishment_reject; - int decoded = 0; - int size = 0; - - ogs_trace("[NAS] Decode PDU_SESSION_ESTABLISHMENT_REJECT\n"); - - size = ogs_nas_5gs_decode_s_nssai(&pdu_session_establishment_reject->s_nssai, pkbuf); - ogs_assert(size >= 0); - decoded += size; - - size = ogs_nas_5gs_decode_eap_message(&pdu_session_establishment_reject->eap_message, pkbuf); - ogs_assert(size >= 0); - decoded += size; - - return decoded; -} - -int ogs_nas_5gs_decode_pdu_session_authentication_command(ogs_nas_5gs_message_t *message, ogs_pkbuf_t *pkbuf) -{ - ogs_nas_5gs_pdu_session_authentication_command_t *pdu_session_authentication_command = &message->gsm.pdu_session_authentication_command; - int decoded = 0; - int size = 0; - - ogs_trace("[NAS] Decode PDU_SESSION_AUTHENTICATION_COMMAND\n"); - - size = ogs_nas_5gs_decode_s_nssai(&pdu_session_authentication_command->s_nssai, pkbuf); - ogs_assert(size >= 0); - decoded += size; - - size = ogs_nas_5gs_decode_eap_message(&pdu_session_authentication_command->eap_message, pkbuf); - ogs_assert(size >= 0); - decoded += size; - - return decoded; -} - -int ogs_nas_5gs_decode_pdu_session_authentication_complete(ogs_nas_5gs_message_t *message, ogs_pkbuf_t *pkbuf) -{ - ogs_nas_5gs_pdu_session_authentication_complete_t *pdu_session_authentication_complete = &message->gsm.pdu_session_authentication_complete; - int decoded = 0; - int size = 0; - - ogs_trace("[NAS] Decode PDU_SESSION_AUTHENTICATION_COMPLETE\n"); - - size = ogs_nas_5gs_decode_integrity_protection_maximum_data_rate(&pdu_session_authentication_complete->integrity_protection_maximum_data_rate, pkbuf); + size = ogs_nas_5gs_decode_session_ambr(&pdu_session_establishment_accept->session_ambr, pkbuf); ogs_assert(size >= 0); decoded += size; @@ -1818,74 +1853,242 @@ int ogs_nas_5gs_decode_pdu_session_authentication_complete(ogs_nas_5gs_message_t decoded += size; switch(type) { - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PDU_SESSION_TYPE_TYPE: - size = ogs_nas_5gs_decode_pdu_session_type(&pdu_session_authentication_complete->pdu_session_type, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_CAUSE_TYPE: + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_establishment_accept->gsm_cause, pkbuf); ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PDU_SESSION_TYPE_PRESENT; + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_CAUSE_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SSC_MODE_TYPE: - size = ogs_nas_5gs_decode_ssc_mode(&pdu_session_authentication_complete->ssc_mode, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_TYPE: + size = ogs_nas_5gs_decode_pdu_address(&pdu_session_establishment_accept->pdu_address, pkbuf); ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SSC_MODE_PRESENT; + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_5GSM_CAPABILITY_TYPE: - size = ogs_nas_5gs_decode_5gsm_capability(&pdu_session_authentication_complete->gsm_capability, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_RQ_TIMER_VALUE_TYPE: + size = ogs_nas_5gs_decode_gprs_timer(&pdu_session_establishment_accept->rq_timer_value, pkbuf); ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_5GSM_CAPABILITY_PRESENT; + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_RQ_TIMER_VALUE_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE: - size = ogs_nas_5gs_decode_maximum_number_of_supported_packet_filters(&pdu_session_authentication_complete->maximum_number_of_supported_packet_filters, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_S_NSSAI_TYPE: + size = ogs_nas_5gs_decode_s_nssai(&pdu_session_establishment_accept->s_nssai, pkbuf); ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT; + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_S_NSSAI_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE: - size = ogs_nas_5gs_decode_always_on_pdu_session_requested(&pdu_session_authentication_complete->always_on_pdu_session_requested, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_always_on_pdu_session_indication(&pdu_session_establishment_accept->always_on_pdu_session_indication, pkbuf); ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT; + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SM_PDU_DN_REQUEST_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_sm_pdu_dn_request_container(&pdu_session_authentication_complete->sm_pdu_dn_request_container, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_TYPE: + size = ogs_nas_5gs_decode_mapped_eps_bearer_contexts(&pdu_session_establishment_accept->mapped_eps_bearer_contexts, pkbuf); ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SM_PDU_DN_REQUEST_CONTAINER_PRESENT; + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT; decoded += size; break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_TYPE: + size = ogs_nas_5gs_decode_eap_message(&pdu_session_establishment_accept->eap_message, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE: + size = ogs_nas_5gs_decode_qos_flow_descriptions(&pdu_session_establishment_accept->authorized_qos_flow_descriptions, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: + size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_establishment_accept->extended_protocol_configuration_options, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_TYPE: + size = ogs_nas_5gs_decode_dnn(&pdu_session_establishment_accept->dnn, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_NETWORK_FEATURE_SUPPORT_TYPE: + size = ogs_nas_5gs_decode_5gsm_network_feature_support(&pdu_session_establishment_accept->gsm_network_feature_support, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_NETWORK_FEATURE_SUPPORT_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_SERVING_PLMN_RATE_CONTROL_TYPE: + size = ogs_nas_5gs_decode_serving_plmn_rate_control(&pdu_session_establishment_accept->serving_plmn_rate_control, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_SERVING_PLMN_RATE_CONTROL_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ATSSS_CONTAINER_TYPE: + size = ogs_nas_5gs_decode_atsss_container(&pdu_session_establishment_accept->atsss_container, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ATSSS_CONTAINER_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_CONTROL_PLANE_ONLY_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_control_plane_only_indication(&pdu_session_establishment_accept->control_plane_only_indication, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_CONTROL_PLANE_ONLY_INDICATION_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_TYPE: + size = ogs_nas_5gs_decode_header_compression_configuration(&pdu_session_establishment_accept->header_compression_configuration, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_PRESENT; + decoded += size; + break; + default: + ogs_error("Unknown type(0x%x) or not implemented\n", type); + break; + } + } + + return decoded; +} + +int ogs_nas_5gs_decode_pdu_session_establishment_reject(ogs_nas_5gs_message_t *message, ogs_pkbuf_t *pkbuf) +{ + ogs_nas_5gs_pdu_session_establishment_reject_t *pdu_session_establishment_reject = &message->gsm.pdu_session_establishment_reject; + int decoded = 0; + int size = 0; + + ogs_trace("[NAS] Decode PDU_SESSION_ESTABLISHMENT_REJECT\n"); + + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_establishment_reject->gsm_cause, pkbuf); + ogs_assert(size >= 0); + decoded += size; + + while (pkbuf->len > 0) { + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + decoded += size; + + switch(type) { + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_BACK_OFF_TIMER_VALUE_TYPE: + size = ogs_nas_5gs_decode_gprs_timer_3(&pdu_session_establishment_reject->back_off_timer_value, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_BACK_OFF_TIMER_VALUE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_allowed_ssc_mode(&pdu_session_establishment_reject->allowed_ssc_mode, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_TYPE: + size = ogs_nas_5gs_decode_eap_message(&pdu_session_establishment_reject->eap_message, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: + size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_establishment_reject->extended_protocol_configuration_options, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_RE_ATTEMPT_INDICATOR_TYPE: + size = ogs_nas_5gs_decode_re_attempt_indicator(&pdu_session_establishment_reject->re_attempt_indicator, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_RE_ATTEMPT_INDICATOR_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE: + size = ogs_nas_5gs_decode_5gsm_congestion_re_attempt_indicator(&pdu_session_establishment_reject->gsm_congestion_re_attempt_indicator, pkbuf); + ogs_assert(size >= 0); + pdu_session_establishment_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT; + decoded += size; + break; + default: + ogs_error("Unknown type(0x%x) or not implemented\n", type); + break; + } + } + + return decoded; +} + +int ogs_nas_5gs_decode_pdu_session_authentication_command(ogs_nas_5gs_message_t *message, ogs_pkbuf_t *pkbuf) +{ + ogs_nas_5gs_pdu_session_authentication_command_t *pdu_session_authentication_command = &message->gsm.pdu_session_authentication_command; + int decoded = 0; + int size = 0; + + ogs_trace("[NAS] Decode PDU_SESSION_AUTHENTICATION_COMMAND\n"); + + size = ogs_nas_5gs_decode_eap_message(&pdu_session_authentication_command->eap_message, pkbuf); + ogs_assert(size >= 0); + decoded += size; + + while (pkbuf->len > 0) { + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + decoded += size; + + switch(type) { + case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: + size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_authentication_command->extended_protocol_configuration_options, pkbuf); + ogs_assert(size >= 0); + pdu_session_authentication_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + decoded += size; + break; + default: + ogs_error("Unknown type(0x%x) or not implemented\n", type); + break; + } + } + + return decoded; +} + +int ogs_nas_5gs_decode_pdu_session_authentication_complete(ogs_nas_5gs_message_t *message, ogs_pkbuf_t *pkbuf) +{ + ogs_nas_5gs_pdu_session_authentication_complete_t *pdu_session_authentication_complete = &message->gsm.pdu_session_authentication_complete; + int decoded = 0; + int size = 0; + + ogs_trace("[NAS] Decode PDU_SESSION_AUTHENTICATION_COMPLETE\n"); + + size = ogs_nas_5gs_decode_eap_message(&pdu_session_authentication_complete->eap_message, pkbuf); + ogs_assert(size >= 0); + decoded += size; + + while (pkbuf->len > 0) { + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + decoded += size; + + switch(type) { case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_authentication_complete->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_HEADER_COMPRESSION_CONFIGURATION_TYPE: - size = ogs_nas_5gs_decode_header_compression_configuration(&pdu_session_authentication_complete->header_compression_configuration, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_HEADER_COMPRESSION_CONFIGURATION_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_DS_TT_ETHERNET_PORT_MAC_ADDRESS_TYPE: - size = ogs_nas_5gs_decode_ds_tt_ethernet_port_mac_address(&pdu_session_authentication_complete->ds_tt_ethernet_port_mac_address, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_DS_TT_ETHERNET_PORT_MAC_ADDRESS_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_UE_DS_TT_RESIDENCE_TIME_TYPE: - size = ogs_nas_5gs_decode_ue_ds_tt_residence_time(&pdu_session_authentication_complete->ue_ds_tt_residence_time, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_UE_DS_TT_RESIDENCE_TIME_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_port_management_information_container(&pdu_session_authentication_complete->port_management_information_container, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT; - decoded += size; - break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1901,18 +2104,6 @@ int ogs_nas_5gs_decode_pdu_session_authentication_result(ogs_nas_5gs_message_t * ogs_trace("[NAS] Decode PDU_SESSION_AUTHENTICATION_RESULT\n"); - size = ogs_nas_5gs_decode_pdu_session_type(&pdu_session_authentication_result->selected_pdu_session_type, pkbuf); - ogs_assert(size >= 0); - decoded += size; - - size = ogs_nas_5gs_decode_qos_rules(&pdu_session_authentication_result->authorized_qos_rules, pkbuf); - ogs_assert(size >= 0); - decoded += size; - - size = ogs_nas_5gs_decode_session_ambr(&pdu_session_authentication_result->session_ambr, pkbuf); - ogs_assert(size >= 0); - decoded += size; - while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); @@ -1922,98 +2113,20 @@ int ogs_nas_5gs_decode_pdu_session_authentication_result(ogs_nas_5gs_message_t * decoded += size; switch(type) { - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_CAUSE_TYPE: - size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_authentication_result->gsm_cause, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_CAUSE_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_PDU_ADDRESS_TYPE: - size = ogs_nas_5gs_decode_pdu_address(&pdu_session_authentication_result->pdu_address, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_PDU_ADDRESS_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_RQ_TIMER_VALUE_TYPE: - size = ogs_nas_5gs_decode_gprs_timer(&pdu_session_authentication_result->rq_timer_value, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_RQ_TIMER_VALUE_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_S_NSSAI_TYPE: - size = ogs_nas_5gs_decode_s_nssai(&pdu_session_authentication_result->s_nssai, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_S_NSSAI_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE: - size = ogs_nas_5gs_decode_always_on_pdu_session_indication(&pdu_session_authentication_result->always_on_pdu_session_indication, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_MAPPED_EPS_BEARER_CONTEXTS_TYPE: - size = ogs_nas_5gs_decode_mapped_eps_bearer_contexts(&pdu_session_authentication_result->mapped_eps_bearer_contexts, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT; - decoded += size; - break; case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_TYPE: size = ogs_nas_5gs_decode_eap_message(&pdu_session_authentication_result->eap_message, pkbuf); ogs_assert(size >= 0); pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE: - size = ogs_nas_5gs_decode_qos_flow_descriptions(&pdu_session_authentication_result->authorized_qos_flow_descriptions, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT; - decoded += size; - break; case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_authentication_result->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_DNN_TYPE: - size = ogs_nas_5gs_decode_dnn(&pdu_session_authentication_result->dnn, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_DNN_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_NETWORK_FEATURE_SUPPORT_TYPE: - size = ogs_nas_5gs_decode_5gsm_network_feature_support(&pdu_session_authentication_result->gsm_network_feature_support, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_NETWORK_FEATURE_SUPPORT_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_SERVING_PLMN_RATE_CONTROL_TYPE: - size = ogs_nas_5gs_decode_serving_plmn_rate_control(&pdu_session_authentication_result->serving_plmn_rate_control, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_SERVING_PLMN_RATE_CONTROL_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ATSSS_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_atsss_container(&pdu_session_authentication_result->atsss_container, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ATSSS_CONTAINER_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_CONTROL_PLANE_ONLY_INDICATION_TYPE: - size = ogs_nas_5gs_decode_control_plane_only_indication(&pdu_session_authentication_result->control_plane_only_indication, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_CONTROL_PLANE_ONLY_INDICATION_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_HEADER_COMPRESSION_CONFIGURATION_TYPE: - size = ogs_nas_5gs_decode_header_compression_configuration(&pdu_session_authentication_result->header_compression_configuration, pkbuf); - ogs_assert(size >= 0); - pdu_session_authentication_result->presencemask |= OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_HEADER_COMPRESSION_CONFIGURATION_PRESENT; - decoded += size; - break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2029,10 +2142,6 @@ int ogs_nas_5gs_decode_pdu_session_modification_request(ogs_nas_5gs_message_t *m ogs_trace("[NAS] Decode PDU_SESSION_MODIFICATION_REQUEST\n"); - size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_modification_request->gsm_cause, pkbuf); - ogs_assert(size >= 0); - decoded += size; - while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); @@ -2042,22 +2151,54 @@ int ogs_nas_5gs_decode_pdu_session_modification_request(ogs_nas_5gs_message_t *m decoded += size; switch(type) { - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_BACK_OFF_TIMER_VALUE_TYPE: - size = ogs_nas_5gs_decode_gprs_timer_3(&pdu_session_modification_request->back_off_timer_value, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAPABILITY_TYPE: + size = ogs_nas_5gs_decode_5gsm_capability(&pdu_session_modification_request->gsm_capability, pkbuf); ogs_assert(size >= 0); - pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_BACK_OFF_TIMER_VALUE_PRESENT; + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAPABILITY_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALLOWED_SSC_MODE_TYPE: - size = ogs_nas_5gs_decode_allowed_ssc_mode(&pdu_session_modification_request->allowed_ssc_mode, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAUSE_TYPE: + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_modification_request->gsm_cause, pkbuf); ogs_assert(size >= 0); - pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALLOWED_SSC_MODE_PRESENT; + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAUSE_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EAP_MESSAGE_TYPE: - size = ogs_nas_5gs_decode_eap_message(&pdu_session_modification_request->eap_message, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE: + size = ogs_nas_5gs_decode_maximum_number_of_supported_packet_filters(&pdu_session_modification_request->maximum_number_of_supported_packet_filters, pkbuf); ogs_assert(size >= 0); - pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EAP_MESSAGE_PRESENT; + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_always_on_pdu_session_requested(&pdu_session_modification_request->always_on_pdu_session_requested, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_TYPE: + size = ogs_nas_5gs_decode_integrity_protection_maximum_data_rate(&pdu_session_modification_request->integrity_protection_maximum_data_rate, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_RULES_TYPE: + size = ogs_nas_5gs_decode_qos_rules(&pdu_session_modification_request->requested_qos_rules, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_RULES_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_FLOW_DESCRIPTIONS_TYPE: + size = ogs_nas_5gs_decode_qos_flow_descriptions(&pdu_session_modification_request->requested_qos_flow_descriptions, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_FLOW_DESCRIPTIONS_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_TYPE: + size = ogs_nas_5gs_decode_mapped_eps_bearer_contexts(&pdu_session_modification_request->mapped_eps_bearer_contexts, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_PRESENT; decoded += size; break; case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: @@ -2066,20 +2207,20 @@ int ogs_nas_5gs_decode_pdu_session_modification_request(ogs_nas_5gs_message_t *m pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_RE_ATTEMPT_INDICATOR_TYPE: - size = ogs_nas_5gs_decode_re_attempt_indicator(&pdu_session_modification_request->re_attempt_indicator, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE: + size = ogs_nas_5gs_decode_port_management_information_container(&pdu_session_modification_request->port_management_information_container, pkbuf); ogs_assert(size >= 0); - pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_RE_ATTEMPT_INDICATOR_PRESENT; + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE: - size = ogs_nas_5gs_decode_5gsm_congestion_re_attempt_indicator(&pdu_session_modification_request->gsm_congestion_re_attempt_indicator, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE: + size = ogs_nas_5gs_decode_header_compression_configuration(&pdu_session_modification_request->header_compression_configuration, pkbuf); ogs_assert(size >= 0); - pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT; + pdu_session_modification_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT; decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2095,7 +2236,7 @@ int ogs_nas_5gs_decode_pdu_session_modification_reject(ogs_nas_5gs_message_t *me ogs_trace("[NAS] Decode PDU_SESSION_MODIFICATION_REJECT\n"); - size = ogs_nas_5gs_decode_eap_message(&pdu_session_modification_reject->eap_message, pkbuf); + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_modification_reject->gsm_cause, pkbuf); ogs_assert(size >= 0); decoded += size; @@ -2108,14 +2249,32 @@ int ogs_nas_5gs_decode_pdu_session_modification_reject(ogs_nas_5gs_message_t *me decoded += size; switch(type) { + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_TYPE: + size = ogs_nas_5gs_decode_gprs_timer_3(&pdu_session_modification_reject->back_off_timer_value, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_PRESENT; + decoded += size; + break; case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_modification_reject->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); pdu_session_modification_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_TYPE: + size = ogs_nas_5gs_decode_re_attempt_indicator(&pdu_session_modification_reject->re_attempt_indicator, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE: + size = ogs_nas_5gs_decode_5gsm_congestion_re_attempt_indicator(&pdu_session_modification_reject->gsm_congestion_re_attempt_indicator, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT; + decoded += size; + break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2131,10 +2290,6 @@ int ogs_nas_5gs_decode_pdu_session_modification_command(ogs_nas_5gs_message_t *m ogs_trace("[NAS] Decode PDU_SESSION_MODIFICATION_COMMAND\n"); - size = ogs_nas_5gs_decode_eap_message(&pdu_session_modification_command->eap_message, pkbuf); - ogs_assert(size >= 0); - decoded += size; - while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); @@ -2144,14 +2299,82 @@ int ogs_nas_5gs_decode_pdu_session_modification_command(ogs_nas_5gs_message_t *m decoded += size; switch(type) { + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_5GSM_CAUSE_TYPE: + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_modification_command->gsm_cause, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_5GSM_CAUSE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_TYPE: + size = ogs_nas_5gs_decode_session_ambr(&pdu_session_modification_command->session_ambr, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_RQ_TIMER_VALUE_TYPE: + size = ogs_nas_5gs_decode_gprs_timer(&pdu_session_modification_command->rq_timer_value, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_RQ_TIMER_VALUE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_always_on_pdu_session_indication(&pdu_session_modification_command->always_on_pdu_session_indication, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_RULES_TYPE: + size = ogs_nas_5gs_decode_qos_rules(&pdu_session_modification_command->authorized_qos_rules, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_RULES_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_TYPE: + size = ogs_nas_5gs_decode_mapped_eps_bearer_contexts(&pdu_session_modification_command->mapped_eps_bearer_contexts, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE: + size = ogs_nas_5gs_decode_qos_flow_descriptions(&pdu_session_modification_command->authorized_qos_flow_descriptions, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT; + decoded += size; + break; case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_modification_command->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ATSSS_CONTAINER_TYPE: + size = ogs_nas_5gs_decode_atsss_container(&pdu_session_modification_command->atsss_container, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ATSSS_CONTAINER_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_HEADER_COMPRESSION_CONFIGURATION_TYPE: + size = ogs_nas_5gs_decode_header_compression_configuration(&pdu_session_modification_command->header_compression_configuration, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_HEADER_COMPRESSION_CONFIGURATION_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE: + size = ogs_nas_5gs_decode_port_management_information_container(&pdu_session_modification_command->port_management_information_container, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SERVING_PLMN_RATE_CONTROL_TYPE: + size = ogs_nas_5gs_decode_serving_plmn_rate_control(&pdu_session_modification_command->serving_plmn_rate_control, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SERVING_PLMN_RATE_CONTROL_PRESENT; + decoded += size; + break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2176,20 +2399,20 @@ int ogs_nas_5gs_decode_pdu_session_modification_complete(ogs_nas_5gs_message_t * decoded += size; switch(type) { - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EAP_MESSAGE_TYPE: - size = ogs_nas_5gs_decode_eap_message(&pdu_session_modification_complete->eap_message, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EAP_MESSAGE_PRESENT; - decoded += size; - break; case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_modification_complete->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); pdu_session_modification_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; + case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE: + size = ogs_nas_5gs_decode_port_management_information_container(&pdu_session_modification_complete->port_management_information_container, pkbuf); + ogs_assert(size >= 0); + pdu_session_modification_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT; + decoded += size; + break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2205,6 +2428,10 @@ int ogs_nas_5gs_decode_pdu_session_modification_command_reject(ogs_nas_5gs_messa ogs_trace("[NAS] Decode PDU_SESSION_MODIFICATION_COMMAND_REJECT\n"); + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_modification_command_reject->gsm_cause, pkbuf); + ogs_assert(size >= 0); + decoded += size; + while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); @@ -2214,74 +2441,14 @@ int ogs_nas_5gs_decode_pdu_session_modification_command_reject(ogs_nas_5gs_messa decoded += size; switch(type) { - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAPABILITY_TYPE: - size = ogs_nas_5gs_decode_5gsm_capability(&pdu_session_modification_command_reject->gsm_capability, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAPABILITY_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAUSE_TYPE: - size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_modification_command_reject->gsm_cause, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAUSE_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE: - size = ogs_nas_5gs_decode_maximum_number_of_supported_packet_filters(&pdu_session_modification_command_reject->maximum_number_of_supported_packet_filters, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE: - size = ogs_nas_5gs_decode_always_on_pdu_session_requested(&pdu_session_modification_command_reject->always_on_pdu_session_requested, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_TYPE: - size = ogs_nas_5gs_decode_integrity_protection_maximum_data_rate(&pdu_session_modification_command_reject->integrity_protection_maximum_data_rate, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_RULES_TYPE: - size = ogs_nas_5gs_decode_qos_rules(&pdu_session_modification_command_reject->requested_qos_rules, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_RULES_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_FLOW_DESCRIPTIONS_TYPE: - size = ogs_nas_5gs_decode_qos_flow_descriptions(&pdu_session_modification_command_reject->requested_qos_flow_descriptions, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_FLOW_DESCRIPTIONS_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAPPED_EPS_BEARER_CONTEXTS_TYPE: - size = ogs_nas_5gs_decode_mapped_eps_bearer_contexts(&pdu_session_modification_command_reject->mapped_eps_bearer_contexts, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT; - decoded += size; - break; case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_modification_command_reject->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_port_management_information_container(&pdu_session_modification_command_reject->port_management_information_container, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_HEADER_COMPRESSION_CONFIGURATION_TYPE: - size = ogs_nas_5gs_decode_header_compression_configuration(&pdu_session_modification_command_reject->header_compression_configuration, pkbuf); - ogs_assert(size >= 0); - pdu_session_modification_command_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_HEADER_COMPRESSION_CONFIGURATION_PRESENT; - decoded += size; - break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2297,10 +2464,6 @@ int ogs_nas_5gs_decode_pdu_session_release_request(ogs_nas_5gs_message_t *messag ogs_trace("[NAS] Decode PDU_SESSION_RELEASE_REQUEST\n"); - size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_release_request->gsm_cause, pkbuf); - ogs_assert(size >= 0); - decoded += size; - while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); @@ -2310,10 +2473,10 @@ int ogs_nas_5gs_decode_pdu_session_release_request(ogs_nas_5gs_message_t *messag decoded += size; switch(type) { - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_BACK_OFF_TIMER_VALUE_TYPE: - size = ogs_nas_5gs_decode_gprs_timer_3(&pdu_session_release_request->back_off_timer_value, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CAUSE_TYPE: + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_release_request->gsm_cause, pkbuf); ogs_assert(size >= 0); - pdu_session_release_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_BACK_OFF_TIMER_VALUE_PRESENT; + pdu_session_release_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CAUSE_PRESENT; decoded += size; break; case OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: @@ -2322,20 +2485,8 @@ int ogs_nas_5gs_decode_pdu_session_release_request(ogs_nas_5gs_message_t *messag pdu_session_release_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_RE_ATTEMPT_INDICATOR_TYPE: - size = ogs_nas_5gs_decode_re_attempt_indicator(&pdu_session_release_request->re_attempt_indicator, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_RE_ATTEMPT_INDICATOR_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE: - size = ogs_nas_5gs_decode_5gsm_congestion_re_attempt_indicator(&pdu_session_release_request->gsm_congestion_re_attempt_indicator, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_request->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT; - decoded += size; - break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2351,6 +2502,10 @@ int ogs_nas_5gs_decode_pdu_session_release_reject(ogs_nas_5gs_message_t *message ogs_trace("[NAS] Decode PDU_SESSION_RELEASE_REJECT\n"); + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_release_reject->gsm_cause, pkbuf); + ogs_assert(size >= 0); + decoded += size; + while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); @@ -2360,80 +2515,14 @@ int ogs_nas_5gs_decode_pdu_session_release_reject(ogs_nas_5gs_message_t *message decoded += size; switch(type) { - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_5GSM_CAUSE_TYPE: - size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_release_reject->gsm_cause, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_5GSM_CAUSE_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SESSION_AMBR_TYPE: - size = ogs_nas_5gs_decode_session_ambr(&pdu_session_release_reject->session_ambr, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SESSION_AMBR_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_RQ_TIMER_VALUE_TYPE: - size = ogs_nas_5gs_decode_gprs_timer(&pdu_session_release_reject->rq_timer_value, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_RQ_TIMER_VALUE_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE: - size = ogs_nas_5gs_decode_always_on_pdu_session_indication(&pdu_session_release_reject->always_on_pdu_session_indication, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_RULES_TYPE: - size = ogs_nas_5gs_decode_qos_rules(&pdu_session_release_reject->authorized_qos_rules, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_RULES_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_MAPPED_EPS_BEARER_CONTEXTS_TYPE: - size = ogs_nas_5gs_decode_mapped_eps_bearer_contexts(&pdu_session_release_reject->mapped_eps_bearer_contexts, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE: - size = ogs_nas_5gs_decode_qos_flow_descriptions(&pdu_session_release_reject->authorized_qos_flow_descriptions, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT; - decoded += size; - break; case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_release_reject->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ATSSS_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_atsss_container(&pdu_session_release_reject->atsss_container, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ATSSS_CONTAINER_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_HEADER_COMPRESSION_CONFIGURATION_TYPE: - size = ogs_nas_5gs_decode_header_compression_configuration(&pdu_session_release_reject->header_compression_configuration, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_HEADER_COMPRESSION_CONFIGURATION_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_port_management_information_container(&pdu_session_release_reject->port_management_information_container, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SERVING_PLMN_RATE_CONTROL_TYPE: - size = ogs_nas_5gs_decode_serving_plmn_rate_control(&pdu_session_release_reject->serving_plmn_rate_control, pkbuf); - ogs_assert(size >= 0); - pdu_session_release_reject->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SERVING_PLMN_RATE_CONTROL_PRESENT; - decoded += size; - break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2449,6 +2538,10 @@ int ogs_nas_5gs_decode_pdu_session_release_command(ogs_nas_5gs_message_t *messag ogs_trace("[NAS] Decode PDU_SESSION_RELEASE_COMMAND\n"); + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_release_command->gsm_cause, pkbuf); + ogs_assert(size >= 0); + decoded += size; + while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); @@ -2458,20 +2551,40 @@ int ogs_nas_5gs_decode_pdu_session_release_command(ogs_nas_5gs_message_t *messag decoded += size; switch(type) { + case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_BACK_OFF_TIMER_VALUE_TYPE: + size = ogs_nas_5gs_decode_gprs_timer_3(&pdu_session_release_command->back_off_timer_value, pkbuf); + ogs_assert(size >= 0); + pdu_session_release_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_BACK_OFF_TIMER_VALUE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_TYPE: + size = ogs_nas_5gs_decode_eap_message(&pdu_session_release_command->eap_message, pkbuf); + ogs_assert(size >= 0); + pdu_session_release_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_PRESENT; + decoded += size; + break; + case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE: + size = ogs_nas_5gs_decode_5gsm_congestion_re_attempt_indicator(&pdu_session_release_command->gsm_congestion_re_attempt_indicator, pkbuf); + ogs_assert(size >= 0); + pdu_session_release_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT; + decoded += size; + break; case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_release_command->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); pdu_session_release_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; - case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE: - size = ogs_nas_5gs_decode_port_management_information_container(&pdu_session_release_command->port_management_information_container, pkbuf); + case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_ACCESS_TYPE_TYPE: + decoded--; + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); + size = ogs_nas_5gs_decode_access_type(&pdu_session_release_command->access_type, pkbuf); ogs_assert(size >= 0); - pdu_session_release_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT; + pdu_session_release_command->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_ACCESS_TYPE_PRESENT; decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2487,10 +2600,6 @@ int ogs_nas_5gs_decode_pdu_session_release_complete(ogs_nas_5gs_message_t *messa ogs_trace("[NAS] Decode PDU_SESSION_RELEASE_COMPLETE\n"); - size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_release_complete->gsm_cause, pkbuf); - ogs_assert(size >= 0); - decoded += size; - while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); @@ -2500,6 +2609,12 @@ int ogs_nas_5gs_decode_pdu_session_release_complete(ogs_nas_5gs_message_t *messa decoded += size; switch(type) { + case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_5GSM_CAUSE_TYPE: + size = ogs_nas_5gs_decode_5gsm_cause(&pdu_session_release_complete->gsm_cause, pkbuf); + ogs_assert(size >= 0); + pdu_session_release_complete->presencemask |= OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_5GSM_CAUSE_PRESENT; + decoded += size; + break; case OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&pdu_session_release_complete->extended_protocol_configuration_options, pkbuf); ogs_assert(size >= 0); @@ -2507,7 +2622,7 @@ int ogs_nas_5gs_decode_pdu_session_release_complete(ogs_nas_5gs_message_t *messa decoded += size; break; default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_error("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2523,32 +2638,9 @@ int ogs_nas_5gs_decode_5gsm_status(ogs_nas_5gs_message_t *message, ogs_pkbuf_t * ogs_trace("[NAS] Decode 5GSM_STATUS\n"); - while (pkbuf->len > 0) { - uint8_t *buffer = pkbuf->data; - uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - - size = sizeof(uint8_t); - ogs_assert(ogs_pkbuf_pull(pkbuf, size)); - decoded += size; - - switch(type) { - case OGS_NAS_5GS_5GSM_STATUS_5GSM_CAUSE_TYPE: - size = ogs_nas_5gs_decode_5gsm_cause(&gsm_status->gsm_cause, pkbuf); - ogs_assert(size >= 0); - gsm_status->presencemask |= OGS_NAS_5GS_5GSM_STATUS_5GSM_CAUSE_PRESENT; - decoded += size; - break; - case OGS_NAS_5GS_5GSM_STATUS_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: - size = ogs_nas_5gs_decode_extended_protocol_configuration_options(&gsm_status->extended_protocol_configuration_options, pkbuf); - ogs_assert(size >= 0); - gsm_status->presencemask |= OGS_NAS_5GS_5GSM_STATUS_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - decoded += size; - break; - default: - ogs_warn("Unknown type(0x%x) or not implemented\n", type); - break; - } - } + size = ogs_nas_5gs_decode_5gsm_cause(&gsm_status->gsm_cause, pkbuf); + ogs_assert(size >= 0); + decoded += size; return decoded; } diff --git a/lib/nas/5gs/encoder.c b/lib/nas/5gs/encoder.c index 1dc254369..b50917d2f 100644 --- a/lib/nas/5gs/encoder.c +++ b/lib/nas/5gs/encoder.c @@ -28,7 +28,7 @@ /******************************************************************************* * This file had been created by nas-message.py script v0.2.0 * Please do not modify this file but regenerate it via script. - * Created on: 2020-06-03 23:05:14.888322 by acetcom + * Created on: 2020-06-15 13:46:04.105762 by acetcom * from 24501-g41.docx ******************************************************************************/ @@ -1356,6 +1356,16 @@ int ogs_nas_5gs_encode_configuration_update_complete(ogs_pkbuf_t *pkbuf, ogs_nas encoded += size; } + if (configuration_update_complete->presencemask & OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_ID_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_ID_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_pdu_session_identity_2(pkbuf, &configuration_update_complete->pdu_session_id); + ogs_assert(size >= 0); + encoded += size; + } + if (configuration_update_complete->presencemask & OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_STATUS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_STATUS_TYPE); ogs_assert(size >= 0); @@ -1796,6 +1806,16 @@ int ogs_nas_5gs_encode_ul_nas_transport(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_message_ ogs_assert(size >= 0); encoded += size; + if (ul_nas_transport->presencemask & OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_pdu_session_identity_2(pkbuf, &ul_nas_transport->pdu_session_id); + ogs_assert(size >= 0); + encoded += size; + } + if (ul_nas_transport->presencemask & OGS_NAS_5GS_UL_NAS_TRANSPORT_OLD_PDU_SESSION_ID_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_UL_NAS_TRANSPORT_OLD_PDU_SESSION_ID_TYPE); ogs_assert(size >= 0); @@ -1879,6 +1899,16 @@ int ogs_nas_5gs_encode_dl_nas_transport(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_message_ ogs_assert(size >= 0); encoded += size; + if (dl_nas_transport->presencemask & OGS_NAS_5GS_DL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_DL_NAS_TRANSPORT_PDU_SESSION_ID_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_pdu_session_identity_2(pkbuf, &dl_nas_transport->pdu_session_id); + ogs_assert(size >= 0); + encoded += size; + } + if (dl_nas_transport->presencemask & OGS_NAS_5GS_DL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_DL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE); ogs_assert(size >= 0); @@ -1920,82 +1950,110 @@ int ogs_nas_5gs_encode_pdu_session_establishment_request(ogs_pkbuf_t *pkbuf, ogs ogs_trace("[NAS] Encode PDU_SESSION_ESTABLISHMENT_REQUEST"); - size = ogs_nas_5gs_encode_control_plane_service_type(pkbuf, &pdu_session_establishment_request->control_plane_service_type); + size = ogs_nas_5gs_encode_integrity_protection_maximum_data_rate(pkbuf, &pdu_session_establishment_request->integrity_protection_maximum_data_rate); ogs_assert(size >= 0); encoded += size; - if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_CIOT_SMALL_DATA_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_CIOT_SMALL_DATA_CONTAINER_TYPE); - ogs_assert(size >= 0); - encoded += size; + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_PRESENT) { + pdu_session_establishment_request->pdu_session_type.type = (OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_TYPE >> 4); - size = ogs_nas_5gs_encode_ciot_small_data_container(pkbuf, &pdu_session_establishment_request->ciot_small_data_container); + size = ogs_nas_5gs_encode_pdu_session_type(pkbuf, &pdu_session_establishment_request->pdu_session_type); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE_PRESENT) { - pdu_session_establishment_request->payload_container_type.type = (OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE_TYPE >> 4); + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_PRESENT) { + pdu_session_establishment_request->ssc_mode.type = (OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_TYPE >> 4); - size = ogs_nas_5gs_encode_payload_container_type(pkbuf, &pdu_session_establishment_request->payload_container_type); + size = ogs_nas_5gs_encode_ssc_mode(pkbuf, &pdu_session_establishment_request->ssc_mode); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE); + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_5GSM_CAPABILITY_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_5GSM_CAPABILITY_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_payload_container(pkbuf, &pdu_session_establishment_request->payload_container); + size = ogs_nas_5gs_encode_5gsm_capability(pkbuf, &pdu_session_establishment_request->gsm_capability); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_STATUS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_STATUS_TYPE); + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_pdu_session_status(pkbuf, &pdu_session_establishment_request->pdu_session_status); + size = ogs_nas_5gs_encode_maximum_number_of_supported_packet_filters(pkbuf, &pdu_session_establishment_request->maximum_number_of_supported_packet_filters); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_RELEASE_ASSISTANCE_INDICATION_PRESENT) { - pdu_session_establishment_request->release_assistance_indication.type = (OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_RELEASE_ASSISTANCE_INDICATION_TYPE >> 4); + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT) { + pdu_session_establishment_request->always_on_pdu_session_requested.type = (OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE >> 4); - size = ogs_nas_5gs_encode_release_assistance_indication(pkbuf, &pdu_session_establishment_request->release_assistance_indication); + size = ogs_nas_5gs_encode_always_on_pdu_session_requested(pkbuf, &pdu_session_establishment_request->always_on_pdu_session_requested); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UPLINK_DATA_STATUS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UPLINK_DATA_STATUS_TYPE); + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SM_PDU_DN_REQUEST_CONTAINER_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SM_PDU_DN_REQUEST_CONTAINER_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_uplink_data_status(pkbuf, &pdu_session_establishment_request->uplink_data_status); + size = ogs_nas_5gs_encode_sm_pdu_dn_request_container(pkbuf, &pdu_session_establishment_request->sm_pdu_dn_request_container); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_NAS_MESSAGE_CONTAINER_TYPE); + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_message_container(pkbuf, &pdu_session_establishment_request->nas_message_container); + size = ogs_nas_5gs_encode_extended_protocol_configuration_options(pkbuf, &pdu_session_establishment_request->extended_protocol_configuration_options); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ADDITIONAL_INFORMATION_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ADDITIONAL_INFORMATION_TYPE); + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_additional_information(pkbuf, &pdu_session_establishment_request->additional_information); + size = ogs_nas_5gs_encode_header_compression_configuration(pkbuf, &pdu_session_establishment_request->header_compression_configuration); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_DS_TT_ETHERNET_PORT_MAC_ADDRESS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_DS_TT_ETHERNET_PORT_MAC_ADDRESS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_ds_tt_ethernet_port_mac_address(pkbuf, &pdu_session_establishment_request->ds_tt_ethernet_port_mac_address); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UE_DS_TT_RESIDENCE_TIME_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UE_DS_TT_RESIDENCE_TIME_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_ue_ds_tt_residence_time(pkbuf, &pdu_session_establishment_request->ue_ds_tt_residence_time); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_port_management_information_container(pkbuf, &pdu_session_establishment_request->port_management_information_container); ogs_assert(size >= 0); encoded += size; } @@ -2011,14 +2069,164 @@ int ogs_nas_5gs_encode_pdu_session_establishment_accept(ogs_pkbuf_t *pkbuf, ogs_ ogs_trace("[NAS] Encode PDU_SESSION_ESTABLISHMENT_ACCEPT"); - size = ogs_nas_5gs_encode_s_nssai(pkbuf, &pdu_session_establishment_accept->s_nssai); + size = ogs_nas_5gs_encode_pdu_session_type(pkbuf, &pdu_session_establishment_accept->selected_pdu_session_type); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_establishment_accept->eap_message); + size = ogs_nas_5gs_encode_qos_rules(pkbuf, &pdu_session_establishment_accept->authorized_qos_rules); ogs_assert(size >= 0); encoded += size; + size = ogs_nas_5gs_encode_session_ambr(pkbuf, &pdu_session_establishment_accept->session_ambr); + ogs_assert(size >= 0); + encoded += size; + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_CAUSE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_CAUSE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_establishment_accept->gsm_cause); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_pdu_address(pkbuf, &pdu_session_establishment_accept->pdu_address); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_RQ_TIMER_VALUE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_RQ_TIMER_VALUE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_gprs_timer(pkbuf, &pdu_session_establishment_accept->rq_timer_value); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_S_NSSAI_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_S_NSSAI_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_s_nssai(pkbuf, &pdu_session_establishment_accept->s_nssai); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT) { + pdu_session_establishment_accept->always_on_pdu_session_indication.type = (OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE >> 4); + + size = ogs_nas_5gs_encode_always_on_pdu_session_indication(pkbuf, &pdu_session_establishment_accept->always_on_pdu_session_indication); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_mapped_eps_bearer_contexts(pkbuf, &pdu_session_establishment_accept->mapped_eps_bearer_contexts); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_establishment_accept->eap_message); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_qos_flow_descriptions(pkbuf, &pdu_session_establishment_accept->authorized_qos_flow_descriptions); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_extended_protocol_configuration_options(pkbuf, &pdu_session_establishment_accept->extended_protocol_configuration_options); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_dnn(pkbuf, &pdu_session_establishment_accept->dnn); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_NETWORK_FEATURE_SUPPORT_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_NETWORK_FEATURE_SUPPORT_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_5gsm_network_feature_support(pkbuf, &pdu_session_establishment_accept->gsm_network_feature_support); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_SERVING_PLMN_RATE_CONTROL_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_SERVING_PLMN_RATE_CONTROL_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_serving_plmn_rate_control(pkbuf, &pdu_session_establishment_accept->serving_plmn_rate_control); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ATSSS_CONTAINER_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ATSSS_CONTAINER_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_atsss_container(pkbuf, &pdu_session_establishment_accept->atsss_container); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_CONTROL_PLANE_ONLY_INDICATION_PRESENT) { + pdu_session_establishment_accept->control_plane_only_indication.type = (OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_CONTROL_PLANE_ONLY_INDICATION_TYPE >> 4); + + size = ogs_nas_5gs_encode_control_plane_only_indication(pkbuf, &pdu_session_establishment_accept->control_plane_only_indication); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_accept->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_header_compression_configuration(pkbuf, &pdu_session_establishment_accept->header_compression_configuration); + ogs_assert(size >= 0); + encoded += size; + } + return encoded; } @@ -2030,13 +2238,67 @@ int ogs_nas_5gs_encode_pdu_session_establishment_reject(ogs_pkbuf_t *pkbuf, ogs_ ogs_trace("[NAS] Encode PDU_SESSION_ESTABLISHMENT_REJECT"); - size = ogs_nas_5gs_encode_s_nssai(pkbuf, &pdu_session_establishment_reject->s_nssai); + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_establishment_reject->gsm_cause); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_establishment_reject->eap_message); - ogs_assert(size >= 0); - encoded += size; + if (pdu_session_establishment_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_BACK_OFF_TIMER_VALUE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_BACK_OFF_TIMER_VALUE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_gprs_timer_3(pkbuf, &pdu_session_establishment_reject->back_off_timer_value); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_PRESENT) { + pdu_session_establishment_reject->allowed_ssc_mode.type = (OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_TYPE >> 4); + + size = ogs_nas_5gs_encode_allowed_ssc_mode(pkbuf, &pdu_session_establishment_reject->allowed_ssc_mode); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_establishment_reject->eap_message); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_extended_protocol_configuration_options(pkbuf, &pdu_session_establishment_reject->extended_protocol_configuration_options); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_RE_ATTEMPT_INDICATOR_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_RE_ATTEMPT_INDICATOR_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_re_attempt_indicator(pkbuf, &pdu_session_establishment_reject->re_attempt_indicator); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_establishment_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_5gsm_congestion_re_attempt_indicator(pkbuf, &pdu_session_establishment_reject->gsm_congestion_re_attempt_indicator); + ogs_assert(size >= 0); + encoded += size; + } return encoded; } @@ -2049,14 +2311,20 @@ int ogs_nas_5gs_encode_pdu_session_authentication_command(ogs_pkbuf_t *pkbuf, og ogs_trace("[NAS] Encode PDU_SESSION_AUTHENTICATION_COMMAND"); - size = ogs_nas_5gs_encode_s_nssai(pkbuf, &pdu_session_authentication_command->s_nssai); - ogs_assert(size >= 0); - encoded += size; - size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_authentication_command->eap_message); ogs_assert(size >= 0); encoded += size; + if (pdu_session_authentication_command->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_extended_protocol_configuration_options(pkbuf, &pdu_session_authentication_command->extended_protocol_configuration_options); + ogs_assert(size >= 0); + encoded += size; + } + return encoded; } @@ -2068,64 +2336,10 @@ int ogs_nas_5gs_encode_pdu_session_authentication_complete(ogs_pkbuf_t *pkbuf, o ogs_trace("[NAS] Encode PDU_SESSION_AUTHENTICATION_COMPLETE"); - size = ogs_nas_5gs_encode_integrity_protection_maximum_data_rate(pkbuf, &pdu_session_authentication_complete->integrity_protection_maximum_data_rate); + size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_authentication_complete->eap_message); ogs_assert(size >= 0); encoded += size; - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PDU_SESSION_TYPE_PRESENT) { - pdu_session_authentication_complete->pdu_session_type.type = (OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PDU_SESSION_TYPE_TYPE >> 4); - - size = ogs_nas_5gs_encode_pdu_session_type(pkbuf, &pdu_session_authentication_complete->pdu_session_type); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SSC_MODE_PRESENT) { - pdu_session_authentication_complete->ssc_mode.type = (OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SSC_MODE_TYPE >> 4); - - size = ogs_nas_5gs_encode_ssc_mode(pkbuf, &pdu_session_authentication_complete->ssc_mode); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_5GSM_CAPABILITY_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_5GSM_CAPABILITY_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_5gsm_capability(pkbuf, &pdu_session_authentication_complete->gsm_capability); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_maximum_number_of_supported_packet_filters(pkbuf, &pdu_session_authentication_complete->maximum_number_of_supported_packet_filters); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT) { - pdu_session_authentication_complete->always_on_pdu_session_requested.type = (OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE >> 4); - - size = ogs_nas_5gs_encode_always_on_pdu_session_requested(pkbuf, &pdu_session_authentication_complete->always_on_pdu_session_requested); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SM_PDU_DN_REQUEST_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SM_PDU_DN_REQUEST_CONTAINER_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_sm_pdu_dn_request_container(pkbuf, &pdu_session_authentication_complete->sm_pdu_dn_request_container); - ogs_assert(size >= 0); - encoded += size; - } - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); ogs_assert(size >= 0); @@ -2136,46 +2350,6 @@ int ogs_nas_5gs_encode_pdu_session_authentication_complete(ogs_pkbuf_t *pkbuf, o encoded += size; } - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_HEADER_COMPRESSION_CONFIGURATION_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_header_compression_configuration(pkbuf, &pdu_session_authentication_complete->header_compression_configuration); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_DS_TT_ETHERNET_PORT_MAC_ADDRESS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_DS_TT_ETHERNET_PORT_MAC_ADDRESS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_ds_tt_ethernet_port_mac_address(pkbuf, &pdu_session_authentication_complete->ds_tt_ethernet_port_mac_address); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_UE_DS_TT_RESIDENCE_TIME_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_UE_DS_TT_RESIDENCE_TIME_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_ue_ds_tt_residence_time(pkbuf, &pdu_session_authentication_complete->ue_ds_tt_residence_time); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_port_management_information_container(pkbuf, &pdu_session_authentication_complete->port_management_information_container); - ogs_assert(size >= 0); - encoded += size; - } - return encoded; } @@ -2187,76 +2361,6 @@ int ogs_nas_5gs_encode_pdu_session_authentication_result(ogs_pkbuf_t *pkbuf, ogs ogs_trace("[NAS] Encode PDU_SESSION_AUTHENTICATION_RESULT"); - size = ogs_nas_5gs_encode_pdu_session_type(pkbuf, &pdu_session_authentication_result->selected_pdu_session_type); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_qos_rules(pkbuf, &pdu_session_authentication_result->authorized_qos_rules); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_session_ambr(pkbuf, &pdu_session_authentication_result->session_ambr); - ogs_assert(size >= 0); - encoded += size; - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_CAUSE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_CAUSE_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_authentication_result->gsm_cause); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_PDU_ADDRESS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_PDU_ADDRESS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_pdu_address(pkbuf, &pdu_session_authentication_result->pdu_address); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_RQ_TIMER_VALUE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_RQ_TIMER_VALUE_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_gprs_timer(pkbuf, &pdu_session_authentication_result->rq_timer_value); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_S_NSSAI_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_S_NSSAI_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_s_nssai(pkbuf, &pdu_session_authentication_result->s_nssai); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT) { - pdu_session_authentication_result->always_on_pdu_session_indication.type = (OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE >> 4); - - size = ogs_nas_5gs_encode_always_on_pdu_session_indication(pkbuf, &pdu_session_authentication_result->always_on_pdu_session_indication); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_MAPPED_EPS_BEARER_CONTEXTS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_mapped_eps_bearer_contexts(pkbuf, &pdu_session_authentication_result->mapped_eps_bearer_contexts); - ogs_assert(size >= 0); - encoded += size; - } - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_TYPE); ogs_assert(size >= 0); @@ -2267,16 +2371,6 @@ int ogs_nas_5gs_encode_pdu_session_authentication_result(ogs_pkbuf_t *pkbuf, ogs encoded += size; } - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_qos_flow_descriptions(pkbuf, &pdu_session_authentication_result->authorized_qos_flow_descriptions); - ogs_assert(size >= 0); - encoded += size; - } - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); ogs_assert(size >= 0); @@ -2287,64 +2381,6 @@ int ogs_nas_5gs_encode_pdu_session_authentication_result(ogs_pkbuf_t *pkbuf, ogs encoded += size; } - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_DNN_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_DNN_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_dnn(pkbuf, &pdu_session_authentication_result->dnn); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_NETWORK_FEATURE_SUPPORT_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_NETWORK_FEATURE_SUPPORT_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_5gsm_network_feature_support(pkbuf, &pdu_session_authentication_result->gsm_network_feature_support); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_SERVING_PLMN_RATE_CONTROL_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_SERVING_PLMN_RATE_CONTROL_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_serving_plmn_rate_control(pkbuf, &pdu_session_authentication_result->serving_plmn_rate_control); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ATSSS_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ATSSS_CONTAINER_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_atsss_container(pkbuf, &pdu_session_authentication_result->atsss_container); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_CONTROL_PLANE_ONLY_INDICATION_PRESENT) { - pdu_session_authentication_result->control_plane_only_indication.type = (OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_CONTROL_PLANE_ONLY_INDICATION_TYPE >> 4); - - size = ogs_nas_5gs_encode_control_plane_only_indication(pkbuf, &pdu_session_authentication_result->control_plane_only_indication); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_authentication_result->presencemask & OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_HEADER_COMPRESSION_CONFIGURATION_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_header_compression_configuration(pkbuf, &pdu_session_authentication_result->header_compression_configuration); - ogs_assert(size >= 0); - encoded += size; - } - return encoded; } @@ -2356,34 +2392,80 @@ int ogs_nas_5gs_encode_pdu_session_modification_request(ogs_pkbuf_t *pkbuf, ogs_ ogs_trace("[NAS] Encode PDU_SESSION_MODIFICATION_REQUEST"); - size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_modification_request->gsm_cause); - ogs_assert(size >= 0); - encoded += size; - - if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_BACK_OFF_TIMER_VALUE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_BACK_OFF_TIMER_VALUE_TYPE); + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAPABILITY_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAPABILITY_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_gprs_timer_3(pkbuf, &pdu_session_modification_request->back_off_timer_value); + size = ogs_nas_5gs_encode_5gsm_capability(pkbuf, &pdu_session_modification_request->gsm_capability); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALLOWED_SSC_MODE_PRESENT) { - pdu_session_modification_request->allowed_ssc_mode.type = (OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALLOWED_SSC_MODE_TYPE >> 4); + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAUSE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAUSE_TYPE); + ogs_assert(size >= 0); + encoded += size; - size = ogs_nas_5gs_encode_allowed_ssc_mode(pkbuf, &pdu_session_modification_request->allowed_ssc_mode); + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_modification_request->gsm_cause); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EAP_MESSAGE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EAP_MESSAGE_TYPE); + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_modification_request->eap_message); + size = ogs_nas_5gs_encode_maximum_number_of_supported_packet_filters(pkbuf, &pdu_session_modification_request->maximum_number_of_supported_packet_filters); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT) { + pdu_session_modification_request->always_on_pdu_session_requested.type = (OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE >> 4); + + size = ogs_nas_5gs_encode_always_on_pdu_session_requested(pkbuf, &pdu_session_modification_request->always_on_pdu_session_requested); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_integrity_protection_maximum_data_rate(pkbuf, &pdu_session_modification_request->integrity_protection_maximum_data_rate); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_RULES_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_RULES_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_qos_rules(pkbuf, &pdu_session_modification_request->requested_qos_rules); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_FLOW_DESCRIPTIONS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_FLOW_DESCRIPTIONS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_qos_flow_descriptions(pkbuf, &pdu_session_modification_request->requested_qos_flow_descriptions); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_mapped_eps_bearer_contexts(pkbuf, &pdu_session_modification_request->mapped_eps_bearer_contexts); ogs_assert(size >= 0); encoded += size; } @@ -2398,22 +2480,22 @@ int ogs_nas_5gs_encode_pdu_session_modification_request(ogs_pkbuf_t *pkbuf, ogs_ encoded += size; } - if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_RE_ATTEMPT_INDICATOR_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_RE_ATTEMPT_INDICATOR_TYPE); + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_re_attempt_indicator(pkbuf, &pdu_session_modification_request->re_attempt_indicator); + size = ogs_nas_5gs_encode_port_management_information_container(pkbuf, &pdu_session_modification_request->port_management_information_container); ogs_assert(size >= 0); encoded += size; } - if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE); + if (pdu_session_modification_request->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_5gsm_congestion_re_attempt_indicator(pkbuf, &pdu_session_modification_request->gsm_congestion_re_attempt_indicator); + size = ogs_nas_5gs_encode_header_compression_configuration(pkbuf, &pdu_session_modification_request->header_compression_configuration); ogs_assert(size >= 0); encoded += size; } @@ -2429,10 +2511,20 @@ int ogs_nas_5gs_encode_pdu_session_modification_reject(ogs_pkbuf_t *pkbuf, ogs_n ogs_trace("[NAS] Encode PDU_SESSION_MODIFICATION_REJECT"); - size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_modification_reject->eap_message); + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_modification_reject->gsm_cause); ogs_assert(size >= 0); encoded += size; + if (pdu_session_modification_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_gprs_timer_3(pkbuf, &pdu_session_modification_reject->back_off_timer_value); + ogs_assert(size >= 0); + encoded += size; + } + if (pdu_session_modification_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); ogs_assert(size >= 0); @@ -2443,6 +2535,26 @@ int ogs_nas_5gs_encode_pdu_session_modification_reject(ogs_pkbuf_t *pkbuf, ogs_n encoded += size; } + if (pdu_session_modification_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_re_attempt_indicator(pkbuf, &pdu_session_modification_reject->re_attempt_indicator); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_5gsm_congestion_re_attempt_indicator(pkbuf, &pdu_session_modification_reject->gsm_congestion_re_attempt_indicator); + ogs_assert(size >= 0); + encoded += size; + } + return encoded; } @@ -2454,9 +2566,73 @@ int ogs_nas_5gs_encode_pdu_session_modification_command(ogs_pkbuf_t *pkbuf, ogs_ ogs_trace("[NAS] Encode PDU_SESSION_MODIFICATION_COMMAND"); - size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_modification_command->eap_message); - ogs_assert(size >= 0); - encoded += size; + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_5GSM_CAUSE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_5GSM_CAUSE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_modification_command->gsm_cause); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_session_ambr(pkbuf, &pdu_session_modification_command->session_ambr); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_RQ_TIMER_VALUE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_RQ_TIMER_VALUE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_gprs_timer(pkbuf, &pdu_session_modification_command->rq_timer_value); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT) { + pdu_session_modification_command->always_on_pdu_session_indication.type = (OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE >> 4); + + size = ogs_nas_5gs_encode_always_on_pdu_session_indication(pkbuf, &pdu_session_modification_command->always_on_pdu_session_indication); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_RULES_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_RULES_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_qos_rules(pkbuf, &pdu_session_modification_command->authorized_qos_rules); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_mapped_eps_bearer_contexts(pkbuf, &pdu_session_modification_command->mapped_eps_bearer_contexts); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_qos_flow_descriptions(pkbuf, &pdu_session_modification_command->authorized_qos_flow_descriptions); + ogs_assert(size >= 0); + encoded += size; + } if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); @@ -2468,6 +2644,46 @@ int ogs_nas_5gs_encode_pdu_session_modification_command(ogs_pkbuf_t *pkbuf, ogs_ encoded += size; } + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ATSSS_CONTAINER_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ATSSS_CONTAINER_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_atsss_container(pkbuf, &pdu_session_modification_command->atsss_container); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_HEADER_COMPRESSION_CONFIGURATION_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_header_compression_configuration(pkbuf, &pdu_session_modification_command->header_compression_configuration); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_port_management_information_container(pkbuf, &pdu_session_modification_command->port_management_information_container); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_modification_command->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SERVING_PLMN_RATE_CONTROL_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SERVING_PLMN_RATE_CONTROL_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_serving_plmn_rate_control(pkbuf, &pdu_session_modification_command->serving_plmn_rate_control); + ogs_assert(size >= 0); + encoded += size; + } + return encoded; } @@ -2479,16 +2695,6 @@ int ogs_nas_5gs_encode_pdu_session_modification_complete(ogs_pkbuf_t *pkbuf, ogs ogs_trace("[NAS] Encode PDU_SESSION_MODIFICATION_COMPLETE"); - if (pdu_session_modification_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EAP_MESSAGE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EAP_MESSAGE_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_modification_complete->eap_message); - ogs_assert(size >= 0); - encoded += size; - } - if (pdu_session_modification_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); ogs_assert(size >= 0); @@ -2499,6 +2705,16 @@ int ogs_nas_5gs_encode_pdu_session_modification_complete(ogs_pkbuf_t *pkbuf, ogs encoded += size; } + if (pdu_session_modification_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_port_management_information_container(pkbuf, &pdu_session_modification_complete->port_management_information_container); + ogs_assert(size >= 0); + encoded += size; + } + return encoded; } @@ -2510,83 +2726,9 @@ int ogs_nas_5gs_encode_pdu_session_modification_command_reject(ogs_pkbuf_t *pkbu ogs_trace("[NAS] Encode PDU_SESSION_MODIFICATION_COMMAND_REJECT"); - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAPABILITY_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAPABILITY_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_5gsm_capability(pkbuf, &pdu_session_modification_command_reject->gsm_capability); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAUSE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAUSE_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_modification_command_reject->gsm_cause); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_maximum_number_of_supported_packet_filters(pkbuf, &pdu_session_modification_command_reject->maximum_number_of_supported_packet_filters); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT) { - pdu_session_modification_command_reject->always_on_pdu_session_requested.type = (OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE >> 4); - - size = ogs_nas_5gs_encode_always_on_pdu_session_requested(pkbuf, &pdu_session_modification_command_reject->always_on_pdu_session_requested); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_integrity_protection_maximum_data_rate(pkbuf, &pdu_session_modification_command_reject->integrity_protection_maximum_data_rate); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_RULES_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_RULES_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_qos_rules(pkbuf, &pdu_session_modification_command_reject->requested_qos_rules); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_FLOW_DESCRIPTIONS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_FLOW_DESCRIPTIONS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_qos_flow_descriptions(pkbuf, &pdu_session_modification_command_reject->requested_qos_flow_descriptions); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAPPED_EPS_BEARER_CONTEXTS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_mapped_eps_bearer_contexts(pkbuf, &pdu_session_modification_command_reject->mapped_eps_bearer_contexts); - ogs_assert(size >= 0); - encoded += size; - } + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_modification_command_reject->gsm_cause); + ogs_assert(size >= 0); + encoded += size; if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); @@ -2598,26 +2740,6 @@ int ogs_nas_5gs_encode_pdu_session_modification_command_reject(ogs_pkbuf_t *pkbu encoded += size; } - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_port_management_information_container(pkbuf, &pdu_session_modification_command_reject->port_management_information_container); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_modification_command_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_HEADER_COMPRESSION_CONFIGURATION_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_header_compression_configuration(pkbuf, &pdu_session_modification_command_reject->header_compression_configuration); - ogs_assert(size >= 0); - encoded += size; - } - return encoded; } @@ -2629,16 +2751,12 @@ int ogs_nas_5gs_encode_pdu_session_release_request(ogs_pkbuf_t *pkbuf, ogs_nas_5 ogs_trace("[NAS] Encode PDU_SESSION_RELEASE_REQUEST"); - size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_release_request->gsm_cause); - ogs_assert(size >= 0); - encoded += size; - - if (pdu_session_release_request->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_BACK_OFF_TIMER_VALUE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_BACK_OFF_TIMER_VALUE_TYPE); + if (pdu_session_release_request->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CAUSE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CAUSE_TYPE); ogs_assert(size >= 0); encoded += size; - size = ogs_nas_5gs_encode_gprs_timer_3(pkbuf, &pdu_session_release_request->back_off_timer_value); + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_release_request->gsm_cause); ogs_assert(size >= 0); encoded += size; } @@ -2653,26 +2771,6 @@ int ogs_nas_5gs_encode_pdu_session_release_request(ogs_pkbuf_t *pkbuf, ogs_nas_5 encoded += size; } - if (pdu_session_release_request->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_RE_ATTEMPT_INDICATOR_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_RE_ATTEMPT_INDICATOR_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_re_attempt_indicator(pkbuf, &pdu_session_release_request->re_attempt_indicator); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_request->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_5gsm_congestion_re_attempt_indicator(pkbuf, &pdu_session_release_request->gsm_congestion_re_attempt_indicator); - ogs_assert(size >= 0); - encoded += size; - } - return encoded; } @@ -2684,73 +2782,9 @@ int ogs_nas_5gs_encode_pdu_session_release_reject(ogs_pkbuf_t *pkbuf, ogs_nas_5g ogs_trace("[NAS] Encode PDU_SESSION_RELEASE_REJECT"); - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_5GSM_CAUSE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_5GSM_CAUSE_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_release_reject->gsm_cause); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SESSION_AMBR_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SESSION_AMBR_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_session_ambr(pkbuf, &pdu_session_release_reject->session_ambr); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_RQ_TIMER_VALUE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_RQ_TIMER_VALUE_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_gprs_timer(pkbuf, &pdu_session_release_reject->rq_timer_value); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT) { - pdu_session_release_reject->always_on_pdu_session_indication.type = (OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE >> 4); - - size = ogs_nas_5gs_encode_always_on_pdu_session_indication(pkbuf, &pdu_session_release_reject->always_on_pdu_session_indication); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_RULES_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_RULES_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_qos_rules(pkbuf, &pdu_session_release_reject->authorized_qos_rules); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_MAPPED_EPS_BEARER_CONTEXTS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_mapped_eps_bearer_contexts(pkbuf, &pdu_session_release_reject->mapped_eps_bearer_contexts); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_qos_flow_descriptions(pkbuf, &pdu_session_release_reject->authorized_qos_flow_descriptions); - ogs_assert(size >= 0); - encoded += size; - } + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_release_reject->gsm_cause); + ogs_assert(size >= 0); + encoded += size; if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); @@ -2762,46 +2796,6 @@ int ogs_nas_5gs_encode_pdu_session_release_reject(ogs_pkbuf_t *pkbuf, ogs_nas_5g encoded += size; } - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ATSSS_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ATSSS_CONTAINER_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_atsss_container(pkbuf, &pdu_session_release_reject->atsss_container); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_HEADER_COMPRESSION_CONFIGURATION_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_header_compression_configuration(pkbuf, &pdu_session_release_reject->header_compression_configuration); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_port_management_information_container(pkbuf, &pdu_session_release_reject->port_management_information_container); - ogs_assert(size >= 0); - encoded += size; - } - - if (pdu_session_release_reject->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SERVING_PLMN_RATE_CONTROL_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SERVING_PLMN_RATE_CONTROL_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_serving_plmn_rate_control(pkbuf, &pdu_session_release_reject->serving_plmn_rate_control); - ogs_assert(size >= 0); - encoded += size; - } - return encoded; } @@ -2813,6 +2807,40 @@ int ogs_nas_5gs_encode_pdu_session_release_command(ogs_pkbuf_t *pkbuf, ogs_nas_5 ogs_trace("[NAS] Encode PDU_SESSION_RELEASE_COMMAND"); + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_release_command->gsm_cause); + ogs_assert(size >= 0); + encoded += size; + + if (pdu_session_release_command->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_BACK_OFF_TIMER_VALUE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_BACK_OFF_TIMER_VALUE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_gprs_timer_3(pkbuf, &pdu_session_release_command->back_off_timer_value); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_release_command->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_eap_message(pkbuf, &pdu_session_release_command->eap_message); + ogs_assert(size >= 0); + encoded += size; + } + + if (pdu_session_release_command->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_5gsm_congestion_re_attempt_indicator(pkbuf, &pdu_session_release_command->gsm_congestion_re_attempt_indicator); + ogs_assert(size >= 0); + encoded += size; + } + if (pdu_session_release_command->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); ogs_assert(size >= 0); @@ -2823,12 +2851,10 @@ int ogs_nas_5gs_encode_pdu_session_release_command(ogs_pkbuf_t *pkbuf, ogs_nas_5 encoded += size; } - if (pdu_session_release_command->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE); - ogs_assert(size >= 0); - encoded += size; + if (pdu_session_release_command->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_ACCESS_TYPE_PRESENT) { + pdu_session_release_command->access_type.type = (OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_ACCESS_TYPE_TYPE >> 4); - size = ogs_nas_5gs_encode_port_management_information_container(pkbuf, &pdu_session_release_command->port_management_information_container); + size = ogs_nas_5gs_encode_access_type(pkbuf, &pdu_session_release_command->access_type); ogs_assert(size >= 0); encoded += size; } @@ -2844,9 +2870,15 @@ int ogs_nas_5gs_encode_pdu_session_release_complete(ogs_pkbuf_t *pkbuf, ogs_nas_ ogs_trace("[NAS] Encode PDU_SESSION_RELEASE_COMPLETE"); - size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_release_complete->gsm_cause); - ogs_assert(size >= 0); - encoded += size; + if (pdu_session_release_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_5GSM_CAUSE_PRESENT) { + size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_5GSM_CAUSE_TYPE); + ogs_assert(size >= 0); + encoded += size; + + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &pdu_session_release_complete->gsm_cause); + ogs_assert(size >= 0); + encoded += size; + } if (pdu_session_release_complete->presencemask & OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); @@ -2869,25 +2901,9 @@ int ogs_nas_5gs_encode_5gsm_status(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_message_t *me ogs_trace("[NAS] Encode 5GSM_STATUS"); - if (gsm_status->presencemask & OGS_NAS_5GS_5GSM_STATUS_5GSM_CAUSE_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_5GSM_STATUS_5GSM_CAUSE_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &gsm_status->gsm_cause); - ogs_assert(size >= 0); - encoded += size; - } - - if (gsm_status->presencemask & OGS_NAS_5GS_5GSM_STATUS_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - size = ogs_nas_5gs_encode_optional_type(pkbuf, OGS_NAS_5GS_5GSM_STATUS_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - ogs_assert(size >= 0); - encoded += size; - - size = ogs_nas_5gs_encode_extended_protocol_configuration_options(pkbuf, &gsm_status->extended_protocol_configuration_options); - ogs_assert(size >= 0); - encoded += size; - } + size = ogs_nas_5gs_encode_5gsm_cause(pkbuf, &gsm_status->gsm_cause); + ogs_assert(size >= 0); + encoded += size; return encoded; } diff --git a/lib/nas/5gs/ies.c b/lib/nas/5gs/ies.c index 091dd5bb2..dba518e44 100644 --- a/lib/nas/5gs/ies.c +++ b/lib/nas/5gs/ies.c @@ -28,7 +28,7 @@ /******************************************************************************* * This file had been created by nas-message.py script v0.2.0 * Please do not modify this file but regenerate it via script. - * Created on: 2020-06-03 23:05:14.860106 by acetcom + * Created on: 2020-06-15 13:46:04.075315 by acetcom * from 24501-g41.docx ******************************************************************************/ @@ -122,7 +122,7 @@ int ogs_nas_5gs_decode_dnn(ogs_nas_dnn_t *dnn, ogs_pkbuf_t *pkbuf) { char data_network_name[OGS_MAX_DNN_LEN]; - dnn->length = ogs_fqdn_parse(data_network_name, dnn->value, dnn->length); + dnn->length = ogs_fqdn_parse(data_network_name, dnn->value, dnn->length); ogs_cpystrn(dnn->value, data_network_name, ogs_min(dnn->length, OGS_MAX_DNN_LEN) + 1); } @@ -3035,6 +3035,9 @@ int ogs_nas_5gs_decode_session_ambr(ogs_nas_session_ambr_t *session_ambr, ogs_pk ogs_assert(ogs_pkbuf_pull(pkbuf, size)); memcpy(session_ambr, pkbuf->data - size, size); + session_ambr->downlink.bitrate = be16toh(source->downlink.bitrate); + session_ambr->uplink.bitrate = be16toh(source->uplink.bitrate); + ogs_trace(" SESSION_AMBR - "); ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); @@ -3047,6 +3050,9 @@ int ogs_nas_5gs_encode_session_ambr(ogs_pkbuf_t *pkbuf, ogs_nas_session_ambr_t * ogs_nas_session_ambr_t target; memcpy(&target, session_ambr, sizeof(ogs_nas_session_ambr_t)); + target.downlink.bitrate = htobe16(session_ambr->downlink.bitrate); + target.uplink.bitrate = htobe16(session_ambr->uplink.bitrate); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); memcpy(pkbuf->data - size, &target, size); diff --git a/lib/nas/5gs/ies.h b/lib/nas/5gs/ies.h index 3193c60f8..99cd5b610 100644 --- a/lib/nas/5gs/ies.h +++ b/lib/nas/5gs/ies.h @@ -28,7 +28,7 @@ /******************************************************************************* * This file had been created by nas-message.py script v0.2.0 * Please do not modify this file but regenerate it via script. - * Created on: 2020-06-03 23:05:14.857252 by acetcom + * Created on: 2020-06-15 13:46:04.070975 by acetcom * from 24501-g41.docx ******************************************************************************/ diff --git a/lib/nas/5gs/message.h b/lib/nas/5gs/message.h index a5844b867..b634a3f59 100644 --- a/lib/nas/5gs/message.h +++ b/lib/nas/5gs/message.h @@ -28,7 +28,7 @@ /******************************************************************************* * This file had been created by nas-message.py script v0.2.0 * Please do not modify this file but regenerate it via script. - * Created on: 2020-06-03 23:05:14.869400 by acetcom + * Created on: 2020-06-15 13:46:04.086829 by acetcom * from 24501-g41.docx ******************************************************************************/ @@ -578,14 +578,16 @@ typedef struct ogs_nas_5gs_configuration_update_command_s { #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_CIOT_SMALL_DATA_CONTAINER_PRESENT ((uint64_t)1<<0) #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PAYLOAD_CONTAINER_TYPE_PRESENT ((uint64_t)1<<1) #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PAYLOAD_CONTAINER_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_STATUS_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_RELEASE_ASSISTANCE_INDICATION_PRESENT ((uint64_t)1<<4) -#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_UPLINK_DATA_STATUS_PRESENT ((uint64_t)1<<5) -#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_NAS_MESSAGE_CONTAINER_PRESENT ((uint64_t)1<<6) -#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_ADDITIONAL_INFORMATION_PRESENT ((uint64_t)1<<7) +#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_ID_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_STATUS_PRESENT ((uint64_t)1<<4) +#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_RELEASE_ASSISTANCE_INDICATION_PRESENT ((uint64_t)1<<5) +#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_UPLINK_DATA_STATUS_PRESENT ((uint64_t)1<<6) +#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_NAS_MESSAGE_CONTAINER_PRESENT ((uint64_t)1<<7) +#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_ADDITIONAL_INFORMATION_PRESENT ((uint64_t)1<<8) #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_CIOT_SMALL_DATA_CONTAINER_TYPE 0x6F #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PAYLOAD_CONTAINER_TYPE_TYPE 0x80 #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PAYLOAD_CONTAINER_TYPE 0x7B +#define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_ID_TYPE 0x12 #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_PDU_SESSION_STATUS_TYPE 0x50 #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_RELEASE_ASSISTANCE_INDICATION_TYPE 0xF0 #define OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE_UPLINK_DATA_STATUS_TYPE 0x40 @@ -817,15 +819,17 @@ typedef struct ogs_nas_5gs_notification_response_s { /******************************************************* * UL NAS TRANSPORT ******************************************************/ -#define OGS_NAS_5GS_UL_NAS_TRANSPORT_OLD_PDU_SESSION_ID_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_UL_NAS_TRANSPORT_REQUEST_TYPE_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_UL_NAS_TRANSPORT_DNN_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_UL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT ((uint64_t)1<<4) -#define OGS_NAS_5GS_UL_NAS_TRANSPORT_MA_PDU_SESSION_INFORMATION_PRESENT ((uint64_t)1<<5) -#define OGS_NAS_5GS_UL_NAS_TRANSPORT_RELEASE_ASSISTANCE_INDICATION_PRESENT ((uint64_t)1<<6) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_OLD_PDU_SESSION_ID_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_REQUEST_TYPE_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_DNN_PRESENT ((uint64_t)1<<4) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT ((uint64_t)1<<5) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_MA_PDU_SESSION_INFORMATION_PRESENT ((uint64_t)1<<6) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_RELEASE_ASSISTANCE_INDICATION_PRESENT ((uint64_t)1<<7) +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_TYPE 0x12 #define OGS_NAS_5GS_UL_NAS_TRANSPORT_OLD_PDU_SESSION_ID_TYPE 0x59 -#define OGS_NAS_5GS_UL_NAS_TRANSPORT_REQUEST_TYPE_TYPE 0x8 +#define OGS_NAS_5GS_UL_NAS_TRANSPORT_REQUEST_TYPE_TYPE 0x80 #define OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_TYPE 0x22 #define OGS_NAS_5GS_UL_NAS_TRANSPORT_DNN_TYPE 0x25 #define OGS_NAS_5GS_UL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE 0x24 @@ -836,10 +840,10 @@ typedef struct ogs_nas_5gs_ul_nas_transport_s { /* Mandatory fields */ ogs_nas_payload_container_type_t payload_container_type; ogs_nas_payload_container_t payload_container; - ogs_nas_pdu_session_identity_2_t pdu_session_id; /* Optional fields */ uint64_t presencemask; + ogs_nas_pdu_session_identity_2_t pdu_session_id; ogs_nas_pdu_session_identity_2_t old_pdu_session_id; ogs_nas_request_type_t request_type; ogs_nas_s_nssai_t s_nssai; @@ -853,9 +857,11 @@ typedef struct ogs_nas_5gs_ul_nas_transport_s { /******************************************************* * DL NAS TRANSPORT ******************************************************/ -#define OGS_NAS_5GS_DL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_DL_NAS_TRANSPORT_5GMM_CAUSE_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_DL_NAS_TRANSPORT_BACK_OFF_TIMER_VALUE_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_DL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_DL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_DL_NAS_TRANSPORT_5GMM_CAUSE_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_DL_NAS_TRANSPORT_BACK_OFF_TIMER_VALUE_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_DL_NAS_TRANSPORT_PDU_SESSION_ID_TYPE 0x12 #define OGS_NAS_5GS_DL_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE 0x24 #define OGS_NAS_5GS_DL_NAS_TRANSPORT_5GMM_CAUSE_TYPE 0x58 #define OGS_NAS_5GS_DL_NAS_TRANSPORT_BACK_OFF_TIMER_VALUE_TYPE 0x37 @@ -864,10 +870,10 @@ typedef struct ogs_nas_5gs_dl_nas_transport_s { /* Mandatory fields */ ogs_nas_payload_container_type_t payload_container_type; ogs_nas_payload_container_t payload_container; - ogs_nas_pdu_session_identity_2_t pdu_session_id; /* Optional fields */ uint64_t presencemask; + ogs_nas_pdu_session_identity_2_t pdu_session_id; ogs_nas_additional_information_t additional_information; ogs_nas_5gmm_cause_t gmm_cause; ogs_nas_gprs_timer_3_t back_off_timer_value; @@ -877,101 +883,30 @@ typedef struct ogs_nas_5gs_dl_nas_transport_s { /******************************************************* * PDU SESSION ESTABLISHMENT REQUEST ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_CIOT_SMALL_DATA_CONTAINER_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_STATUS_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_RELEASE_ASSISTANCE_INDICATION_PRESENT ((uint64_t)1<<4) -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UPLINK_DATA_STATUS_PRESENT ((uint64_t)1<<5) -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT ((uint64_t)1<<6) -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ADDITIONAL_INFORMATION_PRESENT ((uint64_t)1<<7) -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_CIOT_SMALL_DATA_CONTAINER_TYPE 0x6F -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE_TYPE 0x80 -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PAYLOAD_CONTAINER_TYPE 0x7B -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_STATUS_TYPE 0x50 -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_RELEASE_ASSISTANCE_INDICATION_TYPE 0xF0 -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UPLINK_DATA_STATUS_TYPE 0x40 -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_NAS_MESSAGE_CONTAINER_TYPE 0x71 -#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ADDITIONAL_INFORMATION_TYPE 0x24 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_5GSM_CAPABILITY_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT ((uint64_t)1<<4) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SM_PDU_DN_REQUEST_CONTAINER_PRESENT ((uint64_t)1<<5) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<6) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT ((uint64_t)1<<7) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_DS_TT_ETHERNET_PORT_MAC_ADDRESS_PRESENT ((uint64_t)1<<8) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UE_DS_TT_RESIDENCE_TIME_PRESENT ((uint64_t)1<<9) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT ((uint64_t)1<<10) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_TYPE 0x90 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_TYPE 0xA0 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_5GSM_CAPABILITY_TYPE 0x28 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE 0x55 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE 0xB0 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SM_PDU_DN_REQUEST_CONTAINER_TYPE 0x39 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_DS_TT_ETHERNET_PORT_MAC_ADDRESS_TYPE 0x6E +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_UE_DS_TT_RESIDENCE_TIME_TYPE 0x6F +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE 0x7C typedef struct ogs_nas_5gs_pdu_session_establishment_request_s { - /* Mandatory fields */ - ogs_nas_control_plane_service_type_t control_plane_service_type; - - /* Optional fields */ - uint64_t presencemask; - ogs_nas_ciot_small_data_container_t ciot_small_data_container; - ogs_nas_payload_container_type_t payload_container_type; - ogs_nas_payload_container_t payload_container; - ogs_nas_pdu_session_identity_2_t pdu_session_id; - ogs_nas_pdu_session_status_t pdu_session_status; - ogs_nas_release_assistance_indication_t release_assistance_indication; - ogs_nas_uplink_data_status_t uplink_data_status; - ogs_nas_message_container_t nas_message_container; - ogs_nas_additional_information_t additional_information; -} ogs_nas_5gs_pdu_session_establishment_request_t; - - -/******************************************************* - * PDU SESSION ESTABLISHMENT ACCEPT - ******************************************************/ - -typedef struct ogs_nas_5gs_pdu_session_establishment_accept_s { - /* Mandatory fields */ - ogs_nas_s_nssai_t s_nssai; - ogs_nas_eap_message_t eap_message; -} ogs_nas_5gs_pdu_session_establishment_accept_t; - - -/******************************************************* - * PDU SESSION ESTABLISHMENT REJECT - ******************************************************/ - -typedef struct ogs_nas_5gs_pdu_session_establishment_reject_s { - /* Mandatory fields */ - ogs_nas_s_nssai_t s_nssai; - ogs_nas_eap_message_t eap_message; -} ogs_nas_5gs_pdu_session_establishment_reject_t; - - -/******************************************************* - * PDU SESSION AUTHENTICATION COMMAND - ******************************************************/ - -typedef struct ogs_nas_5gs_pdu_session_authentication_command_s { - /* Mandatory fields */ - ogs_nas_s_nssai_t s_nssai; - ogs_nas_eap_message_t eap_message; -} ogs_nas_5gs_pdu_session_authentication_command_t; - - -/******************************************************* - * PDU SESSION AUTHENTICATION COMPLETE - ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PDU_SESSION_TYPE_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SSC_MODE_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_5GSM_CAPABILITY_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT ((uint64_t)1<<4) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SM_PDU_DN_REQUEST_CONTAINER_PRESENT ((uint64_t)1<<5) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<6) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_HEADER_COMPRESSION_CONFIGURATION_PRESENT ((uint64_t)1<<7) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_DS_TT_ETHERNET_PORT_MAC_ADDRESS_PRESENT ((uint64_t)1<<8) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_UE_DS_TT_RESIDENCE_TIME_PRESENT ((uint64_t)1<<9) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT ((uint64_t)1<<10) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PDU_SESSION_TYPE_TYPE 0x90 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SSC_MODE_TYPE 0xA0 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_5GSM_CAPABILITY_TYPE 0x28 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE 0x55 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE 0xB0 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_SM_PDU_DN_REQUEST_CONTAINER_TYPE 0x39 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_DS_TT_ETHERNET_PORT_MAC_ADDRESS_TYPE 0x6E -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_UE_DS_TT_RESIDENCE_TIME_TYPE 0x6F -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE 0x7C - -typedef struct ogs_nas_5gs_pdu_session_authentication_complete_s { /* Mandatory fields */ ogs_nas_integrity_protection_maximum_data_rate_t integrity_protection_maximum_data_rate; @@ -988,44 +923,44 @@ typedef struct ogs_nas_5gs_pdu_session_authentication_complete_s { ogs_nas_ds_tt_ethernet_port_mac_address_t ds_tt_ethernet_port_mac_address; ogs_nas_ue_ds_tt_residence_time_t ue_ds_tt_residence_time; ogs_nas_port_management_information_container_t port_management_information_container; -} ogs_nas_5gs_pdu_session_authentication_complete_t; +} ogs_nas_5gs_pdu_session_establishment_request_t; /******************************************************* - * PDU SESSION AUTHENTICATION RESULT + * PDU SESSION ESTABLISHMENT ACCEPT ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_CAUSE_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_PDU_ADDRESS_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_RQ_TIMER_VALUE_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_S_NSSAI_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT ((uint64_t)1<<4) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT ((uint64_t)1<<5) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENT ((uint64_t)1<<6) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT ((uint64_t)1<<7) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<8) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_DNN_PRESENT ((uint64_t)1<<9) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_NETWORK_FEATURE_SUPPORT_PRESENT ((uint64_t)1<<10) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_SERVING_PLMN_RATE_CONTROL_PRESENT ((uint64_t)1<<11) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ATSSS_CONTAINER_PRESENT ((uint64_t)1<<12) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_CONTROL_PLANE_ONLY_INDICATION_PRESENT ((uint64_t)1<<13) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_HEADER_COMPRESSION_CONFIGURATION_PRESENT ((uint64_t)1<<14) -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_CAUSE_TYPE 0x59 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_PDU_ADDRESS_TYPE 0x29 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_RQ_TIMER_VALUE_TYPE 0x56 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_S_NSSAI_TYPE 0x22 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE 0x80 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_MAPPED_EPS_BEARER_CONTEXTS_TYPE 0x75 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_TYPE 0x78 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE 0x79 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_DNN_TYPE 0x25 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_5GSM_NETWORK_FEATURE_SUPPORT_TYPE 0x17 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_SERVING_PLMN_RATE_CONTROL_TYPE 0x18 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_ATSSS_CONTAINER_TYPE 0x77 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_CONTROL_PLANE_ONLY_INDICATION_TYPE 0xC0 -#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_CAUSE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_RQ_TIMER_VALUE_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_S_NSSAI_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT ((uint64_t)1<<4) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT ((uint64_t)1<<5) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_PRESENT ((uint64_t)1<<6) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT ((uint64_t)1<<7) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<8) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_PRESENT ((uint64_t)1<<9) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_NETWORK_FEATURE_SUPPORT_PRESENT ((uint64_t)1<<10) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_SERVING_PLMN_RATE_CONTROL_PRESENT ((uint64_t)1<<11) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ATSSS_CONTAINER_PRESENT ((uint64_t)1<<12) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_CONTROL_PLANE_ONLY_INDICATION_PRESENT ((uint64_t)1<<13) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_PRESENT ((uint64_t)1<<14) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_CAUSE_TYPE 0x59 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_TYPE 0x29 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_RQ_TIMER_VALUE_TYPE 0x56 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_S_NSSAI_TYPE 0x22 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE 0x80 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_TYPE 0x75 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_TYPE 0x78 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE 0x79 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_TYPE 0x25 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_NETWORK_FEATURE_SUPPORT_TYPE 0x17 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_SERVING_PLMN_RATE_CONTROL_TYPE 0x18 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_ATSSS_CONTAINER_TYPE 0x77 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_CONTROL_PLANE_ONLY_INDICATION_TYPE 0xC0 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66 -typedef struct ogs_nas_5gs_pdu_session_authentication_result_s { +typedef struct ogs_nas_5gs_pdu_session_establishment_accept_s { /* Mandatory fields */ ogs_nas_pdu_session_type_t selected_pdu_session_type; ogs_nas_qos_rules_t authorized_qos_rules; @@ -1048,26 +983,26 @@ typedef struct ogs_nas_5gs_pdu_session_authentication_result_s { ogs_nas_atsss_container_t atsss_container; ogs_nas_control_plane_only_indication_t control_plane_only_indication; ogs_nas_header_compression_configuration_t header_compression_configuration; -} ogs_nas_5gs_pdu_session_authentication_result_t; +} ogs_nas_5gs_pdu_session_establishment_accept_t; /******************************************************* - * PDU SESSION MODIFICATION REQUEST + * PDU SESSION ESTABLISHMENT REJECT ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_BACK_OFF_TIMER_VALUE_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALLOWED_SSC_MODE_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EAP_MESSAGE_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<4) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<5) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_BACK_OFF_TIMER_VALUE_TYPE 0x37 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALLOWED_SSC_MODE_TYPE 0xF0 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EAP_MESSAGE_TYPE 0x78 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_RE_ATTEMPT_INDICATOR_TYPE 0x1D -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE 0x61 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_BACK_OFF_TIMER_VALUE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<4) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<5) +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_BACK_OFF_TIMER_VALUE_TYPE 0x37 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_TYPE 0xF0 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_TYPE 0x78 +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_RE_ATTEMPT_INDICATOR_TYPE 0x1D +#define OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE 0x61 -typedef struct ogs_nas_5gs_pdu_session_modification_request_s { +typedef struct ogs_nas_5gs_pdu_session_establishment_reject_s { /* Mandatory fields */ ogs_nas_5gsm_cause_t gsm_cause; @@ -1079,85 +1014,85 @@ typedef struct ogs_nas_5gs_pdu_session_modification_request_s { ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; ogs_nas_re_attempt_indicator_t re_attempt_indicator; ogs_nas_5gsm_congestion_re_attempt_indicator_t gsm_congestion_re_attempt_indicator; -} ogs_nas_5gs_pdu_session_modification_request_t; +} ogs_nas_5gs_pdu_session_establishment_reject_t; /******************************************************* - * PDU SESSION MODIFICATION REJECT + * PDU SESSION AUTHENTICATION COMMAND ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -typedef struct ogs_nas_5gs_pdu_session_modification_reject_s { +typedef struct ogs_nas_5gs_pdu_session_authentication_command_s { /* Mandatory fields */ ogs_nas_eap_message_t eap_message; /* Optional fields */ uint64_t presencemask; ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; -} ogs_nas_5gs_pdu_session_modification_reject_t; +} ogs_nas_5gs_pdu_session_authentication_command_t; /******************************************************* - * PDU SESSION MODIFICATION COMMAND + * PDU SESSION AUTHENTICATION COMPLETE ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -typedef struct ogs_nas_5gs_pdu_session_modification_command_s { +typedef struct ogs_nas_5gs_pdu_session_authentication_complete_s { /* Mandatory fields */ ogs_nas_eap_message_t eap_message; /* Optional fields */ uint64_t presencemask; ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; -} ogs_nas_5gs_pdu_session_modification_command_t; +} ogs_nas_5gs_pdu_session_authentication_complete_t; /******************************************************* - * PDU SESSION MODIFICATION COMPLETE + * PDU SESSION AUTHENTICATION RESULT ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EAP_MESSAGE_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EAP_MESSAGE_TYPE 0x78 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_TYPE 0x78 +#define OGS_NAS_5GS_PDU_SESSION_AUTHENTICATION_RESULT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -typedef struct ogs_nas_5gs_pdu_session_modification_complete_s { +typedef struct ogs_nas_5gs_pdu_session_authentication_result_s { /* Optional fields */ uint64_t presencemask; ogs_nas_eap_message_t eap_message; ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; -} ogs_nas_5gs_pdu_session_modification_complete_t; +} ogs_nas_5gs_pdu_session_authentication_result_t; /******************************************************* - * PDU SESSION MODIFICATION COMMAND REJECT + * PDU SESSION MODIFICATION REQUEST ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAPABILITY_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAUSE_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_PRESENT ((uint64_t)1<<4) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_RULES_PRESENT ((uint64_t)1<<5) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_FLOW_DESCRIPTIONS_PRESENT ((uint64_t)1<<6) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT ((uint64_t)1<<7) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<8) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT ((uint64_t)1<<9) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_HEADER_COMPRESSION_CONFIGURATION_PRESENT ((uint64_t)1<<10) -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAPABILITY_TYPE 0x28 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_5GSM_CAUSE_TYPE 0x59 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE 0x55 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE 0xB0 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_TYPE 0x13 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_RULES_TYPE 0x7A -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_REQUESTED_QOS_FLOW_DESCRIPTIONS_TYPE 0x79 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_MAPPED_EPS_BEARER_CONTEXTS_TYPE 0x75 -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE 0x7C -#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAPABILITY_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAUSE_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_PRESENT ((uint64_t)1<<4) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_RULES_PRESENT ((uint64_t)1<<5) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_FLOW_DESCRIPTIONS_PRESENT ((uint64_t)1<<6) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_PRESENT ((uint64_t)1<<7) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<8) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT ((uint64_t)1<<9) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT ((uint64_t)1<<10) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAPABILITY_TYPE 0x28 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_5GSM_CAUSE_TYPE 0x59 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_TYPE 0x55 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_ALWAYS_ON_PDU_SESSION_REQUESTED_TYPE 0xB0 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE_TYPE 0x13 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_RULES_TYPE 0x7A +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_REQUESTED_QOS_FLOW_DESCRIPTIONS_TYPE 0x79 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_TYPE 0x75 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE 0x7C +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66 -typedef struct ogs_nas_5gs_pdu_session_modification_command_reject_s { +typedef struct ogs_nas_5gs_pdu_session_modification_request_s { /* Optional fields */ uint64_t presencemask; @@ -1172,22 +1107,22 @@ typedef struct ogs_nas_5gs_pdu_session_modification_command_reject_s { ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; ogs_nas_port_management_information_container_t port_management_information_container; ogs_nas_header_compression_configuration_t header_compression_configuration; -} ogs_nas_5gs_pdu_session_modification_command_reject_t; +} ogs_nas_5gs_pdu_session_modification_request_t; /******************************************************* - * PDU SESSION RELEASE REQUEST + * PDU SESSION MODIFICATION REJECT ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_BACK_OFF_TIMER_VALUE_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_BACK_OFF_TIMER_VALUE_TYPE 0x37 -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_RE_ATTEMPT_INDICATOR_TYPE 0x1D -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE 0x61 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_TYPE 0x37 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_TYPE 0x1D +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_REJECT_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE 0x61 -typedef struct ogs_nas_5gs_pdu_session_release_request_s { +typedef struct ogs_nas_5gs_pdu_session_modification_reject_s { /* Mandatory fields */ ogs_nas_5gsm_cause_t gsm_cause; @@ -1197,38 +1132,38 @@ typedef struct ogs_nas_5gs_pdu_session_release_request_s { ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; ogs_nas_re_attempt_indicator_t re_attempt_indicator; ogs_nas_5gsm_congestion_re_attempt_indicator_t gsm_congestion_re_attempt_indicator; -} ogs_nas_5gs_pdu_session_release_request_t; +} ogs_nas_5gs_pdu_session_modification_reject_t; /******************************************************* - * PDU SESSION RELEASE REJECT + * PDU SESSION MODIFICATION COMMAND ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_5GSM_CAUSE_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SESSION_AMBR_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_RQ_TIMER_VALUE_PRESENT ((uint64_t)1<<2) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT ((uint64_t)1<<3) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_RULES_PRESENT ((uint64_t)1<<4) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_MAPPED_EPS_BEARER_CONTEXTS_PRESENT ((uint64_t)1<<5) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT ((uint64_t)1<<6) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<7) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ATSSS_CONTAINER_PRESENT ((uint64_t)1<<8) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_HEADER_COMPRESSION_CONFIGURATION_PRESENT ((uint64_t)1<<9) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT ((uint64_t)1<<10) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SERVING_PLMN_RATE_CONTROL_PRESENT ((uint64_t)1<<11) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_5GSM_CAUSE_TYPE 0x59 -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SESSION_AMBR_TYPE 0x2A -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_RQ_TIMER_VALUE_TYPE 0x56 -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE 0x80 -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_RULES_TYPE 0x7A -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_MAPPED_EPS_BEARER_CONTEXTS_TYPE 0x75 -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE 0x79 -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_ATSSS_CONTAINER_TYPE 0x77 -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66 -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE 0x7C -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_SERVING_PLMN_RATE_CONTROL_TYPE 0x1E +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_5GSM_CAUSE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_RQ_TIMER_VALUE_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ALWAYS_ON_PDU_SESSION_INDICATION_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_RULES_PRESENT ((uint64_t)1<<4) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_PRESENT ((uint64_t)1<<5) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT ((uint64_t)1<<6) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<7) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ATSSS_CONTAINER_PRESENT ((uint64_t)1<<8) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_HEADER_COMPRESSION_CONFIGURATION_PRESENT ((uint64_t)1<<9) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT ((uint64_t)1<<10) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SERVING_PLMN_RATE_CONTROL_PRESENT ((uint64_t)1<<11) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_5GSM_CAUSE_TYPE 0x59 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_TYPE 0x2A +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_RQ_TIMER_VALUE_TYPE 0x56 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ALWAYS_ON_PDU_SESSION_INDICATION_TYPE 0x80 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_RULES_TYPE 0x7A +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_TYPE 0x75 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_TYPE 0x79 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_ATSSS_CONTAINER_TYPE 0x77 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66 +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE 0x7C +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_SERVING_PLMN_RATE_CONTROL_TYPE 0x1E -typedef struct ogs_nas_5gs_pdu_session_release_reject_s { +typedef struct ogs_nas_5gs_pdu_session_modification_command_s { /* Optional fields */ uint64_t presencemask; @@ -1244,38 +1179,116 @@ typedef struct ogs_nas_5gs_pdu_session_release_reject_s { ogs_nas_header_compression_configuration_t header_compression_configuration; ogs_nas_port_management_information_container_t port_management_information_container; ogs_nas_serving_plmn_rate_control_t serving_plmn_rate_control; +} ogs_nas_5gs_pdu_session_modification_command_t; + + +/******************************************************* + * PDU SESSION MODIFICATION COMPLETE + ******************************************************/ +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMPLETE_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE 0x7C + +typedef struct ogs_nas_5gs_pdu_session_modification_complete_s { + + /* Optional fields */ + uint64_t presencemask; + ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; + ogs_nas_port_management_information_container_t port_management_information_container; +} ogs_nas_5gs_pdu_session_modification_complete_t; + + +/******************************************************* + * PDU SESSION MODIFICATION COMMAND REJECT + ******************************************************/ +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B + +typedef struct ogs_nas_5gs_pdu_session_modification_command_reject_s { + /* Mandatory fields */ + ogs_nas_5gsm_cause_t gsm_cause; + + /* Optional fields */ + uint64_t presencemask; + ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; +} ogs_nas_5gs_pdu_session_modification_command_reject_t; + + +/******************************************************* + * PDU SESSION RELEASE REQUEST + ******************************************************/ +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CAUSE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_5GSM_CAUSE_TYPE 0x59 +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B + +typedef struct ogs_nas_5gs_pdu_session_release_request_s { + + /* Optional fields */ + uint64_t presencemask; + ogs_nas_5gsm_cause_t gsm_cause; + ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; +} ogs_nas_5gs_pdu_session_release_request_t; + + +/******************************************************* + * PDU SESSION RELEASE REJECT + ******************************************************/ +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B + +typedef struct ogs_nas_5gs_pdu_session_release_reject_s { + /* Mandatory fields */ + ogs_nas_5gsm_cause_t gsm_cause; + + /* Optional fields */ + uint64_t presencemask; + ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; } ogs_nas_5gs_pdu_session_release_reject_t; /******************************************************* * PDU SESSION RELEASE COMMAND ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_BACK_OFF_TIMER_VALUE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_PRESENT ((uint64_t)1<<2) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<3) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_ACCESS_TYPE_PRESENT ((uint64_t)1<<4) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_BACK_OFF_TIMER_VALUE_TYPE 0x37 +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_TYPE 0x78 +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_5GSM_CONGESTION_RE_ATTEMPT_INDICATOR_TYPE 0x61 #define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_PORT_MANAGEMENT_INFORMATION_CONTAINER_TYPE 0x7C +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMMAND_ACCESS_TYPE_TYPE 0xD0 typedef struct ogs_nas_5gs_pdu_session_release_command_s { + /* Mandatory fields */ + ogs_nas_5gsm_cause_t gsm_cause; /* Optional fields */ uint64_t presencemask; + ogs_nas_gprs_timer_3_t back_off_timer_value; + ogs_nas_eap_message_t eap_message; + ogs_nas_5gsm_congestion_re_attempt_indicator_t gsm_congestion_re_attempt_indicator; ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; - ogs_nas_port_management_information_container_t port_management_information_container; + ogs_nas_access_type_t access_type; } ogs_nas_5gs_pdu_session_release_command_t; /******************************************************* * PDU SESSION RELEASE COMPLETE ******************************************************/ -#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_5GSM_CAUSE_PRESENT ((uint64_t)1<<0) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<1) +#define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_5GSM_CAUSE_TYPE 0x59 #define OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B typedef struct ogs_nas_5gs_pdu_session_release_complete_s { - /* Mandatory fields */ - ogs_nas_5gsm_cause_t gsm_cause; /* Optional fields */ uint64_t presencemask; + ogs_nas_5gsm_cause_t gsm_cause; ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; } ogs_nas_5gs_pdu_session_release_complete_t; @@ -1283,17 +1296,10 @@ typedef struct ogs_nas_5gs_pdu_session_release_complete_s { /******************************************************* * 5GSM STATUS ******************************************************/ -#define OGS_NAS_5GS_5GSM_STATUS_5GSM_CAUSE_PRESENT ((uint64_t)1<<0) -#define OGS_NAS_5GS_5GSM_STATUS_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT ((uint64_t)1<<1) -#define OGS_NAS_5GS_5GSM_STATUS_5GSM_CAUSE_TYPE 0x59 -#define OGS_NAS_5GS_5GSM_STATUS_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B typedef struct ogs_nas_5gs_5gsm_status_s { - - /* Optional fields */ - uint64_t presencemask; + /* Mandatory fields */ ogs_nas_5gsm_cause_t gsm_cause; - ogs_nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; } ogs_nas_5gs_5gsm_status_t; diff --git a/lib/nas/5gs/support/cache/nas-msg-103.py b/lib/nas/5gs/support/cache/nas-msg-103.py index 8f0df721d..5ecbcaf87 100644 --- a/lib/nas/5gs/support/cache/nas-msg-103.py +++ b/lib/nas/5gs/support/cache/nas-msg-103.py @@ -3,7 +3,7 @@ ies.append({ "iei" : "", "value" : "Payload container type", "type" : "Payload c ies.append({ "iei" : "", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "M", "format" : "LV-E", "length" : "3-65537"}) ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"}) ies.append({ "iei" : "59", "value" : "Old PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "O", "format" : "TV", "length" : "2"}) -ies.append({ "iei" : "8", "value" : "Request type", "type" : "Request type", "reference" : "9.11.3.47", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "8-", "value" : "Request type", "type" : "Request type", "reference" : "9.11.3.47", "presence" : "O", "format" : "TV", "length" : "1"}) ies.append({ "iei" : "22", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "O", "format" : "TLV", "length" : "3-10"}) ies.append({ "iei" : "25", "value" : "DNN", "type" : "DNN", "reference" : "9.11.2.1B", "presence" : "O", "format" : "TLV", "length" : "3-102"}) ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"}) diff --git a/lib/nas/5gs/support/cache/nas-msg-193.py b/lib/nas/5gs/support/cache/nas-msg-193.py index 452ffb777..80bef0f87 100644 --- a/lib/nas/5gs/support/cache/nas-msg-193.py +++ b/lib/nas/5gs/support/cache/nas-msg-193.py @@ -1,12 +1,14 @@ ies = [] -ies.append({ "iei" : "", "value" : "Control plane service type", "type" : "Control plane service type", "reference" : "9.11.3.18D", "presence" : "M", "format" : "V", "length" : "1/2"}) -ies.append({ "iei" : "6F", "value" : "CIoT small data container", "type" : "CIoT small data container", "reference" : "9.11.3.18B", "presence" : "O", "format" : "TLV", "length" : "4-257"}) -ies.append({ "iei" : "8-", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "7B", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) -ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"}) -ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"}) -ies.append({ "iei" : "F-", "value" : "Release assistance indication", "type" : "Release assistance indication", "reference" : "9.11.3.46A", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"}) -ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"}) -ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"}) +ies.append({ "iei" : "", "value" : "Integrity protection maximum data rate", "type" : "Integrity protection maximum data rate", "reference" : "9.11.4.7", "presence" : "M", "format" : "V", "length" : "2"}) +ies.append({ "iei" : "9-", "value" : "PDU session type", "type" : "PDU session type", "reference" : "9.11.4.11", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "A-", "value" : "SSC mode", "type" : "SSC mode", "reference" : "9.11.4.16", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "28", "value" : "5GSM capability", "type" : "5GSM capability", "reference" : "9.11.4.1", "presence" : "O", "format" : "TLV", "length" : "3-15"}) +ies.append({ "iei" : "55", "value" : "Maximum number of supported packet filters", "type" : "Maximum number of supported packet filters", "reference" : "9.11.4.9", "presence" : "O", "format" : "TV", "length" : "3"}) +ies.append({ "iei" : "B-", "value" : "Always-on PDU session requested", "type" : "Always-on PDU session requested", "reference" : "9.11.4.4", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "39", "value" : "SM PDU DN request container", "type" : "SM PDU DN request container", "reference" : "9.11.4.15", "presence" : "O", "format" : "TLV", "length" : "3-255"}) +ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) +ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"}) +ies.append({ "iei" : "6E", "value" : "DS-TT Ethernet port MAC address", "type" : "DS-TT Ethernet port MAC address", "reference" : "9.11.4.25", "presence" : "O", "format" : "TLV", "length" : "8"}) +ies.append({ "iei" : "6F", "value" : "UE-DS-TT residence time", "type" : "UE-DS-TT residence time", "reference" : "9.11.4.26", "presence" : "O", "format" : "TLV", "length" : "10"}) +ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-194.py b/lib/nas/5gs/support/cache/nas-msg-194.py index 80034e781..b4ec01d61 100644 --- a/lib/nas/5gs/support/cache/nas-msg-194.py +++ b/lib/nas/5gs/support/cache/nas-msg-194.py @@ -1,4 +1,20 @@ ies = [] -ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"}) -ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"}) +ies.append({ "iei" : "", "value" : "Selected PDU session type", "type" : "PDU session type", "reference" : "9.11.4.11", "presence" : "M", "format" : "V", "length" : "1/2"}) +ies.append({ "iei" : "", "value" : "Authorized QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "M", "format" : "LV-E", "length" : "6-65538"}) +ies.append({ "iei" : "", "value" : "Session AMBR", "type" : "Session-AMBR", "reference" : "9.11.4.14", "presence" : "M", "format" : "LV", "length" : "7"}) +ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) +ies.append({ "iei" : "29", "value" : "PDU address", "type" : "PDU address", "reference" : "9.11.4.10", "presence" : "O", "format" : "TLV", "length" : "7, 11 or 15"}) +ies.append({ "iei" : "56", "value" : "RQ timer value", "type" : "GPRS timer", "reference" : "9.11.2.3", "presence" : "O", "format" : "TV", "length" : "2"}) +ies.append({ "iei" : "22", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "O", "format" : "TLV", "length" : "3-10"}) +ies.append({ "iei" : "8-", "value" : "Always-on PDU session indication", "type" : "Always-on PDU session indication", "reference" : "9.11.4.3", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) +ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"}) +ies.append({ "iei" : "79", "value" : "Authorized QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"}) +ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) +ies.append({ "iei" : "25", "value" : "DNN", "type" : "DNN", "reference" : "9.11.2.1B", "presence" : "O", "format" : "TLV", "length" : "3-102"}) +ies.append({ "iei" : "17", "value" : "5GSM network feature support", "type" : "5GSM network feature support", "reference" : "9.11.4.18", "presence" : "O", "format" : "TLV", "length" : "3-15"}) +ies.append({ "iei" : "18", "value" : "Serving PLMN rate control", "type" : "Serving PLMN rate control", "reference" : "9.11.4.20", "presence" : "O", "format" : "TLV", "length" : "4"}) +ies.append({ "iei" : "77", "value" : "ATSSS container", "type" : "ATSSS container", "reference" : "9.11.4.22", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) +ies.append({ "iei" : "C-", "value" : "Control plane only indication", "type" : "Control plane only indication", "reference" : "9.11.4.23", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-195.py b/lib/nas/5gs/support/cache/nas-msg-195.py index 80034e781..e3a62a38f 100644 --- a/lib/nas/5gs/support/cache/nas-msg-195.py +++ b/lib/nas/5gs/support/cache/nas-msg-195.py @@ -1,4 +1,9 @@ ies = [] -ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"}) -ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"}) +ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) +ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"}) +ies.append({ "iei" : "F-", "value" : "Allowed SSC mode", "type" : "Allowed SSC mode", "reference" : "9.11.4.5", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"}) +ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) +ies.append({ "iei" : "1D", "value" : "Re-attempt indicator", "type" : "Re-attempt indicator", "reference" : "9.11.4.17", "presence" : "O", "format" : "TLV", "length" : "3"}) +ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-197.py b/lib/nas/5gs/support/cache/nas-msg-197.py index 80034e781..1374b9c2b 100644 --- a/lib/nas/5gs/support/cache/nas-msg-197.py +++ b/lib/nas/5gs/support/cache/nas-msg-197.py @@ -1,4 +1,4 @@ ies = [] -ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"}) ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"}) +ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-198.py b/lib/nas/5gs/support/cache/nas-msg-198.py index 80bef0f87..1374b9c2b 100644 --- a/lib/nas/5gs/support/cache/nas-msg-198.py +++ b/lib/nas/5gs/support/cache/nas-msg-198.py @@ -1,14 +1,4 @@ ies = [] -ies.append({ "iei" : "", "value" : "Integrity protection maximum data rate", "type" : "Integrity protection maximum data rate", "reference" : "9.11.4.7", "presence" : "M", "format" : "V", "length" : "2"}) -ies.append({ "iei" : "9-", "value" : "PDU session type", "type" : "PDU session type", "reference" : "9.11.4.11", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "A-", "value" : "SSC mode", "type" : "SSC mode", "reference" : "9.11.4.16", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "28", "value" : "5GSM capability", "type" : "5GSM capability", "reference" : "9.11.4.1", "presence" : "O", "format" : "TLV", "length" : "3-15"}) -ies.append({ "iei" : "55", "value" : "Maximum number of supported packet filters", "type" : "Maximum number of supported packet filters", "reference" : "9.11.4.9", "presence" : "O", "format" : "TV", "length" : "3"}) -ies.append({ "iei" : "B-", "value" : "Always-on PDU session requested", "type" : "Always-on PDU session requested", "reference" : "9.11.4.4", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "39", "value" : "SM PDU DN request container", "type" : "SM PDU DN request container", "reference" : "9.11.4.15", "presence" : "O", "format" : "TLV", "length" : "3-255"}) +ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) -ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"}) -ies.append({ "iei" : "6E", "value" : "DS-TT Ethernet port MAC address", "type" : "DS-TT Ethernet port MAC address", "reference" : "9.11.4.25", "presence" : "O", "format" : "TLV", "length" : "8"}) -ies.append({ "iei" : "6F", "value" : "UE-DS-TT residence time", "type" : "UE-DS-TT residence time", "reference" : "9.11.4.26", "presence" : "O", "format" : "TLV", "length" : "10"}) -ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-199.py b/lib/nas/5gs/support/cache/nas-msg-199.py index b4ec01d61..45c566034 100644 --- a/lib/nas/5gs/support/cache/nas-msg-199.py +++ b/lib/nas/5gs/support/cache/nas-msg-199.py @@ -1,20 +1,4 @@ ies = [] -ies.append({ "iei" : "", "value" : "Selected PDU session type", "type" : "PDU session type", "reference" : "9.11.4.11", "presence" : "M", "format" : "V", "length" : "1/2"}) -ies.append({ "iei" : "", "value" : "Authorized QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "M", "format" : "LV-E", "length" : "6-65538"}) -ies.append({ "iei" : "", "value" : "Session AMBR", "type" : "Session-AMBR", "reference" : "9.11.4.14", "presence" : "M", "format" : "LV", "length" : "7"}) -ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) -ies.append({ "iei" : "29", "value" : "PDU address", "type" : "PDU address", "reference" : "9.11.4.10", "presence" : "O", "format" : "TLV", "length" : "7, 11 or 15"}) -ies.append({ "iei" : "56", "value" : "RQ timer value", "type" : "GPRS timer", "reference" : "9.11.2.3", "presence" : "O", "format" : "TV", "length" : "2"}) -ies.append({ "iei" : "22", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "O", "format" : "TLV", "length" : "3-10"}) -ies.append({ "iei" : "8-", "value" : "Always-on PDU session indication", "type" : "Always-on PDU session indication", "reference" : "9.11.4.3", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"}) -ies.append({ "iei" : "79", "value" : "Authorized QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) -ies.append({ "iei" : "25", "value" : "DNN", "type" : "DNN", "reference" : "9.11.2.1B", "presence" : "O", "format" : "TLV", "length" : "3-102"}) -ies.append({ "iei" : "17", "value" : "5GSM network feature support", "type" : "5GSM network feature support", "reference" : "9.11.4.18", "presence" : "O", "format" : "TLV", "length" : "3-15"}) -ies.append({ "iei" : "18", "value" : "Serving PLMN rate control", "type" : "Serving PLMN rate control", "reference" : "9.11.4.20", "presence" : "O", "format" : "TLV", "length" : "4"}) -ies.append({ "iei" : "77", "value" : "ATSSS container", "type" : "ATSSS container", "reference" : "9.11.4.22", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) -ies.append({ "iei" : "C-", "value" : "Control plane only indication", "type" : "Control plane only indication", "reference" : "9.11.4.23", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-201.py b/lib/nas/5gs/support/cache/nas-msg-201.py index e3a62a38f..81241c269 100644 --- a/lib/nas/5gs/support/cache/nas-msg-201.py +++ b/lib/nas/5gs/support/cache/nas-msg-201.py @@ -1,9 +1,13 @@ ies = [] -ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) -ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"}) -ies.append({ "iei" : "F-", "value" : "Allowed SSC mode", "type" : "Allowed SSC mode", "reference" : "9.11.4.5", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"}) +ies.append({ "iei" : "28", "value" : "5GSM capability", "type" : "5GSM capability", "reference" : "9.11.4.1", "presence" : "O", "format" : "TLV", "length" : "3-15"}) +ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) +ies.append({ "iei" : "55", "value" : "Maximum number of supported packet filters", "type" : "Maximum number of supported packet filters", "reference" : "9.11.4.9", "presence" : "O", "format" : "TV", "length" : "3"}) +ies.append({ "iei" : "B-", "value" : "Always-on PDU session requested", "type" : "Always-on PDU session requested", "reference" : "9.11.4.4", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "13", "value" : "Integrity protection maximum data rate", "type" : "Integrity protection maximum data rate", "reference" : "9.11.4.7", "presence" : "O", "format" : "TV", "length" : "3"}) +ies.append({ "iei" : "7A", "value" : "Requested QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) +ies.append({ "iei" : "79", "value" : "Requested QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"}) +ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) -ies.append({ "iei" : "1D", "value" : "Re-attempt indicator", "type" : "Re-attempt indicator", "reference" : "9.11.4.17", "presence" : "O", "format" : "TLV", "length" : "3"}) -ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"}) +ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) +ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-202.py b/lib/nas/5gs/support/cache/nas-msg-202.py index 1374b9c2b..42f75bd85 100644 --- a/lib/nas/5gs/support/cache/nas-msg-202.py +++ b/lib/nas/5gs/support/cache/nas-msg-202.py @@ -1,4 +1,7 @@ ies = [] -ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"}) +ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) +ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) +ies.append({ "iei" : "1D", "value" : "Re-attempt indicator", "type" : "Re-attempt indicator", "reference" : "9.11.4.17", "presence" : "O", "format" : "TLV", "length" : "3"}) +ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-203.py b/lib/nas/5gs/support/cache/nas-msg-203.py index 1374b9c2b..4aaed74c7 100644 --- a/lib/nas/5gs/support/cache/nas-msg-203.py +++ b/lib/nas/5gs/support/cache/nas-msg-203.py @@ -1,4 +1,14 @@ ies = [] -ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"}) +ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) +ies.append({ "iei" : "2A", "value" : "Session AMBR", "type" : "Session-AMBR", "reference" : "9.11.4.14", "presence" : "O", "format" : "TLV", "length" : "8"}) +ies.append({ "iei" : "56", "value" : "RQ timer value", "type" : "GPRS timer", "reference" : "9.11.2.3", "presence" : "O", "format" : "TV", "length" : "2"}) +ies.append({ "iei" : "8-", "value" : "Always-on PDU session indication", "type" : "Always-on PDU session indication", "reference" : "9.11.4.3", "presence" : "O", "format" : "TV", "length" : "1"}) +ies.append({ "iei" : "7A", "value" : "Authorized QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) +ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) +ies.append({ "iei" : "79", "value" : "Authorized QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) +ies.append({ "iei" : "77", "value" : "ATSSS container", "type" : "ATSSS container", "reference" : "9.11.4.22", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) +ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"}) +ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) +ies.append({ "iei" : "1E", "value" : "Serving PLMN rate control", "type" : "Serving PLMN rate control", "reference" : "9.11.4.20", "presence" : "O", "format" : "TLV", "length" : "4"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-204.py b/lib/nas/5gs/support/cache/nas-msg-204.py index 45c566034..8d46a9f9f 100644 --- a/lib/nas/5gs/support/cache/nas-msg-204.py +++ b/lib/nas/5gs/support/cache/nas-msg-204.py @@ -1,4 +1,4 @@ ies = [] -ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) +ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-205.py b/lib/nas/5gs/support/cache/nas-msg-205.py index 81241c269..e83f8213c 100644 --- a/lib/nas/5gs/support/cache/nas-msg-205.py +++ b/lib/nas/5gs/support/cache/nas-msg-205.py @@ -1,13 +1,4 @@ ies = [] -ies.append({ "iei" : "28", "value" : "5GSM capability", "type" : "5GSM capability", "reference" : "9.11.4.1", "presence" : "O", "format" : "TLV", "length" : "3-15"}) -ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) -ies.append({ "iei" : "55", "value" : "Maximum number of supported packet filters", "type" : "Maximum number of supported packet filters", "reference" : "9.11.4.9", "presence" : "O", "format" : "TV", "length" : "3"}) -ies.append({ "iei" : "B-", "value" : "Always-on PDU session requested", "type" : "Always-on PDU session requested", "reference" : "9.11.4.4", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "13", "value" : "Integrity protection maximum data rate", "type" : "Integrity protection maximum data rate", "reference" : "9.11.4.7", "presence" : "O", "format" : "TV", "length" : "3"}) -ies.append({ "iei" : "7A", "value" : "Requested QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) -ies.append({ "iei" : "79", "value" : "Requested QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"}) -ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) +ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) -ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) -ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-209.py b/lib/nas/5gs/support/cache/nas-msg-209.py index 42f75bd85..60af80af2 100644 --- a/lib/nas/5gs/support/cache/nas-msg-209.py +++ b/lib/nas/5gs/support/cache/nas-msg-209.py @@ -1,7 +1,4 @@ ies = [] -ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) -ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"}) +ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) -ies.append({ "iei" : "1D", "value" : "Re-attempt indicator", "type" : "Re-attempt indicator", "reference" : "9.11.4.17", "presence" : "O", "format" : "TLV", "length" : "3"}) -ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-210.py b/lib/nas/5gs/support/cache/nas-msg-210.py index 4aaed74c7..e83f8213c 100644 --- a/lib/nas/5gs/support/cache/nas-msg-210.py +++ b/lib/nas/5gs/support/cache/nas-msg-210.py @@ -1,14 +1,4 @@ ies = [] -ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) -ies.append({ "iei" : "2A", "value" : "Session AMBR", "type" : "Session-AMBR", "reference" : "9.11.4.14", "presence" : "O", "format" : "TLV", "length" : "8"}) -ies.append({ "iei" : "56", "value" : "RQ timer value", "type" : "GPRS timer", "reference" : "9.11.2.3", "presence" : "O", "format" : "TV", "length" : "2"}) -ies.append({ "iei" : "8-", "value" : "Always-on PDU session indication", "type" : "Always-on PDU session indication", "reference" : "9.11.4.3", "presence" : "O", "format" : "TV", "length" : "1"}) -ies.append({ "iei" : "7A", "value" : "Authorized QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) -ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"}) -ies.append({ "iei" : "79", "value" : "Authorized QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"}) +ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) -ies.append({ "iei" : "77", "value" : "ATSSS container", "type" : "ATSSS container", "reference" : "9.11.4.22", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) -ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"}) -ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) -ies.append({ "iei" : "1E", "value" : "Serving PLMN rate control", "type" : "Serving PLMN rate control", "reference" : "9.11.4.20", "presence" : "O", "format" : "TLV", "length" : "4"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-211.py b/lib/nas/5gs/support/cache/nas-msg-211.py index 8d46a9f9f..af14e9fc2 100644 --- a/lib/nas/5gs/support/cache/nas-msg-211.py +++ b/lib/nas/5gs/support/cache/nas-msg-211.py @@ -1,4 +1,8 @@ ies = [] +ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) +ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"}) +ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"}) +ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) -ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"}) +ies.append({ "iei" : "D-", "value" : "Access type", "type" : "Access type", "reference" : "9.11.2.1A", "presence" : "O", "format" : "TV", "length" : "1"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-212.py b/lib/nas/5gs/support/cache/nas-msg-212.py index e83f8213c..60af80af2 100644 --- a/lib/nas/5gs/support/cache/nas-msg-212.py +++ b/lib/nas/5gs/support/cache/nas-msg-212.py @@ -1,4 +1,4 @@ ies = [] -ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) +ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/cache/nas-msg-214.py b/lib/nas/5gs/support/cache/nas-msg-214.py index 60af80af2..c62a732a6 100644 --- a/lib/nas/5gs/support/cache/nas-msg-214.py +++ b/lib/nas/5gs/support/cache/nas-msg-214.py @@ -1,4 +1,3 @@ ies = [] -ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"}) -ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"}) +ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"}) msg_list[key]["ies"] = ies diff --git a/lib/nas/5gs/support/nas-message.py b/lib/nas/5gs/support/nas-message.py index 664c21248..2d35f4e08 100644 --- a/lib/nas/5gs/support/nas-message.py +++ b/lib/nas/5gs/support/nas-message.py @@ -123,6 +123,10 @@ def get_cells(cells): format = cells[4].text.encode('ascii', 'ignore') length = cells[5].text.encode('ascii', 'ignore') +# Spec errata - workaround + if (type == "Request type" and value == "Request type"): + iei = "8-" + return { "iei" : iei, "value" : value, "type" : type, "reference" : reference, "presence" : presence, "format" : format, "length" : length } def write_cells_to_file(name, cells): @@ -236,22 +240,22 @@ msg_list["SECURITY MODE COMPLETE"]["table"] = 25 msg_list["SECURITY MODE REJECT"]["table"] = 26 msg_list["5GMM STATUS"]["table"] = 28 -msg_list["PDU SESSION ESTABLISHMENT REQUEST"]["table"] = 29 -msg_list["PDU SESSION ESTABLISHMENT ACCEPT"]["table"] = 30 -msg_list["PDU SESSION ESTABLISHMENT REJECT"]["table"] = 31 -msg_list["PDU SESSION AUTHENTICATION COMMAND"]["table"] = 32 -msg_list["PDU SESSION AUTHENTICATION COMPLETE"]["table"] = 33 -msg_list["PDU SESSION AUTHENTICATION RESULT"]["table"] = 34 -msg_list["PDU SESSION MODIFICATION REQUEST"]["table"] = 35 -msg_list["PDU SESSION MODIFICATION REJECT"]["table"] = 36 -msg_list["PDU SESSION MODIFICATION COMMAND"]["table"] = 37 -msg_list["PDU SESSION MODIFICATION COMPLETE"]["table"] = 38 -msg_list["PDU SESSION MODIFICATION COMMAND REJECT"]["table"] = 39 -msg_list["PDU SESSION RELEASE REQUEST"]["table"] = 40 -msg_list["PDU SESSION RELEASE REJECT"]["table"] = 41 -msg_list["PDU SESSION RELEASE COMMAND"]["table"] = 42 -msg_list["PDU SESSION RELEASE COMPLETE"]["table"] = 43 -msg_list["5GSM STATUS"]["table"] = 44 +msg_list["PDU SESSION ESTABLISHMENT REQUEST"]["table"] = 33 +msg_list["PDU SESSION ESTABLISHMENT ACCEPT"]["table"] = 34 +msg_list["PDU SESSION ESTABLISHMENT REJECT"]["table"] = 35 +msg_list["PDU SESSION AUTHENTICATION COMMAND"]["table"] = 36 +msg_list["PDU SESSION AUTHENTICATION COMPLETE"]["table"] = 37 +msg_list["PDU SESSION AUTHENTICATION RESULT"]["table"] = 38 +msg_list["PDU SESSION MODIFICATION REQUEST"]["table"] = 39 +msg_list["PDU SESSION MODIFICATION REJECT"]["table"] = 40 +msg_list["PDU SESSION MODIFICATION COMMAND"]["table"] = 41 +msg_list["PDU SESSION MODIFICATION COMPLETE"]["table"] = 42 +msg_list["PDU SESSION MODIFICATION COMMAND REJECT"]["table"] = 43 +msg_list["PDU SESSION RELEASE REQUEST"]["table"] = 44 +msg_list["PDU SESSION RELEASE REJECT"]["table"] = 45 +msg_list["PDU SESSION RELEASE COMMAND"]["table"] = 46 +msg_list["PDU SESSION RELEASE COMPLETE"]["table"] = 47 +msg_list["5GSM STATUS"]["table"] = 48 for key in msg_list.keys(): if "table" not in msg_list[key].keys(): @@ -388,8 +392,6 @@ for (k, v) in sorted_type_list: f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n\n" % v_lower(k)) f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % get_value(k)) - if "decode" in type_list[k]: - f.write("%s" % type_list[k]["decode"]) f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n"); f.write(" return size;\n") @@ -549,10 +551,10 @@ for (k, v) in sorted_msg_list: f.write(" * %s\n" % k) f.write(" ******************************************************/") - for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]): + for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] != "M"]): f.write("\n#define OGS_NAS_5GS_%s_%s_PRESENT ((uint64_t)1<<%d)" % (v_upper(k), v_upper(ie["value"]), i)) - for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]): + for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] != "M"]): f.write("\n#define OGS_NAS_5GS_%s_%s_TYPE 0x%s" % (v_upper(k), v_upper(ie["value"]), re.sub('-', '0', ie["iei"]))) f.write("\n\ntypedef struct ogs_nas_5gs_%s_s {\n" % v_lower(k)) @@ -564,7 +566,7 @@ for (k, v) in sorted_msg_list: f.write(" /* Mandatory fields */\n") mandatory_fields = True; - if ie["presence"] == "O" and optional_fields is False: + if ie["presence"] != "M" and optional_fields is False: f.write("\n /* Optional fields */\n") f.write(" uint64_t presencemask;\n"); optional_fields = True; @@ -664,7 +666,7 @@ for (k, v) in sorted_msg_list: f.write(" decoded += size;\n\n") optional_fields = False; - for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]: + for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] != "M"]: if optional_fields is False: f.write(""" while (pkbuf->len > 0) { uint8_t *buffer = pkbuf->data; @@ -679,15 +681,18 @@ for (k, v) in sorted_msg_list: optional_fields = True; f.write(" case OGS_NAS_5GS_%s_%s_TYPE:\n" % (v_upper(k), v_upper(ie["value"]))) + if (ie["format"] == "TV" or ie["format"] == "T") and ie["length"] == "1": + f.write(" decoded--;\n") + f.write(" ogs_assert(ogs_pkbuf_push(pkbuf, 1));\n") f.write(" size = ogs_nas_5gs_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"]))) f.write(" ogs_assert(size >= 0);\n") f.write(" %s->presencemask |= OGS_NAS_5GS_%s_%s_PRESENT;\n" % (get_value(k), v_upper(k), v_upper(ie["value"]))) f.write(" decoded += size;\n") f.write(" break;\n") - if [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]: + if [ies for ies in msg_list[k]["ies"] if ies["presence"] != "M"]: f.write(""" default: - ogs_warn("Unknown type(0x%x) or not implemented\\n", type); + ogs_error("Unknown type(0x%x) or not implemented\\n", type); break; } } @@ -816,7 +821,7 @@ for (k, v) in sorted_msg_list: f.write(" ogs_assert(size >= 0);\n") f.write(" encoded += size;\n\n") - for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]: + for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] != "M"]: f.write(" if (%s->presencemask & OGS_NAS_5GS_%s_%s_PRESENT) {\n" % (get_value(k), v_upper(k), v_upper(ie["value"]))) if ie["length"] == "1" and ie["format"] == "TV": f.write(" %s->%s.type = (OGS_NAS_5GS_%s_%s_TYPE >> 4);\n\n" % (get_value(k), get_value(ie["value"]), v_upper(k), v_upper(ie["value"]))) diff --git a/lib/nas/5gs/support/type-list.py b/lib/nas/5gs/support/type-list.py index 999784196..27044ba1d 100644 --- a/lib/nas/5gs/support/type-list.py +++ b/lib/nas/5gs/support/type-list.py @@ -29,10 +29,18 @@ type_list["Header compression configuration"]["encode"] = \ type_list["DNN"]["decode"] = \ " {\n" \ " char data_network_name[OGS_MAX_DNN_LEN];\n" \ -" dnn->length = ogs_fqdn_parse(data_network_name, dnn->value, dnn->length);\n" \ +" dnn->length = ogs_fqdn_parse(data_network_name, dnn->value, dnn->length);\n" \ " ogs_cpystrn(dnn->value, data_network_name, ogs_min(dnn->length, OGS_MAX_DNN_LEN) + 1);\n" \ " }\n\n" type_list["DNN"]["encode"] = \ " target.length = ogs_fqdn_build(target.value, dnn->value, dnn->length);\n" \ " size = target.length + sizeof(target.length);\n\n" + +type_list["Session-AMBR"]["decode"] = \ +" session_ambr->downlink.bitrate = be16toh(source->downlink.bitrate);\n" \ +" session_ambr->uplink.bitrate = be16toh(source->uplink.bitrate);\n\n" + +type_list["Session-AMBR"]["encode"] = \ +" target.downlink.bitrate = htobe16(session_ambr->downlink.bitrate);\n" \ +" target.uplink.bitrate = htobe16(session_ambr->uplink.bitrate);\n\n" diff --git a/lib/nas/5gs/types.c b/lib/nas/5gs/types.c index 1f8c1e4ac..9ff359ed1 100644 --- a/lib/nas/5gs/types.c +++ b/lib/nas/5gs/types.c @@ -52,7 +52,7 @@ void ogs_nas_5gs_tai_list_build( target0.tai[i].tac[j] = ogs_htobe24(source0->tai[i].tac[j]); } - size = (1 + 3 + 2 * source0->tai[i].num); + size = (1 + 3 + 3 * source0->tai[i].num); if ((target->length + size) > OGS_NAS_5GS_MAX_TAI_LIST_LEN) { ogs_warn("Overflow: Ignore remained TAI LIST(length:%d, size:%d)", target->length, size); @@ -73,7 +73,7 @@ void ogs_nas_5gs_tai_list_build( ogs_assert(source2->num < OGS_MAX_NUM_OF_TAI); target2.num = source2->num - 1; - size = (1 + (3 + 2) * source2->num); + size = (1 + (3 + 3) * source2->num); if ((target->length + size) > OGS_NAS_5GS_MAX_TAI_LIST_LEN) { ogs_warn("Overflow: Ignore remained TAI LIST(length:%d, size:%d)", target->length, size); @@ -90,3 +90,197 @@ void ogs_nas_5gs_tai_list_build( target->length += size; } } + +void ogs_nas_bitrate_from_uint64(ogs_nas_bitrate_t *nas, uint64_t bitrate) +{ + ogs_assert(nas); + ogs_assert(bitrate); + + bitrate >>= 10; /* bps to Kbps */ + + for (nas->unit = OGS_NAS_BR_UNIT_1K; + nas->unit < OGS_NAS_BR_UNIT_256P; nas->unit++) { + if ((bitrate >> 2) == 0) { + break; + } + bitrate >>= 2; + } + nas->bitrate = bitrate; +} + +void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules, + ogs_nas_qos_rule_t *rule, int num_of_rule) +{ + int i, j; + char *buffer; + uint16_t length; + ogs_nas_qos_rule_t target; + + ogs_assert(rules); + ogs_assert(rule); + ogs_assert(num_of_rule); + + buffer = ogs_calloc(1, OGS_NAS_MAX_QOS_RULES_LEN); + ogs_assert(buffer); + length = 0; + + for (i = 0; i < num_of_rule; i++) { + memcpy(&target, rule + i, sizeof(ogs_nas_qos_rule_t)); + + ogs_assert(length + sizeof(target.identifier) <= + OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, &target.identifier, sizeof(target.identifier)); + length += sizeof(target.identifier); + + ogs_assert(length + sizeof(target.length) <= + OGS_NAS_MAX_QOS_RULES_LEN); + target.length = htobe16(target.length); + memcpy(buffer + length, &target.length, sizeof(target.length)); + length += sizeof(target.length); + + ogs_assert(length + sizeof(target.flags) <= OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, &target.flags, sizeof(target.flags)); + length += sizeof(target.flags); + + for (j = 0; j < target.num_of_packet_filter; j++) { + ogs_assert(length + sizeof(target.pf[j].flags) <= + OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, &target.pf[j].flags, + sizeof(target.pf[j].flags)); + length += sizeof(target.pf[j].flags); + + ogs_assert(length + sizeof(target.pf[j].length) <= + OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, &target.pf[j].length, + sizeof(target.pf[j].length)); + length += sizeof(target.pf[j].length); + + for (j = 0; j < target.pf[j].num_of_component; j++) { + ogs_assert(length + sizeof(target.pf[j].component[j].type) <= + OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, + &target.pf[j].component[j].type, + sizeof(target.pf[j].component[j].type)); + length += sizeof(target.pf[j].component[j].type); + switch(target.pf[j].component[j].type) { + case OGS_PACKET_FILTER_MATCH_ALL: + break; + case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE: + ogs_assert(length + + sizeof(target.pf[j].component[j].proto) <= + OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, + &target.pf[j].component[j].proto, + sizeof(target.pf[j].component[j].proto)); + length += sizeof(target.pf[j].component[j].proto); + break; + case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE: + case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE: + ogs_assert(length + + sizeof(target.pf[j].component[j].ipv4.addr) + <= OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, + &target.pf[j].component[j].ipv4.addr, + sizeof(target.pf[j].component[j].ipv4.addr)); + length += sizeof(target.pf[j].component[j].ipv4.addr); + + ogs_assert(length + + sizeof(target.pf[j].component[j].ipv4.mask) + <= OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, + &target.pf[j].component[j].ipv4.mask, + sizeof(target.pf[j].component[j].ipv4.mask)); + length += sizeof(target.pf[j].component[j].ipv4.mask); + break; + case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE: + case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE: + ogs_assert(length + + sizeof(target.pf[j].component[j].ipv6.addr) + <= OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, + &target.pf[j].component[j].ipv6.addr, + sizeof(target.pf[j].component[j].ipv6.addr)); + length += sizeof(target.pf[j].component[j].ipv6.addr); + + ogs_assert(length + + sizeof(target.pf[j].component[j].ipv6.prefixlen) + <= OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, + &target.pf[j].component[j].ipv6.prefixlen, + sizeof(target.pf[j].component[j].ipv6.prefixlen)); + length += sizeof(target.pf[j].component[j].ipv6.prefixlen); + break; + case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE: + case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE: + ogs_assert(length + + sizeof(target.pf[j].component[j].ipv6_mask.addr) + <= OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, + &target.pf[j].component[j].ipv6_mask.addr, + sizeof(target.pf[j].component[j].ipv6_mask.addr)); + length += sizeof(target.pf[j].component[j].ipv6_mask.addr); + + ogs_assert(length + + sizeof(target.pf[j].component[j].ipv6_mask.mask) + <= OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, + &target.pf[j].component[j].ipv6_mask.mask, + sizeof(target.pf[j].component[j].ipv6_mask.mask)); + length += sizeof(target.pf[j].component[j].ipv6_mask.mask); + break; + case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE: + case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE: + ogs_assert(length + + sizeof(target.pf[j].component[j].port.low) + <= OGS_NAS_MAX_QOS_RULES_LEN); + target.pf[j].component[j].port.low = + htobe16(target.pf[j].component[j].port.low); + memcpy(buffer + length, + &target.pf[j].component[j].port.low, + sizeof(target.pf[j].component[j].port.low)); + length += sizeof(target.pf[j].component[j].port.low); + break; + case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE: + case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE: + ogs_assert(length + + sizeof(target.pf[j].component[j].port.low) + <= OGS_NAS_MAX_QOS_RULES_LEN); + target.pf[j].component[j].port.low = + htobe16(target.pf[j].component[j].port.low); + memcpy(buffer + length, + &target.pf[j].component[j].port.low, + sizeof(target.pf[j].component[j].port.low)); + length += sizeof(target.pf[j].component[j].port.low); + + ogs_assert(length + + sizeof(target.pf[j].component[j].port.high) + <= OGS_NAS_MAX_QOS_RULES_LEN); + target.pf[j].component[j].port.high = + htobe16(target.pf[j].component[j].port.high); + memcpy(buffer + length, + &target.pf[j].component[j].port.high, + sizeof(target.pf[j].component[j].port.high)); + length += sizeof(target.pf[j].component[j].port.high); + break; + default: + ogs_fatal("Unknown Packet Filter Type(%d)", + target.pf[j].component[j].type); + ogs_assert_if_reached(); + } + } + + } + + ogs_assert(length + sizeof(target.precedence) <= + OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, &target.precedence, sizeof(target.precedence)); + length += sizeof(target.precedence); + ogs_assert(length + sizeof(target.flow.flags) <= + OGS_NAS_MAX_QOS_RULES_LEN); + memcpy(buffer + length, &target.flow.flags, sizeof(target.precedence)); + length += sizeof(target.flow.flags); + } + + rules->buffer = buffer; + rules->length = length; +} diff --git a/lib/nas/5gs/types.h b/lib/nas/5gs/types.h index 57dc6eb6f..6aa0aa460 100644 --- a/lib/nas/5gs/types.h +++ b/lib/nas/5gs/types.h @@ -47,7 +47,7 @@ typedef struct ogs_nas_dnn_s { * O TLV-E 7-1503 */ typedef struct ogs_nas_eap_message_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_eap_message_t; /* 9.11.2.8.1 S-NSSAI @@ -58,8 +58,8 @@ typedef struct ogs_nas_eap_message_s { #define OGS_NAS_S_NSSAI_SST_SD_AND_MAPPED_HPLMN_SST_LEN 5 typedef struct ogs_nas_s_nssai_s { uint8_t length; - ogs_s_nssai_t s_nssai; - ogs_s_nssai_t mapped_s_nssai; + uint8_t sst; + ogs_uint24_t sd; } __attribute__ ((packed)) ogs_nas_s_nssai_t; /* 9.11.3.1 5GMM capability @@ -146,7 +146,7 @@ ED4(uint8_t spare1:1;, #define OGS_NAS_5GS_SUPI_FORMAT_IMSI 0 #define OGS_NAS_5GS_SUPI_FORMAT_NETWORK_SPECIFIC_IDENTIFIER 1 uint8_t supi_format:3;, - uint8_t spare:1;, + uint8_t odd_even:1;, uint8_t type:3;) } __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_header_t; typedef struct ogs_nas_5gs_mobile_identity_imsi_s { @@ -177,7 +177,7 @@ typedef struct ogs_nas_5gs_mobile_identity_s_tmsi_s { } __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_s_tmsi_t; typedef struct ogs_nas_5gs_mobile_identity_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_5gs_mobile_identity_t; /* 9.11.3.5 5GS network feature support @@ -197,9 +197,6 @@ ED3(uint8_t spare:6;, /* 9.11.3.6 5GS registration result * O TLV 3-5 */ -#define OGS_NAS_5GS_REGISTRATION_TYPE_3GPP_ACCESS 0 -#define OGS_NAS_5GS_REGISTRATION_TYPE_NON_3GPP_ACCESS 1 -#define OGS_NAS_5GS_REGISTRATION_TYPE_3GPP_AND_NON_3GPP_ACCESS 2 typedef struct ogs_nas_5gs_registration_result_s { uint8_t length; ED3(uint8_t spare:4;, @@ -214,9 +211,14 @@ ED3(uint8_t spare:4;, #define OGS_NAS_5GS_REGISTRATION_TYPE_PERIODIC_UPDATING 3 #define OGS_NAS_5GS_REGISTRATION_TYPE_EMERGENCY 4 typedef struct ogs_nas_5gs_registration_type_s { -ED3(uint8_t type:4;, - uint8_t follow_on_request:1;, - uint8_t value:3;) + union { + struct { + ED3(uint8_t type:4;, + uint8_t follow_on_request:1;, + uint8_t value:3;) + }; + uint8_t data; + }; } ogs_nas_5gs_registration_type_t; /* 9.11.3.8 5GS tracking area identity @@ -292,10 +294,9 @@ typedef struct ogs_nas_abba_s { /* 9.11.3.11 Access Type * M V 1/2 */ -#define OGS_NAS_NOTIFICATION_ACCESS_TYPE_3GPP 1 -#define OGS_NAS_NOTIFICATION_ACCESS_TYPE_NON_3GPP 2 typedef struct ogs_nas_access_type_s { -ED2(uint8_t spare:5;, +ED3(uint8_t type:4;, + uint8_t spare:1;, uint8_t value:3;) } __attribute__ ((packed)) ogs_nas_access_type_t; @@ -351,7 +352,7 @@ ED4(uint8_t type:4;, * O TLV-E 3-n */ typedef struct ogs_nas_cag_information_list_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_cag_information_list_t; /* 9.11.3.18B CIoT small data container @@ -369,11 +370,13 @@ ED3(uint8_t data_type:3;, * O TLV-E x-n */ typedef struct ogs_nas_ciphering_key_data_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_ciphering_key_data_t; /* 9.11.3.18D Control plane service type * M V 1/2 */ +#define OGS_NAS_5GS_CONTROL_PLANE_SERVICE_TYPE_MO 0 +#define OGS_NAS_5GS_CONTROL_PLANE_SERVICE_TYPE_MT 1 typedef struct ogs_nas_control_plane_service_type_s { ED3(uint8_t type:4;, uint8_t spare:1;, @@ -393,7 +396,7 @@ ED4(uint8_t type:4;, * O TLV-E 4-n */ typedef struct ogs_nas_eps_nas_message_container_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_eps_nas_message_container_t; /* 9.11.3.25 EPS NAS security algorithms @@ -404,14 +407,14 @@ typedef ogs_nas_security_algorithms_t ogs_nas_eps_nas_security_algorithms_t; * O TLV-E 3-811 */ typedef struct ogs_nas_ladn_indication_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_ladn_indication_t; /* 9.11.3.30 LADN information * O TLV-E 12-1715 */ typedef struct ogs_nas_ladn_information_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_ladn_information_t; /* 9.11.3.31 MICO indication @@ -431,17 +434,17 @@ ED2(uint8_t type:4;, /* 9.11.3.31B Mapped NSSAI * O TLV 3-42 */ -#define OGS_NAX_MAX_NUM_OF_MAPPED_S_NSSAI 10 +#define OGS_NAS_MAX_MAPPED_NSSAI_LEN 40 typedef struct ogs_nas_mapped_nssai_s { uint8_t length; - ogs_s_nssai_t s_nssai[OGS_NAX_MAX_NUM_OF_MAPPED_S_NSSAI]; + char buffer[OGS_NAS_MAX_MAPPED_NSSAI_LEN]; } ogs_nas_mapped_nssai_t; /* 9.11.3.33 message container * O TLV-E 4-n */ typedef struct ogs_nas_message_container_s { uint16_t length; - uint8_t *buffer; + void *buffer; } __attribute__ ((packed)) ogs_nas_message_container_t; /* 9.11.3.36 Network slicing indication @@ -455,10 +458,10 @@ ED4(uint8_t type:4;, /* 9.11.3.37 NSSAI * O TLV 4-72 */ -#define OGS_NAS_MAX_NUM_OF_S_NSSAI 18 +#define OGS_NAS_MAX_NSSAI_LEN 70 typedef struct ogs_nas_nssai_s { uint8_t length; - ogs_s_nssai_t s_nssai[OGS_NAS_MAX_NUM_OF_S_NSSAI]; + char buffer[OGS_NAS_MAX_NSSAI_LEN]; } __attribute__ ((packed)) ogs_nas_nssai_t; /* 9.11.3.37A NSSAI inclusion mode @@ -477,18 +480,25 @@ ED3(uint8_t type:4;, * O TLV-E 3-n */ typedef struct ogs_nas_operator_defined_access_category_definitions_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_operator_defined_access_category_definitions_t; /* 9.11.3.39 Payload container * O TLV-E 4-65535 */ typedef struct ogs_nas_payload_container_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_payload_container_t; /* 9.11.3.40 Payload container type * O TV 1 */ +#define OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION 1 +#define OGS_NAS_PAYLOAD_CONTAINER_SMS 2 +#define OGS_NAS_PAYLOAD_CONTAINER_LPP 3 +#define OGS_NAS_PAYLOAD_CONTAINER_SOR 4 +#define OGS_NAS_PAYLOAD_CONTAINER_UE_POLICY 5 +#define OGS_NAS_PAYLOAD_CONTAINER_UE_PARAMETER_UPDATE 6 +#define OGS_NAS_PAYLOAD_CONTAINER_MULTIPLE 7 typedef struct ogs_nas_payload_container_type_s { ED2(uint8_t type:4;, uint8_t value:4;) @@ -496,10 +506,7 @@ ED2(uint8_t type:4;, /* 9.11.3.41 PDU session identity 2 * C TV 2 */ -typedef struct ogs_nas_pdu_session_identity_2_s { - uint8_t type; - uint8_t value; -} __attribute__ ((packed)) ogs_nas_pdu_session_identity_2_t; +typedef uint8_t ogs_nas_pdu_session_identity_2_t; /* 9.11.3.42 PDU session reactivation result * O TLV 4-34 */ @@ -509,7 +516,7 @@ typedef ogs_nas_allowed_pdu_session_status_t ogs_nas_pdu_session_reactivation_re * O TLV-E 5-515 */ typedef struct ogs_nas_pdu_session_reactivation_result_error_cause_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_pdu_session_reactivation_result_error_cause_t; /* 9.11.3.44 PDU session status @@ -518,13 +525,10 @@ typedef ogs_nas_allowed_pdu_session_status_t ogs_nas_pdu_session_status_t; /* 9.11.3.46 Rejected NSSAI * O TLV 4-42 */ +#define OGS_NAS_MAX_REJECTED_NSSAI_LEN 40 typedef struct ogs_nas_rejected_nssai_s { uint8_t length; - struct { -ED2(uint8_t len:4;, - uint8_t value:4;) - ogs_s_nssai_t s_nssai; - } rejected[OGS_MAX_NUM_OF_S_NSSAI]; + char buffer[OGS_NAS_MAX_REJECTED_NSSAI_LEN]; } ogs_nas_rejected_nssai_t; /* 9.11.3.49 Service area list @@ -561,7 +565,7 @@ ED2(uint8_t type:4;, * O TLV-E 20-n */ typedef struct ogs_nas_sor_transparent_container_s { uint8_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_sor_transparent_container_t; /* 9.11.3.48 S1 UE network capability @@ -664,7 +668,7 @@ ED3(uint8_t spare:6;, #define OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION 96 #define OGS_5GSM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97 #define OGS_5GSM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 98 -#define OGS_5GSM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT IMPLEMENTED 99 +#define OGS_5GSM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 99 #define OGS_5GSM_CAUSE_CONDITIONAL_IE_ERROR 100 #define OGS_5GSM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 101 #define OGS_5GSM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111 @@ -715,7 +719,7 @@ typedef struct ogs_nas_integrity_protection_maximum_data_rate_s { * O TLV-E 7-65535 */ typedef struct ogs_nas_mapped_eps_bearer_contexts_s { uint8_t length; - uint8_t *buffer; + void *buffer; } __attribute__ ((packed)) ogs_nas_mapped_eps_bearer_contexts_t; /* 9.11.4.9 Maximum number of supported packet filters @@ -726,34 +730,8 @@ ED2(uint8_t max2:3;, uint8_t spare:5;) } __attribute__ ((packed)) ogs_nas_maximum_number_of_supported_packet_filters_t; -/* 9.11.4.10 PDU address - * O TLV 7, 11 or 15 */ -#define OGS_NAS_PDU_ADDRESS_TYPE_IPV4 1 -#define OGS_NAS_PDU_ADDRESS_TYPE_IPV6 2 -#define OGS_NAS_PDU_ADDRESS_TYPE_IPV4V6 3 -typedef struct ogs_nas_pdu_address_s { - uint8_t length; -ED2(uint8_t reserved:5;, - uint8_t type:3;) - union { - uint32_t addr; - struct { - uint8_t addr6[OGS_IPV6_LEN>>1]; /* Interface Identifer Only */ - }; - struct { - uint8_t addr6[OGS_IPV6_LEN>>1]; /* Interface Identifer Only */ - uint32_t addr; - } both; - }; -} __attribute__ ((packed)) ogs_nas_pdu_address_t; - /* 9.11.4.11 PDU session type * O TV 1 */ -#define OGS_NAS_PDU_SESSION_TYPE_IPV4 1 -#define OGS_NAS_PDU_SESSION_TYPE_IPV6 2 -#define OGS_NAS_PDU_SESSION_TYPE_IPV4V6 3 -#define OGS_NAS_PDU_SESSION_TYPE_UNSTRUCTURED 4 -#define OGS_NAS_PDU_SESSION_TYPE_ETHERNET 5 typedef struct ogs_nas_pdu_session_type_s { ED3(uint8_t type:4;, uint8_t spare:1;, @@ -764,15 +742,102 @@ ED3(uint8_t type:4;, * O TLV-E 6-65535 */ typedef struct ogs_nas_qos_flow_descriptions_s { uint8_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_qos_flow_descriptions_t; /* 9.11.4.13 QoS rules * M LV-E 6-65535 */ +#define OGS_NAS_MAX_NUM_OF_QOS_RULE 8 +#define OGS_NAS_MAX_NUM_OF_PACKET_FILTER_COMPONENT 16 +typedef struct ogs_nas_qos_rule_s { + uint8_t identifier; + uint16_t length; + union { + struct { +#define OGS_NAS_QOS_CODE_CREATE_NEW_QOS_RULE 1 +#define OGS_NAS_QOS_CODE_DELETE_EXISTING_QOS_RULE 2 +#define OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_ADD_PACKET_FILTERS 3 +#define OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_REPLACE_PACKET_FILTERS 4 +#define OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS 5 +#define OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS 6 + ED3(uint8_t code:3;, + uint8_t DQR_bit:1;, + uint8_t num_of_packet_filter:4;) + }; + uint8_t flags; + }; + struct { + union { + struct { + ED3(uint8_t spare:2;, +#define OGS_NAS_QOS_DIRECTION_DOWNLINK 1 +#define OGS_NAS_QOS_DIRECTION_UPLINK 2 +#define OGS_NAS_QOS_DIRECTION_BIDIRECTIONAL 3 + uint8_t direction:2;, + uint8_t pf_identifier:4;) + }; + uint8_t flags; + }; + uint8_t length; +#define OGS_PACKET_FILTER_MATCH_ALL 1 +#define OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48 +#define OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16 +#define OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17 +#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE 32 +#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE 33 +#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE 34 +#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE 35 +#define OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE 64 +#define OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE 65 +#define OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE 80 +#define OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE 81 +#define OGS_PACKET_FILTER_SECURITY_PARAMETER_INDEX_TYPE 96 +#define OGS_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112 +#define OGS_PACKET_FILTER_FLOW_LABEL_TYPE 128 + struct { + uint8_t type; + union { + uint8_t proto; + struct { + uint32_t addr; + uint32_t mask; + } ipv4; + struct { + uint32_t addr[4]; + uint8_t prefixlen; + } ipv6; + struct { + uint32_t addr[4]; + uint32_t mask[4]; + } ipv6_mask; + struct { + uint16_t low; + uint16_t high; + } port; + }; + } component[OGS_NAS_MAX_NUM_OF_PACKET_FILTER_COMPONENT]; + uint8_t num_of_component; + } pf[OGS_MAX_NUM_OF_PACKET_FILTER]; + + uint8_t precedence; + union { + struct { + ED3(uint8_t spare:1;, + uint8_t segregation:1;, + uint8_t identifier:4;) + }; + uint8_t flags; + } flow; +} ogs_nas_qos_rule_t; + +#define OGS_NAS_MAX_QOS_RULES_LEN 65535 typedef struct ogs_nas_qos_rules_s { - uint8_t length; - uint8_t *buffer; -} ogs_nas_qos_rules_t; + uint16_t length; + void *buffer; +} __attribute__ ((packed)) ogs_nas_qos_rules_t; + +void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules, + ogs_nas_qos_rule_t *rule, int num_of_rule); /* 9.11.4.14 Session-AMBR * M LV 7 */ @@ -801,16 +866,18 @@ typedef struct ogs_nas_qos_rules_s { #define OGS_NAS_BR_UNIT_16P 23 #define OGS_NAS_BR_UNIT_64P 24 #define OGS_NAS_BR_UNIT_256P 25 +typedef struct ogs_nas_bitrate_s { + uint8_t unit; + uint16_t bitrate; +} __attribute__ ((packed)) ogs_nas_bitrate_t; + +void ogs_nas_bitrate_from_uint64( + ogs_nas_bitrate_t *nas_bitrate, uint64_t bitrate); + typedef struct ogs_nas_session_ambr_s { uint8_t length; - struct { - uint8_t unit; - uint16_t br; - } dl; - struct { - uint8_t unit; - uint16_t br; - } ul; + ogs_nas_bitrate_t downlink; + ogs_nas_bitrate_t uplink; } __attribute__ ((packed)) ogs_nas_session_ambr_t; /* 9.11.4.15 SM PDU DN request container @@ -847,7 +914,7 @@ ED2(uint8_t spare:7;, * O TLV-E 3-65535 */ typedef struct ogs_nas_atsss_container_s { uint8_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_atsss_container_t; /* 9.9.4.25 Release assistance indication @@ -892,7 +959,7 @@ typedef struct ogs_nas_ue_ds_tt_residence_time_s { * O TLV-E 4-65535 */ typedef struct ogs_nas_port_management_information_container_s { uint8_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_port_management_information_container_t; /* 9.11.3.72 N5GC indication diff --git a/lib/nas/common/types.h b/lib/nas/common/types.h index 8d6acf52c..97f21452d 100644 --- a/lib/nas/common/types.h +++ b/lib/nas/common/types.h @@ -333,7 +333,8 @@ ED2(uint8_t unit:3;, * O TLV 3 */ typedef struct ogs_nas_gprs_timer_2_s { uint8_t length; - uint8_t gprs_timer_2_value; +ED2(uint8_t unit:3;, + uint8_t value:5;) } __attribute__ ((packed)) ogs_nas_gprs_timer_2_t; /* 9.9.3.16B GPRS timer 3 @@ -351,7 +352,7 @@ typedef struct ogs_nas_gprs_timer_2_s { typedef struct ogs_nas_gprs_timer_3_s { uint8_t length; ED2(uint8_t unit:3;, - uint8_t timer_value:5;) + uint8_t value:5;) } __attribute__ ((packed)) ogs_nas_gprs_timer_3_t; /* 9.9.3.18 IMEISV request @@ -363,7 +364,7 @@ ED3(uint8_t type:4;, uint8_t spare:1;, #define OGS_NAS_IMEISV_NOT_REQUESTED 0 #define OGS_NAS_IMEISV_REQUESTED 1 - uint8_t imeisv_request_value:3;) + uint8_t value:3;) } __attribute__ ((packed)) ogs_nas_imeisv_request_t; /* 9.9.3.21 NAS key set identifier @@ -697,7 +698,7 @@ typedef struct ogs_nas_emergency_number_list_s { * O TLV-E 7-65535 */ typedef struct ogs_nas_extended_emergency_number_list_s { uint8_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_extended_emergency_number_list_t; /* 9.9.3.46 Extended DRX parameters @@ -748,6 +749,29 @@ void eps_qos_build(ogs_nas_eps_quality_of_service_t *eps_qos, uint8_t qci, uint64_t dl_mbr, uint64_t ul_mbr, uint64_t dl_gbr, uint64_t ul_gbr); +/* 9.9.4.9 PDN address + * M LV 6-14 */ +/* 9.11.4.10 PDU address + * O TLV 7, 11 or 15 */ +#define OGS_NAS_PDU_ADDRESS_IPV4_LEN 5 +#define OGS_NAS_PDU_ADDRESS_IPV6_LEN 9 +#define OGS_NAS_PDU_ADDRESS_IPV4V6_LEN 13 +typedef struct ogs_nas_pdu_address_s { + uint8_t length; +ED2(uint8_t reserved:5;, + uint8_t pdn_type:3;) + union { + uint32_t addr; + struct { + uint8_t addr6[OGS_IPV6_LEN>>1]; /* Interface Identifer Only */ + }; + struct { + uint8_t addr6[OGS_IPV6_LEN>>1]; /* Interface Identifer Only */ + uint32_t addr; + } both; + }; +} __attribute__ ((packed)) ogs_nas_pdu_address_t; + /* 9.9.4.14 Request type * M V 1/2 * See subclause 10.5.6.17 in 3GPP TS 24.008 [13]. @@ -830,7 +854,7 @@ ED3(uint8_t type:4;, * O TLV-E 4-65538 */ typedef struct ogs_nas_extended_protocol_configuration_options_s { uint16_t length; - uint8_t *buffer; + void *buffer; } __attribute__ ((packed)) ogs_nas_extended_protocol_configuration_options_t; /* 9.9.4.28 Serving PLMN rate control diff --git a/lib/nas/eps/types.h b/lib/nas/eps/types.h index 9f741c0d1..60632151c 100644 --- a/lib/nas/eps/types.h +++ b/lib/nas/eps/types.h @@ -293,7 +293,7 @@ ED4(uint8_t tsc:1;, * M LV-E 5-n */ typedef struct ogs_nas_esm_message_container_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_esm_message_container_t; /* 9.9.3.17 Identity type 2 @@ -526,7 +526,7 @@ typedef uint8_t ogs_nas_generic_message_container_type_t; * M LV-E 3-n */ typedef struct ogs_nas_generic_message_container_s { uint16_t length; - uint8_t *buffer; + void *buffer; } ogs_nas_generic_message_container_t; /* 9.9.3.44 Voice domain preference and UE's usage setting @@ -663,24 +663,7 @@ ED3(uint8_t type:4;, /* 9.9.4.9 PDN address * M LV 6-14 */ -#define OGS_NAS_PDN_ADDRESS_IPV4_LEN 5 -#define OGS_NAS_PDN_ADDRESS_IPV6_LEN 9 -#define OGS_NAS_PDN_ADDRESS_IPV4V6_LEN 13 -typedef struct ogs_nas_pdn_address_s { - uint8_t length; -ED2(uint8_t reserved:5;, - uint8_t pdn_type:3;) - union { - uint32_t addr; - struct { - uint8_t addr6[OGS_IPV6_LEN>>1]; /* Interface Identifer Only */ - }; - struct { - uint8_t addr6[OGS_IPV6_LEN>>1]; /* Interface Identifer Only */ - uint32_t addr; - } both; - }; -} __attribute__ ((packed)) ogs_nas_pdn_address_t; +typedef ogs_nas_pdu_address_t ogs_nas_pdn_address_t; /* 9.9.4.11 Protocol configuration options * See subclause 10.5.6.3 in 3GPP TS 24.008 [13]. diff --git a/lib/ngap/message.c b/lib/ngap/message.c index 1056176e8..077fa276a 100644 --- a/lib/ngap/message.c +++ b/lib/ngap/message.c @@ -21,9 +21,8 @@ int __ogs_ngap_domain; -ogs_pkbuf_t *ogs_ngap_encode(ogs_ngap_message_t *message) +ogs_pkbuf_t *nga_ngap_encode(ogs_ngap_message_t *message) { - asn_enc_rval_t enc_ret = {0}; ogs_pkbuf_t *pkbuf = NULL; ogs_assert(message); @@ -31,41 +30,30 @@ ogs_pkbuf_t *ogs_ngap_encode(ogs_ngap_message_t *message) if (ogs_log_get_domain_level(OGS_LOG_DOMAIN) >= OGS_LOG_TRACE) asn_fprint(stdout, &asn_DEF_NGAP_NGAP_PDU, message); - pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN); - ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN); + pkbuf = ogs_asn_encode(&asn_DEF_NGAP_NGAP_PDU, message); + ogs_asn_free(&asn_DEF_NGAP_NGAP_PDU, message); - enc_ret = aper_encode_to_buffer(&asn_DEF_NGAP_NGAP_PDU, NULL, - message, pkbuf->data, OGS_MAX_SDU_LEN); - ogs_ngap_free(message); - - if (enc_ret.encoded < 0) { - ogs_error("Failed to encode NGAP-PDU[%d]", (int)enc_ret.encoded); - ogs_pkbuf_free(pkbuf); + if (pkbuf == NULL) { + ogs_error("Failed to encode NGAP-PDU"); return NULL; } - ogs_pkbuf_trim(pkbuf, (enc_ret.encoded >> 3)); - return pkbuf; } -int ogs_ngap_decode(ogs_ngap_message_t *message, ogs_pkbuf_t *pkbuf) +int nga_ngap_decode(ogs_ngap_message_t *message, ogs_pkbuf_t *pkbuf) { - asn_dec_rval_t dec_ret = {0}; - + int rv; ogs_assert(message); ogs_assert(pkbuf); ogs_assert(pkbuf->data); ogs_assert(pkbuf->len); - memset((void *)message, 0, sizeof(ogs_ngap_message_t)); - dec_ret = aper_decode(NULL, &asn_DEF_NGAP_NGAP_PDU, (void **)&message, - pkbuf->data, pkbuf->len, 0, 0); - - if (dec_ret.code != RC_OK) { - ogs_warn("Failed to decode NGAP-PDU[code:%d,consumed:%d]", - dec_ret.code, (int)dec_ret.consumed); - return OGS_ERROR; + rv = ogs_asn_decode(&asn_DEF_NGAP_NGAP_PDU, + message, sizeof(ogs_ngap_message_t), pkbuf); + if (rv != OGS_OK) { + ogs_warn("Failed to decode NGAP-PDU"); + return rv; } if (ogs_log_get_domain_level(OGS_LOG_DOMAIN) >= OGS_LOG_TRACE) @@ -74,11 +62,8 @@ int ogs_ngap_decode(ogs_ngap_message_t *message, ogs_pkbuf_t *pkbuf) return OGS_OK; } -int ogs_ngap_free(ogs_ngap_message_t *message) +void nga_ngap_free(ogs_ngap_message_t *message) { ogs_assert(message); - - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, message); - - return OGS_OK; + ogs_asn_free(&asn_DEF_NGAP_NGAP_PDU, message); } diff --git a/lib/ngap/message.h b/lib/ngap/message.h index 8f6a916de..eb4a91e58 100644 --- a/lib/ngap/message.h +++ b/lib/ngap/message.h @@ -30,9 +30,9 @@ extern "C" { typedef struct NGAP_NGAP_PDU ogs_ngap_message_t; -int ogs_ngap_decode(ogs_ngap_message_t *message, ogs_pkbuf_t *pkbuf); -ogs_pkbuf_t *ogs_ngap_encode(ogs_ngap_message_t *message); -int ogs_ngap_free(ogs_ngap_message_t *message); +int nga_ngap_decode(ogs_ngap_message_t *message, ogs_pkbuf_t *pkbuf); +ogs_pkbuf_t *nga_ngap_encode(ogs_ngap_message_t *message); +void nga_ngap_free(ogs_ngap_message_t *message); #ifdef __cplusplus } diff --git a/lib/ngap/ogs-ngap.h b/lib/ngap/ogs-ngap.h index 92b31be64..f79a52c95 100644 --- a/lib/ngap/ogs-ngap.h +++ b/lib/ngap/ogs-ngap.h @@ -630,6 +630,7 @@ #include "NGAP_XnTNLConfigurationInfo.h" #include "asn1c/util/conv.h" +#include "asn1c/util/message.h" #define OGS_NGAP_INSIDE diff --git a/lib/s1ap/message.c b/lib/s1ap/message.c index 044ebacea..9feca6c48 100644 --- a/lib/s1ap/message.c +++ b/lib/s1ap/message.c @@ -23,7 +23,6 @@ int __ogs_s1ap_domain; ogs_pkbuf_t *ogs_s1ap_encode(ogs_s1ap_message_t *message) { - asn_enc_rval_t enc_ret = {0}; ogs_pkbuf_t *pkbuf = NULL; ogs_assert(message); @@ -31,41 +30,30 @@ ogs_pkbuf_t *ogs_s1ap_encode(ogs_s1ap_message_t *message) if (ogs_log_get_domain_level(OGS_LOG_DOMAIN) >= OGS_LOG_TRACE) asn_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, message); - pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN); - ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN); + pkbuf = ogs_asn_encode(&asn_DEF_S1AP_S1AP_PDU, message); + ogs_asn_free(&asn_DEF_S1AP_S1AP_PDU, message); - enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_S1AP_PDU, NULL, - message, pkbuf->data, OGS_MAX_SDU_LEN); - ogs_s1ap_free(message); - - if (enc_ret.encoded < 0) { - ogs_error("Failed to encode S1AP-PDU[%d]", (int)enc_ret.encoded); - ogs_pkbuf_free(pkbuf); + if (pkbuf == NULL) { + ogs_error("Failed to encode S1AP-PDU"); return NULL; } - ogs_pkbuf_trim(pkbuf, (enc_ret.encoded >> 3)); - return pkbuf; } int ogs_s1ap_decode(ogs_s1ap_message_t *message, ogs_pkbuf_t *pkbuf) { - asn_dec_rval_t dec_ret = {0}; - + int rv; ogs_assert(message); ogs_assert(pkbuf); ogs_assert(pkbuf->data); ogs_assert(pkbuf->len); - memset((void *)message, 0, sizeof(ogs_s1ap_message_t)); - dec_ret = aper_decode(NULL, &asn_DEF_S1AP_S1AP_PDU, (void **)&message, - pkbuf->data, pkbuf->len, 0, 0); - - if (dec_ret.code != RC_OK) { - ogs_warn("Failed to decode S1AP-PDU[code:%d,consumed:%d]", - dec_ret.code, (int)dec_ret.consumed); - return OGS_ERROR; + rv = ogs_asn_decode(&asn_DEF_S1AP_S1AP_PDU, + message, sizeof(ogs_s1ap_message_t), pkbuf); + if (rv != OGS_OK) { + ogs_warn("Failed to decode S1AP-PDU"); + return rv; } if (ogs_log_get_domain_level(OGS_LOG_DOMAIN) >= OGS_LOG_TRACE) @@ -74,11 +62,8 @@ int ogs_s1ap_decode(ogs_s1ap_message_t *message, ogs_pkbuf_t *pkbuf) return OGS_OK; } -int ogs_s1ap_free(ogs_s1ap_message_t *message) +void ogs_s1ap_free(ogs_s1ap_message_t *message) { ogs_assert(message); - - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, message); - - return OGS_OK; + ogs_asn_free(&asn_DEF_S1AP_S1AP_PDU, message); } diff --git a/lib/s1ap/message.h b/lib/s1ap/message.h index 37a026989..e8d448696 100644 --- a/lib/s1ap/message.h +++ b/lib/s1ap/message.h @@ -32,7 +32,7 @@ typedef struct S1AP_S1AP_PDU ogs_s1ap_message_t; int ogs_s1ap_decode(ogs_s1ap_message_t *message, ogs_pkbuf_t *pkbuf); ogs_pkbuf_t *ogs_s1ap_encode(ogs_s1ap_message_t *message); -int ogs_s1ap_free(ogs_s1ap_message_t *message); +void ogs_s1ap_free(ogs_s1ap_message_t *message); #ifdef __cplusplus } diff --git a/lib/s1ap/ogs-s1ap.h b/lib/s1ap/ogs-s1ap.h index 173979cac..adadd24ef 100644 --- a/lib/s1ap/ogs-s1ap.h +++ b/lib/s1ap/ogs-s1ap.h @@ -542,6 +542,7 @@ #include "S1AP_asn_constant.h" #include "asn1c/util/conv.h" +#include "asn1c/util/message.h" #define OGS_S1AP_INSIDE diff --git a/lib/sbi/client.c b/lib/sbi/client.c index 66e67e3ee..d393892f9 100644 --- a/lib/sbi/client.c +++ b/lib/sbi/client.c @@ -20,7 +20,6 @@ #include "ogs-app.h" #include "ogs-sbi.h" -#include "sbi-private.h" #include "curl/curl.h" typedef struct sockinfo_s { @@ -49,6 +48,7 @@ typedef struct connection_s { ogs_timer_t *timer; CURL *easy; + char error[CURL_ERROR_SIZE]; ogs_sbi_client_t *client; @@ -183,18 +183,18 @@ static void mcode_or_die(const char *where, CURLMcode code) } } -static char *add_params_to_url(CURL *easy, char *url, ogs_hash_t *params) +static char *add_params_to_uri(CURL *easy, char *uri, ogs_hash_t *params) { ogs_hash_index_t *hi; int has_params = 0; const char *fp = "?", *np = "&"; ogs_assert(easy); - ogs_assert(url); + ogs_assert(uri); ogs_assert(params); ogs_assert(ogs_hash_count(params)); - has_params = (strchr(url, '?') != NULL); + has_params = (strchr(uri, '?') != NULL); for (hi = ogs_hash_first(params); hi; hi = ogs_hash_next(hi)) { const char *key = NULL; @@ -213,17 +213,17 @@ static char *add_params_to_url(CURL *easy, char *url, ogs_hash_t *params) ogs_assert(val_esc); if (!has_params) { - url = ogs_mstrcatf(url, "%s%s=%s", fp, key_esc, val_esc); + uri = ogs_mstrcatf(uri, "%s%s=%s", fp, key_esc, val_esc); has_params = 1; } else { - url = ogs_mstrcatf(url, "%s%s=%s", np, key_esc, val_esc); + uri = ogs_mstrcatf(uri, "%s%s=%s", np, key_esc, val_esc); } curl_free(val_esc); curl_free(key_esc); } - return url; + return uri; } static connection_t *connection_add(ogs_sbi_client_t *client, @@ -277,21 +277,24 @@ static connection_t *connection_add(ogs_sbi_client_t *client, strcmp(request->h.method, OGS_SBI_HTTP_METHOD_DELETE) == 0 || strcmp(request->h.method, OGS_SBI_HTTP_METHOD_POST) == 0) { - curl_easy_setopt(conn->easy, CURLOPT_CUSTOMREQUEST, request->h.method); + curl_easy_setopt(conn->easy, + CURLOPT_CUSTOMREQUEST, request->h.method); if (request->http.content) { - curl_easy_setopt(conn->easy, CURLOPT_POSTFIELDS, - request->http.content); + curl_easy_setopt(conn->easy, + CURLOPT_POSTFIELDS, request->http.content); + curl_easy_setopt(conn->easy, + CURLOPT_POSTFIELDSIZE, request->http.content_length); } } curl_easy_setopt(conn->easy, CURLOPT_HTTPHEADER, conn->header_list); if (ogs_hash_count(request->http.params)) { - request->h.url = add_params_to_url(conn->easy, - request->h.url, request->http.params); + request->h.uri = add_params_to_uri(conn->easy, + request->h.uri, request->http.params); } - curl_easy_setopt(conn->easy, CURLOPT_URL, request->h.url); + curl_easy_setopt(conn->easy, CURLOPT_URL, request->h.uri); curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); @@ -413,9 +416,9 @@ static void check_multi_info(ogs_sbi_client_t *client) response->h.method = ogs_strdup(conn->method); /* remove https://localhost:8000 */ - response->h.url = ogs_strdup(url); + response->h.uri = ogs_strdup(url); - response->http.content = ogs_strdup(conn->memory); + response->http.content = ogs_memdup(conn->memory, conn->size); response->http.content_length = conn->size; if (content_type) @@ -452,13 +455,53 @@ void ogs_sbi_client_send_request( ogs_assert(client); ogs_assert(request); - if (request->h.url == NULL) { - request->h.url = ogs_sbi_client_uri(client, &request->h); + if (request->h.uri == NULL) { + request->h.uri = ogs_sbi_client_uri(client, &request->h); } conn = connection_add(client, request, data); ogs_assert(conn); - ogs_sbi_request_free(request); +} + +void ogs_sbi_client_send_request_to_nf_instance( + ogs_sbi_nf_instance_t *nf_instance, + ogs_sbi_request_t *request, void *data) +{ + ogs_sbi_client_t *client = NULL; + + ogs_assert(request); + ogs_assert(nf_instance); + + if (request->h.uri == NULL) { + client = ogs_sbi_client_find_by_service_name(nf_instance, + request->h.service.name, request->h.api.version); + if (!client) { + ogs_error("[%s] Cannot find client [%s:%s]", + nf_instance->id, + request->h.service.name, request->h.api.version); + return; + } + } else { + ogs_sockaddr_t *addr = NULL; + char buf[OGS_ADDRSTRLEN]; + + addr = ogs_sbi_getaddr_from_uri(request->h.uri); + if (!addr) { + ogs_error("[%s] Invalid confirmation URL [%s]", + nf_instance->id, request->h.uri); + return; + } + client = ogs_sbi_client_find(addr); + if (!client) { + ogs_error("[%s] Cannot find client [%s:%d]", nf_instance->id, + OGS_ADDR(addr, buf), OGS_PORT(addr)); + ogs_freeaddrinfo(addr); + return; + } + ogs_freeaddrinfo(addr); + } + + ogs_sbi_client_send_request(client, request, data); } static size_t write_cb(void *contents, size_t size, size_t nmemb, void *data) @@ -492,8 +535,17 @@ static size_t header_cb(void *ptr, size_t size, size_t nmemb, void *data) conn = data; ogs_assert(conn); - if (strncmp(ptr, OGS_SBI_LOCATION, strlen(OGS_SBI_LOCATION)) == 0) - conn->location = ogs_strdup((char *)ptr + strlen(OGS_SBI_LOCATION) + 2); + if (strncmp(ptr, OGS_SBI_LOCATION, strlen(OGS_SBI_LOCATION)) == 0) { + /* ptr : "Location: http://xxx/xxx/xxx\r\n" + We need to truncate "Location" + ": " + "\r\n" in 'ptr' string */ + int len = strlen(ptr) - strlen(OGS_SBI_LOCATION) - 2 - 2; + if (len) { + /* Only copy http://xxx/xxx/xxx" from 'ptr' string */ + conn->location = ogs_memdup( + (char *)ptr + strlen(OGS_SBI_LOCATION) + 2, len+1); + conn->location[len] = 0; + } + } return (nmemb*size); } diff --git a/lib/sbi/client.h b/lib/sbi/client.h index b571b1b62..ee527775b 100644 --- a/lib/sbi/client.h +++ b/lib/sbi/client.h @@ -57,6 +57,8 @@ typedef struct ogs_sbi_client_s { unsigned int reference_count; /* reference count for memory free */ } ogs_sbi_client_t; +typedef struct ogs_sbi_nf_instance_s ogs_sbi_nf_instance_t; + void ogs_sbi_client_init(int num_of_sockinfo_pool, int num_of_connection_pool); void ogs_sbi_client_final(void); @@ -66,6 +68,9 @@ ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr); void ogs_sbi_client_send_request( ogs_sbi_client_t *client, ogs_sbi_request_t *request, void *data); +void ogs_sbi_client_send_request_to_nf_instance( + ogs_sbi_nf_instance_t *nf_instance, + ogs_sbi_request_t *request, void *data); #ifdef __cplusplus } diff --git a/lib/sbi/context.c b/lib/sbi/context.c index e93caf07f..59f157c2b 100644 --- a/lib/sbi/context.c +++ b/lib/sbi/context.c @@ -907,23 +907,28 @@ bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance) } ogs_sbi_client_t *ogs_sbi_client_find_by_service_name( - ogs_sbi_nf_instance_t *nf_instance, char *name) + ogs_sbi_nf_instance_t *nf_instance, char *name, char *version) { ogs_sbi_nf_service_t *nf_service = NULL; + int i; ogs_assert(nf_instance); ogs_assert(name); + ogs_assert(version); ogs_list_for_each(&nf_instance->nf_service_list, nf_service) { ogs_assert(nf_service->name); - if (strcmp(nf_service->name, name) == 0) - break; + if (strcmp(nf_service->name, name) == 0) { + for (i = 0; i < nf_service->num_of_version; i++) { + if (strcmp(nf_service->versions[i].in_uri, version) == 0) { + return nf_service->client; + } + } + } } - if (nf_service) - return nf_service->client; - else - return nf_instance->client; + ogs_error("[Fallback] Cannot find NF service[%s:%s]", name, version); + return nf_instance->client; } ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_nf_type( @@ -939,6 +944,21 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_nf_type( return nf_instance; } +void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object) +{ + int i; + + ogs_assert(sbi_object); + + for (i = 0; i < OGS_SBI_MAX_NF_TYPE; i++) { + if (sbi_object->nf_types[i].nf_instance) + ogs_sbi_nf_instance_remove(sbi_object->nf_types[i].nf_instance); + } + + if (sbi_object->request) + ogs_sbi_request_free(sbi_object->request); +} + ogs_sbi_subscription_t *ogs_sbi_subscription_add(void) { ogs_sbi_subscription_t *subscription = NULL; diff --git a/lib/sbi/context.h b/lib/sbi/context.h index 92fc1a847..0ae57cda5 100644 --- a/lib/sbi/context.h +++ b/lib/sbi/context.h @@ -104,6 +104,23 @@ typedef struct ogs_sbi_nf_types_s { ogs_sbi_nf_instance_t *nf_instance; } ogs_sbi_nf_types_t[OGS_SBI_MAX_NF_TYPE]; +typedef struct ogs_sbi_object_s { + ogs_lnode_t lnode; + + struct { + ogs_timer_t *timer; + ogs_time_t duration; + } client_wait; + + OpenAPI_nf_type_e nf_type; + ogs_sbi_request_t *request; + + ogs_sbi_nf_types_t nf_types; + + ogs_sbi_session_t *session; + void *nf_state_registered; +} ogs_sbi_object_t; + typedef struct ogs_sbi_nf_service_s { ogs_lnode_t lnode; @@ -152,6 +169,20 @@ typedef struct ogs_sbi_subscription_s { void *client; /* only used in SERVER */ } ogs_sbi_subscription_t; +typedef struct ogs_sbi_discover_s { + OpenAPI_nf_type_e nf_type; + + char *uri; + struct { + char *name; + } service; + struct { + char *version; + } api; + + ogs_sbi_request_t *request; +} ogs_sbi_discover_t; + void ogs_sbi_context_init(ogs_pollset_t *pollset, ogs_timer_mgr_t *timer_mgr); void ogs_sbi_context_final(void); ogs_sbi_context_t *ogs_sbi_self(void); @@ -181,12 +212,14 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default( ogs_sbi_nf_instance_t *nf_instance, char *name); ogs_sbi_client_t *ogs_sbi_client_find_by_service_name( - ogs_sbi_nf_instance_t *nf_instance, char *name); + ogs_sbi_nf_instance_t *nf_instance, char *name, char *version); bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance); bool ogs_sbi_nf_types_associate( ogs_sbi_nf_types_t nf_types, OpenAPI_nf_type_e nf_type, void *state); +void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object); + ogs_sbi_subscription_t *ogs_sbi_subscription_add(void); void ogs_sbi_subscription_set_id( ogs_sbi_subscription_t *subscription, char *id); diff --git a/lib/sbi/contrib/multipart_parser.c b/lib/sbi/contrib/multipart_parser.c new file mode 100644 index 000000000..97f922343 --- /dev/null +++ b/lib/sbi/contrib/multipart_parser.c @@ -0,0 +1,309 @@ +/* Based on node-formidable by Felix Geisendorfer + * Igor Afonov - afonov@gmail.com - 2012 + * MIT License - http://www.opensource.org/licenses/mit-license.php + */ + +#include "ogs-core.h" +#include "multipart_parser.h" + +#include + +static void multipart_log(const char * format, ...) +{ +#ifdef DEBUG_MULTIPART + va_list args; + va_start(args, format); + + fprintf(stderr, "[HTTP_MULTIPART_PARSER] %s:%d: ", __FILE__, __LINE__); + vfprintf(stderr, format, args); + fprintf(stderr, "\n"); +#endif +} + +#define NOTIFY_CB(FOR) \ +do { \ + if (p->settings->on_##FOR) { \ + if (p->settings->on_##FOR(p) != 0) { \ + return i; \ + } \ + } \ +} while (0) + +#define EMIT_DATA_CB(FOR, ptr, len) \ +do { \ + if (p->settings->on_##FOR) { \ + if (p->settings->on_##FOR(p, ptr, len) != 0) { \ + return i; \ + } \ + } \ +} while (0) + + +#define LF 10 +#define CR 13 + +struct multipart_parser { + void * data; + + size_t index; + size_t boundary_length; + + unsigned char state; + + const multipart_parser_settings* settings; + + char* lookbehind; + char multipart_boundary[1]; +}; + +enum state { + s_uninitialized = 1, + s_start, + s_start_boundary, + s_header_field_start, + s_header_field, + s_headers_almost_done, + s_header_value_start, + s_header_value, + s_header_value_almost_done, + s_part_data_start, + s_part_data, + s_part_data_almost_boundary, + s_part_data_boundary, + s_part_data_almost_end, + s_part_data_end, + s_part_data_final_hyphen, + s_end +}; + +multipart_parser* multipart_parser_init + (const char *boundary, const multipart_parser_settings* settings) { + + multipart_parser* p = malloc(sizeof(multipart_parser) + + strlen(boundary) + + strlen(boundary) + 9); + + strcpy(p->multipart_boundary, boundary); + p->boundary_length = strlen(boundary); + + p->lookbehind = (p->multipart_boundary + p->boundary_length + 1); + + p->index = 0; + p->state = s_start; + p->settings = settings; + + return p; +} + +void multipart_parser_free(multipart_parser* p) { + free(p); +} + +void multipart_parser_set_data(multipart_parser *p, void *data) { + p->data = data; +} + +void *multipart_parser_get_data(multipart_parser *p) { + return p->data; +} + +size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len) { + size_t i = 0; + size_t mark = 0; + char c, cl; + int is_last = 0; + + while(i < len) { + c = buf[i]; + is_last = (i == (len - 1)); + switch (p->state) { + case s_start: + multipart_log("s_start"); + p->index = 0; + p->state = s_start_boundary; + + /* fallthrough */ + OGS_GNUC_FALLTHROUGH; + case s_start_boundary: + multipart_log("s_start_boundary"); + if (p->index == p->boundary_length) { + if (c != CR) { + return i; + } + p->index++; + break; + } else if (p->index == (p->boundary_length + 1)) { + if (c != LF) { + return i; + } + p->index = 0; + NOTIFY_CB(part_data_begin); + p->state = s_header_field_start; + break; + } + if (c != p->multipart_boundary[p->index]) { + return i; + } + p->index++; + break; + + case s_header_field_start: + multipart_log("s_header_field_start"); + mark = i; + p->state = s_header_field; + + /* fallthrough */ + OGS_GNUC_FALLTHROUGH; + case s_header_field: + multipart_log("s_header_field"); + if (c == CR) { + p->state = s_headers_almost_done; + break; + } + + if (c == ':') { + EMIT_DATA_CB(header_field, buf + mark, i - mark); + p->state = s_header_value_start; + break; + } + + cl = tolower(c); + if ((c != '-') && (cl < 'a' || cl > 'z')) { + multipart_log("invalid character in header name"); + return i; + } + if (is_last) + EMIT_DATA_CB(header_field, buf + mark, (i - mark) + 1); + break; + + case s_headers_almost_done: + multipart_log("s_headers_almost_done"); + if (c != LF) { + return i; + } + + p->state = s_part_data_start; + break; + + case s_header_value_start: + multipart_log("s_header_value_start"); + if (c == ' ') { + break; + } + + mark = i; + p->state = s_header_value; + + /* fallthrough */ + OGS_GNUC_FALLTHROUGH; + case s_header_value: + multipart_log("s_header_value"); + if (c == CR) { + EMIT_DATA_CB(header_value, buf + mark, i - mark); + p->state = s_header_value_almost_done; + break; + } + if (is_last) + EMIT_DATA_CB(header_value, buf + mark, (i - mark) + 1); + break; + + case s_header_value_almost_done: + multipart_log("s_header_value_almost_done"); + if (c != LF) { + return i; + } + p->state = s_header_field_start; + break; + + case s_part_data_start: + multipart_log("s_part_data_start"); + NOTIFY_CB(headers_complete); + mark = i; + p->state = s_part_data; + + /* fallthrough */ + OGS_GNUC_FALLTHROUGH; + case s_part_data: + multipart_log("s_part_data"); + if (c == CR) { + EMIT_DATA_CB(part_data, buf + mark, i - mark); + mark = i; + p->state = s_part_data_almost_boundary; + p->lookbehind[0] = CR; + break; + } + if (is_last) + EMIT_DATA_CB(part_data, buf + mark, (i - mark) + 1); + break; + + case s_part_data_almost_boundary: + multipart_log("s_part_data_almost_boundary"); + if (c == LF) { + p->state = s_part_data_boundary; + p->lookbehind[1] = LF; + p->index = 0; + break; + } + EMIT_DATA_CB(part_data, p->lookbehind, 1); + p->state = s_part_data; + mark = i --; + break; + + case s_part_data_boundary: + multipart_log("s_part_data_boundary"); + if (p->multipart_boundary[p->index] != c) { + EMIT_DATA_CB(part_data, p->lookbehind, 2 + p->index); + p->state = s_part_data; + mark = i --; + break; + } + p->lookbehind[2 + p->index] = c; + if ((++ p->index) == p->boundary_length) { + NOTIFY_CB(part_data_end); + p->state = s_part_data_almost_end; + } + break; + + case s_part_data_almost_end: + multipart_log("s_part_data_almost_end"); + if (c == '-') { + p->state = s_part_data_final_hyphen; + break; + } + if (c == CR) { + p->state = s_part_data_end; + break; + } + return i; + + case s_part_data_final_hyphen: + multipart_log("s_part_data_final_hyphen"); + if (c == '-') { + NOTIFY_CB(body_end); + p->state = s_end; + break; + } + return i; + + case s_part_data_end: + multipart_log("s_part_data_end"); + if (c == LF) { + p->state = s_header_field_start; + NOTIFY_CB(part_data_begin); + break; + } + return i; + + case s_end: + multipart_log("s_end: %02X", (int) c); + break; + + default: + multipart_log("Multipart parser unrecoverable error"); + return 0; + } + ++ i; + } + + return len; +} diff --git a/lib/sbi/contrib/multipart_parser.h b/lib/sbi/contrib/multipart_parser.h new file mode 100644 index 000000000..2427bbb3c --- /dev/null +++ b/lib/sbi/contrib/multipart_parser.h @@ -0,0 +1,45 @@ +/* Based on node-formidable by Felix Geisendorfer + * Igor Afonov - afonov@gmail.com - 2012 + * MIT License - http://www.opensource.org/licenses/mit-license.php + */ +#ifndef _multipart_parser_h +#define _multipart_parser_h + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef struct multipart_parser multipart_parser; +typedef struct multipart_parser_settings multipart_parser_settings; +typedef struct multipart_parser_state multipart_parser_state; + +typedef int (*multipart_data_cb) (multipart_parser*, const char *at, size_t length); +typedef int (*multipart_notify_cb) (multipart_parser*); + +struct multipart_parser_settings { + multipart_data_cb on_header_field; + multipart_data_cb on_header_value; + multipart_data_cb on_part_data; + + multipart_notify_cb on_part_data_begin; + multipart_notify_cb on_headers_complete; + multipart_notify_cb on_part_data_end; + multipart_notify_cb on_body_end; +}; + +multipart_parser* multipart_parser_init + (const char *boundary, const multipart_parser_settings* settings); + +void multipart_parser_free(multipart_parser* p); + +size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len); + +void multipart_parser_set_data(multipart_parser* p, void* data); +void * multipart_parser_get_data(multipart_parser* p); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/lib/sbi/conv.c b/lib/sbi/conv.c index a03dbdced..578d6b9a6 100644 --- a/lib/sbi/conv.c +++ b/lib/sbi/conv.c @@ -18,21 +18,20 @@ */ #include "ogs-sbi.h" - -#include "sbi-private.h" +#include "yuarel.h" static char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h) { char buf[OGS_ADDRSTRLEN]; - char url[OGS_HUGE_LEN]; + char uri[OGS_HUGE_LEN]; char *p, *last; int i; ogs_assert(addr); ogs_assert(h); - p = url; - last = url + OGS_HUGE_LEN; + p = uri; + last = uri + OGS_HUGE_LEN; /* HTTP scheme is selected based on TLS information */ if (https == true) @@ -63,7 +62,7 @@ static char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h) h->resource.component[i]; i++) p = ogs_slprintf(p, last, "/%s", h->resource.component[i]); - return ogs_strdup(url); + return ogs_strdup(uri); } char *ogs_sbi_server_uri(ogs_sbi_server_t *server, ogs_sbi_header_t *h) @@ -125,11 +124,11 @@ static char *url_decode(const char *str) } } -char *ogs_sbi_parse_url(char *url, const char *delim, char **saveptr) +char *ogs_sbi_parse_uri(char *uri, const char *delim, char **saveptr) { char *item = NULL; - item = url_decode(strtok_r(url, delim, saveptr)); + item = url_decode(strtok_r(uri, delim, saveptr)); if (!item) { return NULL; } @@ -189,3 +188,45 @@ ogs_sockaddr_t *ogs_sbi_getaddr_from_uri(char *uri) ogs_free(p); return addr; } + +char *ogs_sbi_bitrate_to_string(uint64_t bitrate, int unit) +{ + if (unit == OGS_SBI_BITRATE_KBPS) { + return ogs_msprintf("%lld Kbps", + (long long)bitrate / 1024); + } else if (unit == OGS_SBI_BITRATE_MBPS) { + return ogs_msprintf("%lld Mbps", + (long long)bitrate / 1024 / 1024); + } else if (unit == OGS_SBI_BITRATE_GBPS) { + return ogs_msprintf("%lld Gbps", + (long long)bitrate / 1024 / 1024 / 1024); + } else if (unit == OGS_SBI_BITRATE_TBPS) { + return ogs_msprintf("%lld Tbps", + (long long)bitrate / 1024 / 1024 / 1024 / 1024); + } + + return ogs_msprintf("%lld bps", (long long)bitrate); +} + +uint64_t ogs_sbi_bitrate_from_string(char *str) +{ + char *unit = NULL; + uint64_t bitrate = 0; + ogs_assert(str); + + unit = strrchr(str, ' '); + bitrate = atoll(str); + + SWITCH(unit+1) + CASE("Kbps") + return bitrate * 1024; + CASE("Mbps") + return bitrate * 1024 * 1024; + CASE("Gbps") + return bitrate * 1024 * 1024 * 1024; + CASE("Tbps") + return bitrate * 1024 * 1024 * 1024 * 1024; + DEFAULT + END + return bitrate; +} diff --git a/lib/sbi/conv.h b/lib/sbi/conv.h index cf9bcd2b1..909a74fe7 100644 --- a/lib/sbi/conv.h +++ b/lib/sbi/conv.h @@ -35,9 +35,17 @@ typedef struct ogs_sbi_header_s ogs_sbi_header_t; char *ogs_sbi_server_uri(ogs_sbi_server_t *server, ogs_sbi_header_t *h); char *ogs_sbi_client_uri(ogs_sbi_client_t *client, ogs_sbi_header_t *h); -char *ogs_sbi_parse_url(char *url, const char *delim, char **saveptr); +char *ogs_sbi_parse_uri(char *uri, const char *delim, char **saveptr); ogs_sockaddr_t *ogs_sbi_getaddr_from_uri(char *uri); +#define OGS_SBI_BITRATE_BPS 0 +#define OGS_SBI_BITRATE_KBPS 1 +#define OGS_SBI_BITRATE_MBPS 2 +#define OGS_SBI_BITRATE_GBPS 3 +#define OGS_SBI_BITRATE_TBPS 4 +char *ogs_sbi_bitrate_to_string(uint64_t bitrate, int unit); +uint64_t ogs_sbi_bitrate_from_string(char *str); + #ifdef __cplusplus } #endif diff --git a/lib/sbi/meson.build b/lib/sbi/meson.build index e2be9ccb1..de501606d 100644 --- a/lib/sbi/meson.build +++ b/lib/sbi/meson.build @@ -18,6 +18,7 @@ subdir('openapi') libsbi_sources = files(''' + contrib/multipart_parser.c custom/links.c yuarel.c @@ -47,6 +48,7 @@ libsbi = library('ogssbi', c_args : sbi_cc_flags, include_directories : [libsbi_inc, libinc], dependencies : [libcore_dep, + libcrypt_dep, libapp_dep, libsbi_openapi_dep, libgnutls_dep, @@ -58,6 +60,7 @@ libsbi_dep = declare_dependency( link_with : libsbi, include_directories : [libsbi_inc, libinc], dependencies : [libcore_dep, + libcrypt_dep, libapp_dep, libsbi_openapi_dep, libgnutls_dep, diff --git a/lib/sbi/message.c b/lib/sbi/message.c index 1ccb87c22..ac8c54111 100644 --- a/lib/sbi/message.c +++ b/lib/sbi/message.c @@ -18,12 +18,30 @@ */ #include "ogs-sbi.h" +#include "ogs-crypt.h" +#include "yuarel.h" -#include "sbi-private.h" +#include "contrib/multipart_parser.h" static OGS_POOL(request_pool, ogs_sbi_request_t); static OGS_POOL(response_pool, ogs_sbi_response_t); +static char *build_json(ogs_sbi_message_t *message); +static int parse_json(ogs_sbi_message_t *message, + char *content_type, char *json); + +static void build_content( + ogs_sbi_http_message_t *http, ogs_sbi_message_t *message); +static int parse_content( + ogs_sbi_message_t *message, ogs_sbi_http_message_t *http); + +static void build_multipart( + ogs_sbi_http_message_t *http, ogs_sbi_message_t *message); +static int parse_multipart( + ogs_sbi_message_t *sbi_message, ogs_sbi_http_message_t *http); + +static void http_message_free(ogs_sbi_http_message_t *http); + void ogs_sbi_message_init(int num_of_request_pool, int num_of_response_pool) { ogs_pool_init(&request_pool, num_of_request_pool); @@ -38,6 +56,8 @@ void ogs_sbi_message_final(void) void ogs_sbi_message_free(ogs_sbi_message_t *message) { + int i; + ogs_assert(message); if (message->NFProfile) @@ -77,6 +97,47 @@ void ogs_sbi_message_free(ogs_sbi_message_t *message) message->ConfirmationDataResponse); if (message->AuthEvent) OpenAPI_auth_event_free(message->AuthEvent); + if (message->Amf3GppAccessRegistration) + OpenAPI_amf3_gpp_access_registration_free( + message->Amf3GppAccessRegistration); + if (message->AccessAndMobilitySubscriptionData) + OpenAPI_access_and_mobility_subscription_data_free( + message->AccessAndMobilitySubscriptionData); + if (message->SmfSelectionSubscriptionData) + OpenAPI_smf_selection_subscription_data_free( + message->SmfSelectionSubscriptionData); + if (message->UeContextInSmfData) + OpenAPI_ue_context_in_smf_data_free(message->UeContextInSmfData); + if (message->SmContextCreateData) + OpenAPI_sm_context_create_data_free(message->SmContextCreateData); + if (message->SmContextCreatedData) + OpenAPI_sm_context_created_data_free(message->SmContextCreatedData); + if (message->SmContextCreateError) + OpenAPI_sm_context_create_error_free(message->SmContextCreateError); + if (message->SmContextUpdateData) + OpenAPI_sm_context_update_data_free(message->SmContextUpdateData); + if (message->SmContextUpdatedData) + OpenAPI_sm_context_updated_data_free(message->SmContextUpdatedData); + if (message->SmContextUpdateError) + OpenAPI_sm_context_update_error_free(message->SmContextUpdateError); + if (message->SmContextReleaseData) + OpenAPI_sm_context_release_data_free(message->SmContextReleaseData); + if (message->SmContextReleasedData) + OpenAPI_sm_context_released_data_free(message->SmContextReleasedData); + if (message->SessionManagementSubscriptionData) + OpenAPI_session_management_subscription_data_free( + message->SessionManagementSubscriptionData); + if (message->N1N2MessageTransferReqData) + OpenAPI_n1_n2_message_transfer_req_data_free( + message->N1N2MessageTransferReqData); + if (message->N1N2MessageTransferRspData) + OpenAPI_n1_n2_message_transfer_rsp_data_free( + message->N1N2MessageTransferRspData); + + for (i = 0; i < message->num_of_part; i++) { + if (message->part[i].pkbuf) + ogs_pkbuf_free(message->part[i].pkbuf); + } } ogs_sbi_request_t *ogs_sbi_request_new(void) @@ -108,17 +169,14 @@ ogs_sbi_response_t *ogs_sbi_response_new(void) return response; } -static void sbi_header_free(ogs_sbi_header_t *h); -static void http_message_free(http_message_t *http); - void ogs_sbi_request_free(ogs_sbi_request_t *request) { ogs_assert(request); - if (request->h.url) - ogs_free(request->h.url); + if (request->h.uri) + ogs_free(request->h.uri); - sbi_header_free(&request->h); + ogs_sbi_header_free(&request->h); http_message_free(&request->http); ogs_pool_free(&request_pool, request); @@ -128,55 +186,15 @@ void ogs_sbi_response_free(ogs_sbi_response_t *response) { ogs_assert(response); - if (response->h.url) - ogs_free(response->h.url); + if (response->h.uri) + ogs_free(response->h.uri); - sbi_header_free(&response->h); + ogs_sbi_header_free(&response->h); http_message_free(&response->http); ogs_pool_free(&response_pool, response); } -static void sbi_header_free(ogs_sbi_header_t *h) -{ - int i; - ogs_assert(h); - - if (h->method) ogs_free(h->method); - if (h->service.name) ogs_free(h->service.name); - if (h->api.version) ogs_free(h->api.version); - - for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT && - h->resource.component[i]; i++) - ogs_free(h->resource.component[i]); -} - -static void http_message_free(http_message_t *http) -{ - ogs_assert(http); - - if (http->params) { - ogs_hash_index_t *hi; - for (hi = ogs_hash_first(http->params); hi; hi = ogs_hash_next(hi)) { - char *val = ogs_hash_this_val(hi); - ogs_free(val); - } - ogs_hash_destroy(http->params); - } - - if (http->headers) { - ogs_hash_index_t *hi; - for (hi = ogs_hash_first(http->headers); hi; hi = ogs_hash_next(hi)) { - char *val = ogs_hash_this_val(hi); - ogs_free(val); - } - ogs_hash_destroy(http->headers); - } - if (http->content) ogs_free(http->content); -} - -static char *build_content(ogs_sbi_message_t *message); - ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message) { ogs_sbi_request_t *request = NULL; @@ -188,8 +206,8 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message) ogs_assert(message->h.method); request->h.method = ogs_strdup(message->h.method); - if (message->h.url) { - request->h.url = ogs_strdup(message->h.url); + if (message->h.uri) { + request->h.uri = ogs_strdup(message->h.uri); } else { int i; @@ -227,18 +245,58 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message) char *v = ogs_msprintf("%d", message->param.limit); ogs_assert(v); ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_LIMIT, v); + ogs_free(v); + } + if (message->param.dnn) { + char *v = ogs_msprintf("%s", message->param.dnn); + ogs_assert(v); + ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_DNN, v); + ogs_free(v); + } + if (message->param.plmn_id_presence) { + OpenAPI_plmn_id_t plmn_id; + + plmn_id.mnc = ogs_plmn_id_mnc_string(&message->param.plmn_id); + plmn_id.mcc = ogs_plmn_id_mcc_string(&message->param.plmn_id); + + if (plmn_id.mnc && plmn_id.mcc) { + char *v = NULL; + cJSON *item = NULL; + + item = OpenAPI_plmn_id_convertToJSON(&plmn_id); + ogs_assert(item); + if (plmn_id.mnc) ogs_free(plmn_id.mnc); + if (plmn_id.mcc) ogs_free(plmn_id.mcc); + + v = cJSON_Print(item); + ogs_assert(v); + cJSON_Delete(item); + + ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_PLMN_ID, v); + ogs_free(v); + } + } + if (message->param.s_nssai_presence) { + char *v = NULL; + cJSON *item = NULL; + OpenAPI_snssai_t s_nssai; + + s_nssai.sst = message->param.s_nssai.sst; + s_nssai.sd = ogs_s_nssai_sd_to_string(message->param.s_nssai.sd); + + item = OpenAPI_snssai_convertToJSON(&s_nssai); + ogs_assert(item); + if (s_nssai.sd) ogs_free(s_nssai.sd); + + v = cJSON_Print(item); + ogs_assert(v); + cJSON_Delete(item); + + ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_S_NSSAI, v); + ogs_free(v); } - /* HTTP Message */ - request->http.content = build_content(message); - if (request->http.content) { - if (message->http.content_type) - ogs_sbi_header_set(request->http.headers, - OGS_SBI_CONTENT_TYPE, message->http.content_type); - else - ogs_sbi_header_set(request->http.headers, - OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE); - } + build_content(&request->http, message); if (message->http.accept) { ogs_sbi_header_set(request->http.headers, OGS_SBI_ACCEPT, @@ -275,17 +333,8 @@ ogs_sbi_response_t *ogs_sbi_build_response( response->status = status; - /* HTTP Message */ if (response->status != OGS_SBI_HTTP_STATUS_NO_CONTENT) { - response->http.content = build_content(message); - if (response->http.content) { - if (message->http.content_type) - ogs_sbi_header_set(response->http.headers, - OGS_SBI_CONTENT_TYPE, message->http.content_type); - else - ogs_sbi_header_set(response->http.headers, - OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE); - } + build_content(&response->http, message); } if (message->http.location) { @@ -299,10 +348,243 @@ ogs_sbi_response_t *ogs_sbi_build_response( return response; } -static char *build_content(ogs_sbi_message_t *message) +int ogs_sbi_parse_request( + ogs_sbi_message_t *message, ogs_sbi_request_t *request) +{ + int rv; + ogs_hash_index_t *hi; + + ogs_assert(request); + ogs_assert(message); + + rv = ogs_sbi_parse_header(message, &request->h); + if (rv != OGS_OK) { + ogs_error("ogs_sbi_parse_header() failed"); + return OGS_ERROR; + } + + for (hi = ogs_hash_first(request->http.params); + hi; hi = ogs_hash_next(hi)) { + if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_TYPE)) { + message->param.nf_type = + OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); + } else if (!strcmp(ogs_hash_this_key(hi), + OGS_SBI_PARAM_TARGET_NF_TYPE)) { + message->param.target_nf_type = + OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); + } else if (!strcmp(ogs_hash_this_key(hi), + OGS_SBI_PARAM_REQUESTER_NF_TYPE)) { + message->param.requester_nf_type = + OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); + } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_LIMIT)) { + message->param.limit = atoi(ogs_hash_this_val(hi)); + } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_DNN)) { + message->param.dnn = ogs_hash_this_val(hi); + } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_PLMN_ID)) { + char *v = NULL; + cJSON *item = NULL; + OpenAPI_plmn_id_t *plmn_id = NULL; + + v = ogs_hash_this_val(hi); + if (v) { + item = cJSON_Parse(v); + if (item) { + plmn_id = OpenAPI_plmn_id_parseFromJSON(item); + if (plmn_id && plmn_id->mnc && plmn_id->mcc) { + ogs_plmn_id_build(&message->param.plmn_id, + atoi(plmn_id->mcc), + atoi(plmn_id->mnc), strlen(plmn_id->mnc)); + message->param.plmn_id_presence = true; + OpenAPI_plmn_id_free(plmn_id); + } + cJSON_Delete(item); + } + } + } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_S_NSSAI)) { + char *v = NULL; + cJSON *item = NULL; + OpenAPI_snssai_t *s_nssai = NULL; + + v = ogs_hash_this_val(hi); + if (v) { + item = cJSON_Parse(v); + if (item) { + s_nssai = OpenAPI_snssai_parseFromJSON(item); + if (s_nssai) { + message->param.s_nssai_presence = true; + message->param.s_nssai.sst = s_nssai->sst; + message->param.s_nssai.sd = + ogs_s_nssai_sd_from_string(s_nssai->sd); + OpenAPI_snssai_free(s_nssai); + } + cJSON_Delete(item); + } + } + } + } + + for (hi = ogs_hash_first(request->http.headers); + hi; hi = ogs_hash_next(hi)) { + if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT_ENCODING)) { + message->http.content_encoding = ogs_hash_this_val(hi); + } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) { + message->http.content_type = ogs_hash_this_val(hi); + } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT)) { + message->http.accept = ogs_hash_this_val(hi); + } + } + + if (parse_content(message, &request->http) != OGS_OK) { + ogs_error("parse_content() failed"); + return OGS_ERROR; + } + + return OGS_OK; +} + +int ogs_sbi_parse_response( + ogs_sbi_message_t *message, ogs_sbi_response_t *response) +{ + int rv; + ogs_hash_index_t *hi; + + ogs_assert(response); + ogs_assert(message); + + rv = ogs_sbi_parse_header(message, &response->h); + if (rv != OGS_OK) { + ogs_error("ogs_sbi_parse_header() failed"); + return OGS_ERROR; + } + + for (hi = ogs_hash_first(response->http.headers); + hi; hi = ogs_hash_next(hi)) { + if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) { + message->http.content_type = ogs_hash_this_val(hi); + } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_LOCATION)) { + message->http.location = ogs_hash_this_val(hi); + } + } + + message->res_status = response->status; + + if (parse_content(message, &response->http) != OGS_OK) { + ogs_error("parse_content() failed"); + return OGS_ERROR; + } + + return OGS_OK; +} + +void ogs_sbi_header_set(ogs_hash_t *ht, const void *key, const void *val) +{ + ogs_hash_set(ht, key, strlen(key), ogs_strdup(val)); +} + +void *ogs_sbi_header_get(ogs_hash_t *ht, const void *key) +{ + return ogs_hash_get(ht, key, strlen(key)); +} + +ogs_pkbuf_t *ogs_sbi_find_part_by_content_id( + ogs_sbi_message_t *message, char *content_id) +{ + int i; + + ogs_assert(message); + ogs_assert(content_id); + + for (i = 0; i < message->num_of_part; i++) { + if (message->part[i].content_id && + strcmp(message->part[i].content_id, content_id) == 0) + return message->part[i].pkbuf; + } + + return NULL; +} + +int ogs_sbi_parse_header( + ogs_sbi_message_t *message, ogs_sbi_header_t *header) +{ + struct yuarel yuarel; + char *saveptr = NULL; + char *uri = NULL, *p = NULL;; + + char *component = NULL; + int i = 0; + + ogs_assert(message); + ogs_assert(header); + + memset(message, 0, sizeof(*message)); + + message->h.method = header->method; + message->h.uri = header->uri; + ogs_assert(message->h.uri); + + uri = ogs_strdup(header->uri); + ogs_assert(uri); + p = uri; + + if (p[0] != '/') { + int rv = yuarel_parse(&yuarel, p); + if (rv != OGS_OK) { + ogs_error("yuarel_parse() failed"); + ogs_free(uri); + return OGS_ERROR; + } + + p = yuarel.path; + } + + header->service.name = ogs_sbi_parse_uri(p, "/", &saveptr); + if (!header->service.name) { + ogs_error("ogs_sbi_parse_uri() failed"); + ogs_free(uri); + return OGS_ERROR; + } + message->h.service.name = header->service.name; + + header->api.version = ogs_sbi_parse_uri(NULL, "/", &saveptr); + if (!header->api.version) { + ogs_error("ogs_sbi_parse_uri() failed"); + ogs_free(uri); + return OGS_ERROR; + } + message->h.api.version = header->api.version; + + for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT && + (component = ogs_sbi_parse_uri(NULL, "/", &saveptr)) != NULL; + i++) { + header->resource.component[i] = component; + message->h.resource.component[i] = component; + } + + ogs_free(uri); + + return OGS_OK; +} + +void ogs_sbi_header_free(ogs_sbi_header_t *h) +{ + int i; + ogs_assert(h); + + if (h->method) ogs_free(h->method); + if (h->service.name) ogs_free(h->service.name); + if (h->api.version) ogs_free(h->api.version); + + for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT && + h->resource.component[i]; i++) + ogs_free(h->resource.component[i]); +} + + +static char *build_json(ogs_sbi_message_t *message) { char *content = NULL; cJSON *item = NULL; + ogs_assert(message); if (message->ProblemDetails) { @@ -367,6 +649,66 @@ static char *build_content(ogs_sbi_message_t *message) } else if (message->AuthEvent) { item = OpenAPI_auth_event_convertToJSON(message->AuthEvent); ogs_assert(item); + } else if (message->Amf3GppAccessRegistration) { + item = OpenAPI_amf3_gpp_access_registration_convertToJSON( + message->Amf3GppAccessRegistration); + ogs_assert(item); + } else if (message->AccessAndMobilitySubscriptionData) { + item = OpenAPI_access_and_mobility_subscription_data_convertToJSON( + message->AccessAndMobilitySubscriptionData); + ogs_assert(item); + } else if (message->SmfSelectionSubscriptionData) { + item = OpenAPI_smf_selection_subscription_data_convertToJSON( + message->SmfSelectionSubscriptionData); + ogs_assert(item); + } else if (message->UeContextInSmfData) { + item = OpenAPI_ue_context_in_smf_data_convertToJSON( + message->UeContextInSmfData); + ogs_assert(item); + } else if (message->SmContextCreateData) { + item = OpenAPI_sm_context_create_data_convertToJSON( + message->SmContextCreateData); + ogs_assert(item); + } else if (message->SmContextCreatedData) { + item = OpenAPI_sm_context_created_data_convertToJSON( + message->SmContextCreatedData); + ogs_assert(item); + } else if (message->SmContextCreateError) { + item = OpenAPI_sm_context_create_error_convertToJSON( + message->SmContextCreateError); + ogs_assert(item); + } else if (message->SmContextUpdateData) { + item = OpenAPI_sm_context_update_data_convertToJSON( + message->SmContextUpdateData); + ogs_assert(item); + } else if (message->SmContextUpdatedData) { + item = OpenAPI_sm_context_updated_data_convertToJSON( + message->SmContextUpdatedData); + ogs_assert(item); + } else if (message->SmContextUpdateError) { + item = OpenAPI_sm_context_update_error_convertToJSON( + message->SmContextUpdateError); + ogs_assert(item); + } else if (message->SmContextReleaseData) { + item = OpenAPI_sm_context_release_data_convertToJSON( + message->SmContextReleaseData); + ogs_assert(item); + } else if (message->SmContextReleasedData) { + item = OpenAPI_sm_context_released_data_convertToJSON( + message->SmContextReleasedData); + ogs_assert(item); + } else if (message->SessionManagementSubscriptionData) { + item = OpenAPI_session_management_subscription_data_convertToJSON( + message->SessionManagementSubscriptionData); + ogs_assert(item); + } else if (message->N1N2MessageTransferReqData) { + item = OpenAPI_n1_n2_message_transfer_req_data_convertToJSON( + message->N1N2MessageTransferReqData); + ogs_assert(item); + } else if (message->N1N2MessageTransferRspData) { + item = OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON( + message->N1N2MessageTransferRspData); + ogs_assert(item); } if (item) { @@ -378,410 +720,526 @@ static char *build_content(ogs_sbi_message_t *message) return content; } -static int parse_sbi_header( - ogs_sbi_message_t *message, ogs_sbi_header_t *header); -static int parse_content(ogs_sbi_message_t *message, char *content); - -int ogs_sbi_parse_request( - ogs_sbi_message_t *message, ogs_sbi_request_t *request) -{ - int rv; - ogs_hash_index_t *hi; - - ogs_assert(request); - ogs_assert(message); - - rv = parse_sbi_header(message, &request->h); - if (rv != OGS_OK) { - ogs_error("sbi_parse_header() failed"); - return OGS_ERROR; - } - - for (hi = ogs_hash_first(request->http.params); - hi; hi = ogs_hash_next(hi)) { - if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_TYPE)) { - message->param.nf_type = - OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); - } else if (!strcmp(ogs_hash_this_key(hi), - OGS_SBI_PARAM_TARGET_NF_TYPE)) { - message->param.target_nf_type = - OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); - } else if (!strcmp(ogs_hash_this_key(hi), - OGS_SBI_PARAM_REQUESTER_NF_TYPE)) { - message->param.requester_nf_type = - OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); - } else if (!strcmp(ogs_hash_this_key(hi), - OGS_SBI_PARAM_LIMIT)) { - message->param.limit = atoi(ogs_hash_this_val(hi)); - } - } - - for (hi = ogs_hash_first(request->http.headers); - hi; hi = ogs_hash_next(hi)) { - if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT_ENCODING)) { - message->http.content_encoding = ogs_hash_this_val(hi); - } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) { - message->http.content_type = ogs_hash_this_val(hi); - } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT)) { - message->http.accept = ogs_hash_this_val(hi); - } - } - - if (parse_content(message, request->http.content) != OGS_OK) { - ogs_error("parse_content() failed"); - return OGS_ERROR; - } - - return OGS_OK; -} - -int ogs_sbi_parse_response( - ogs_sbi_message_t *message, ogs_sbi_response_t *response) -{ - int rv; - ogs_hash_index_t *hi; - - ogs_assert(response); - ogs_assert(message); - - rv = parse_sbi_header(message, &response->h); - if (rv != OGS_OK) { - ogs_error("sbi_parse_header() failed"); - return OGS_ERROR; - } - - for (hi = ogs_hash_first(response->http.headers); - hi; hi = ogs_hash_next(hi)) { - if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) - message->http.content_type = ogs_hash_this_val(hi); - else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_LOCATION)) - message->http.location = ogs_hash_this_val(hi); - } - - message->res_status = response->status; - - if (parse_content(message, response->http.content) != OGS_OK) { - ogs_error("parse_content() failed"); - return OGS_ERROR; - } - - return OGS_OK; -} - -static int parse_sbi_header( - ogs_sbi_message_t *message, ogs_sbi_header_t *header) -{ - struct yuarel yuarel; - char *saveptr = NULL; - char *url = NULL, *p = NULL;; - - char *component = NULL; - int i = 0; - - ogs_assert(message); - ogs_assert(header); - - memset(message, 0, sizeof(*message)); - - message->h.method = header->method; - ogs_assert(message->h.method); - message->h.url = header->url; - ogs_assert(message->h.url); - - url = ogs_strdup(header->url); - ogs_assert(url); - p = url; - - if (p[0] != '/') { - int rv = yuarel_parse(&yuarel, p); - if (rv != OGS_OK) { - ogs_error("yuarel_parse() failed"); - ogs_free(url); - return OGS_ERROR; - } - - p = yuarel.path; - } - - header->service.name = ogs_sbi_parse_url(p, "/", &saveptr); - if (!header->service.name) { - ogs_error("ogs_sbi_parse_url() failed"); - ogs_free(url); - return OGS_ERROR; - } - message->h.service.name = header->service.name; - - header->api.version = ogs_sbi_parse_url(NULL, "/", &saveptr); - if (!header->api.version) { - ogs_error("ogs_sbi_parse_url() failed"); - ogs_free(url); - return OGS_ERROR; - } - message->h.api.version = header->api.version; - - for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT && - (component = ogs_sbi_parse_url(NULL, "/", &saveptr)) != NULL; - i++) { - header->resource.component[i] = component; - message->h.resource.component[i] = component; - } - - ogs_free(url); - - return OGS_OK; -} - -static int parse_content(ogs_sbi_message_t *message, char *content) +static int parse_json(ogs_sbi_message_t *message, + char *content_type, char *json) { int rv = OGS_OK; cJSON *item = NULL; ogs_assert(message); - if (!content) + if (!json) return OGS_OK; - if (strcmp(message->h.api.version, OGS_SBI_API_VERSION) != 0) { - ogs_error("Not supported version - %s", message->h.api.version); - return OGS_ERROR; - } - - item = cJSON_Parse(content); + item = cJSON_Parse(json); if (!item) { ogs_error("JSON parse error"); return OGS_ERROR; } - if (message->http.content_type) { - if (!strncmp(message->http.content_type, - OGS_SBI_CONTENT_PROBLEM_TYPE, - strlen(OGS_SBI_CONTENT_PROBLEM_TYPE))) { - message->ProblemDetails = - OpenAPI_problem_details_parseFromJSON(item); - } else if (!strncmp(message->http.content_type, - OGS_SBI_CONTENT_PATCH_TYPE, - strlen(OGS_SBI_CONTENT_PATCH_TYPE))) { - if (item) { - OpenAPI_patch_item_t *patch_item = NULL; - cJSON *patchJSON = NULL; - message->PatchItemList = OpenAPI_list_create(); - cJSON_ArrayForEach(patchJSON, item) { - if (!cJSON_IsObject(patchJSON)) { - rv = OGS_ERROR; - ogs_error("Unknown JSON"); - goto cleanup; - } - - patch_item = OpenAPI_patch_item_parseFromJSON(patchJSON); - OpenAPI_list_add(message->PatchItemList, patch_item); + if (content_type && + !strncmp(content_type, OGS_SBI_CONTENT_PROBLEM_TYPE, + strlen(OGS_SBI_CONTENT_PROBLEM_TYPE))) { + message->ProblemDetails = OpenAPI_problem_details_parseFromJSON(item); + } else if (content_type && + !strncmp(content_type, OGS_SBI_CONTENT_PATCH_TYPE, + strlen(OGS_SBI_CONTENT_PATCH_TYPE))) { + if (item) { + OpenAPI_patch_item_t *patch_item = NULL; + cJSON *patchJSON = NULL; + message->PatchItemList = OpenAPI_list_create(); + cJSON_ArrayForEach(patchJSON, item) { + if (!cJSON_IsObject(patchJSON)) { + rv = OGS_ERROR; + ogs_error("Unknown JSON"); + goto cleanup; } + + patch_item = OpenAPI_patch_item_parseFromJSON(patchJSON); + OpenAPI_list_add(message->PatchItemList, patch_item); } - } else { - SWITCH(message->h.service.name) - CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM) + } + } else { + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM) - SWITCH(message->h.resource.component[0]) - CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) - message->NFProfile = - OpenAPI_nf_profile_parseFromJSON(item); - if (!message->NFProfile) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + message->NFProfile = + OpenAPI_nf_profile_parseFromJSON(item); + if (!message->NFProfile) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) + message->SubscriptionData = + OpenAPI_subscription_data_parseFromJSON(item); + if (!message->SubscriptionData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY) + message->NotificationData = + OpenAPI_notification_data_parseFromJSON(item); + if (!message->NotificationData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[0]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC) + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + message->SearchResult = + OpenAPI_search_result_parseFromJSON(item); + if (!message->SearchResult) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[0]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NAUSF_AUTH) + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS) + SWITCH(message->h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + if (message->res_status == 0) { + message->AuthenticationInfo = + OpenAPI_authentication_info_parseFromJSON(item); + if (!message->AuthenticationInfo) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == + OGS_SBI_HTTP_STATUS_CREATED) { + message->UeAuthenticationCtx = + OpenAPI_ue_authentication_ctx_parseFromJSON(item); + if (!message->UeAuthenticationCtx) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } } break; - - CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) - message->SubscriptionData = - OpenAPI_subscription_data_parseFromJSON(item); - if (!message->SubscriptionData) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); + CASE(OGS_SBI_HTTP_METHOD_PUT) + if (message->res_status == 0) { + message->ConfirmationData = + OpenAPI_confirmation_data_parseFromJSON(item); + if (!message->ConfirmationData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { + message->ConfirmationDataResponse = + OpenAPI_confirmation_data_response_parseFromJSON( + item); + if (!message->ConfirmationDataResponse) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } } break; - - CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY) - message->NotificationData = - OpenAPI_notification_data_parseFromJSON(item); - if (!message->NotificationData) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); - } - break; - DEFAULT rv = OGS_ERROR; - ogs_error("Unknown resource name [%s]", - message->h.resource.component[0]); + ogs_error("Unknown method [%s]", message->h.method); END break; - CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC) - SWITCH(message->h.resource.component[0]) - CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) - message->SearchResult = - OpenAPI_search_result_parseFromJSON(item); - if (!message->SearchResult) { + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[0]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU) + SWITCH(message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION) + SWITCH(message->h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_GENERATE_AUTH_DATA) + if (message->res_status == 0) { + message->AuthenticationInfoRequest = + OpenAPI_authentication_info_request_parseFromJSON( + item); + if (!message->AuthenticationInfoRequest) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { + message->AuthenticationInfoResult = + OpenAPI_authentication_info_result_parseFromJSON( + item); + if (!message->AuthenticationInfoResult) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } + break; + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[2]); + END + break; + + CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS) + message->AuthEvent = OpenAPI_auth_event_parseFromJSON(item); + if (!message->AuthEvent) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[1]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NUDM_UECM) + SWITCH(message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS) + SWITCH(message->h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS) + message->Amf3GppAccessRegistration = + OpenAPI_amf3_gpp_access_registration_parseFromJSON( + item); + if (!message->Amf3GppAccessRegistration) { rv = OGS_ERROR; ogs_error("JSON parse error"); } break; - DEFAULT rv = OGS_ERROR; ogs_error("Unknown resource name [%s]", - message->h.resource.component[0]); + message->h.resource.component[2]); END break; - CASE(OGS_SBI_SERVICE_NAME_NAUSF_AUTH) - SWITCH(message->h.resource.component[0]) - CASE(OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS) - SWITCH(message->h.method) - CASE(OGS_SBI_HTTP_METHOD_POST) - if (message->res_status == - OGS_SBI_HTTP_STATUS_CREATED) { - message->UeAuthenticationCtx = - OpenAPI_ue_authentication_ctx_parseFromJSON(item); - if (!message->UeAuthenticationCtx) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); - } - } else { - message->AuthenticationInfo = - OpenAPI_authentication_info_parseFromJSON(item); - if (!message->AuthenticationInfo) { + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[1]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + SWITCH(message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) + message->AccessAndMobilitySubscriptionData = + OpenAPI_access_and_mobility_subscription_data_parseFromJSON( + item); + if (!message->AccessAndMobilitySubscriptionData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) + message->SmfSelectionSubscriptionData = + OpenAPI_smf_selection_subscription_data_parseFromJSON(item); + if (!message->SmfSelectionSubscriptionData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) + message->UeContextInSmfData = + OpenAPI_ue_context_in_smf_data_parseFromJSON(item); + if (!message->UeContextInSmfData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) + message->SessionManagementSubscriptionData = + OpenAPI_session_management_subscription_data_parseFromJSON( + item); + if (!message->SessionManagementSubscriptionData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[1]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NUDR_DR) + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA) + SWITCH(message->h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_DATA) + SWITCH(message->h.resource.component[3]) + CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_SUBSCRIPTION) + if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { + message->AuthenticationSubscription = + OpenAPI_authentication_subscription_parseFromJSON(item); + if (!message->AuthenticationSubscription) { rv = OGS_ERROR; ogs_error("JSON parse error"); } } break; - CASE(OGS_SBI_HTTP_METHOD_PUT) - if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { - message->ConfirmationDataResponse = - OpenAPI_confirmation_data_response_parseFromJSON(item); - if (!message->ConfirmationDataResponse) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); - } - } else { - message->ConfirmationData = - OpenAPI_confirmation_data_parseFromJSON(item); - if (!message->ConfirmationData) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); - } - } - break; - DEFAULT - rv = OGS_ERROR; - ogs_error("Unknown method [%s]", message->h.method); - END - break; - - DEFAULT - rv = OGS_ERROR; - ogs_error("Unknown resource name [%s]", - message->h.resource.component[0]); - END - break; - - CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU) - SWITCH(message->h.resource.component[1]) - CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION) - SWITCH(message->h.resource.component[2]) - CASE(OGS_SBI_RESOURCE_NAME_GENERATE_AUTH_DATA) - if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { - message->AuthenticationInfoResult = - OpenAPI_authentication_info_result_parseFromJSON( - item); - if (!message->AuthenticationInfoResult) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); - } - } else { - message->AuthenticationInfoRequest = - OpenAPI_authentication_info_request_parseFromJSON( - item); - if (!message->AuthenticationInfoRequest) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); - } + CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_STATUS) + message->AuthEvent = + OpenAPI_auth_event_parseFromJSON(item); + if (!message->AuthEvent) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); } break; DEFAULT rv = OGS_ERROR; ogs_error("Unknown resource name [%s]", - message->h.resource.component[2]); + message->h.resource.component[3]); END break; - CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS) - message->AuthEvent = OpenAPI_auth_event_parseFromJSON(item); - if (!message->AuthEvent) { + CASE(OGS_SBI_RESOURCE_NAME_CONTEXT_DATA) + message->Amf3GppAccessRegistration = + OpenAPI_amf3_gpp_access_registration_parseFromJSON( + item); + if (!message->Amf3GppAccessRegistration) { rv = OGS_ERROR; ogs_error("JSON parse error"); } break; DEFAULT - rv = OGS_ERROR; - ogs_error("Unknown resource name [%s]", - message->h.resource.component[1]); - END - break; - - CASE(OGS_SBI_SERVICE_NAME_NUDR_DR) - SWITCH(message->h.resource.component[0]) - CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA) - SWITCH(message->h.resource.component[2]) - CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_DATA) - SWITCH(message->h.resource.component[3]) - CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_SUBSCRIPTION) - if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { - message->AuthenticationSubscription = - OpenAPI_authentication_subscription_parseFromJSON(item); - if (!message->AuthenticationSubscription) { - rv = OGS_ERROR; - ogs_error("JSON parse error"); - } - } - break; - CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_STATUS) - message->AuthEvent = - OpenAPI_auth_event_parseFromJSON(item); - if (!message->AuthEvent) { + SWITCH(message->h.resource.component[3]) + CASE(OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA) + SWITCH(message->h.resource.component[4]) + CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) + message->AccessAndMobilitySubscriptionData = + OpenAPI_access_and_mobility_subscription_data_parseFromJSON(item); + if (!message->AccessAndMobilitySubscriptionData) { rv = OGS_ERROR; ogs_error("JSON parse error"); } break; + + CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) + message->SmfSelectionSubscriptionData = + OpenAPI_smf_selection_subscription_data_parseFromJSON(item); + if (!message->SmfSelectionSubscriptionData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) + message->UeContextInSmfData = + OpenAPI_ue_context_in_smf_data_parseFromJSON( + item); + if (!message->UeContextInSmfData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) + message->SessionManagementSubscriptionData = + OpenAPI_session_management_subscription_data_parseFromJSON(item); + if (!message->SessionManagementSubscriptionData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + DEFAULT rv = OGS_ERROR; ogs_error("Unknown resource name [%s]", - message->h.resource.component[3]); + message->h.resource.component[4]); END break; DEFAULT rv = OGS_ERROR; ogs_error("Unknown resource name [%s]", - message->h.resource.component[2]); + message->h.resource.component[3]); END + END + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[0]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION) + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_SM_CONTEXTS) + SWITCH(message->h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_MODIFY) + if (message->res_status == 0) { + message->SmContextUpdateData = + OpenAPI_sm_context_update_data_parseFromJSON(item); + if (!message->SmContextUpdateData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { + message->SmContextUpdatedData = + OpenAPI_sm_context_updated_data_parseFromJSON(item); + if (!message->SmContextUpdatedData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == + OGS_SBI_HTTP_STATUS_BAD_REQUEST || + message->res_status == + OGS_SBI_HTTP_STATUS_FORBIDDEN || + message->res_status == + OGS_SBI_HTTP_STATUS_NOT_FOUND || + message->res_status == + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR || + message->res_status == + OGS_SBI_HTTP_STATUS_SERVICE_UNAVAILABLE || + message->res_status == + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT) { + message->SmContextUpdateError = + OpenAPI_sm_context_update_error_parseFromJSON(item); + if (!message->SmContextUpdateError) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } + break; + CASE(OGS_SBI_RESOURCE_NAME_RELEASE) + if (message->res_status == 0) { + message->SmContextReleaseData = + OpenAPI_sm_context_release_data_parseFromJSON(item); + if (!message->SmContextReleaseData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == + OGS_SBI_HTTP_STATUS_NO_CONTENT) { + } else if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { + message->SmContextReleasedData = + OpenAPI_sm_context_released_data_parseFromJSON( + item); + if (!message->SmContextReleasedData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } + break; + DEFAULT + if (message->res_status == 0) { + message->SmContextCreateData = + OpenAPI_sm_context_create_data_parseFromJSON(item); + if (!message->SmContextCreateData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == + OGS_SBI_HTTP_STATUS_CREATED) { + message->SmContextCreatedData = + OpenAPI_sm_context_created_data_parseFromJSON(item); + if (!message->SmContextCreatedData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == + OGS_SBI_HTTP_STATUS_BAD_REQUEST || + message->res_status == + OGS_SBI_HTTP_STATUS_FORBIDDEN || + message->res_status == + OGS_SBI_HTTP_STATUS_NOT_FOUND || + message->res_status == + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR || + message->res_status == + OGS_SBI_HTTP_STATUS_SERVICE_UNAVAILABLE || + message->res_status == + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT) { + message->SmContextCreateError = + OpenAPI_sm_context_create_error_parseFromJSON(item); + if (!message->SmContextCreateError) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } + END + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.component[0]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM) + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXTS) + SWITCH(message->h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES) + if (message->res_status == 0) { + message->N1N2MessageTransferReqData = + OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON(item); + if (!message->N1N2MessageTransferReqData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == + OGS_SBI_HTTP_STATUS_OK || + message->res_status == + OGS_SBI_HTTP_STATUS_ACCEPTED) { + message->N1N2MessageTransferRspData = + OpenAPI_n1_n2_message_transfer_rsp_data_parseFromJSON(item); + if (!message->N1N2MessageTransferRspData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } break; DEFAULT rv = OGS_ERROR; ogs_error("Unknown resource name [%s]", - message->h.resource.component[0]); + message->h.resource.component[2]); END break; - DEFAULT rv = OGS_ERROR; - ogs_error("Not implemented API name [%s]", - message->h.service.name); + ogs_error("Unknown resource name [%s]", + message->h.resource.component[0]); END - } + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Not implemented API name [%s]", + message->h.service.name); + END } cleanup: @@ -790,13 +1248,360 @@ cleanup: return rv; } -void ogs_sbi_header_set(ogs_hash_t *ht, const void *key, const void *val) +static int parse_content( + ogs_sbi_message_t *message, ogs_sbi_http_message_t *http) { - ogs_hash_set(ht, key, strlen(key), ogs_strdup(val)); + ogs_assert(message); + ogs_assert(http); + + if (message->http.content_type && + !strncmp(message->http.content_type, OGS_SBI_CONTENT_MULTIPART_TYPE, + strlen(OGS_SBI_CONTENT_MULTIPART_TYPE))) { + return parse_multipart(message, http); + } else { + return parse_json(message, message->http.content_type, http->content); + } } -void *ogs_sbi_header_get(ogs_hash_t *ht, const void *key) +static void build_content( + ogs_sbi_http_message_t *http, ogs_sbi_message_t *message) { - return ogs_hash_get(ht, key, strlen(key)); + ogs_assert(message); + ogs_assert(http); + + if (message->num_of_part) { + build_multipart(http, message); + } else { + http->content = build_json(message); + if (http->content) { + http->content_length = strlen(http->content); + if (message->http.content_type) + ogs_sbi_header_set(http->headers, + OGS_SBI_CONTENT_TYPE, message->http.content_type); + else + ogs_sbi_header_set(http->headers, + OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE); + } + } } +typedef struct multipart_parser_data_s { + int num_of_part; + struct { + char *content_type; + char *content_id; + char *content; + size_t content_length; + } part[OGS_SBI_MAX_NUM_OF_PART]; + + char *header_field; +} multipart_parser_data_t; + +static int on_header_field( + multipart_parser *parser, const char *at, size_t length) +{ + multipart_parser_data_t *data = NULL; + + ogs_assert(parser); + data = multipart_parser_get_data(parser); + ogs_assert(data); + + if (at && length) { + if (data->header_field) + ogs_free(data->header_field); + data->header_field = ogs_strndup(at, length); + } + return 0; +} + +static int on_header_value( + multipart_parser *parser, const char *at, size_t length) +{ + multipart_parser_data_t *data = NULL; + + ogs_assert(parser); + data = multipart_parser_get_data(parser); + ogs_assert(data); + + if (at && length) { + SWITCH(data->header_field) + CASE(OGS_SBI_CONTENT_TYPE) + if (data->part[data->num_of_part].content_type) + ogs_free(data->part[data->num_of_part].content_type); + data->part[data->num_of_part].content_type = + ogs_strndup(at, length); + break; + CASE(OGS_SBI_CONTENT_ID) + if (data->part[data->num_of_part].content_id) + ogs_free(data->part[data->num_of_part].content_id); + data->part[data->num_of_part].content_id = + ogs_strndup(at, length); + break; + + DEFAULT + ogs_error("Unknown header field [%s]", data->header_field); + END + } + + return 0; +} + +static int on_part_data( + multipart_parser *parser, const char *at, size_t length) +{ + multipart_parser_data_t *data = NULL; + + ogs_assert(parser); + data = multipart_parser_get_data(parser); + ogs_assert(data); + + if (at && length) { + SWITCH(data->part[data->num_of_part].content_type) + CASE(OGS_SBI_CONTENT_JSON_TYPE) + CASE(OGS_SBI_CONTENT_5GNAS_TYPE) + CASE(OGS_SBI_CONTENT_NGAP_TYPE) + size_t offset = 0; + + if (data->part[data->num_of_part].content == NULL) { + data->part[data->num_of_part].content_length = length; + data->part[data->num_of_part].content = + (char *)ogs_malloc(length + 1); + ogs_assert(data->part[data->num_of_part].content); + } else { + offset = data->part[data->num_of_part].content_length; + if ((data->part[data->num_of_part].content_length + length) > + OGS_HUGE_LEN) { + ogs_error("Overflow length [%d:%d]", + (int)data->part[data->num_of_part].content_length, + (int)length); + ogs_assert_if_reached(); + return 0; + } + data->part[data->num_of_part].content_length += length; + data->part[data->num_of_part].content = (char *)ogs_realloc( + data->part[data->num_of_part].content, + data->part[data->num_of_part].content_length + 1); + ogs_assert(data->part[data->num_of_part].content); + } + memcpy(data->part[data->num_of_part].content + offset, at, length); + data->part[data->num_of_part].content[ + data->part[data->num_of_part].content_length] = 0; + break; + + DEFAULT + ogs_log_hexdump(OGS_LOG_FATAL, (unsigned char *)at, length); + ogs_error("Unknown content_type [%s]", + data->part[data->num_of_part].content_type); + END + } + return 0; +} + +static int on_part_data_end(multipart_parser *parser) +{ + multipart_parser_data_t *data = NULL; + + ogs_assert(parser); + data = multipart_parser_get_data(parser); + ogs_assert(data); + + data->num_of_part++; + + return 0; +} + +static int parse_multipart( + ogs_sbi_message_t *message, ogs_sbi_http_message_t *http) +{ + char *boundary = NULL; + int i; + + multipart_parser_settings settings; + multipart_parser_data_t data; + + multipart_parser *parser = NULL; + + ogs_assert(message); + ogs_assert(http); + + memset(&settings, 0, sizeof(settings)); + settings.on_header_field = &on_header_field; + settings.on_header_value = &on_header_value; + settings.on_part_data = &on_part_data; + settings.on_part_data_end = &on_part_data_end; + + for (i = 0; i < http->content_length; i++) { + if (http->content[i] == '\r' && http->content[i+1] == '\n') + break; + } + + if (i >= http->content_length) { + ogs_error("Invalid HTTP content [%d]", i); + ogs_log_hexdump(OGS_LOG_ERROR, + (unsigned char *)http->content, http->content_length); + return OGS_ERROR; + } + + boundary = ogs_strndup(http->content, i); + ogs_assert(boundary); + + parser = multipart_parser_init(boundary, &settings); + ogs_assert(parser); + + memset(&data, 0, sizeof(data)); + multipart_parser_set_data(parser, &data); + multipart_parser_execute(parser, http->content, http->content_length); + + multipart_parser_free(parser); + ogs_free(boundary); + + for (i = 0; i < data.num_of_part; i++) { + SWITCH(data.part[i].content_type) + CASE(OGS_SBI_CONTENT_JSON_TYPE) + parse_json(message, + data.part[i].content_type, data.part[i].content); + + if (data.part[i].content_id) + ogs_free(data.part[i].content_id); + if (data.part[i].content_type) + ogs_free(data.part[i].content_type); + if (data.part[i].content) + ogs_free(data.part[i].content); + + break; + + CASE(OGS_SBI_CONTENT_5GNAS_TYPE) + CASE(OGS_SBI_CONTENT_NGAP_TYPE) + http->part[http->num_of_part].content_id = + data.part[i].content_id; + http->part[http->num_of_part].content_type = + data.part[i].content_type; + http->part[http->num_of_part].pkbuf = + ogs_pkbuf_alloc(NULL, data.part[i].content_length); + ogs_pkbuf_put_data(http->part[http->num_of_part].pkbuf, + data.part[i].content, data.part[i].content_length); + + message->part[message->num_of_part].content_id = + http->part[http->num_of_part].content_id; + message->part[message->num_of_part].content_type = + http->part[http->num_of_part].content_type; + message->part[message->num_of_part].pkbuf = + ogs_pkbuf_copy(http->part[http->num_of_part].pkbuf); + + http->num_of_part++; + message->num_of_part++; + + if (data.part[i].content) + ogs_free(data.part[i].content); + break; + + DEFAULT + ogs_error("Unknown content-type[%s]", data.part[i].content_type); + END + } + + if (data.part[i].content_id) + ogs_free(data.part[i].content_id); + if (data.part[i].content_type) + ogs_free(data.part[i].content_type); + + if (data.header_field) + ogs_free(data.header_field); + + return OGS_OK; +} + +static void build_multipart( + ogs_sbi_http_message_t *http, ogs_sbi_message_t *message) +{ + int i; + + char boundary[32]; + unsigned char digest[16]; + char *p = NULL, *last; + + char *content_type = NULL; + char *json = NULL; + + ogs_assert(message); + ogs_assert(http); + + ogs_random(digest, 16); + strcpy(boundary, "=-"); + ogs_base64_encode_binary(boundary + 2, digest, 16); + + p = http->content = ogs_calloc(1, OGS_HUGE_LEN); + ogs_assert(p); + last = p + OGS_HUGE_LEN; + + /* First boundary */ + p = ogs_slprintf(p, last, "--%s\r\n", boundary); + + /* Encapsulated multipart part (application/json) */ + json = build_json(message); + ogs_assert(json); + + p = ogs_slprintf(p, last, "%s\r\n\r\n%s", + OGS_SBI_CONTENT_TYPE ": " OGS_SBI_CONTENT_JSON_TYPE, json); + + ogs_free(json); + + /* Add part */ + for (i = 0; i < message->num_of_part; i++) { + p = ogs_slprintf(p, last, "\r\n--%s\r\n", boundary); + p = ogs_slprintf(p, last, "%s: %s\r\n", + OGS_SBI_CONTENT_ID, message->part[i].content_id); + p = ogs_slprintf(p, last, "%s: %s\r\n\r\n", + OGS_SBI_CONTENT_TYPE, message->part[i].content_type); + memcpy(p, message->part[i].pkbuf->data, message->part[i].pkbuf->len); + p += message->part[i].pkbuf->len; + } + + /* Last boundary */ + p = ogs_slprintf(p, last, "\r\n--%s--\r\n", boundary); + + http->content_length = p - http->content; + + content_type = ogs_msprintf("%s; boundary=\"%s\"", + OGS_SBI_CONTENT_MULTIPART_TYPE, boundary); + ogs_assert(content_type); + + ogs_sbi_header_set(http->headers, OGS_SBI_CONTENT_TYPE, content_type); + + ogs_free(content_type); +} + +static void http_message_free(ogs_sbi_http_message_t *http) +{ + int i; + ogs_assert(http); + + if (http->params) { + ogs_hash_index_t *hi; + for (hi = ogs_hash_first(http->params); hi; hi = ogs_hash_next(hi)) { + char *val = ogs_hash_this_val(hi); + ogs_free(val); + } + ogs_hash_destroy(http->params); + } + + if (http->headers) { + ogs_hash_index_t *hi; + for (hi = ogs_hash_first(http->headers); hi; hi = ogs_hash_next(hi)) { + char *val = ogs_hash_this_val(hi); + ogs_free(val); + } + ogs_hash_destroy(http->headers); + } + if (http->content) + ogs_free(http->content); + + for (i = 0; i < http->num_of_part; i++) { + if (http->part[i].pkbuf) + ogs_pkbuf_free(http->part[i].pkbuf); + if (http->part[i].content_id) + ogs_free(http->part[i].content_id); + if (http->part[i].content_type) + ogs_free(http->part[i].content_type); + } +} diff --git a/lib/sbi/message.h b/lib/sbi/message.h index afbeed4e3..c528fd4da 100644 --- a/lib/sbi/message.h +++ b/lib/sbi/message.h @@ -75,8 +75,10 @@ extern "C" { #define OGS_SBI_HTTP_METHOD_PUT "PUT" #define OGS_SBI_HTTP_METHOD_OPTIONS "OPTIONS" -#define OGS_SBI_API_VERSION "v1" -#define OGS_SBI_API_FULL_VERSION "1.0.0" +#define OGS_SBI_API_V1 "v1" +#define OGS_SBI_API_V1_0_0 "1.0.0" +#define OGS_SBI_API_V2 "v2" +#define OGS_SBI_API_V2_0_0 "2.0.0" #define OGS_SBI_SERVICE_NAME_NNRF_NFM "nnrf-nfm" #define OGS_SBI_SERVICE_NAME_NNRF_DISC "nnrf-disc" @@ -91,11 +93,18 @@ extern "C" { #define OGS_SBI_RESOURCE_NAME_EAP_SESSION "eap-session" #define OGS_SBI_SERVICE_NAME_NUDM_SDM "nudm-sdm" -#define OGS_SBI_SERVICE_NAME_NUDM_UECM "nudm-uecm" +#define OGS_SBI_RESOURCE_NAME_AM_DATA "am-data" +#define OGS_SBI_RESOURCE_NAME_SM_DATA "sm-data" +#define OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA "smf-select-data" +#define OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA "ue-context-in-smf-data" #define OGS_SBI_SERVICE_NAME_NUDM_UEAU "nudm-ueau" #define OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION "security-information" #define OGS_SBI_RESOURCE_NAME_GENERATE_AUTH_DATA "generate-auth-data" #define OGS_SBI_RESOURCE_NAME_AUTH_EVENTS "auth-events" +#define OGS_SBI_SERVICE_NAME_NUDM_UECM "nudm-uecm" +#define OGS_SBI_RESOURCE_NAME_REGISTRATIONS "registrations" +#define OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS "amf-3gpp-access" +#define OGS_SBI_RESOURCE_NAME_DEREG_NOTIFY "dereg-notify" #define OGS_SBI_SERVICE_NAME_NUDR_DR "nudr-dr" #define OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA "subscription-data" @@ -103,31 +112,66 @@ extern "C" { #define OGS_SBI_RESOURCE_NAME_AUTHENTICATION_SUBSCRIPTION \ "authentication-subscription" #define OGS_SBI_RESOURCE_NAME_AUTHENTICATION_STATUS "authentication-status" +#define OGS_SBI_RESOURCE_NAME_CONTEXT_DATA "context-data" +#define OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA "provisioned-data" #define OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION "nsmf-pdusession" +#define OGS_SBI_RESOURCE_NAME_SM_CONTEXTS "sm-contexts" #define OGS_SBI_SERVICE_NAME_NSMF_EVENT_EXPOSURE "nsmf-event-exposure" +#define OGS_SBI_RESOURCE_NAME_MODIFY "modify" +#define OGS_SBI_RESOURCE_NAME_RELEASE "release" + +#define OGS_SBI_SERVICE_NAME_NAMF_COMM "namf-comm" +#define OGS_SBI_SERVICE_NAME_NAMF_CALLBACK "namf-callback" +#define OGS_SBI_RESOURCE_NAME_UE_CONTEXTS "ue-contexts" +#define OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES "n1-n2-messages" +#define OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS "sm-context-status" #define OGS_SBI_PARAM_NF_TYPE "nf-type" #define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type" #define OGS_SBI_PARAM_REQUESTER_NF_TYPE "requester-nf-type" #define OGS_SBI_PARAM_LIMIT "limit" +#define OGS_SBI_PARAM_DNN "dnn" +#define OGS_SBI_PARAM_PLMN_ID "plmn-id" +#define OGS_SBI_PARAM_S_NSSAI "single-nssai" #define OGS_SBI_ACCEPT "Accept" #define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding" #define OGS_SBI_CONTENT_TYPE "Content-Type" #define OGS_SBI_LOCATION "Location" -#define OGS_SBI_CONTENT_JSON_TYPE "application/json" -#define OGS_SBI_CONTENT_PROBLEM_TYPE "application/problem+json" -#define OGS_SBI_CONTENT_PATCH_TYPE \ - "application/json-patch+json" -#define OGS_SBI_CONTENT_3GPPHAL_TYPE "application/3gppHal+json" +#define OGS_SBI_APPLICATION_TYPE "application" +#define OGS_SBI_APPLICATION_JSON_TYPE "json" +#define OGS_SBI_APPLICATION_PROBLEM_TYPE "problem+json" +#define OGS_SBI_APPLICATION_PATCH_TYPE "json-patch+json" +#define OGS_SBI_APPLICATION_3GPPHAL_TYPE "3gppHal+json" +#define OGS_SBI_APPLICATION_5GNAS_TYPE "vnd.3gpp.5gnas" +#define OGS_SBI_APPLICATION_NGAP_TYPE "vnd.3gpp.ngap" -typedef struct ogs_sbi_request_s ogs_sbi_request_t; -typedef struct ogs_sbi_response_s ogs_sbi_response_t; +#define OGS_SBI_CONTENT_JSON_TYPE \ + OGS_SBI_APPLICATION_TYPE "/" OGS_SBI_APPLICATION_JSON_TYPE +#define OGS_SBI_CONTENT_PROBLEM_TYPE \ + OGS_SBI_APPLICATION_TYPE "/" OGS_SBI_APPLICATION_PROBLEM_TYPE +#define OGS_SBI_CONTENT_PATCH_TYPE \ + OGS_SBI_APPLICATION_TYPE "/" OGS_SBI_APPLICATION_PATCH_TYPE +#define OGS_SBI_CONTENT_3GPPHAL_TYPE \ + OGS_SBI_APPLICATION_TYPE "/" OGS_SBI_APPLICATION_3GPPHAL_TYPE +#define OGS_SBI_CONTENT_5GNAS_TYPE \ + OGS_SBI_APPLICATION_TYPE "/" OGS_SBI_APPLICATION_5GNAS_TYPE +#define OGS_SBI_CONTENT_NGAP_TYPE \ + OGS_SBI_APPLICATION_TYPE "/" OGS_SBI_APPLICATION_NGAP_TYPE + +#define OGS_SBI_MULTIPART_TYPE "multipart" +#define OGS_SBI_MULTIPART_RELATED_TYPE "related" +#define OGS_SBI_CONTENT_MULTIPART_TYPE \ + OGS_SBI_MULTIPART_TYPE "/" OGS_SBI_MULTIPART_RELATED_TYPE + +#define OGS_SBI_CONTENT_ID "Content-Id" +#define OGS_SBI_CONTENT_5GNAS_SM_ID "5gnas-sm" +#define OGS_SBI_CONTENT_NGAP_SM_ID "ngap-sm" typedef struct ogs_sbi_header_s { char *method; - char *url; + char *uri; struct { char *name; @@ -144,6 +188,13 @@ typedef struct ogs_sbi_header_s { } ogs_sbi_header_t; +typedef struct ogs_sbi_part_s { + char *content_id; + char *content_type; + + ogs_pkbuf_t *pkbuf; +} ogs_sbi_part_t; + typedef struct ogs_sbi_message_s { ogs_sbi_header_t h; @@ -160,6 +211,11 @@ typedef struct ogs_sbi_message_s { OpenAPI_nf_type_e requester_nf_type; OpenAPI_nf_type_e nf_type; int limit; + char *dnn; + bool plmn_id_presence; + ogs_plmn_id_t plmn_id; + bool s_nssai_presence; + ogs_s_nssai_t s_nssai; } param; int res_status; @@ -179,10 +235,58 @@ typedef struct ogs_sbi_message_s { OpenAPI_confirmation_data_t *ConfirmationData; OpenAPI_confirmation_data_response_t *ConfirmationDataResponse; OpenAPI_auth_event_t *AuthEvent; + OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration; + OpenAPI_access_and_mobility_subscription_data_t + *AccessAndMobilitySubscriptionData; + OpenAPI_smf_selection_subscription_data_t *SmfSelectionSubscriptionData; + OpenAPI_ue_context_in_smf_data_t *UeContextInSmfData; + OpenAPI_sm_context_create_data_t *SmContextCreateData; + OpenAPI_sm_context_created_data_t *SmContextCreatedData; + OpenAPI_sm_context_create_error_t *SmContextCreateError; + OpenAPI_sm_context_update_data_t *SmContextUpdateData; + OpenAPI_sm_context_updated_data_t *SmContextUpdatedData; + OpenAPI_sm_context_update_error_t *SmContextUpdateError; + OpenAPI_sm_context_release_data_t *SmContextReleaseData; + OpenAPI_sm_context_released_data_t *SmContextReleasedData; + OpenAPI_session_management_subscription_data_t * + SessionManagementSubscriptionData; + OpenAPI_n1_n2_message_transfer_req_data_t *N1N2MessageTransferReqData; + OpenAPI_n1_n2_message_transfer_rsp_data_t *N1N2MessageTransferRspData; ogs_sbi_links_t *links; + +#define OGS_SBI_MAX_NUM_OF_PART 8 + int num_of_part; + ogs_sbi_part_t part[OGS_SBI_MAX_NUM_OF_PART]; } ogs_sbi_message_t; +typedef struct ogs_sbi_http_message_s { + ogs_hash_t *params; + ogs_hash_t *headers; + + char *content; + size_t content_length; + + int num_of_part; + ogs_sbi_part_t part[OGS_SBI_MAX_NUM_OF_PART]; +} ogs_sbi_http_message_t; + +typedef struct ogs_sbi_request_s { + ogs_sbi_header_t h; + ogs_sbi_http_message_t http; + + /* Used in microhttpd */ + bool suspended; + ogs_poll_t *poll; +} ogs_sbi_request_t; + +typedef struct ogs_sbi_response_s { + ogs_sbi_header_t h; + ogs_sbi_http_message_t http; + + int status; +} ogs_sbi_response_t; + void ogs_sbi_message_init(int num_of_request_pool, int num_of_response_pool); void ogs_sbi_message_final(void); @@ -204,6 +308,13 @@ int ogs_sbi_parse_response( void ogs_sbi_header_set(ogs_hash_t *ht, const void *key, const void *val); void *ogs_sbi_header_get(ogs_hash_t *ht, const void *key); +ogs_pkbuf_t *ogs_sbi_find_part_by_content_id( + ogs_sbi_message_t *message, char *content_id); + +int ogs_sbi_parse_header( + ogs_sbi_message_t *message, ogs_sbi_header_t *header); +void ogs_sbi_header_free(ogs_sbi_header_t *h); + #ifdef __cplusplus } #endif diff --git a/lib/sbi/nnrf-build.c b/lib/sbi/nnrf-build.c index 59acb89fd..98295d15e 100644 --- a/lib/sbi/nnrf-build.c +++ b/lib/sbi/nnrf-build.c @@ -229,7 +229,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_register( memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; message.h.resource.component[1] = ogs_sbi_self()->nf_instance_id; @@ -264,7 +264,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_update(ogs_sbi_nf_instance_t *nf_instance) memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_PATCH; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; message.h.resource.component[1] = ogs_sbi_self()->nf_instance_id; @@ -301,7 +301,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_de_register( memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; message.h.resource.component[1] = nf_instance->id; @@ -328,7 +328,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe( memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS; @@ -340,7 +340,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe( memset(&header, 0, sizeof(header)); header.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM; - header.api.version = (char *)OGS_SBI_API_VERSION; + header.api.version = (char *)OGS_SBI_API_V1; header.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY; SubscriptionData->nf_status_notification_uri = @@ -372,7 +372,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe( memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS; message.h.resource.component[1] = subscription->id; @@ -395,7 +395,7 @@ ogs_sbi_request_t *ogs_nnrf_disc_build_discover( memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_DISC; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; diff --git a/lib/sbi/ogs-sbi.h b/lib/sbi/ogs-sbi.h index 28888f2d2..ed04c4e09 100644 --- a/lib/sbi/ogs-sbi.h +++ b/lib/sbi/ogs-sbi.h @@ -43,6 +43,21 @@ #include "model/confirmation_data.h" #include "model/confirmation_data_response.h" #include "model/auth_event.h" +#include "model/amf3_gpp_access_registration.h" +#include "model/access_and_mobility_subscription_data.h" +#include "model/smf_selection_subscription_data.h" +#include "model/ue_context_in_smf_data.h" +#include "model/sm_context_create_data.h" +#include "model/sm_context_created_data.h" +#include "model/sm_context_create_error.h" +#include "model/sm_context_update_data.h" +#include "model/sm_context_updated_data.h" +#include "model/sm_context_update_error.h" +#include "model/sm_context_release_data.h" +#include "model/sm_context_released_data.h" +#include "model/session_management_subscription_data.h" +#include "model/n1_n2_message_transfer_req_data.h" +#include "model/n1_n2_message_transfer_rsp_data.h" #include "custom/links.h" diff --git a/lib/sbi/openapi/.openapi-generator-ignore b/lib/sbi/openapi/.openapi-generator-ignore index 1de928e96..a97049e51 100644 --- a/lib/sbi/openapi/.openapi-generator-ignore +++ b/lib/sbi/openapi/.openapi-generator-ignore @@ -6,7 +6,6 @@ api/** include/apiClient.h src/apiClient.c -src/binary.c unit-test/** diff --git a/lib/sbi/openapi/.openapi-generator/templates/apiKey.c.mustache b/lib/sbi/openapi/.openapi-generator/templates/apiKey.c.mustache index dfc1f732f..06f310961 100644 --- a/lib/sbi/openapi/.openapi-generator/templates/apiKey.c.mustache +++ b/lib/sbi/openapi/.openapi-generator/templates/apiKey.c.mustache @@ -4,7 +4,7 @@ OpenAPI_map_t *OpenAPI_map_create(char *key, void *value) { - OpenAPI_map_t *OpenAPI_map = ogs_malloc(sizeof(OpenAPI_map_t)); + OpenAPI_map_t *OpenAPI_map = ogs_malloc(sizeof(OpenAPI_map_t)); OpenAPI_map->key = key; OpenAPI_map->value = value; return OpenAPI_map; diff --git a/lib/sbi/openapi/.openapi-generator/templates/binary.c.mustache b/lib/sbi/openapi/.openapi-generator/templates/binary.c.mustache index a8c9cc6e7..8cf5849dc 100644 --- a/lib/sbi/openapi/.openapi-generator/templates/binary.c.mustache +++ b/lib/sbi/openapi/.openapi-generator/templates/binary.c.mustache @@ -7,7 +7,7 @@ OpenAPI_binary_t *OpenAPI_instantiate_binary_t(char *data, int len) { - binary_t* ret = malloc(sizeof(struct binary_t)); + OpenAPI_binary_t* ret = malloc(sizeof(OpenAPI_binary_t)); ret->len=len; ret->data = malloc(len); @@ -35,7 +35,7 @@ char *OpenAPI_base64encode(const void *b64_encode_this, (*mem_bio_mem_ptr).data[(*mem_bio_mem_ptr).length] = '\0'; //Adds null-terminator to tail. return (*mem_bio_mem_ptr).data; //Returns base-64 encoded data. (See: "buf_mem_st" struct). #else // OPENSSL -#warning Data will not be encoded. If you want to use function "base64encode", please define "-DOPENSSL" when building the library. +//#warning Data will not be encoded. If you want to use function "base64encode", please define "-DOPENSSL" when building the library. return NULL; #endif // OPENSSL } @@ -59,7 +59,7 @@ char *OpenAPI_base64decode(const void *b64_decode_this, *decoded_bytes = decoded_byte_index; return base64_decoded; //Returns base-64 decoded data with trailing null terminator. #else // OPENSSL -#warning Data will not be decoded. If you want to use function "base64decode", please define "-DOPENSSL" when building the library. +//#warning Data will not be decoded. If you want to use function "base64decode", please define "-DOPENSSL" when building the library. return NULL; #endif // OPENSSL } diff --git a/lib/sbi/openapi/.openapi-generator/templates/binary.h.mustache b/lib/sbi/openapi/.openapi-generator/templates/binary.h.mustache index c86f1c86c..5f8a2f4d5 100644 --- a/lib/sbi/openapi/.openapi-generator/templates/binary.h.mustache +++ b/lib/sbi/openapi/.openapi-generator/templates/binary.h.mustache @@ -8,8 +8,8 @@ extern "C" { #endif typedef struct OpenAPI_binary_s { - uint8_t* data; - unsigned int len; + char* data; + int len; } OpenAPI_binary_t; OpenAPI_binary_t *OpenAPI_instantiate_binary_t(char *data, int len); diff --git a/lib/sbi/openapi/.openapi-generator/templates/model-body.mustache b/lib/sbi/openapi/.openapi-generator/templates/model-body.mustache index c59c0be2c..8e82bb19c 100644 --- a/lib/sbi/openapi/.openapi-generator/templates/model-body.mustache +++ b/lib/sbi/openapi/.openapi-generator/templates/model-body.mustache @@ -236,12 +236,7 @@ cJSON *OpenAPI_{{classname}}_convertToJSON(OpenAPI_{{classname}}_t *{{classname} {{/isBoolean}} {{/required}} {{^required}} - {{#isBoolean}} - if ({{{classname}}}->{{{name}}} >= 0) { - {{/isBoolean}} - {{^isBoolean}} - if ({{{classname}}}->{{{name}}}) { - {{/isBoolean}} + if ({{{classname}}}->{{{name}}}) { {{/required}} {{^isContainer}} {{#isPrimitiveType}} @@ -522,7 +517,7 @@ OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_parseFromJSON(cJSON *{{classname} } {{/isByteArray}} {{#isBinary}} - OpenAPI_binary_t* decoded_str_{{{name}}} = OpenAPI_malloc(sizeof(struct binary_t)); + OpenAPI_binary_t* decoded_str_{{{name}}} = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); {{^required}}if ({{{name}}}) { {{/required}} if (!cJSON_IsString({{{name}}})) { ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); @@ -789,5 +784,39 @@ OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_parseFromJSON(cJSON *{{classname} end: return NULL; } + +OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_copy(OpenAPI_{{classname}}_t *dst, OpenAPI_{{classname}}_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_{{classname}}_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_{{classname}}_free(dst); + dst = OpenAPI_{{classname}}_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} {{/isEnum}} {{/model}}{{/models}} diff --git a/lib/sbi/openapi/.openapi-generator/templates/model-header.mustache b/lib/sbi/openapi/.openapi-generator/templates/model-header.mustache index 362fbdb09..400e72c59 100644 --- a/lib/sbi/openapi/.openapi-generator/templates/model-header.mustache +++ b/lib/sbi/openapi/.openapi-generator/templates/model-header.mustache @@ -171,6 +171,7 @@ OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_create( void OpenAPI_{{classname}}_free(OpenAPI_{{classname}}_t *{{classname}}); OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_parseFromJSON(cJSON *{{classname}}JSON); cJSON *OpenAPI_{{classname}}_convertToJSON(OpenAPI_{{classname}}_t *{{classname}}); +OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_copy(OpenAPI_{{classname}}_t *dst, OpenAPI_{{classname}}_t *src); {{/isEnum}} #ifdef __cplusplus diff --git a/lib/sbi/openapi/include/binary.h b/lib/sbi/openapi/include/binary.h index 15e6b3c29..55a06f3a1 100644 --- a/lib/sbi/openapi/include/binary.h +++ b/lib/sbi/openapi/include/binary.h @@ -8,8 +8,8 @@ extern "C" { #endif typedef struct OpenAPI_binary_s { - uint8_t* data; - unsigned int len; + char* data; + int len; } OpenAPI_binary_t; OpenAPI_binary_t *OpenAPI_instantiate_binary_t(char *data, int len); diff --git a/lib/sbi/openapi/meson.build b/lib/sbi/openapi/meson.build index 0a21cb6b2..613282afc 100644 --- a/lib/sbi/openapi/meson.build +++ b/lib/sbi/openapi/meson.build @@ -18,6 +18,7 @@ libsbi_openapi_sources = files(''' src/list.c src/apiKey.c + src/binary.c external/cJSON.c model/object.c model/access_type.c @@ -463,6 +464,185 @@ libsbi_openapi_sources = files(''' model/usage_threshold.c model/v2x_rat_type.c + model/additional_qos_flow_info.c + model/apn_rate_status.c + model/cause.c + model/cn_assisted_ran_para.c + model/ddn_failure_subs.c + model/dnai_information.c + model/dnn_selection_mode.c + model/dynamic5_qi.c + model/ebi_arp_mapping.c + model/eps_bearer_info.c + model/eps_interworking_indication.c + model/eps_pdn_cnx_info.c + model/exemption_ind.c + model/gbr_qos_flow_information.c + model/ho_state.c + model/hsmf_update_data.c + model/hsmf_update_error.c + model/hsmf_updated_data.c + model/indirect_data_forwarding_tunnel_info.c + model/inline_object.c + model/inline_object_1.c + model/inline_object_2.c + model/inline_object_3.c + model/inline_object_4.c + model/ma_release_indication.c + model/max_integrity_protected_data_rate.c + model/mme_capabilities.c + model/mo_exception_data_flag.c + model/mo_exp_data_counter.c + model/n2_sm_info_type.c + model/n4_information.c + model/n4_message_type.c + model/ng_ap_cause.c + model/ng_ran_target_id.c + model/non_dynamic5_qi.c + model/notification_cause.c + model/notification_control.c + model/partial_record_method.c + model/pdu_session_create_data.c + model/pdu_session_create_error.c + model/pdu_session_created_data.c + model/pdu_session_notify_item.c + model/psa_indication.c + model/psa_information.c + model/qos_flow_access_type.c + model/qos_flow_add_modify_request_item.c + model/qos_flow_item.c + model/qos_flow_notify_item.c + model/qos_flow_profile.c + model/qos_flow_release_request_item.c + model/qos_flow_setup_item.c + model/qos_flow_usage_report.c + model/qos_resource_type.c + model/ref_to_binary_data.c + model/reflective_qo_s_attribute.c + model/release_data.c + model/released_data.c + model/request_indication.c + model/request_type.c + model/resource_status.c + model/roaming_charging_profile.c + model/secondary_rat_usage_info.c + model/secondary_rat_usage_report.c + model/send_mo_data_req_data.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_release_data.c + model/sm_context_released_data.c + model/sm_context_retrieve_data.c + model/sm_context_retrieved_data.c + 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/small_data_rate_status.c + model/status_info.c + model/status_notification.c + model/transfer_mo_data_req_data.c + model/transfer_mt_data_add_info.c + model/transfer_mt_data_error.c + model/transfer_mt_data_req_data.c + model/trigger.c + model/trigger_category.c + model/trigger_type.c + model/tunnel_info.c + model/ulcl_bp_information.c + model/unavailable_access_indication.c + model/up_cnx_state.c + 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/allowed_nssai.c + model/allowed_snssai.c + model/amf_event.c + model/amf_event_area.c + model/amf_event_mode.c + model/amf_event_subscription.c + model/amf_event_trigger.c + model/amf_event_type.c + model/amf_status_change_notification.c + model/amf_status_change_subscription_data.c + model/amf_status_info.c + model/area_of_validity.c + model/assign_ebi_data.c + model/assign_ebi_error.c + model/assign_ebi_failed.c + model/assigned_ebi_data.c + model/ciphering_algorithm.c + model/configured_snssai.c + model/expected_ue_behavior.c + model/integrity_algorithm.c + model/key_amf.c + model/key_amf_type.c + model/ladn_info.c + model/location_filter.c + model/mm_context.c + model/n1_message_container.c + model/n1_message_notification.c + model/n1_n2_message_transfer_cause.c + model/n1_n2_message_transfer_error.c + model/n1_n2_message_transfer_req_data.c + model/n1_n2_message_transfer_rsp_data.c + model/n1_n2_msg_txfr_err_detail.c + model/n1_n2_msg_txfr_failure_notification.c + model/n2_info_container.c + model/n2_info_content.c + model/n2_info_notification_rsp_data.c + model/n2_info_notify_reason.c + model/n2_information_notification.c + model/n2_information_transfer_error.c + model/n2_information_transfer_req_data.c + model/n2_information_transfer_result.c + model/n2_information_transfer_rsp_data.c + model/n2_ran_information.c + model/n2_sm_information.c + model/nas_security_mode.c + model/ng_ksi.c + model/ngap_ie_type.c + model/non_ue_n2_info_subscription_create_data.c + model/non_ue_n2_info_subscription_created_data.c + model/nrppa_information.c + model/nsi_information.c + model/nssai_mapping.c + model/pdu_session_context.c + model/policy_req_trigger.c + model/pws_error_data.c + model/pws_information.c + model/pws_response_data.c + model/rat_selector.c + model/registration_context_container.c + model/sbi_binding_level.c + model/sc_type.c + model/seaf_data.c + model/small_data_rate_status_info.c + model/smf_change_indication.c + model/smf_change_info.c + model/status_change.c + model/traffic_descriptor.c + model/transfer_reason.c + model/ue_context.c + model/ue_context_create_data.c + model/ue_context_create_error.c + model/ue_context_created_data.c + model/ue_context_release.c + model/ue_context_transfer_req_data.c + model/ue_context_transfer_rsp_data.c + model/ue_context_transfer_status.c + model/ue_n1_n2_info_subscription_create_data.c + model/ue_n1_n2_info_subscription_created_data.c + model/ue_reg_status_update_req_data.c + model/ue_reg_status_update_rsp_data.c + model/v2x_context.c + '''.split()) libsbi_openapi_inc = include_directories('.') diff --git a/lib/sbi/openapi/model/access_and_mobility_data.c b/lib/sbi/openapi/model/access_and_mobility_data.c index 091e4da9d..027136cb8 100644 --- a/lib/sbi/openapi/model/access_and_mobility_data.c +++ b/lib/sbi/openapi/model/access_and_mobility_data.c @@ -16,7 +16,7 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create( char *conn_states_ts, OpenAPI_ue_reachability_t *reachability_status, char *reachability_status_ts, - OpenAPI_sms_support_t *sms_over_nas_status, + OpenAPI_sms_support_e sms_over_nas_status, char *sms_over_nas_status_ts, int roaming_status, char *roaming_status_ts, @@ -75,14 +75,10 @@ void OpenAPI_access_and_mobility_data_free(OpenAPI_access_and_mobility_data_t *a ogs_free(access_and_mobility_data->conn_states_ts); OpenAPI_ue_reachability_free(access_and_mobility_data->reachability_status); ogs_free(access_and_mobility_data->reachability_status_ts); - OpenAPI_sms_support_free(access_and_mobility_data->sms_over_nas_status); ogs_free(access_and_mobility_data->sms_over_nas_status_ts); ogs_free(access_and_mobility_data->roaming_status_ts); OpenAPI_plmn_id_free(access_and_mobility_data->current_plmn); ogs_free(access_and_mobility_data->current_plmn_ts); - OpenAPI_list_for_each(access_and_mobility_data->rat_type, node) { - OpenAPI_rat_type_free(node->data); - } OpenAPI_list_free(access_and_mobility_data->rat_type); ogs_free(access_and_mobility_data->rat_types_ts); ogs_free(access_and_mobility_data); @@ -214,13 +210,7 @@ cJSON *OpenAPI_access_and_mobility_data_convertToJSON(OpenAPI_access_and_mobilit } if (access_and_mobility_data->sms_over_nas_status) { - cJSON *sms_over_nas_status_local_JSON = OpenAPI_sms_support_convertToJSON(access_and_mobility_data->sms_over_nas_status); - if (sms_over_nas_status_local_JSON == NULL) { - ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [sms_over_nas_status]"); - goto end; - } - cJSON_AddItemToObject(item, "smsOverNasStatus", sms_over_nas_status_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "smsOverNasStatus", OpenAPI_sms_support_ToString(access_and_mobility_data->sms_over_nas_status)) == NULL) { ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [sms_over_nas_status]"); goto end; } @@ -233,7 +223,7 @@ cJSON *OpenAPI_access_and_mobility_data_convertToJSON(OpenAPI_access_and_mobilit } } - if (access_and_mobility_data->roaming_status >= 0) { + if (access_and_mobility_data->roaming_status) { if (cJSON_AddBoolToObject(item, "roamingStatus", access_and_mobility_data->roaming_status) == NULL) { ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [roaming_status]"); goto end; @@ -268,21 +258,16 @@ cJSON *OpenAPI_access_and_mobility_data_convertToJSON(OpenAPI_access_and_mobilit } if (access_and_mobility_data->rat_type) { - cJSON *rat_typeList = cJSON_AddArrayToObject(item, "ratType"); - if (rat_typeList == NULL) { + cJSON *rat_type = cJSON_AddArrayToObject(item, "ratType"); + if (rat_type == NULL) { ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [rat_type]"); goto end; } - OpenAPI_lnode_t *rat_type_node; - if (access_and_mobility_data->rat_type) { - OpenAPI_list_for_each(access_and_mobility_data->rat_type, rat_type_node) { - cJSON *itemLocal = OpenAPI_rat_type_convertToJSON(rat_type_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [rat_type]"); - goto end; - } - cJSON_AddItemToArray(rat_typeList, itemLocal); + OpenAPI_list_for_each(access_and_mobility_data->rat_type, rat_type_node) { + if (cJSON_AddStringToObject(rat_type, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)rat_type_node->data)) == NULL) { + ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [rat_type]"); + goto end; } } } @@ -428,9 +413,13 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJS cJSON *sms_over_nas_status = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "smsOverNasStatus"); - OpenAPI_sms_support_t *sms_over_nas_status_local_nonprim = NULL; + OpenAPI_sms_support_e sms_over_nas_statusVariable; if (sms_over_nas_status) { - sms_over_nas_status_local_nonprim = OpenAPI_sms_support_parseFromJSON(sms_over_nas_status); + if (!cJSON_IsString(sms_over_nas_status)) { + ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [sms_over_nas_status]"); + goto end; + } + sms_over_nas_statusVariable = OpenAPI_sms_support_FromString(sms_over_nas_status->valuestring); } cJSON *sms_over_nas_status_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "smsOverNasStatusTs"); @@ -489,13 +478,12 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJS rat_typeList = OpenAPI_list_create(); cJSON_ArrayForEach(rat_type_local_nonprimitive, rat_type ) { - if (!cJSON_IsObject(rat_type_local_nonprimitive)) { + if (!cJSON_IsString(rat_type_local_nonprimitive)) { ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [rat_type]"); goto end; } - OpenAPI_rat_type_t *rat_typeItem = OpenAPI_rat_type_parseFromJSON(rat_type_local_nonprimitive); - OpenAPI_list_add(rat_typeList, rat_typeItem); + OpenAPI_list_add(rat_typeList, (void *)OpenAPI_rat_type_FromString(rat_type_local_nonprimitive->valuestring)); } } @@ -520,7 +508,7 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJS conn_states_ts ? ogs_strdup(conn_states_ts->valuestring) : NULL, reachability_status ? reachability_status_local_nonprim : NULL, reachability_status_ts ? ogs_strdup(reachability_status_ts->valuestring) : NULL, - sms_over_nas_status ? sms_over_nas_status_local_nonprim : NULL, + sms_over_nas_status ? sms_over_nas_statusVariable : 0, sms_over_nas_status_ts ? ogs_strdup(sms_over_nas_status_ts->valuestring) : NULL, roaming_status ? roaming_status->valueint : 0, roaming_status_ts ? ogs_strdup(roaming_status_ts->valuestring) : NULL, @@ -535,3 +523,37 @@ end: return NULL; } +OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_copy(OpenAPI_access_and_mobility_data_t *dst, OpenAPI_access_and_mobility_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_access_and_mobility_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_access_and_mobility_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_access_and_mobility_data_free(dst); + dst = OpenAPI_access_and_mobility_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/access_and_mobility_data.h b/lib/sbi/openapi/model/access_and_mobility_data.h index e0d7f9fd0..f8c027fa4 100644 --- a/lib/sbi/openapi/model/access_and_mobility_data.h +++ b/lib/sbi/openapi/model/access_and_mobility_data.h @@ -38,7 +38,7 @@ typedef struct OpenAPI_access_and_mobility_data_s { char *conn_states_ts; struct OpenAPI_ue_reachability_s *reachability_status; char *reachability_status_ts; - struct OpenAPI_sms_support_s *sms_over_nas_status; + OpenAPI_sms_support_e sms_over_nas_status; char *sms_over_nas_status_ts; int roaming_status; char *roaming_status_ts; @@ -60,7 +60,7 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create( char *conn_states_ts, OpenAPI_ue_reachability_t *reachability_status, char *reachability_status_ts, - OpenAPI_sms_support_t *sms_over_nas_status, + OpenAPI_sms_support_e sms_over_nas_status, char *sms_over_nas_status_ts, int roaming_status, char *roaming_status_ts, @@ -72,6 +72,7 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create( void OpenAPI_access_and_mobility_data_free(OpenAPI_access_and_mobility_data_t *access_and_mobility_data); OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJSON(cJSON *access_and_mobility_dataJSON); cJSON *OpenAPI_access_and_mobility_data_convertToJSON(OpenAPI_access_and_mobility_data_t *access_and_mobility_data); +OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_copy(OpenAPI_access_and_mobility_data_t *dst, OpenAPI_access_and_mobility_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/access_and_mobility_subscription_data.c b/lib/sbi/openapi/model/access_and_mobility_subscription_data.c index 94c2cc3a3..d87a1c4c5 100644 --- a/lib/sbi/openapi/model/access_and_mobility_subscription_data.c +++ b/lib/sbi/openapi/model/access_and_mobility_subscription_data.c @@ -142,9 +142,6 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil OpenAPI_list_free(access_and_mobility_subscription_data->shared_vn_group_data_ids); OpenAPI_ambr_rm_free(access_and_mobility_subscription_data->subscribed_ue_ambr); OpenAPI_nssai_free(access_and_mobility_subscription_data->nssai); - OpenAPI_list_for_each(access_and_mobility_subscription_data->rat_restrictions, node) { - OpenAPI_rat_type_free(node->data); - } OpenAPI_list_free(access_and_mobility_subscription_data->rat_restrictions); OpenAPI_list_for_each(access_and_mobility_subscription_data->forbidden_areas, node) { OpenAPI_area_free(node->data); @@ -182,13 +179,7 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil OpenAPI_maximum_latency_free(node->data); } OpenAPI_list_free(access_and_mobility_subscription_data->maximum_latency_list); - OpenAPI_list_for_each(access_and_mobility_subscription_data->primary_rat_restrictions, node) { - OpenAPI_rat_type_free(node->data); - } OpenAPI_list_free(access_and_mobility_subscription_data->primary_rat_restrictions); - OpenAPI_list_for_each(access_and_mobility_subscription_data->secondary_rat_restrictions, node) { - OpenAPI_rat_type_free(node->data); - } OpenAPI_list_free(access_and_mobility_subscription_data->secondary_rat_restrictions); OpenAPI_list_for_each(access_and_mobility_subscription_data->edrx_parameters_list, node) { OpenAPI_edrx_parameters_free(node->data); @@ -317,21 +308,16 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } if (access_and_mobility_subscription_data->rat_restrictions) { - cJSON *rat_restrictionsList = cJSON_AddArrayToObject(item, "ratRestrictions"); - if (rat_restrictionsList == NULL) { + cJSON *rat_restrictions = cJSON_AddArrayToObject(item, "ratRestrictions"); + if (rat_restrictions == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [rat_restrictions]"); goto end; } - OpenAPI_lnode_t *rat_restrictions_node; - if (access_and_mobility_subscription_data->rat_restrictions) { - OpenAPI_list_for_each(access_and_mobility_subscription_data->rat_restrictions, rat_restrictions_node) { - cJSON *itemLocal = OpenAPI_rat_type_convertToJSON(rat_restrictions_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [rat_restrictions]"); - goto end; - } - cJSON_AddItemToArray(rat_restrictionsList, itemLocal); + OpenAPI_list_for_each(access_and_mobility_subscription_data->rat_restrictions, rat_restrictions_node) { + if (cJSON_AddStringToObject(rat_restrictions, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)rat_restrictions_node->data)) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [rat_restrictions]"); + goto end; } } } @@ -410,14 +396,14 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } - if (access_and_mobility_subscription_data->mps_priority >= 0) { + if (access_and_mobility_subscription_data->mps_priority) { if (cJSON_AddBoolToObject(item, "mpsPriority", access_and_mobility_subscription_data->mps_priority) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mps_priority]"); goto end; } } - if (access_and_mobility_subscription_data->mcs_priority >= 0) { + if (access_and_mobility_subscription_data->mcs_priority) { if (cJSON_AddBoolToObject(item, "mcsPriority", access_and_mobility_subscription_data->mcs_priority) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mcs_priority]"); goto end; @@ -451,14 +437,14 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } - if (access_and_mobility_subscription_data->sor_info_expect_ind >= 0) { + if (access_and_mobility_subscription_data->sor_info_expect_ind) { if (cJSON_AddBoolToObject(item, "sorInfoExpectInd", access_and_mobility_subscription_data->sor_info_expect_ind) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [sor_info_expect_ind]"); goto end; } } - if (access_and_mobility_subscription_data->soraf_retrieval >= 0) { + if (access_and_mobility_subscription_data->soraf_retrieval) { if (cJSON_AddBoolToObject(item, "sorafRetrieval", access_and_mobility_subscription_data->soraf_retrieval) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [soraf_retrieval]"); goto end; @@ -493,7 +479,7 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } - if (access_and_mobility_subscription_data->mico_allowed >= 0) { + if (access_and_mobility_subscription_data->mico_allowed) { if (cJSON_AddBoolToObject(item, "micoAllowed", access_and_mobility_subscription_data->mico_allowed) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mico_allowed]"); goto end; @@ -599,7 +585,7 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } - if (access_and_mobility_subscription_data->nssai_inclusion_allowed >= 0) { + if (access_and_mobility_subscription_data->nssai_inclusion_allowed) { if (cJSON_AddBoolToObject(item, "nssaiInclusionAllowed", access_and_mobility_subscription_data->nssai_inclusion_allowed) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [nssai_inclusion_allowed]"); goto end; @@ -693,41 +679,31 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } if (access_and_mobility_subscription_data->primary_rat_restrictions) { - cJSON *primary_rat_restrictionsList = cJSON_AddArrayToObject(item, "primaryRatRestrictions"); - if (primary_rat_restrictionsList == NULL) { + cJSON *primary_rat_restrictions = cJSON_AddArrayToObject(item, "primaryRatRestrictions"); + if (primary_rat_restrictions == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [primary_rat_restrictions]"); goto end; } - OpenAPI_lnode_t *primary_rat_restrictions_node; - if (access_and_mobility_subscription_data->primary_rat_restrictions) { - OpenAPI_list_for_each(access_and_mobility_subscription_data->primary_rat_restrictions, primary_rat_restrictions_node) { - cJSON *itemLocal = OpenAPI_rat_type_convertToJSON(primary_rat_restrictions_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [primary_rat_restrictions]"); - goto end; - } - cJSON_AddItemToArray(primary_rat_restrictionsList, itemLocal); + OpenAPI_list_for_each(access_and_mobility_subscription_data->primary_rat_restrictions, primary_rat_restrictions_node) { + if (cJSON_AddStringToObject(primary_rat_restrictions, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)primary_rat_restrictions_node->data)) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [primary_rat_restrictions]"); + goto end; } } } if (access_and_mobility_subscription_data->secondary_rat_restrictions) { - cJSON *secondary_rat_restrictionsList = cJSON_AddArrayToObject(item, "secondaryRatRestrictions"); - if (secondary_rat_restrictionsList == NULL) { + cJSON *secondary_rat_restrictions = cJSON_AddArrayToObject(item, "secondaryRatRestrictions"); + if (secondary_rat_restrictions == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [secondary_rat_restrictions]"); goto end; } - OpenAPI_lnode_t *secondary_rat_restrictions_node; - if (access_and_mobility_subscription_data->secondary_rat_restrictions) { - OpenAPI_list_for_each(access_and_mobility_subscription_data->secondary_rat_restrictions, secondary_rat_restrictions_node) { - cJSON *itemLocal = OpenAPI_rat_type_convertToJSON(secondary_rat_restrictions_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [secondary_rat_restrictions]"); - goto end; - } - cJSON_AddItemToArray(secondary_rat_restrictionsList, itemLocal); + OpenAPI_list_for_each(access_and_mobility_subscription_data->secondary_rat_restrictions, secondary_rat_restrictions_node) { + if (cJSON_AddStringToObject(secondary_rat_restrictions, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)secondary_rat_restrictions_node->data)) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [secondary_rat_restrictions]"); + goto end; } } } @@ -772,7 +748,7 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } - if (access_and_mobility_subscription_data->iab_operation_allowed >= 0) { + if (access_and_mobility_subscription_data->iab_operation_allowed) { if (cJSON_AddBoolToObject(item, "iabOperationAllowed", access_and_mobility_subscription_data->iab_operation_allowed) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [iab_operation_allowed]"); goto end; @@ -942,13 +918,12 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub rat_restrictionsList = OpenAPI_list_create(); cJSON_ArrayForEach(rat_restrictions_local_nonprimitive, rat_restrictions ) { - if (!cJSON_IsObject(rat_restrictions_local_nonprimitive)) { + if (!cJSON_IsString(rat_restrictions_local_nonprimitive)) { ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [rat_restrictions]"); goto end; } - OpenAPI_rat_type_t *rat_restrictionsItem = OpenAPI_rat_type_parseFromJSON(rat_restrictions_local_nonprimitive); - OpenAPI_list_add(rat_restrictionsList, rat_restrictionsItem); + OpenAPI_list_add(rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(rat_restrictions_local_nonprimitive->valuestring)); } } @@ -1326,13 +1301,12 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub primary_rat_restrictionsList = OpenAPI_list_create(); cJSON_ArrayForEach(primary_rat_restrictions_local_nonprimitive, primary_rat_restrictions ) { - if (!cJSON_IsObject(primary_rat_restrictions_local_nonprimitive)) { + if (!cJSON_IsString(primary_rat_restrictions_local_nonprimitive)) { ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [primary_rat_restrictions]"); goto end; } - OpenAPI_rat_type_t *primary_rat_restrictionsItem = OpenAPI_rat_type_parseFromJSON(primary_rat_restrictions_local_nonprimitive); - OpenAPI_list_add(primary_rat_restrictionsList, primary_rat_restrictionsItem); + OpenAPI_list_add(primary_rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(primary_rat_restrictions_local_nonprimitive->valuestring)); } } @@ -1349,13 +1323,12 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub secondary_rat_restrictionsList = OpenAPI_list_create(); cJSON_ArrayForEach(secondary_rat_restrictions_local_nonprimitive, secondary_rat_restrictions ) { - if (!cJSON_IsObject(secondary_rat_restrictions_local_nonprimitive)) { + if (!cJSON_IsString(secondary_rat_restrictions_local_nonprimitive)) { ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [secondary_rat_restrictions]"); goto end; } - OpenAPI_rat_type_t *secondary_rat_restrictionsItem = OpenAPI_rat_type_parseFromJSON(secondary_rat_restrictions_local_nonprimitive); - OpenAPI_list_add(secondary_rat_restrictionsList, secondary_rat_restrictionsItem); + OpenAPI_list_add(secondary_rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(secondary_rat_restrictions_local_nonprimitive->valuestring)); } } @@ -1503,3 +1476,37 @@ end: return NULL; } +OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_copy(OpenAPI_access_and_mobility_subscription_data_t *dst, OpenAPI_access_and_mobility_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_access_and_mobility_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_access_and_mobility_subscription_data_free(dst); + dst = OpenAPI_access_and_mobility_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/access_and_mobility_subscription_data.h b/lib/sbi/openapi/model/access_and_mobility_subscription_data.h index a4705fe50..7f38b3752 100644 --- a/lib/sbi/openapi/model/access_and_mobility_subscription_data.h +++ b/lib/sbi/openapi/model/access_and_mobility_subscription_data.h @@ -146,6 +146,7 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data); OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_parseFromJSON(cJSON *access_and_mobility_subscription_dataJSON); cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data); +OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_copy(OpenAPI_access_and_mobility_subscription_data_t *dst, OpenAPI_access_and_mobility_subscription_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/access_right_status.c b/lib/sbi/openapi/model/access_right_status.c index a712f9cef..0768ac08f 100644 --- a/lib/sbi/openapi/model/access_right_status.c +++ b/lib/sbi/openapi/model/access_right_status.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_access_right_status_t *OpenAPI_access_right_status_copy(OpenAPI_access_right_status_t *dst, OpenAPI_access_right_status_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_access_right_status_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_access_right_status_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_access_right_status_free(dst); + dst = OpenAPI_access_right_status_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/access_right_status.h b/lib/sbi/openapi/model/access_right_status.h index 6b5e17c55..8cdb4a78c 100644 --- a/lib/sbi/openapi/model/access_right_status.h +++ b/lib/sbi/openapi/model/access_right_status.h @@ -26,6 +26,7 @@ OpenAPI_access_right_status_t *OpenAPI_access_right_status_create( void OpenAPI_access_right_status_free(OpenAPI_access_right_status_t *access_right_status); OpenAPI_access_right_status_t *OpenAPI_access_right_status_parseFromJSON(cJSON *access_right_statusJSON); cJSON *OpenAPI_access_right_status_convertToJSON(OpenAPI_access_right_status_t *access_right_status); +OpenAPI_access_right_status_t *OpenAPI_access_right_status_copy(OpenAPI_access_right_status_t *dst, OpenAPI_access_right_status_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/access_tech.c b/lib/sbi/openapi/model/access_tech.c index d1f949f04..6779fd15f 100644 --- a/lib/sbi/openapi/model/access_tech.c +++ b/lib/sbi/openapi/model/access_tech.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_access_tech_t *OpenAPI_access_tech_copy(OpenAPI_access_tech_t *dst, OpenAPI_access_tech_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_access_tech_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_access_tech_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_access_tech_free(dst); + dst = OpenAPI_access_tech_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/access_tech.h b/lib/sbi/openapi/model/access_tech.h index 83b7f079f..b3d94e46f 100644 --- a/lib/sbi/openapi/model/access_tech.h +++ b/lib/sbi/openapi/model/access_tech.h @@ -26,6 +26,7 @@ OpenAPI_access_tech_t *OpenAPI_access_tech_create( void OpenAPI_access_tech_free(OpenAPI_access_tech_t *access_tech); OpenAPI_access_tech_t *OpenAPI_access_tech_parseFromJSON(cJSON *access_techJSON); cJSON *OpenAPI_access_tech_convertToJSON(OpenAPI_access_tech_t *access_tech); +OpenAPI_access_tech_t *OpenAPI_access_tech_copy(OpenAPI_access_tech_t *dst, OpenAPI_access_tech_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/acknowledge_info.c b/lib/sbi/openapi/model/acknowledge_info.c index 2e7628033..f78b2eb71 100644 --- a/lib/sbi/openapi/model/acknowledge_info.c +++ b/lib/sbi/openapi/model/acknowledge_info.c @@ -134,3 +134,37 @@ end: return NULL; } +OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_copy(OpenAPI_acknowledge_info_t *dst, OpenAPI_acknowledge_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_acknowledge_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_acknowledge_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_acknowledge_info_free(dst); + dst = OpenAPI_acknowledge_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/acknowledge_info.h b/lib/sbi/openapi/model/acknowledge_info.h index cfd54c961..dc5e13ec6 100644 --- a/lib/sbi/openapi/model/acknowledge_info.h +++ b/lib/sbi/openapi/model/acknowledge_info.h @@ -34,6 +34,7 @@ OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_create( void OpenAPI_acknowledge_info_free(OpenAPI_acknowledge_info_t *acknowledge_info); OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_parseFromJSON(cJSON *acknowledge_infoJSON); cJSON *OpenAPI_acknowledge_info_convertToJSON(OpenAPI_acknowledge_info_t *acknowledge_info); +OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_copy(OpenAPI_acknowledge_info_t *dst, OpenAPI_acknowledge_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/acs_info.c b/lib/sbi/openapi/model/acs_info.c index 362aa690f..0b4bbe73e 100644 --- a/lib/sbi/openapi/model/acs_info.c +++ b/lib/sbi/openapi/model/acs_info.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_acs_info_t *OpenAPI_acs_info_copy(OpenAPI_acs_info_t *dst, OpenAPI_acs_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_acs_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_acs_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_acs_info_free(dst); + dst = OpenAPI_acs_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/acs_info.h b/lib/sbi/openapi/model/acs_info.h index 598085cdf..69de69915 100644 --- a/lib/sbi/openapi/model/acs_info.h +++ b/lib/sbi/openapi/model/acs_info.h @@ -32,6 +32,7 @@ OpenAPI_acs_info_t *OpenAPI_acs_info_create( void OpenAPI_acs_info_free(OpenAPI_acs_info_t *acs_info); OpenAPI_acs_info_t *OpenAPI_acs_info_parseFromJSON(cJSON *acs_infoJSON); cJSON *OpenAPI_acs_info_convertToJSON(OpenAPI_acs_info_t *acs_info); +OpenAPI_acs_info_t *OpenAPI_acs_info_copy(OpenAPI_acs_info_t *dst, OpenAPI_acs_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/acs_info_rm.c b/lib/sbi/openapi/model/acs_info_rm.c index 1a5f935b2..8432f0784 100644 --- a/lib/sbi/openapi/model/acs_info_rm.c +++ b/lib/sbi/openapi/model/acs_info_rm.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_acs_info_rm_t *OpenAPI_acs_info_rm_copy(OpenAPI_acs_info_rm_t *dst, OpenAPI_acs_info_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_acs_info_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_acs_info_rm_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_acs_info_rm_free(dst); + dst = OpenAPI_acs_info_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/acs_info_rm.h b/lib/sbi/openapi/model/acs_info_rm.h index 1704ae4df..faee3c4a5 100644 --- a/lib/sbi/openapi/model/acs_info_rm.h +++ b/lib/sbi/openapi/model/acs_info_rm.h @@ -34,6 +34,7 @@ OpenAPI_acs_info_rm_t *OpenAPI_acs_info_rm_create( void OpenAPI_acs_info_rm_free(OpenAPI_acs_info_rm_t *acs_info_rm); OpenAPI_acs_info_rm_t *OpenAPI_acs_info_rm_parseFromJSON(cJSON *acs_info_rmJSON); cJSON *OpenAPI_acs_info_rm_convertToJSON(OpenAPI_acs_info_rm_t *acs_info_rm); +OpenAPI_acs_info_rm_t *OpenAPI_acs_info_rm_copy(OpenAPI_acs_info_rm_t *dst, OpenAPI_acs_info_rm_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/additional_qos_flow_info.c b/lib/sbi/openapi/model/additional_qos_flow_info.c new file mode 100644 index 000000000..dcb1bb0c4 --- /dev/null +++ b/lib/sbi/openapi/model/additional_qos_flow_info.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "additional_qos_flow_info.h" + +OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_create( + ) +{ + OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_additional_qos_flow_info_t)); + if (!additional_qos_flow_info_local_var) { + return NULL; + } + + return additional_qos_flow_info_local_var; +} + +void OpenAPI_additional_qos_flow_info_free(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info) +{ + if (NULL == additional_qos_flow_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(additional_qos_flow_info); +} + +cJSON *OpenAPI_additional_qos_flow_info_convertToJSON(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info) +{ + cJSON *item = NULL; + + if (additional_qos_flow_info == NULL) { + ogs_error("OpenAPI_additional_qos_flow_info_convertToJSON() failed [AdditionalQosFlowInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_parseFromJSON(cJSON *additional_qos_flow_infoJSON) +{ + OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info_local_var = NULL; + additional_qos_flow_info_local_var = OpenAPI_additional_qos_flow_info_create ( + ); + + return additional_qos_flow_info_local_var; +end: + return NULL; +} + +OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_copy(OpenAPI_additional_qos_flow_info_t *dst, OpenAPI_additional_qos_flow_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_additional_qos_flow_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_additional_qos_flow_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_additional_qos_flow_info_free(dst); + dst = OpenAPI_additional_qos_flow_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/additional_qos_flow_info.h b/lib/sbi/openapi/model/additional_qos_flow_info.h new file mode 100644 index 000000000..b81373843 --- /dev/null +++ b/lib/sbi/openapi/model/additional_qos_flow_info.h @@ -0,0 +1,37 @@ +/* + * additional_qos_flow_info.h + * + * + */ + +#ifndef _OpenAPI_additional_qos_flow_info_H_ +#define _OpenAPI_additional_qos_flow_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "null_value.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_additional_qos_flow_info_s OpenAPI_additional_qos_flow_info_t; +typedef struct OpenAPI_additional_qos_flow_info_s { +} OpenAPI_additional_qos_flow_info_t; + +OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_create( + ); +void OpenAPI_additional_qos_flow_info_free(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info); +OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_parseFromJSON(cJSON *additional_qos_flow_infoJSON); +cJSON *OpenAPI_additional_qos_flow_info_convertToJSON(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info); +OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_copy(OpenAPI_additional_qos_flow_info_t *dst, OpenAPI_additional_qos_flow_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_additional_qos_flow_info_H_ */ + diff --git a/lib/sbi/openapi/model/additional_snssai_data.c b/lib/sbi/openapi/model/additional_snssai_data.c index c901d485a..010287222 100644 --- a/lib/sbi/openapi/model/additional_snssai_data.c +++ b/lib/sbi/openapi/model/additional_snssai_data.c @@ -36,7 +36,7 @@ cJSON *OpenAPI_additional_snssai_data_convertToJSON(OpenAPI_additional_snssai_da } item = cJSON_CreateObject(); - if (additional_snssai_data->required_authn_authz >= 0) { + if (additional_snssai_data->required_authn_authz) { if (cJSON_AddBoolToObject(item, "requiredAuthnAuthz", additional_snssai_data->required_authn_authz) == NULL) { ogs_error("OpenAPI_additional_snssai_data_convertToJSON() failed [required_authn_authz]"); goto end; @@ -68,3 +68,37 @@ end: return NULL; } +OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_copy(OpenAPI_additional_snssai_data_t *dst, OpenAPI_additional_snssai_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_additional_snssai_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_additional_snssai_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_additional_snssai_data_free(dst); + dst = OpenAPI_additional_snssai_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/additional_snssai_data.h b/lib/sbi/openapi/model/additional_snssai_data.h index b3af4cf34..77f31a688 100644 --- a/lib/sbi/openapi/model/additional_snssai_data.h +++ b/lib/sbi/openapi/model/additional_snssai_data.h @@ -28,6 +28,7 @@ OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_create( void OpenAPI_additional_snssai_data_free(OpenAPI_additional_snssai_data_t *additional_snssai_data); OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_parseFromJSON(cJSON *additional_snssai_dataJSON); cJSON *OpenAPI_additional_snssai_data_convertToJSON(OpenAPI_additional_snssai_data_t *additional_snssai_data); +OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_copy(OpenAPI_additional_snssai_data_t *dst, OpenAPI_additional_snssai_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/af_event.c b/lib/sbi/openapi/model/af_event.c index 9f6b3bdcd..e4343daea 100644 --- a/lib/sbi/openapi/model/af_event.c +++ b/lib/sbi/openapi/model/af_event.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_af_event_t *OpenAPI_af_event_copy(OpenAPI_af_event_t *dst, OpenAPI_af_event_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_af_event_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_af_event_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_af_event_free(dst); + dst = OpenAPI_af_event_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/af_event.h b/lib/sbi/openapi/model/af_event.h index 25048b9ad..9b89b632d 100644 --- a/lib/sbi/openapi/model/af_event.h +++ b/lib/sbi/openapi/model/af_event.h @@ -26,6 +26,7 @@ OpenAPI_af_event_t *OpenAPI_af_event_create( void OpenAPI_af_event_free(OpenAPI_af_event_t *af_event); OpenAPI_af_event_t *OpenAPI_af_event_parseFromJSON(cJSON *af_eventJSON); cJSON *OpenAPI_af_event_convertToJSON(OpenAPI_af_event_t *af_event); +OpenAPI_af_event_t *OpenAPI_af_event_copy(OpenAPI_af_event_t *dst, OpenAPI_af_event_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/af_event_exposure_data.c b/lib/sbi/openapi/model/af_event_exposure_data.c index c7a7cbc70..893dc5536 100644 --- a/lib/sbi/openapi/model/af_event_exposure_data.c +++ b/lib/sbi/openapi/model/af_event_exposure_data.c @@ -190,3 +190,37 @@ end: return NULL; } +OpenAPI_af_event_exposure_data_t *OpenAPI_af_event_exposure_data_copy(OpenAPI_af_event_exposure_data_t *dst, OpenAPI_af_event_exposure_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_af_event_exposure_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_af_event_exposure_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_af_event_exposure_data_free(dst); + dst = OpenAPI_af_event_exposure_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/af_event_exposure_data.h b/lib/sbi/openapi/model/af_event_exposure_data.h index 844957655..1de8e2273 100644 --- a/lib/sbi/openapi/model/af_event_exposure_data.h +++ b/lib/sbi/openapi/model/af_event_exposure_data.h @@ -33,6 +33,7 @@ OpenAPI_af_event_exposure_data_t *OpenAPI_af_event_exposure_data_create( void OpenAPI_af_event_exposure_data_free(OpenAPI_af_event_exposure_data_t *af_event_exposure_data); OpenAPI_af_event_exposure_data_t *OpenAPI_af_event_exposure_data_parseFromJSON(cJSON *af_event_exposure_dataJSON); cJSON *OpenAPI_af_event_exposure_data_convertToJSON(OpenAPI_af_event_exposure_data_t *af_event_exposure_data); +OpenAPI_af_event_exposure_data_t *OpenAPI_af_event_exposure_data_copy(OpenAPI_af_event_exposure_data_t *dst, OpenAPI_af_event_exposure_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/af_external.c b/lib/sbi/openapi/model/af_external.c index 14f2a32c7..d0e0853e4 100644 --- a/lib/sbi/openapi/model/af_external.c +++ b/lib/sbi/openapi/model/af_external.c @@ -164,3 +164,37 @@ end: return NULL; } +OpenAPI_af_external_t *OpenAPI_af_external_copy(OpenAPI_af_external_t *dst, OpenAPI_af_external_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_af_external_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_af_external_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_af_external_free(dst); + dst = OpenAPI_af_external_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/af_external.h b/lib/sbi/openapi/model/af_external.h index 8a95369b1..ece018f96 100644 --- a/lib/sbi/openapi/model/af_external.h +++ b/lib/sbi/openapi/model/af_external.h @@ -37,6 +37,7 @@ OpenAPI_af_external_t *OpenAPI_af_external_create( void OpenAPI_af_external_free(OpenAPI_af_external_t *af_external); OpenAPI_af_external_t *OpenAPI_af_external_parseFromJSON(cJSON *af_externalJSON); cJSON *OpenAPI_af_external_convertToJSON(OpenAPI_af_external_t *af_external); +OpenAPI_af_external_t *OpenAPI_af_external_copy(OpenAPI_af_external_t *dst, OpenAPI_af_external_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/af_non_external.c b/lib/sbi/openapi/model/af_non_external.c index ccd050d0b..9cf8798a8 100644 --- a/lib/sbi/openapi/model/af_non_external.c +++ b/lib/sbi/openapi/model/af_non_external.c @@ -190,3 +190,37 @@ end: return NULL; } +OpenAPI_af_non_external_t *OpenAPI_af_non_external_copy(OpenAPI_af_non_external_t *dst, OpenAPI_af_non_external_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_af_non_external_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_af_non_external_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_af_non_external_free(dst); + dst = OpenAPI_af_non_external_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/af_non_external.h b/lib/sbi/openapi/model/af_non_external.h index fc53f1414..646d48749 100644 --- a/lib/sbi/openapi/model/af_non_external.h +++ b/lib/sbi/openapi/model/af_non_external.h @@ -40,6 +40,7 @@ OpenAPI_af_non_external_t *OpenAPI_af_non_external_create( void OpenAPI_af_non_external_free(OpenAPI_af_non_external_t *af_non_external); OpenAPI_af_non_external_t *OpenAPI_af_non_external_parseFromJSON(cJSON *af_non_externalJSON); cJSON *OpenAPI_af_non_external_convertToJSON(OpenAPI_af_non_external_t *af_non_external); +OpenAPI_af_non_external_t *OpenAPI_af_non_external_copy(OpenAPI_af_non_external_t *dst, OpenAPI_af_non_external_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/allowed_nssai.c b/lib/sbi/openapi/model/allowed_nssai.c new file mode 100644 index 000000000..cd8e82608 --- /dev/null +++ b/lib/sbi/openapi/model/allowed_nssai.c @@ -0,0 +1,166 @@ + +#include +#include +#include +#include "allowed_nssai.h" + +OpenAPI_allowed_nssai_t *OpenAPI_allowed_nssai_create( + OpenAPI_list_t *allowed_snssai_list, + OpenAPI_access_type_e access_type + ) +{ + OpenAPI_allowed_nssai_t *allowed_nssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_allowed_nssai_t)); + if (!allowed_nssai_local_var) { + return NULL; + } + allowed_nssai_local_var->allowed_snssai_list = allowed_snssai_list; + allowed_nssai_local_var->access_type = access_type; + + return allowed_nssai_local_var; +} + +void OpenAPI_allowed_nssai_free(OpenAPI_allowed_nssai_t *allowed_nssai) +{ + if (NULL == allowed_nssai) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(allowed_nssai->allowed_snssai_list, node) { + OpenAPI_allowed_snssai_free(node->data); + } + OpenAPI_list_free(allowed_nssai->allowed_snssai_list); + ogs_free(allowed_nssai); +} + +cJSON *OpenAPI_allowed_nssai_convertToJSON(OpenAPI_allowed_nssai_t *allowed_nssai) +{ + cJSON *item = NULL; + + if (allowed_nssai == NULL) { + ogs_error("OpenAPI_allowed_nssai_convertToJSON() failed [AllowedNssai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!allowed_nssai->allowed_snssai_list) { + ogs_error("OpenAPI_allowed_nssai_convertToJSON() failed [allowed_snssai_list]"); + goto end; + } + cJSON *allowed_snssai_listList = cJSON_AddArrayToObject(item, "allowedSnssaiList"); + if (allowed_snssai_listList == NULL) { + ogs_error("OpenAPI_allowed_nssai_convertToJSON() failed [allowed_snssai_list]"); + goto end; + } + + OpenAPI_lnode_t *allowed_snssai_list_node; + if (allowed_nssai->allowed_snssai_list) { + OpenAPI_list_for_each(allowed_nssai->allowed_snssai_list, allowed_snssai_list_node) { + cJSON *itemLocal = OpenAPI_allowed_snssai_convertToJSON(allowed_snssai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_allowed_nssai_convertToJSON() failed [allowed_snssai_list]"); + goto end; + } + cJSON_AddItemToArray(allowed_snssai_listList, itemLocal); + } + } + + if (!allowed_nssai->access_type) { + ogs_error("OpenAPI_allowed_nssai_convertToJSON() failed [access_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(allowed_nssai->access_type)) == NULL) { + ogs_error("OpenAPI_allowed_nssai_convertToJSON() failed [access_type]"); + goto end; + } + +end: + return item; +} + +OpenAPI_allowed_nssai_t *OpenAPI_allowed_nssai_parseFromJSON(cJSON *allowed_nssaiJSON) +{ + OpenAPI_allowed_nssai_t *allowed_nssai_local_var = NULL; + cJSON *allowed_snssai_list = cJSON_GetObjectItemCaseSensitive(allowed_nssaiJSON, "allowedSnssaiList"); + if (!allowed_snssai_list) { + ogs_error("OpenAPI_allowed_nssai_parseFromJSON() failed [allowed_snssai_list]"); + goto end; + } + + OpenAPI_list_t *allowed_snssai_listList; + + cJSON *allowed_snssai_list_local_nonprimitive; + if (!cJSON_IsArray(allowed_snssai_list)) { + ogs_error("OpenAPI_allowed_nssai_parseFromJSON() failed [allowed_snssai_list]"); + goto end; + } + + allowed_snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_snssai_list_local_nonprimitive, allowed_snssai_list ) { + if (!cJSON_IsObject(allowed_snssai_list_local_nonprimitive)) { + ogs_error("OpenAPI_allowed_nssai_parseFromJSON() failed [allowed_snssai_list]"); + goto end; + } + OpenAPI_allowed_snssai_t *allowed_snssai_listItem = OpenAPI_allowed_snssai_parseFromJSON(allowed_snssai_list_local_nonprimitive); + + OpenAPI_list_add(allowed_snssai_listList, allowed_snssai_listItem); + } + + cJSON *access_type = cJSON_GetObjectItemCaseSensitive(allowed_nssaiJSON, "accessType"); + if (!access_type) { + ogs_error("OpenAPI_allowed_nssai_parseFromJSON() failed [access_type]"); + goto end; + } + + OpenAPI_access_type_e access_typeVariable; + + if (!cJSON_IsString(access_type)) { + ogs_error("OpenAPI_allowed_nssai_parseFromJSON() failed [access_type]"); + goto end; + } + access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring); + + allowed_nssai_local_var = OpenAPI_allowed_nssai_create ( + allowed_snssai_listList, + access_typeVariable + ); + + return allowed_nssai_local_var; +end: + return NULL; +} + +OpenAPI_allowed_nssai_t *OpenAPI_allowed_nssai_copy(OpenAPI_allowed_nssai_t *dst, OpenAPI_allowed_nssai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_allowed_nssai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_allowed_nssai_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_allowed_nssai_free(dst); + dst = OpenAPI_allowed_nssai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/allowed_nssai.h b/lib/sbi/openapi/model/allowed_nssai.h new file mode 100644 index 000000000..3dc27d645 --- /dev/null +++ b/lib/sbi/openapi/model/allowed_nssai.h @@ -0,0 +1,42 @@ +/* + * allowed_nssai.h + * + * + */ + +#ifndef _OpenAPI_allowed_nssai_H_ +#define _OpenAPI_allowed_nssai_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "allowed_snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_allowed_nssai_s OpenAPI_allowed_nssai_t; +typedef struct OpenAPI_allowed_nssai_s { + OpenAPI_list_t *allowed_snssai_list; + OpenAPI_access_type_e access_type; +} OpenAPI_allowed_nssai_t; + +OpenAPI_allowed_nssai_t *OpenAPI_allowed_nssai_create( + OpenAPI_list_t *allowed_snssai_list, + OpenAPI_access_type_e access_type + ); +void OpenAPI_allowed_nssai_free(OpenAPI_allowed_nssai_t *allowed_nssai); +OpenAPI_allowed_nssai_t *OpenAPI_allowed_nssai_parseFromJSON(cJSON *allowed_nssaiJSON); +cJSON *OpenAPI_allowed_nssai_convertToJSON(OpenAPI_allowed_nssai_t *allowed_nssai); +OpenAPI_allowed_nssai_t *OpenAPI_allowed_nssai_copy(OpenAPI_allowed_nssai_t *dst, OpenAPI_allowed_nssai_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_allowed_nssai_H_ */ + diff --git a/lib/sbi/openapi/model/allowed_snssai.c b/lib/sbi/openapi/model/allowed_snssai.c new file mode 100644 index 000000000..9b8053282 --- /dev/null +++ b/lib/sbi/openapi/model/allowed_snssai.c @@ -0,0 +1,188 @@ + +#include +#include +#include +#include "allowed_snssai.h" + +OpenAPI_allowed_snssai_t *OpenAPI_allowed_snssai_create( + OpenAPI_snssai_t *allowed_snssai, + OpenAPI_list_t *nsi_information_list, + OpenAPI_snssai_t *mapped_home_snssai + ) +{ + OpenAPI_allowed_snssai_t *allowed_snssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_allowed_snssai_t)); + if (!allowed_snssai_local_var) { + return NULL; + } + allowed_snssai_local_var->allowed_snssai = allowed_snssai; + allowed_snssai_local_var->nsi_information_list = nsi_information_list; + allowed_snssai_local_var->mapped_home_snssai = mapped_home_snssai; + + return allowed_snssai_local_var; +} + +void OpenAPI_allowed_snssai_free(OpenAPI_allowed_snssai_t *allowed_snssai) +{ + if (NULL == allowed_snssai) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_snssai_free(allowed_snssai->allowed_snssai); + OpenAPI_list_for_each(allowed_snssai->nsi_information_list, node) { + OpenAPI_nsi_information_free(node->data); + } + OpenAPI_list_free(allowed_snssai->nsi_information_list); + OpenAPI_snssai_free(allowed_snssai->mapped_home_snssai); + ogs_free(allowed_snssai); +} + +cJSON *OpenAPI_allowed_snssai_convertToJSON(OpenAPI_allowed_snssai_t *allowed_snssai) +{ + cJSON *item = NULL; + + if (allowed_snssai == NULL) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed [AllowedSnssai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!allowed_snssai->allowed_snssai) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed [allowed_snssai]"); + goto end; + } + cJSON *allowed_snssai_local_JSON = OpenAPI_snssai_convertToJSON(allowed_snssai->allowed_snssai); + if (allowed_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed [allowed_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "allowedSnssai", allowed_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed [allowed_snssai]"); + goto end; + } + + if (allowed_snssai->nsi_information_list) { + cJSON *nsi_information_listList = cJSON_AddArrayToObject(item, "nsiInformationList"); + if (nsi_information_listList == NULL) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed [nsi_information_list]"); + goto end; + } + + OpenAPI_lnode_t *nsi_information_list_node; + if (allowed_snssai->nsi_information_list) { + OpenAPI_list_for_each(allowed_snssai->nsi_information_list, nsi_information_list_node) { + cJSON *itemLocal = OpenAPI_nsi_information_convertToJSON(nsi_information_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed [nsi_information_list]"); + goto end; + } + cJSON_AddItemToArray(nsi_information_listList, itemLocal); + } + } + } + + if (allowed_snssai->mapped_home_snssai) { + cJSON *mapped_home_snssai_local_JSON = OpenAPI_snssai_convertToJSON(allowed_snssai->mapped_home_snssai); + if (mapped_home_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed [mapped_home_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "mappedHomeSnssai", mapped_home_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed [mapped_home_snssai]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_allowed_snssai_t *OpenAPI_allowed_snssai_parseFromJSON(cJSON *allowed_snssaiJSON) +{ + OpenAPI_allowed_snssai_t *allowed_snssai_local_var = NULL; + cJSON *allowed_snssai = cJSON_GetObjectItemCaseSensitive(allowed_snssaiJSON, "allowedSnssai"); + if (!allowed_snssai) { + ogs_error("OpenAPI_allowed_snssai_parseFromJSON() failed [allowed_snssai]"); + goto end; + } + + OpenAPI_snssai_t *allowed_snssai_local_nonprim = NULL; + + allowed_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(allowed_snssai); + + cJSON *nsi_information_list = cJSON_GetObjectItemCaseSensitive(allowed_snssaiJSON, "nsiInformationList"); + + OpenAPI_list_t *nsi_information_listList; + if (nsi_information_list) { + cJSON *nsi_information_list_local_nonprimitive; + if (!cJSON_IsArray(nsi_information_list)) { + ogs_error("OpenAPI_allowed_snssai_parseFromJSON() failed [nsi_information_list]"); + goto end; + } + + nsi_information_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsi_information_list_local_nonprimitive, nsi_information_list ) { + if (!cJSON_IsObject(nsi_information_list_local_nonprimitive)) { + ogs_error("OpenAPI_allowed_snssai_parseFromJSON() failed [nsi_information_list]"); + goto end; + } + OpenAPI_nsi_information_t *nsi_information_listItem = OpenAPI_nsi_information_parseFromJSON(nsi_information_list_local_nonprimitive); + + OpenAPI_list_add(nsi_information_listList, nsi_information_listItem); + } + } + + cJSON *mapped_home_snssai = cJSON_GetObjectItemCaseSensitive(allowed_snssaiJSON, "mappedHomeSnssai"); + + OpenAPI_snssai_t *mapped_home_snssai_local_nonprim = NULL; + if (mapped_home_snssai) { + mapped_home_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(mapped_home_snssai); + } + + allowed_snssai_local_var = OpenAPI_allowed_snssai_create ( + allowed_snssai_local_nonprim, + nsi_information_list ? nsi_information_listList : NULL, + mapped_home_snssai ? mapped_home_snssai_local_nonprim : NULL + ); + + return allowed_snssai_local_var; +end: + return NULL; +} + +OpenAPI_allowed_snssai_t *OpenAPI_allowed_snssai_copy(OpenAPI_allowed_snssai_t *dst, OpenAPI_allowed_snssai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_allowed_snssai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_allowed_snssai_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_allowed_snssai_free(dst); + dst = OpenAPI_allowed_snssai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/allowed_snssai.h b/lib/sbi/openapi/model/allowed_snssai.h new file mode 100644 index 000000000..2b170138d --- /dev/null +++ b/lib/sbi/openapi/model/allowed_snssai.h @@ -0,0 +1,44 @@ +/* + * allowed_snssai.h + * + * + */ + +#ifndef _OpenAPI_allowed_snssai_H_ +#define _OpenAPI_allowed_snssai_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nsi_information.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_allowed_snssai_s OpenAPI_allowed_snssai_t; +typedef struct OpenAPI_allowed_snssai_s { + struct OpenAPI_snssai_s *allowed_snssai; + OpenAPI_list_t *nsi_information_list; + struct OpenAPI_snssai_s *mapped_home_snssai; +} OpenAPI_allowed_snssai_t; + +OpenAPI_allowed_snssai_t *OpenAPI_allowed_snssai_create( + OpenAPI_snssai_t *allowed_snssai, + OpenAPI_list_t *nsi_information_list, + OpenAPI_snssai_t *mapped_home_snssai + ); +void OpenAPI_allowed_snssai_free(OpenAPI_allowed_snssai_t *allowed_snssai); +OpenAPI_allowed_snssai_t *OpenAPI_allowed_snssai_parseFromJSON(cJSON *allowed_snssaiJSON); +cJSON *OpenAPI_allowed_snssai_convertToJSON(OpenAPI_allowed_snssai_t *allowed_snssai); +OpenAPI_allowed_snssai_t *OpenAPI_allowed_snssai_copy(OpenAPI_allowed_snssai_t *dst, OpenAPI_allowed_snssai_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_allowed_snssai_H_ */ + diff --git a/lib/sbi/openapi/model/am_policy_data.c b/lib/sbi/openapi/model/am_policy_data.c index 0e3031963..0245efac1 100644 --- a/lib/sbi/openapi/model/am_policy_data.c +++ b/lib/sbi/openapi/model/am_policy_data.c @@ -145,3 +145,37 @@ end: return NULL; } +OpenAPI_am_policy_data_t *OpenAPI_am_policy_data_copy(OpenAPI_am_policy_data_t *dst, OpenAPI_am_policy_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_am_policy_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_am_policy_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_am_policy_data_free(dst); + dst = OpenAPI_am_policy_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/am_policy_data.h b/lib/sbi/openapi/model/am_policy_data.h index dc508be64..bd1955106 100644 --- a/lib/sbi/openapi/model/am_policy_data.h +++ b/lib/sbi/openapi/model/am_policy_data.h @@ -31,6 +31,7 @@ OpenAPI_am_policy_data_t *OpenAPI_am_policy_data_create( void OpenAPI_am_policy_data_free(OpenAPI_am_policy_data_t *am_policy_data); OpenAPI_am_policy_data_t *OpenAPI_am_policy_data_parseFromJSON(cJSON *am_policy_dataJSON); cJSON *OpenAPI_am_policy_data_convertToJSON(OpenAPI_am_policy_data_t *am_policy_data); +OpenAPI_am_policy_data_t *OpenAPI_am_policy_data_copy(OpenAPI_am_policy_data_t *dst, OpenAPI_am_policy_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ambr.c b/lib/sbi/openapi/model/ambr.c index e215d1d2a..45e086b81 100644 --- a/lib/sbi/openapi/model/ambr.c +++ b/lib/sbi/openapi/model/ambr.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_ambr_t *OpenAPI_ambr_copy(OpenAPI_ambr_t *dst, OpenAPI_ambr_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ambr_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ambr_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ambr_free(dst); + dst = OpenAPI_ambr_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ambr.h b/lib/sbi/openapi/model/ambr.h index cbc051d09..a91a5ecd1 100644 --- a/lib/sbi/openapi/model/ambr.h +++ b/lib/sbi/openapi/model/ambr.h @@ -30,6 +30,7 @@ OpenAPI_ambr_t *OpenAPI_ambr_create( void OpenAPI_ambr_free(OpenAPI_ambr_t *ambr); OpenAPI_ambr_t *OpenAPI_ambr_parseFromJSON(cJSON *ambrJSON); cJSON *OpenAPI_ambr_convertToJSON(OpenAPI_ambr_t *ambr); +OpenAPI_ambr_t *OpenAPI_ambr_copy(OpenAPI_ambr_t *dst, OpenAPI_ambr_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ambr_rm.c b/lib/sbi/openapi/model/ambr_rm.c index 9fbaf7f0b..1ea36106a 100644 --- a/lib/sbi/openapi/model/ambr_rm.c +++ b/lib/sbi/openapi/model/ambr_rm.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_copy(OpenAPI_ambr_rm_t *dst, OpenAPI_ambr_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ambr_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ambr_rm_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ambr_rm_free(dst); + dst = OpenAPI_ambr_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ambr_rm.h b/lib/sbi/openapi/model/ambr_rm.h index a376aff8a..c916854fb 100644 --- a/lib/sbi/openapi/model/ambr_rm.h +++ b/lib/sbi/openapi/model/ambr_rm.h @@ -30,6 +30,7 @@ OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_create( void OpenAPI_ambr_rm_free(OpenAPI_ambr_rm_t *ambr_rm); OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_parseFromJSON(cJSON *ambr_rmJSON); cJSON *OpenAPI_ambr_rm_convertToJSON(OpenAPI_ambr_rm_t *ambr_rm); +OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_copy(OpenAPI_ambr_rm_t *dst, OpenAPI_ambr_rm_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration.c b/lib/sbi/openapi/model/amf3_gpp_access_registration.c index 2dbc842ce..d47549712 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration.c +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration.c @@ -18,7 +18,7 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre OpenAPI_guami_t *guami, OpenAPI_list_t *backup_amf_info, int dr_flag, - OpenAPI_rat_type_t *rat_type, + OpenAPI_rat_type_e rat_type, int urrp_indicator, char *amf_ee_subscription_id, int ue_srvcc_capability, @@ -78,7 +78,6 @@ void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registrat OpenAPI_backup_amf_info_free(node->data); } OpenAPI_list_free(amf3_gpp_access_registration->backup_amf_info); - OpenAPI_rat_type_free(amf3_gpp_access_registration->rat_type); ogs_free(amf3_gpp_access_registration->amf_ee_subscription_id); ogs_free(amf3_gpp_access_registration->nid); ogs_free(amf3_gpp_access_registration->registration_time); @@ -114,7 +113,7 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces } } - if (amf3_gpp_access_registration->purge_flag >= 0) { + if (amf3_gpp_access_registration->purge_flag) { if (cJSON_AddBoolToObject(item, "purgeFlag", amf3_gpp_access_registration->purge_flag) == NULL) { ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [purge_flag]"); goto end; @@ -171,7 +170,7 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces } } - if (amf3_gpp_access_registration->initial_registration_ind >= 0) { + if (amf3_gpp_access_registration->initial_registration_ind) { if (cJSON_AddBoolToObject(item, "initialRegistrationInd", amf3_gpp_access_registration->initial_registration_ind) == NULL) { ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [initial_registration_ind]"); goto end; @@ -213,7 +212,7 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces } } - if (amf3_gpp_access_registration->dr_flag >= 0) { + if (amf3_gpp_access_registration->dr_flag) { if (cJSON_AddBoolToObject(item, "drFlag", amf3_gpp_access_registration->dr_flag) == NULL) { ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [dr_flag]"); goto end; @@ -224,18 +223,12 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [rat_type]"); goto end; } - cJSON *rat_type_local_JSON = OpenAPI_rat_type_convertToJSON(amf3_gpp_access_registration->rat_type); - if (rat_type_local_JSON == NULL) { - ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [rat_type]"); - goto end; - } - cJSON_AddItemToObject(item, "ratType", rat_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(amf3_gpp_access_registration->rat_type)) == NULL) { ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [rat_type]"); goto end; } - if (amf3_gpp_access_registration->urrp_indicator >= 0) { + if (amf3_gpp_access_registration->urrp_indicator) { if (cJSON_AddBoolToObject(item, "urrpIndicator", amf3_gpp_access_registration->urrp_indicator) == NULL) { ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [urrp_indicator]"); goto end; @@ -249,7 +242,7 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces } } - if (amf3_gpp_access_registration->ue_srvcc_capability >= 0) { + if (amf3_gpp_access_registration->ue_srvcc_capability) { if (cJSON_AddBoolToObject(item, "ueSrvccCapability", amf3_gpp_access_registration->ue_srvcc_capability) == NULL) { ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ue_srvcc_capability]"); goto end; @@ -440,9 +433,13 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par goto end; } - OpenAPI_rat_type_t *rat_type_local_nonprim = NULL; + OpenAPI_rat_type_e rat_typeVariable; - rat_type_local_nonprim = OpenAPI_rat_type_parseFromJSON(rat_type); + if (!cJSON_IsString(rat_type)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [rat_type]"); + goto end; + } + rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); cJSON *urrp_indicator = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "urrpIndicator"); @@ -530,7 +527,7 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par guami_local_nonprim, backup_amf_info ? backup_amf_infoList : NULL, dr_flag ? dr_flag->valueint : 0, - rat_type_local_nonprim, + rat_typeVariable, urrp_indicator ? urrp_indicator->valueint : 0, amf_ee_subscription_id ? ogs_strdup(amf_ee_subscription_id->valuestring) : NULL, ue_srvcc_capability ? ue_srvcc_capability->valueint : 0, @@ -546,3 +543,37 @@ end: return NULL; } +OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_copy(OpenAPI_amf3_gpp_access_registration_t *dst, OpenAPI_amf3_gpp_access_registration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf3_gpp_access_registration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf3_gpp_access_registration_free(dst); + dst = OpenAPI_amf3_gpp_access_registration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration.h b/lib/sbi/openapi/model/amf3_gpp_access_registration.h index 5dd1eefc3..29ec6f052 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration.h +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration.h @@ -36,7 +36,7 @@ typedef struct OpenAPI_amf3_gpp_access_registration_s { struct OpenAPI_guami_s *guami; OpenAPI_list_t *backup_amf_info; int dr_flag; - struct OpenAPI_rat_type_s *rat_type; + OpenAPI_rat_type_e rat_type; int urrp_indicator; char *amf_ee_subscription_id; int ue_srvcc_capability; @@ -61,7 +61,7 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre OpenAPI_guami_t *guami, OpenAPI_list_t *backup_amf_info, int dr_flag, - OpenAPI_rat_type_t *rat_type, + OpenAPI_rat_type_e rat_type, int urrp_indicator, char *amf_ee_subscription_id, int ue_srvcc_capability, @@ -74,6 +74,7 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration); OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_parseFromJSON(cJSON *amf3_gpp_access_registrationJSON); cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration); +OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_copy(OpenAPI_amf3_gpp_access_registration_t *dst, OpenAPI_amf3_gpp_access_registration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c index d8255f174..43227d597 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c @@ -71,7 +71,7 @@ cJSON *OpenAPI_amf3_gpp_access_registration_modification_convertToJSON(OpenAPI_a goto end; } - if (amf3_gpp_access_registration_modification->purge_flag >= 0) { + if (amf3_gpp_access_registration_modification->purge_flag) { if (cJSON_AddBoolToObject(item, "purgeFlag", amf3_gpp_access_registration_modification->purge_flag) == NULL) { ogs_error("OpenAPI_amf3_gpp_access_registration_modification_convertToJSON() failed [purge_flag]"); goto end; @@ -131,7 +131,7 @@ cJSON *OpenAPI_amf3_gpp_access_registration_modification_convertToJSON(OpenAPI_a } } - if (amf3_gpp_access_registration_modification->ue_srvcc_capability >= 0) { + if (amf3_gpp_access_registration_modification->ue_srvcc_capability) { if (cJSON_AddBoolToObject(item, "ueSrvccCapability", amf3_gpp_access_registration_modification->ue_srvcc_capability) == NULL) { ogs_error("OpenAPI_amf3_gpp_access_registration_modification_convertToJSON() failed [ue_srvcc_capability]"); goto end; @@ -234,3 +234,37 @@ end: return NULL; } +OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_copy(OpenAPI_amf3_gpp_access_registration_modification_t *dst, OpenAPI_amf3_gpp_access_registration_modification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf3_gpp_access_registration_modification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf3_gpp_access_registration_modification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf3_gpp_access_registration_modification_free(dst); + dst = OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h index 0b9deaf83..600c39782 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h @@ -44,6 +44,7 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg void OpenAPI_amf3_gpp_access_registration_modification_free(OpenAPI_amf3_gpp_access_registration_modification_t *amf3_gpp_access_registration_modification); OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON(cJSON *amf3_gpp_access_registration_modificationJSON); cJSON *OpenAPI_amf3_gpp_access_registration_modification_convertToJSON(OpenAPI_amf3_gpp_access_registration_modification_t *amf3_gpp_access_registration_modification); +OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_copy(OpenAPI_amf3_gpp_access_registration_modification_t *dst, OpenAPI_amf3_gpp_access_registration_modification_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/amf_cond.c b/lib/sbi/openapi/model/amf_cond.c index 079b8dd44..dbbc7ccb9 100644 --- a/lib/sbi/openapi/model/amf_cond.c +++ b/lib/sbi/openapi/model/amf_cond.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_amf_cond_t *OpenAPI_amf_cond_copy(OpenAPI_amf_cond_t *dst, OpenAPI_amf_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_cond_free(dst); + dst = OpenAPI_amf_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_cond.h b/lib/sbi/openapi/model/amf_cond.h index ea3e90b92..41d4dd4e5 100644 --- a/lib/sbi/openapi/model/amf_cond.h +++ b/lib/sbi/openapi/model/amf_cond.h @@ -30,6 +30,7 @@ OpenAPI_amf_cond_t *OpenAPI_amf_cond_create( void OpenAPI_amf_cond_free(OpenAPI_amf_cond_t *amf_cond); OpenAPI_amf_cond_t *OpenAPI_amf_cond_parseFromJSON(cJSON *amf_condJSON); cJSON *OpenAPI_amf_cond_convertToJSON(OpenAPI_amf_cond_t *amf_cond); +OpenAPI_amf_cond_t *OpenAPI_amf_cond_copy(OpenAPI_amf_cond_t *dst, OpenAPI_amf_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/amf_dereg_info.c b/lib/sbi/openapi/model/amf_dereg_info.c index 9f9075e9c..b4f0ae582 100644 --- a/lib/sbi/openapi/model/amf_dereg_info.c +++ b/lib/sbi/openapi/model/amf_dereg_info.c @@ -78,3 +78,37 @@ end: return NULL; } +OpenAPI_amf_dereg_info_t *OpenAPI_amf_dereg_info_copy(OpenAPI_amf_dereg_info_t *dst, OpenAPI_amf_dereg_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_dereg_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_dereg_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_amf_dereg_info_free(dst); + dst = OpenAPI_amf_dereg_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_dereg_info.h b/lib/sbi/openapi/model/amf_dereg_info.h index 173a258dd..67d2f6a09 100644 --- a/lib/sbi/openapi/model/amf_dereg_info.h +++ b/lib/sbi/openapi/model/amf_dereg_info.h @@ -29,6 +29,7 @@ OpenAPI_amf_dereg_info_t *OpenAPI_amf_dereg_info_create( void OpenAPI_amf_dereg_info_free(OpenAPI_amf_dereg_info_t *amf_dereg_info); OpenAPI_amf_dereg_info_t *OpenAPI_amf_dereg_info_parseFromJSON(cJSON *amf_dereg_infoJSON); cJSON *OpenAPI_amf_dereg_info_convertToJSON(OpenAPI_amf_dereg_info_t *amf_dereg_info); +OpenAPI_amf_dereg_info_t *OpenAPI_amf_dereg_info_copy(OpenAPI_amf_dereg_info_t *dst, OpenAPI_amf_dereg_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/amf_event.c b/lib/sbi/openapi/model/amf_event.c new file mode 100644 index 000000000..ff6ffc397 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event.c @@ -0,0 +1,302 @@ + +#include +#include +#include +#include "amf_event.h" + +OpenAPI_amf_event_t *OpenAPI_amf_event_create( + OpenAPI_amf_event_type_t *type, + int immediate_flag, + OpenAPI_list_t *area_list, + OpenAPI_list_t *location_filter_list, + int ref_id, + OpenAPI_list_t *traffic_descriptor_list + ) +{ + OpenAPI_amf_event_t *amf_event_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_event_t)); + if (!amf_event_local_var) { + return NULL; + } + amf_event_local_var->type = type; + amf_event_local_var->immediate_flag = immediate_flag; + amf_event_local_var->area_list = area_list; + amf_event_local_var->location_filter_list = location_filter_list; + amf_event_local_var->ref_id = ref_id; + amf_event_local_var->traffic_descriptor_list = traffic_descriptor_list; + + return amf_event_local_var; +} + +void OpenAPI_amf_event_free(OpenAPI_amf_event_t *amf_event) +{ + if (NULL == amf_event) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_amf_event_type_free(amf_event->type); + OpenAPI_list_for_each(amf_event->area_list, node) { + OpenAPI_amf_event_area_free(node->data); + } + OpenAPI_list_free(amf_event->area_list); + OpenAPI_list_for_each(amf_event->location_filter_list, node) { + OpenAPI_location_filter_free(node->data); + } + OpenAPI_list_free(amf_event->location_filter_list); + OpenAPI_list_for_each(amf_event->traffic_descriptor_list, node) { + OpenAPI_traffic_descriptor_free(node->data); + } + OpenAPI_list_free(amf_event->traffic_descriptor_list); + ogs_free(amf_event); +} + +cJSON *OpenAPI_amf_event_convertToJSON(OpenAPI_amf_event_t *amf_event) +{ + cJSON *item = NULL; + + if (amf_event == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [AmfEvent]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!amf_event->type) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [type]"); + goto end; + } + cJSON *type_local_JSON = OpenAPI_amf_event_type_convertToJSON(amf_event->type); + if (type_local_JSON == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [type]"); + goto end; + } + cJSON_AddItemToObject(item, "type", type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [type]"); + goto end; + } + + if (amf_event->immediate_flag) { + if (cJSON_AddBoolToObject(item, "immediateFlag", amf_event->immediate_flag) == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [immediate_flag]"); + goto end; + } + } + + if (amf_event->area_list) { + cJSON *area_listList = cJSON_AddArrayToObject(item, "areaList"); + if (area_listList == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [area_list]"); + goto end; + } + + OpenAPI_lnode_t *area_list_node; + if (amf_event->area_list) { + OpenAPI_list_for_each(amf_event->area_list, area_list_node) { + cJSON *itemLocal = OpenAPI_amf_event_area_convertToJSON(area_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [area_list]"); + goto end; + } + cJSON_AddItemToArray(area_listList, itemLocal); + } + } + } + + if (amf_event->location_filter_list) { + cJSON *location_filter_listList = cJSON_AddArrayToObject(item, "locationFilterList"); + if (location_filter_listList == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [location_filter_list]"); + goto end; + } + + OpenAPI_lnode_t *location_filter_list_node; + if (amf_event->location_filter_list) { + OpenAPI_list_for_each(amf_event->location_filter_list, location_filter_list_node) { + cJSON *itemLocal = OpenAPI_location_filter_convertToJSON(location_filter_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [location_filter_list]"); + goto end; + } + cJSON_AddItemToArray(location_filter_listList, itemLocal); + } + } + } + + if (amf_event->ref_id) { + if (cJSON_AddNumberToObject(item, "refId", amf_event->ref_id) == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [ref_id]"); + goto end; + } + } + + if (amf_event->traffic_descriptor_list) { + cJSON *traffic_descriptor_listList = cJSON_AddArrayToObject(item, "trafficDescriptorList"); + if (traffic_descriptor_listList == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [traffic_descriptor_list]"); + goto end; + } + + OpenAPI_lnode_t *traffic_descriptor_list_node; + if (amf_event->traffic_descriptor_list) { + OpenAPI_list_for_each(amf_event->traffic_descriptor_list, traffic_descriptor_list_node) { + cJSON *itemLocal = OpenAPI_traffic_descriptor_convertToJSON(traffic_descriptor_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [traffic_descriptor_list]"); + goto end; + } + cJSON_AddItemToArray(traffic_descriptor_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON) +{ + OpenAPI_amf_event_t *amf_event_local_var = NULL; + cJSON *type = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "type"); + if (!type) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [type]"); + goto end; + } + + OpenAPI_amf_event_type_t *type_local_nonprim = NULL; + + type_local_nonprim = OpenAPI_amf_event_type_parseFromJSON(type); + + cJSON *immediate_flag = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "immediateFlag"); + + if (immediate_flag) { + if (!cJSON_IsBool(immediate_flag)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [immediate_flag]"); + goto end; + } + } + + cJSON *area_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "areaList"); + + OpenAPI_list_t *area_listList; + if (area_list) { + cJSON *area_list_local_nonprimitive; + if (!cJSON_IsArray(area_list)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [area_list]"); + goto end; + } + + area_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(area_list_local_nonprimitive, area_list ) { + if (!cJSON_IsObject(area_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [area_list]"); + goto end; + } + OpenAPI_amf_event_area_t *area_listItem = OpenAPI_amf_event_area_parseFromJSON(area_list_local_nonprimitive); + + OpenAPI_list_add(area_listList, area_listItem); + } + } + + cJSON *location_filter_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "locationFilterList"); + + OpenAPI_list_t *location_filter_listList; + if (location_filter_list) { + cJSON *location_filter_list_local_nonprimitive; + if (!cJSON_IsArray(location_filter_list)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [location_filter_list]"); + goto end; + } + + location_filter_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(location_filter_list_local_nonprimitive, location_filter_list ) { + if (!cJSON_IsObject(location_filter_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [location_filter_list]"); + goto end; + } + OpenAPI_location_filter_t *location_filter_listItem = OpenAPI_location_filter_parseFromJSON(location_filter_list_local_nonprimitive); + + OpenAPI_list_add(location_filter_listList, location_filter_listItem); + } + } + + cJSON *ref_id = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "refId"); + + if (ref_id) { + if (!cJSON_IsNumber(ref_id)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [ref_id]"); + goto end; + } + } + + cJSON *traffic_descriptor_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "trafficDescriptorList"); + + OpenAPI_list_t *traffic_descriptor_listList; + if (traffic_descriptor_list) { + cJSON *traffic_descriptor_list_local_nonprimitive; + if (!cJSON_IsArray(traffic_descriptor_list)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [traffic_descriptor_list]"); + goto end; + } + + traffic_descriptor_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(traffic_descriptor_list_local_nonprimitive, traffic_descriptor_list ) { + if (!cJSON_IsObject(traffic_descriptor_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [traffic_descriptor_list]"); + goto end; + } + OpenAPI_traffic_descriptor_t *traffic_descriptor_listItem = OpenAPI_traffic_descriptor_parseFromJSON(traffic_descriptor_list_local_nonprimitive); + + OpenAPI_list_add(traffic_descriptor_listList, traffic_descriptor_listItem); + } + } + + amf_event_local_var = OpenAPI_amf_event_create ( + type_local_nonprim, + immediate_flag ? immediate_flag->valueint : 0, + area_list ? area_listList : NULL, + location_filter_list ? location_filter_listList : NULL, + ref_id ? ref_id->valuedouble : 0, + traffic_descriptor_list ? traffic_descriptor_listList : NULL + ); + + return amf_event_local_var; +end: + return NULL; +} + +OpenAPI_amf_event_t *OpenAPI_amf_event_copy(OpenAPI_amf_event_t *dst, OpenAPI_amf_event_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_event_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_event_free(dst); + dst = OpenAPI_amf_event_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_event.h b/lib/sbi/openapi/model/amf_event.h new file mode 100644 index 000000000..41c348e7e --- /dev/null +++ b/lib/sbi/openapi/model/amf_event.h @@ -0,0 +1,52 @@ +/* + * amf_event.h + * + * + */ + +#ifndef _OpenAPI_amf_event_H_ +#define _OpenAPI_amf_event_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_event_area.h" +#include "amf_event_type.h" +#include "location_filter.h" +#include "traffic_descriptor.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_amf_event_s OpenAPI_amf_event_t; +typedef struct OpenAPI_amf_event_s { + struct OpenAPI_amf_event_type_s *type; + int immediate_flag; + OpenAPI_list_t *area_list; + OpenAPI_list_t *location_filter_list; + int ref_id; + OpenAPI_list_t *traffic_descriptor_list; +} OpenAPI_amf_event_t; + +OpenAPI_amf_event_t *OpenAPI_amf_event_create( + OpenAPI_amf_event_type_t *type, + int immediate_flag, + OpenAPI_list_t *area_list, + OpenAPI_list_t *location_filter_list, + int ref_id, + OpenAPI_list_t *traffic_descriptor_list + ); +void OpenAPI_amf_event_free(OpenAPI_amf_event_t *amf_event); +OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON); +cJSON *OpenAPI_amf_event_convertToJSON(OpenAPI_amf_event_t *amf_event); +OpenAPI_amf_event_t *OpenAPI_amf_event_copy(OpenAPI_amf_event_t *dst, OpenAPI_amf_event_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_event_H_ */ + diff --git a/lib/sbi/openapi/model/amf_event_area.c b/lib/sbi/openapi/model/amf_event_area.c new file mode 100644 index 000000000..15dddb8d9 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_area.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "amf_event_area.h" + +OpenAPI_amf_event_area_t *OpenAPI_amf_event_area_create( + OpenAPI_presence_info_t *presence_info, + OpenAPI_ladn_info_t *ladn_info + ) +{ + OpenAPI_amf_event_area_t *amf_event_area_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_event_area_t)); + if (!amf_event_area_local_var) { + return NULL; + } + amf_event_area_local_var->presence_info = presence_info; + amf_event_area_local_var->ladn_info = ladn_info; + + return amf_event_area_local_var; +} + +void OpenAPI_amf_event_area_free(OpenAPI_amf_event_area_t *amf_event_area) +{ + if (NULL == amf_event_area) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_presence_info_free(amf_event_area->presence_info); + OpenAPI_ladn_info_free(amf_event_area->ladn_info); + ogs_free(amf_event_area); +} + +cJSON *OpenAPI_amf_event_area_convertToJSON(OpenAPI_amf_event_area_t *amf_event_area) +{ + cJSON *item = NULL; + + if (amf_event_area == NULL) { + ogs_error("OpenAPI_amf_event_area_convertToJSON() failed [AmfEventArea]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (amf_event_area->presence_info) { + cJSON *presence_info_local_JSON = OpenAPI_presence_info_convertToJSON(amf_event_area->presence_info); + if (presence_info_local_JSON == NULL) { + ogs_error("OpenAPI_amf_event_area_convertToJSON() failed [presence_info]"); + goto end; + } + cJSON_AddItemToObject(item, "presenceInfo", presence_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_event_area_convertToJSON() failed [presence_info]"); + goto end; + } + } + + if (amf_event_area->ladn_info) { + cJSON *ladn_info_local_JSON = OpenAPI_ladn_info_convertToJSON(amf_event_area->ladn_info); + if (ladn_info_local_JSON == NULL) { + ogs_error("OpenAPI_amf_event_area_convertToJSON() failed [ladn_info]"); + goto end; + } + cJSON_AddItemToObject(item, "ladnInfo", ladn_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_event_area_convertToJSON() failed [ladn_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_amf_event_area_t *OpenAPI_amf_event_area_parseFromJSON(cJSON *amf_event_areaJSON) +{ + OpenAPI_amf_event_area_t *amf_event_area_local_var = NULL; + cJSON *presence_info = cJSON_GetObjectItemCaseSensitive(amf_event_areaJSON, "presenceInfo"); + + OpenAPI_presence_info_t *presence_info_local_nonprim = NULL; + if (presence_info) { + presence_info_local_nonprim = OpenAPI_presence_info_parseFromJSON(presence_info); + } + + cJSON *ladn_info = cJSON_GetObjectItemCaseSensitive(amf_event_areaJSON, "ladnInfo"); + + OpenAPI_ladn_info_t *ladn_info_local_nonprim = NULL; + if (ladn_info) { + ladn_info_local_nonprim = OpenAPI_ladn_info_parseFromJSON(ladn_info); + } + + amf_event_area_local_var = OpenAPI_amf_event_area_create ( + presence_info ? presence_info_local_nonprim : NULL, + ladn_info ? ladn_info_local_nonprim : NULL + ); + + return amf_event_area_local_var; +end: + return NULL; +} + +OpenAPI_amf_event_area_t *OpenAPI_amf_event_area_copy(OpenAPI_amf_event_area_t *dst, OpenAPI_amf_event_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_event_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_event_area_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_event_area_free(dst); + dst = OpenAPI_amf_event_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_event_area.h b/lib/sbi/openapi/model/amf_event_area.h new file mode 100644 index 000000000..485ba80d8 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_area.h @@ -0,0 +1,42 @@ +/* + * amf_event_area.h + * + * + */ + +#ifndef _OpenAPI_amf_event_area_H_ +#define _OpenAPI_amf_event_area_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ladn_info.h" +#include "presence_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_amf_event_area_s OpenAPI_amf_event_area_t; +typedef struct OpenAPI_amf_event_area_s { + struct OpenAPI_presence_info_s *presence_info; + struct OpenAPI_ladn_info_s *ladn_info; +} OpenAPI_amf_event_area_t; + +OpenAPI_amf_event_area_t *OpenAPI_amf_event_area_create( + OpenAPI_presence_info_t *presence_info, + OpenAPI_ladn_info_t *ladn_info + ); +void OpenAPI_amf_event_area_free(OpenAPI_amf_event_area_t *amf_event_area); +OpenAPI_amf_event_area_t *OpenAPI_amf_event_area_parseFromJSON(cJSON *amf_event_areaJSON); +cJSON *OpenAPI_amf_event_area_convertToJSON(OpenAPI_amf_event_area_t *amf_event_area); +OpenAPI_amf_event_area_t *OpenAPI_amf_event_area_copy(OpenAPI_amf_event_area_t *dst, OpenAPI_amf_event_area_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_event_area_H_ */ + diff --git a/lib/sbi/openapi/model/amf_event_mode.c b/lib/sbi/openapi/model/amf_event_mode.c new file mode 100644 index 000000000..7d7c2b864 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_mode.c @@ -0,0 +1,153 @@ + +#include +#include +#include +#include "amf_event_mode.h" + +OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_create( + OpenAPI_amf_event_trigger_t *trigger, + int max_reports, + char *expiry + ) +{ + OpenAPI_amf_event_mode_t *amf_event_mode_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_event_mode_t)); + if (!amf_event_mode_local_var) { + return NULL; + } + amf_event_mode_local_var->trigger = trigger; + amf_event_mode_local_var->max_reports = max_reports; + amf_event_mode_local_var->expiry = expiry; + + return amf_event_mode_local_var; +} + +void OpenAPI_amf_event_mode_free(OpenAPI_amf_event_mode_t *amf_event_mode) +{ + if (NULL == amf_event_mode) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_amf_event_trigger_free(amf_event_mode->trigger); + ogs_free(amf_event_mode->expiry); + ogs_free(amf_event_mode); +} + +cJSON *OpenAPI_amf_event_mode_convertToJSON(OpenAPI_amf_event_mode_t *amf_event_mode) +{ + cJSON *item = NULL; + + if (amf_event_mode == NULL) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [AmfEventMode]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!amf_event_mode->trigger) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [trigger]"); + goto end; + } + cJSON *trigger_local_JSON = OpenAPI_amf_event_trigger_convertToJSON(amf_event_mode->trigger); + if (trigger_local_JSON == NULL) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [trigger]"); + goto end; + } + cJSON_AddItemToObject(item, "trigger", trigger_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [trigger]"); + goto end; + } + + if (amf_event_mode->max_reports) { + if (cJSON_AddNumberToObject(item, "maxReports", amf_event_mode->max_reports) == NULL) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [max_reports]"); + goto end; + } + } + + if (amf_event_mode->expiry) { + if (cJSON_AddStringToObject(item, "expiry", amf_event_mode->expiry) == NULL) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [expiry]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_parseFromJSON(cJSON *amf_event_modeJSON) +{ + OpenAPI_amf_event_mode_t *amf_event_mode_local_var = NULL; + cJSON *trigger = cJSON_GetObjectItemCaseSensitive(amf_event_modeJSON, "trigger"); + if (!trigger) { + ogs_error("OpenAPI_amf_event_mode_parseFromJSON() failed [trigger]"); + goto end; + } + + OpenAPI_amf_event_trigger_t *trigger_local_nonprim = NULL; + + trigger_local_nonprim = OpenAPI_amf_event_trigger_parseFromJSON(trigger); + + cJSON *max_reports = cJSON_GetObjectItemCaseSensitive(amf_event_modeJSON, "maxReports"); + + if (max_reports) { + if (!cJSON_IsNumber(max_reports)) { + ogs_error("OpenAPI_amf_event_mode_parseFromJSON() failed [max_reports]"); + goto end; + } + } + + cJSON *expiry = cJSON_GetObjectItemCaseSensitive(amf_event_modeJSON, "expiry"); + + if (expiry) { + if (!cJSON_IsString(expiry)) { + ogs_error("OpenAPI_amf_event_mode_parseFromJSON() failed [expiry]"); + goto end; + } + } + + amf_event_mode_local_var = OpenAPI_amf_event_mode_create ( + trigger_local_nonprim, + max_reports ? max_reports->valuedouble : 0, + expiry ? ogs_strdup(expiry->valuestring) : NULL + ); + + return amf_event_mode_local_var; +end: + return NULL; +} + +OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_copy(OpenAPI_amf_event_mode_t *dst, OpenAPI_amf_event_mode_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_event_mode_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_event_mode_free(dst); + dst = OpenAPI_amf_event_mode_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_event_mode.h b/lib/sbi/openapi/model/amf_event_mode.h new file mode 100644 index 000000000..e0ce9268d --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_mode.h @@ -0,0 +1,43 @@ +/* + * amf_event_mode.h + * + * + */ + +#ifndef _OpenAPI_amf_event_mode_H_ +#define _OpenAPI_amf_event_mode_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_event_trigger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_amf_event_mode_s OpenAPI_amf_event_mode_t; +typedef struct OpenAPI_amf_event_mode_s { + struct OpenAPI_amf_event_trigger_s *trigger; + int max_reports; + char *expiry; +} OpenAPI_amf_event_mode_t; + +OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_create( + OpenAPI_amf_event_trigger_t *trigger, + int max_reports, + char *expiry + ); +void OpenAPI_amf_event_mode_free(OpenAPI_amf_event_mode_t *amf_event_mode); +OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_parseFromJSON(cJSON *amf_event_modeJSON); +cJSON *OpenAPI_amf_event_mode_convertToJSON(OpenAPI_amf_event_mode_t *amf_event_mode); +OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_copy(OpenAPI_amf_event_mode_t *dst, OpenAPI_amf_event_mode_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_event_mode_H_ */ + diff --git a/lib/sbi/openapi/model/amf_event_subscription.c b/lib/sbi/openapi/model/amf_event_subscription.c new file mode 100644 index 000000000..8d5ee236b --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_subscription.c @@ -0,0 +1,378 @@ + +#include +#include +#include +#include "amf_event_subscription.h" + +OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_create( + OpenAPI_list_t *event_list, + char *event_notify_uri, + char *notify_correlation_id, + char *nf_id, + char *subs_change_notify_uri, + char *subs_change_notify_correlation_id, + char *supi, + char *group_id, + char *gpsi, + char *pei, + int any_ue, + OpenAPI_amf_event_mode_t *options + ) +{ + OpenAPI_amf_event_subscription_t *amf_event_subscription_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_event_subscription_t)); + if (!amf_event_subscription_local_var) { + return NULL; + } + amf_event_subscription_local_var->event_list = event_list; + amf_event_subscription_local_var->event_notify_uri = event_notify_uri; + amf_event_subscription_local_var->notify_correlation_id = notify_correlation_id; + amf_event_subscription_local_var->nf_id = nf_id; + amf_event_subscription_local_var->subs_change_notify_uri = subs_change_notify_uri; + amf_event_subscription_local_var->subs_change_notify_correlation_id = subs_change_notify_correlation_id; + amf_event_subscription_local_var->supi = supi; + amf_event_subscription_local_var->group_id = group_id; + amf_event_subscription_local_var->gpsi = gpsi; + amf_event_subscription_local_var->pei = pei; + amf_event_subscription_local_var->any_ue = any_ue; + amf_event_subscription_local_var->options = options; + + return amf_event_subscription_local_var; +} + +void OpenAPI_amf_event_subscription_free(OpenAPI_amf_event_subscription_t *amf_event_subscription) +{ + if (NULL == amf_event_subscription) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(amf_event_subscription->event_list, node) { + OpenAPI_amf_event_free(node->data); + } + OpenAPI_list_free(amf_event_subscription->event_list); + ogs_free(amf_event_subscription->event_notify_uri); + ogs_free(amf_event_subscription->notify_correlation_id); + ogs_free(amf_event_subscription->nf_id); + ogs_free(amf_event_subscription->subs_change_notify_uri); + ogs_free(amf_event_subscription->subs_change_notify_correlation_id); + ogs_free(amf_event_subscription->supi); + ogs_free(amf_event_subscription->group_id); + ogs_free(amf_event_subscription->gpsi); + ogs_free(amf_event_subscription->pei); + OpenAPI_amf_event_mode_free(amf_event_subscription->options); + ogs_free(amf_event_subscription); +} + +cJSON *OpenAPI_amf_event_subscription_convertToJSON(OpenAPI_amf_event_subscription_t *amf_event_subscription) +{ + cJSON *item = NULL; + + if (amf_event_subscription == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [AmfEventSubscription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!amf_event_subscription->event_list) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [event_list]"); + goto end; + } + cJSON *event_listList = cJSON_AddArrayToObject(item, "eventList"); + if (event_listList == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [event_list]"); + goto end; + } + + OpenAPI_lnode_t *event_list_node; + if (amf_event_subscription->event_list) { + OpenAPI_list_for_each(amf_event_subscription->event_list, event_list_node) { + cJSON *itemLocal = OpenAPI_amf_event_convertToJSON(event_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [event_list]"); + goto end; + } + cJSON_AddItemToArray(event_listList, itemLocal); + } + } + + if (!amf_event_subscription->event_notify_uri) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [event_notify_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "eventNotifyUri", amf_event_subscription->event_notify_uri) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [event_notify_uri]"); + goto end; + } + + if (!amf_event_subscription->notify_correlation_id) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [notify_correlation_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "notifyCorrelationId", amf_event_subscription->notify_correlation_id) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [notify_correlation_id]"); + goto end; + } + + if (!amf_event_subscription->nf_id) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [nf_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfId", amf_event_subscription->nf_id) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [nf_id]"); + goto end; + } + + if (amf_event_subscription->subs_change_notify_uri) { + if (cJSON_AddStringToObject(item, "subsChangeNotifyUri", amf_event_subscription->subs_change_notify_uri) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [subs_change_notify_uri]"); + goto end; + } + } + + if (amf_event_subscription->subs_change_notify_correlation_id) { + if (cJSON_AddStringToObject(item, "subsChangeNotifyCorrelationId", amf_event_subscription->subs_change_notify_correlation_id) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [subs_change_notify_correlation_id]"); + goto end; + } + } + + if (amf_event_subscription->supi) { + if (cJSON_AddStringToObject(item, "supi", amf_event_subscription->supi) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [supi]"); + goto end; + } + } + + if (amf_event_subscription->group_id) { + if (cJSON_AddStringToObject(item, "groupId", amf_event_subscription->group_id) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (amf_event_subscription->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", amf_event_subscription->gpsi) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (amf_event_subscription->pei) { + if (cJSON_AddStringToObject(item, "pei", amf_event_subscription->pei) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [pei]"); + goto end; + } + } + + if (amf_event_subscription->any_ue) { + if (cJSON_AddBoolToObject(item, "anyUE", amf_event_subscription->any_ue) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [any_ue]"); + goto end; + } + } + + if (amf_event_subscription->options) { + cJSON *options_local_JSON = OpenAPI_amf_event_mode_convertToJSON(amf_event_subscription->options); + if (options_local_JSON == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [options]"); + goto end; + } + cJSON_AddItemToObject(item, "options", options_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [options]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_parseFromJSON(cJSON *amf_event_subscriptionJSON) +{ + OpenAPI_amf_event_subscription_t *amf_event_subscription_local_var = NULL; + cJSON *event_list = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "eventList"); + if (!event_list) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [event_list]"); + goto end; + } + + OpenAPI_list_t *event_listList; + + cJSON *event_list_local_nonprimitive; + if (!cJSON_IsArray(event_list)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [event_list]"); + goto end; + } + + event_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_list_local_nonprimitive, event_list ) { + if (!cJSON_IsObject(event_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [event_list]"); + goto end; + } + OpenAPI_amf_event_t *event_listItem = OpenAPI_amf_event_parseFromJSON(event_list_local_nonprimitive); + + OpenAPI_list_add(event_listList, event_listItem); + } + + cJSON *event_notify_uri = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "eventNotifyUri"); + if (!event_notify_uri) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [event_notify_uri]"); + goto end; + } + + + if (!cJSON_IsString(event_notify_uri)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [event_notify_uri]"); + goto end; + } + + cJSON *notify_correlation_id = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "notifyCorrelationId"); + if (!notify_correlation_id) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [notify_correlation_id]"); + goto end; + } + + + if (!cJSON_IsString(notify_correlation_id)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [notify_correlation_id]"); + goto end; + } + + cJSON *nf_id = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "nfId"); + if (!nf_id) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [nf_id]"); + goto end; + } + + + if (!cJSON_IsString(nf_id)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [nf_id]"); + goto end; + } + + cJSON *subs_change_notify_uri = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "subsChangeNotifyUri"); + + if (subs_change_notify_uri) { + if (!cJSON_IsString(subs_change_notify_uri)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [subs_change_notify_uri]"); + goto end; + } + } + + cJSON *subs_change_notify_correlation_id = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "subsChangeNotifyCorrelationId"); + + if (subs_change_notify_correlation_id) { + if (!cJSON_IsString(subs_change_notify_correlation_id)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [subs_change_notify_correlation_id]"); + goto end; + } + } + + cJSON *supi = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "supi"); + + if (supi) { + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [supi]"); + goto end; + } + } + + cJSON *group_id = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "groupId"); + + if (group_id) { + if (!cJSON_IsString(group_id)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [group_id]"); + goto end; + } + } + + cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "gpsi"); + + if (gpsi) { + if (!cJSON_IsString(gpsi)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + cJSON *pei = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "pei"); + + if (pei) { + if (!cJSON_IsString(pei)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [pei]"); + goto end; + } + } + + cJSON *any_ue = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "anyUE"); + + if (any_ue) { + if (!cJSON_IsBool(any_ue)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [any_ue]"); + goto end; + } + } + + cJSON *options = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "options"); + + OpenAPI_amf_event_mode_t *options_local_nonprim = NULL; + if (options) { + options_local_nonprim = OpenAPI_amf_event_mode_parseFromJSON(options); + } + + amf_event_subscription_local_var = OpenAPI_amf_event_subscription_create ( + event_listList, + ogs_strdup(event_notify_uri->valuestring), + ogs_strdup(notify_correlation_id->valuestring), + ogs_strdup(nf_id->valuestring), + subs_change_notify_uri ? ogs_strdup(subs_change_notify_uri->valuestring) : NULL, + subs_change_notify_correlation_id ? ogs_strdup(subs_change_notify_correlation_id->valuestring) : NULL, + supi ? ogs_strdup(supi->valuestring) : NULL, + group_id ? ogs_strdup(group_id->valuestring) : NULL, + gpsi ? ogs_strdup(gpsi->valuestring) : NULL, + pei ? ogs_strdup(pei->valuestring) : NULL, + any_ue ? any_ue->valueint : 0, + options ? options_local_nonprim : NULL + ); + + return amf_event_subscription_local_var; +end: + return NULL; +} + +OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_copy(OpenAPI_amf_event_subscription_t *dst, OpenAPI_amf_event_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_event_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_event_subscription_free(dst); + dst = OpenAPI_amf_event_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_event_subscription.h b/lib/sbi/openapi/model/amf_event_subscription.h new file mode 100644 index 000000000..3a1949348 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_subscription.h @@ -0,0 +1,62 @@ +/* + * amf_event_subscription.h + * + * + */ + +#ifndef _OpenAPI_amf_event_subscription_H_ +#define _OpenAPI_amf_event_subscription_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_event.h" +#include "amf_event_mode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_amf_event_subscription_s OpenAPI_amf_event_subscription_t; +typedef struct OpenAPI_amf_event_subscription_s { + OpenAPI_list_t *event_list; + char *event_notify_uri; + char *notify_correlation_id; + char *nf_id; + char *subs_change_notify_uri; + char *subs_change_notify_correlation_id; + char *supi; + char *group_id; + char *gpsi; + char *pei; + int any_ue; + struct OpenAPI_amf_event_mode_s *options; +} OpenAPI_amf_event_subscription_t; + +OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_create( + OpenAPI_list_t *event_list, + char *event_notify_uri, + char *notify_correlation_id, + char *nf_id, + char *subs_change_notify_uri, + char *subs_change_notify_correlation_id, + char *supi, + char *group_id, + char *gpsi, + char *pei, + int any_ue, + OpenAPI_amf_event_mode_t *options + ); +void OpenAPI_amf_event_subscription_free(OpenAPI_amf_event_subscription_t *amf_event_subscription); +OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_parseFromJSON(cJSON *amf_event_subscriptionJSON); +cJSON *OpenAPI_amf_event_subscription_convertToJSON(OpenAPI_amf_event_subscription_t *amf_event_subscription); +OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_copy(OpenAPI_amf_event_subscription_t *dst, OpenAPI_amf_event_subscription_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_event_subscription_H_ */ + diff --git a/lib/sbi/openapi/model/amf_event_trigger.c b/lib/sbi/openapi/model/amf_event_trigger.c new file mode 100644 index 000000000..5102dd668 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_trigger.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "amf_event_trigger.h" + +OpenAPI_amf_event_trigger_t *OpenAPI_amf_event_trigger_create( + ) +{ + OpenAPI_amf_event_trigger_t *amf_event_trigger_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_event_trigger_t)); + if (!amf_event_trigger_local_var) { + return NULL; + } + + return amf_event_trigger_local_var; +} + +void OpenAPI_amf_event_trigger_free(OpenAPI_amf_event_trigger_t *amf_event_trigger) +{ + if (NULL == amf_event_trigger) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(amf_event_trigger); +} + +cJSON *OpenAPI_amf_event_trigger_convertToJSON(OpenAPI_amf_event_trigger_t *amf_event_trigger) +{ + cJSON *item = NULL; + + if (amf_event_trigger == NULL) { + ogs_error("OpenAPI_amf_event_trigger_convertToJSON() failed [AmfEventTrigger]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_amf_event_trigger_t *OpenAPI_amf_event_trigger_parseFromJSON(cJSON *amf_event_triggerJSON) +{ + OpenAPI_amf_event_trigger_t *amf_event_trigger_local_var = NULL; + amf_event_trigger_local_var = OpenAPI_amf_event_trigger_create ( + ); + + return amf_event_trigger_local_var; +end: + return NULL; +} + +OpenAPI_amf_event_trigger_t *OpenAPI_amf_event_trigger_copy(OpenAPI_amf_event_trigger_t *dst, OpenAPI_amf_event_trigger_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_event_trigger_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_event_trigger_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_event_trigger_free(dst); + dst = OpenAPI_amf_event_trigger_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_event_trigger.h b/lib/sbi/openapi/model/amf_event_trigger.h new file mode 100644 index 000000000..3131fda17 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_trigger.h @@ -0,0 +1,36 @@ +/* + * amf_event_trigger.h + * + * + */ + +#ifndef _OpenAPI_amf_event_trigger_H_ +#define _OpenAPI_amf_event_trigger_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_amf_event_trigger_s OpenAPI_amf_event_trigger_t; +typedef struct OpenAPI_amf_event_trigger_s { +} OpenAPI_amf_event_trigger_t; + +OpenAPI_amf_event_trigger_t *OpenAPI_amf_event_trigger_create( + ); +void OpenAPI_amf_event_trigger_free(OpenAPI_amf_event_trigger_t *amf_event_trigger); +OpenAPI_amf_event_trigger_t *OpenAPI_amf_event_trigger_parseFromJSON(cJSON *amf_event_triggerJSON); +cJSON *OpenAPI_amf_event_trigger_convertToJSON(OpenAPI_amf_event_trigger_t *amf_event_trigger); +OpenAPI_amf_event_trigger_t *OpenAPI_amf_event_trigger_copy(OpenAPI_amf_event_trigger_t *dst, OpenAPI_amf_event_trigger_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_event_trigger_H_ */ + diff --git a/lib/sbi/openapi/model/amf_event_type.c b/lib/sbi/openapi/model/amf_event_type.c new file mode 100644 index 000000000..6eca30c62 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_type.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "amf_event_type.h" + +OpenAPI_amf_event_type_t *OpenAPI_amf_event_type_create( + ) +{ + OpenAPI_amf_event_type_t *amf_event_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_event_type_t)); + if (!amf_event_type_local_var) { + return NULL; + } + + return amf_event_type_local_var; +} + +void OpenAPI_amf_event_type_free(OpenAPI_amf_event_type_t *amf_event_type) +{ + if (NULL == amf_event_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(amf_event_type); +} + +cJSON *OpenAPI_amf_event_type_convertToJSON(OpenAPI_amf_event_type_t *amf_event_type) +{ + cJSON *item = NULL; + + if (amf_event_type == NULL) { + ogs_error("OpenAPI_amf_event_type_convertToJSON() failed [AmfEventType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_amf_event_type_t *OpenAPI_amf_event_type_parseFromJSON(cJSON *amf_event_typeJSON) +{ + OpenAPI_amf_event_type_t *amf_event_type_local_var = NULL; + amf_event_type_local_var = OpenAPI_amf_event_type_create ( + ); + + return amf_event_type_local_var; +end: + return NULL; +} + +OpenAPI_amf_event_type_t *OpenAPI_amf_event_type_copy(OpenAPI_amf_event_type_t *dst, OpenAPI_amf_event_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_event_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_event_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_event_type_free(dst); + dst = OpenAPI_amf_event_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_event_type.h b/lib/sbi/openapi/model/amf_event_type.h new file mode 100644 index 000000000..90c682b32 --- /dev/null +++ b/lib/sbi/openapi/model/amf_event_type.h @@ -0,0 +1,36 @@ +/* + * amf_event_type.h + * + * + */ + +#ifndef _OpenAPI_amf_event_type_H_ +#define _OpenAPI_amf_event_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 struct OpenAPI_amf_event_type_s OpenAPI_amf_event_type_t; +typedef struct OpenAPI_amf_event_type_s { +} OpenAPI_amf_event_type_t; + +OpenAPI_amf_event_type_t *OpenAPI_amf_event_type_create( + ); +void OpenAPI_amf_event_type_free(OpenAPI_amf_event_type_t *amf_event_type); +OpenAPI_amf_event_type_t *OpenAPI_amf_event_type_parseFromJSON(cJSON *amf_event_typeJSON); +cJSON *OpenAPI_amf_event_type_convertToJSON(OpenAPI_amf_event_type_t *amf_event_type); +OpenAPI_amf_event_type_t *OpenAPI_amf_event_type_copy(OpenAPI_amf_event_type_t *dst, OpenAPI_amf_event_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_event_type_H_ */ + diff --git a/lib/sbi/openapi/model/amf_info.c b/lib/sbi/openapi/model/amf_info.c index f94ea4442..585af133e 100644 --- a/lib/sbi/openapi/model/amf_info.c +++ b/lib/sbi/openapi/model/amf_info.c @@ -378,3 +378,37 @@ end: return NULL; } +OpenAPI_amf_info_t *OpenAPI_amf_info_copy(OpenAPI_amf_info_t *dst, OpenAPI_amf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_info_free(dst); + dst = OpenAPI_amf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_info.h b/lib/sbi/openapi/model/amf_info.h index 8b361d763..ce382f3de 100644 --- a/lib/sbi/openapi/model/amf_info.h +++ b/lib/sbi/openapi/model/amf_info.h @@ -46,6 +46,7 @@ OpenAPI_amf_info_t *OpenAPI_amf_info_create( void OpenAPI_amf_info_free(OpenAPI_amf_info_t *amf_info); OpenAPI_amf_info_t *OpenAPI_amf_info_parseFromJSON(cJSON *amf_infoJSON); cJSON *OpenAPI_amf_info_convertToJSON(OpenAPI_amf_info_t *amf_info); +OpenAPI_amf_info_t *OpenAPI_amf_info_copy(OpenAPI_amf_info_t *dst, OpenAPI_amf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c index 048af547f..ed6b6853f 100644 --- a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c +++ b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c @@ -16,7 +16,7 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra char *amf_service_name_pcscf_rest, OpenAPI_guami_t *guami, OpenAPI_list_t *backup_amf_info, - OpenAPI_rat_type_t *rat_type, + OpenAPI_rat_type_e rat_type, int urrp_indicator, char *amf_ee_subscription_id, char *nid, @@ -72,7 +72,6 @@ void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_r OpenAPI_backup_amf_info_free(node->data); } OpenAPI_list_free(amf_non3_gpp_access_registration->backup_amf_info); - OpenAPI_rat_type_free(amf_non3_gpp_access_registration->rat_type); ogs_free(amf_non3_gpp_access_registration->amf_ee_subscription_id); ogs_free(amf_non3_gpp_access_registration->nid); ogs_free(amf_non3_gpp_access_registration->registration_time); @@ -108,7 +107,7 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_g } } - if (amf_non3_gpp_access_registration->purge_flag >= 0) { + if (amf_non3_gpp_access_registration->purge_flag) { if (cJSON_AddBoolToObject(item, "purgeFlag", amf_non3_gpp_access_registration->purge_flag) == NULL) { ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [purge_flag]"); goto end; @@ -206,18 +205,12 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_g ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [rat_type]"); goto end; } - cJSON *rat_type_local_JSON = OpenAPI_rat_type_convertToJSON(amf_non3_gpp_access_registration->rat_type); - if (rat_type_local_JSON == NULL) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [rat_type]"); - goto end; - } - cJSON_AddItemToObject(item, "ratType", rat_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(amf_non3_gpp_access_registration->rat_type)) == NULL) { ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [rat_type]"); goto end; } - if (amf_non3_gpp_access_registration->urrp_indicator >= 0) { + if (amf_non3_gpp_access_registration->urrp_indicator) { if (cJSON_AddBoolToObject(item, "urrpIndicator", amf_non3_gpp_access_registration->urrp_indicator) == NULL) { ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [urrp_indicator]"); goto end; @@ -400,9 +393,13 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra goto end; } - OpenAPI_rat_type_t *rat_type_local_nonprim = NULL; + OpenAPI_rat_type_e rat_typeVariable; - rat_type_local_nonprim = OpenAPI_rat_type_parseFromJSON(rat_type); + if (!cJSON_IsString(rat_type)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [rat_type]"); + goto end; + } + rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); cJSON *urrp_indicator = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "urrpIndicator"); @@ -479,7 +476,7 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra amf_service_name_pcscf_rest ? ogs_strdup(amf_service_name_pcscf_rest->valuestring) : NULL, guami_local_nonprim, backup_amf_info ? backup_amf_infoList : NULL, - rat_type_local_nonprim, + rat_typeVariable, urrp_indicator ? urrp_indicator->valueint : 0, amf_ee_subscription_id ? ogs_strdup(amf_ee_subscription_id->valuestring) : NULL, nid ? ogs_strdup(nid->valuestring) : NULL, @@ -494,3 +491,37 @@ end: return NULL; } +OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_copy(OpenAPI_amf_non3_gpp_access_registration_t *dst, OpenAPI_amf_non3_gpp_access_registration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_non3_gpp_access_registration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_non3_gpp_access_registration_free(dst); + dst = OpenAPI_amf_non3_gpp_access_registration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h index f2b88b7d2..9a2144622 100644 --- a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h +++ b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h @@ -34,7 +34,7 @@ typedef struct OpenAPI_amf_non3_gpp_access_registration_s { char *amf_service_name_pcscf_rest; struct OpenAPI_guami_s *guami; OpenAPI_list_t *backup_amf_info; - struct OpenAPI_rat_type_s *rat_type; + OpenAPI_rat_type_e rat_type; int urrp_indicator; char *amf_ee_subscription_id; char *nid; @@ -56,7 +56,7 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra char *amf_service_name_pcscf_rest, OpenAPI_guami_t *guami, OpenAPI_list_t *backup_amf_info, - OpenAPI_rat_type_t *rat_type, + OpenAPI_rat_type_e rat_type, int urrp_indicator, char *amf_ee_subscription_id, char *nid, @@ -68,6 +68,7 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_access_registration); OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_parseFromJSON(cJSON *amf_non3_gpp_access_registrationJSON); cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_access_registration); +OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_copy(OpenAPI_amf_non3_gpp_access_registration_t *dst, OpenAPI_amf_non3_gpp_access_registration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/amf_non3_gpp_access_registration_modification.c b/lib/sbi/openapi/model/amf_non3_gpp_access_registration_modification.c index 55d7d91ee..c77378a06 100644 --- a/lib/sbi/openapi/model/amf_non3_gpp_access_registration_modification.c +++ b/lib/sbi/openapi/model/amf_non3_gpp_access_registration_modification.c @@ -66,7 +66,7 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_modification_convertToJSON(OpenA goto end; } - if (amf_non3_gpp_access_registration_modification->purge_flag >= 0) { + if (amf_non3_gpp_access_registration_modification->purge_flag) { if (cJSON_AddBoolToObject(item, "purgeFlag", amf_non3_gpp_access_registration_modification->purge_flag) == NULL) { ogs_error("OpenAPI_amf_non3_gpp_access_registration_modification_convertToJSON() failed [purge_flag]"); goto end; @@ -191,3 +191,37 @@ end: return NULL; } +OpenAPI_amf_non3_gpp_access_registration_modification_t *OpenAPI_amf_non3_gpp_access_registration_modification_copy(OpenAPI_amf_non3_gpp_access_registration_modification_t *dst, OpenAPI_amf_non3_gpp_access_registration_modification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_non3_gpp_access_registration_modification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_modification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_non3_gpp_access_registration_modification_free(dst); + dst = OpenAPI_amf_non3_gpp_access_registration_modification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_non3_gpp_access_registration_modification.h b/lib/sbi/openapi/model/amf_non3_gpp_access_registration_modification.h index 9eaea0fbb..07d3b86fb 100644 --- a/lib/sbi/openapi/model/amf_non3_gpp_access_registration_modification.h +++ b/lib/sbi/openapi/model/amf_non3_gpp_access_registration_modification.h @@ -39,6 +39,7 @@ OpenAPI_amf_non3_gpp_access_registration_modification_t *OpenAPI_amf_non3_gpp_ac void OpenAPI_amf_non3_gpp_access_registration_modification_free(OpenAPI_amf_non3_gpp_access_registration_modification_t *amf_non3_gpp_access_registration_modification); OpenAPI_amf_non3_gpp_access_registration_modification_t *OpenAPI_amf_non3_gpp_access_registration_modification_parseFromJSON(cJSON *amf_non3_gpp_access_registration_modificationJSON); cJSON *OpenAPI_amf_non3_gpp_access_registration_modification_convertToJSON(OpenAPI_amf_non3_gpp_access_registration_modification_t *amf_non3_gpp_access_registration_modification); +OpenAPI_amf_non3_gpp_access_registration_modification_t *OpenAPI_amf_non3_gpp_access_registration_modification_copy(OpenAPI_amf_non3_gpp_access_registration_modification_t *dst, OpenAPI_amf_non3_gpp_access_registration_modification_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/amf_status_change_notification.c b/lib/sbi/openapi/model/amf_status_change_notification.c new file mode 100644 index 000000000..bb13411e9 --- /dev/null +++ b/lib/sbi/openapi/model/amf_status_change_notification.c @@ -0,0 +1,140 @@ + +#include +#include +#include +#include "amf_status_change_notification.h" + +OpenAPI_amf_status_change_notification_t *OpenAPI_amf_status_change_notification_create( + OpenAPI_list_t *amf_status_info_list + ) +{ + OpenAPI_amf_status_change_notification_t *amf_status_change_notification_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_status_change_notification_t)); + if (!amf_status_change_notification_local_var) { + return NULL; + } + amf_status_change_notification_local_var->amf_status_info_list = amf_status_info_list; + + return amf_status_change_notification_local_var; +} + +void OpenAPI_amf_status_change_notification_free(OpenAPI_amf_status_change_notification_t *amf_status_change_notification) +{ + if (NULL == amf_status_change_notification) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(amf_status_change_notification->amf_status_info_list, node) { + OpenAPI_amf_status_info_free(node->data); + } + OpenAPI_list_free(amf_status_change_notification->amf_status_info_list); + ogs_free(amf_status_change_notification); +} + +cJSON *OpenAPI_amf_status_change_notification_convertToJSON(OpenAPI_amf_status_change_notification_t *amf_status_change_notification) +{ + cJSON *item = NULL; + + if (amf_status_change_notification == NULL) { + ogs_error("OpenAPI_amf_status_change_notification_convertToJSON() failed [AmfStatusChangeNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!amf_status_change_notification->amf_status_info_list) { + ogs_error("OpenAPI_amf_status_change_notification_convertToJSON() failed [amf_status_info_list]"); + goto end; + } + cJSON *amf_status_info_listList = cJSON_AddArrayToObject(item, "amfStatusInfoList"); + if (amf_status_info_listList == NULL) { + ogs_error("OpenAPI_amf_status_change_notification_convertToJSON() failed [amf_status_info_list]"); + goto end; + } + + OpenAPI_lnode_t *amf_status_info_list_node; + if (amf_status_change_notification->amf_status_info_list) { + OpenAPI_list_for_each(amf_status_change_notification->amf_status_info_list, amf_status_info_list_node) { + cJSON *itemLocal = OpenAPI_amf_status_info_convertToJSON(amf_status_info_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_status_change_notification_convertToJSON() failed [amf_status_info_list]"); + goto end; + } + cJSON_AddItemToArray(amf_status_info_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_amf_status_change_notification_t *OpenAPI_amf_status_change_notification_parseFromJSON(cJSON *amf_status_change_notificationJSON) +{ + OpenAPI_amf_status_change_notification_t *amf_status_change_notification_local_var = NULL; + cJSON *amf_status_info_list = cJSON_GetObjectItemCaseSensitive(amf_status_change_notificationJSON, "amfStatusInfoList"); + if (!amf_status_info_list) { + ogs_error("OpenAPI_amf_status_change_notification_parseFromJSON() failed [amf_status_info_list]"); + goto end; + } + + OpenAPI_list_t *amf_status_info_listList; + + cJSON *amf_status_info_list_local_nonprimitive; + if (!cJSON_IsArray(amf_status_info_list)) { + ogs_error("OpenAPI_amf_status_change_notification_parseFromJSON() failed [amf_status_info_list]"); + goto end; + } + + amf_status_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(amf_status_info_list_local_nonprimitive, amf_status_info_list ) { + if (!cJSON_IsObject(amf_status_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_status_change_notification_parseFromJSON() failed [amf_status_info_list]"); + goto end; + } + OpenAPI_amf_status_info_t *amf_status_info_listItem = OpenAPI_amf_status_info_parseFromJSON(amf_status_info_list_local_nonprimitive); + + OpenAPI_list_add(amf_status_info_listList, amf_status_info_listItem); + } + + amf_status_change_notification_local_var = OpenAPI_amf_status_change_notification_create ( + amf_status_info_listList + ); + + return amf_status_change_notification_local_var; +end: + return NULL; +} + +OpenAPI_amf_status_change_notification_t *OpenAPI_amf_status_change_notification_copy(OpenAPI_amf_status_change_notification_t *dst, OpenAPI_amf_status_change_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_status_change_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_status_change_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_status_change_notification_free(dst); + dst = OpenAPI_amf_status_change_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_status_change_notification.h b/lib/sbi/openapi/model/amf_status_change_notification.h new file mode 100644 index 000000000..2877b1fa8 --- /dev/null +++ b/lib/sbi/openapi/model/amf_status_change_notification.h @@ -0,0 +1,39 @@ +/* + * amf_status_change_notification.h + * + * + */ + +#ifndef _OpenAPI_amf_status_change_notification_H_ +#define _OpenAPI_amf_status_change_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_status_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_amf_status_change_notification_s OpenAPI_amf_status_change_notification_t; +typedef struct OpenAPI_amf_status_change_notification_s { + OpenAPI_list_t *amf_status_info_list; +} OpenAPI_amf_status_change_notification_t; + +OpenAPI_amf_status_change_notification_t *OpenAPI_amf_status_change_notification_create( + OpenAPI_list_t *amf_status_info_list + ); +void OpenAPI_amf_status_change_notification_free(OpenAPI_amf_status_change_notification_t *amf_status_change_notification); +OpenAPI_amf_status_change_notification_t *OpenAPI_amf_status_change_notification_parseFromJSON(cJSON *amf_status_change_notificationJSON); +cJSON *OpenAPI_amf_status_change_notification_convertToJSON(OpenAPI_amf_status_change_notification_t *amf_status_change_notification); +OpenAPI_amf_status_change_notification_t *OpenAPI_amf_status_change_notification_copy(OpenAPI_amf_status_change_notification_t *dst, OpenAPI_amf_status_change_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_status_change_notification_H_ */ + diff --git a/lib/sbi/openapi/model/amf_status_change_subscription_data.c b/lib/sbi/openapi/model/amf_status_change_subscription_data.c new file mode 100644 index 000000000..49b096a4e --- /dev/null +++ b/lib/sbi/openapi/model/amf_status_change_subscription_data.c @@ -0,0 +1,160 @@ + +#include +#include +#include +#include "amf_status_change_subscription_data.h" + +OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_create( + char *amf_status_uri, + OpenAPI_list_t *guami_list + ) +{ + OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_status_change_subscription_data_t)); + if (!amf_status_change_subscription_data_local_var) { + return NULL; + } + amf_status_change_subscription_data_local_var->amf_status_uri = amf_status_uri; + amf_status_change_subscription_data_local_var->guami_list = guami_list; + + return amf_status_change_subscription_data_local_var; +} + +void OpenAPI_amf_status_change_subscription_data_free(OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data) +{ + if (NULL == amf_status_change_subscription_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(amf_status_change_subscription_data->amf_status_uri); + OpenAPI_list_for_each(amf_status_change_subscription_data->guami_list, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(amf_status_change_subscription_data->guami_list); + ogs_free(amf_status_change_subscription_data); +} + +cJSON *OpenAPI_amf_status_change_subscription_data_convertToJSON(OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data) +{ + cJSON *item = NULL; + + if (amf_status_change_subscription_data == NULL) { + ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [AMFStatusChangeSubscriptionData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!amf_status_change_subscription_data->amf_status_uri) { + ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [amf_status_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "amfStatusUri", amf_status_change_subscription_data->amf_status_uri) == NULL) { + ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [amf_status_uri]"); + goto end; + } + + if (amf_status_change_subscription_data->guami_list) { + cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); + if (guami_listList == NULL) { + ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [guami_list]"); + goto end; + } + + OpenAPI_lnode_t *guami_list_node; + if (amf_status_change_subscription_data->guami_list) { + OpenAPI_list_for_each(amf_status_change_subscription_data->guami_list, guami_list_node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(guami_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON_AddItemToArray(guami_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_parseFromJSON(cJSON *amf_status_change_subscription_dataJSON) +{ + OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data_local_var = NULL; + cJSON *amf_status_uri = cJSON_GetObjectItemCaseSensitive(amf_status_change_subscription_dataJSON, "amfStatusUri"); + if (!amf_status_uri) { + ogs_error("OpenAPI_amf_status_change_subscription_data_parseFromJSON() failed [amf_status_uri]"); + goto end; + } + + + if (!cJSON_IsString(amf_status_uri)) { + ogs_error("OpenAPI_amf_status_change_subscription_data_parseFromJSON() failed [amf_status_uri]"); + goto end; + } + + cJSON *guami_list = cJSON_GetObjectItemCaseSensitive(amf_status_change_subscription_dataJSON, "guamiList"); + + OpenAPI_list_t *guami_listList; + if (guami_list) { + cJSON *guami_list_local_nonprimitive; + if (!cJSON_IsArray(guami_list)) { + ogs_error("OpenAPI_amf_status_change_subscription_data_parseFromJSON() failed [guami_list]"); + goto end; + } + + guami_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(guami_list_local_nonprimitive, guami_list ) { + if (!cJSON_IsObject(guami_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_status_change_subscription_data_parseFromJSON() failed [guami_list]"); + goto end; + } + OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local_nonprimitive); + + OpenAPI_list_add(guami_listList, guami_listItem); + } + } + + amf_status_change_subscription_data_local_var = OpenAPI_amf_status_change_subscription_data_create ( + ogs_strdup(amf_status_uri->valuestring), + guami_list ? guami_listList : NULL + ); + + return amf_status_change_subscription_data_local_var; +end: + return NULL; +} + +OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_copy(OpenAPI_amf_status_change_subscription_data_t *dst, OpenAPI_amf_status_change_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_status_change_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_status_change_subscription_data_free(dst); + dst = OpenAPI_amf_status_change_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_status_change_subscription_data.h b/lib/sbi/openapi/model/amf_status_change_subscription_data.h new file mode 100644 index 000000000..4ebce198d --- /dev/null +++ b/lib/sbi/openapi/model/amf_status_change_subscription_data.h @@ -0,0 +1,41 @@ +/* + * amf_status_change_subscription_data.h + * + * + */ + +#ifndef _OpenAPI_amf_status_change_subscription_data_H_ +#define _OpenAPI_amf_status_change_subscription_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "guami.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_amf_status_change_subscription_data_s OpenAPI_amf_status_change_subscription_data_t; +typedef struct OpenAPI_amf_status_change_subscription_data_s { + char *amf_status_uri; + OpenAPI_list_t *guami_list; +} OpenAPI_amf_status_change_subscription_data_t; + +OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_create( + char *amf_status_uri, + OpenAPI_list_t *guami_list + ); +void OpenAPI_amf_status_change_subscription_data_free(OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data); +OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_parseFromJSON(cJSON *amf_status_change_subscription_dataJSON); +cJSON *OpenAPI_amf_status_change_subscription_data_convertToJSON(OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data); +OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_copy(OpenAPI_amf_status_change_subscription_data_t *dst, OpenAPI_amf_status_change_subscription_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_status_change_subscription_data_H_ */ + diff --git a/lib/sbi/openapi/model/amf_status_info.c b/lib/sbi/openapi/model/amf_status_info.c new file mode 100644 index 000000000..105ffbe12 --- /dev/null +++ b/lib/sbi/openapi/model/amf_status_info.c @@ -0,0 +1,206 @@ + +#include +#include +#include +#include "amf_status_info.h" + +OpenAPI_amf_status_info_t *OpenAPI_amf_status_info_create( + OpenAPI_list_t *guami_list, + OpenAPI_status_change_e status_change, + char *target_amf_removal, + char *target_amf_failure + ) +{ + OpenAPI_amf_status_info_t *amf_status_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_status_info_t)); + if (!amf_status_info_local_var) { + return NULL; + } + amf_status_info_local_var->guami_list = guami_list; + amf_status_info_local_var->status_change = status_change; + amf_status_info_local_var->target_amf_removal = target_amf_removal; + amf_status_info_local_var->target_amf_failure = target_amf_failure; + + return amf_status_info_local_var; +} + +void OpenAPI_amf_status_info_free(OpenAPI_amf_status_info_t *amf_status_info) +{ + if (NULL == amf_status_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(amf_status_info->guami_list, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(amf_status_info->guami_list); + ogs_free(amf_status_info->target_amf_removal); + ogs_free(amf_status_info->target_amf_failure); + ogs_free(amf_status_info); +} + +cJSON *OpenAPI_amf_status_info_convertToJSON(OpenAPI_amf_status_info_t *amf_status_info) +{ + cJSON *item = NULL; + + if (amf_status_info == NULL) { + ogs_error("OpenAPI_amf_status_info_convertToJSON() failed [AmfStatusInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!amf_status_info->guami_list) { + ogs_error("OpenAPI_amf_status_info_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); + if (guami_listList == NULL) { + ogs_error("OpenAPI_amf_status_info_convertToJSON() failed [guami_list]"); + goto end; + } + + OpenAPI_lnode_t *guami_list_node; + if (amf_status_info->guami_list) { + OpenAPI_list_for_each(amf_status_info->guami_list, guami_list_node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(guami_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_status_info_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON_AddItemToArray(guami_listList, itemLocal); + } + } + + if (!amf_status_info->status_change) { + ogs_error("OpenAPI_amf_status_info_convertToJSON() failed [status_change]"); + goto end; + } + if (cJSON_AddStringToObject(item, "statusChange", OpenAPI_status_change_ToString(amf_status_info->status_change)) == NULL) { + ogs_error("OpenAPI_amf_status_info_convertToJSON() failed [status_change]"); + goto end; + } + + if (amf_status_info->target_amf_removal) { + if (cJSON_AddStringToObject(item, "targetAmfRemoval", amf_status_info->target_amf_removal) == NULL) { + ogs_error("OpenAPI_amf_status_info_convertToJSON() failed [target_amf_removal]"); + goto end; + } + } + + if (amf_status_info->target_amf_failure) { + if (cJSON_AddStringToObject(item, "targetAmfFailure", amf_status_info->target_amf_failure) == NULL) { + ogs_error("OpenAPI_amf_status_info_convertToJSON() failed [target_amf_failure]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_amf_status_info_t *OpenAPI_amf_status_info_parseFromJSON(cJSON *amf_status_infoJSON) +{ + OpenAPI_amf_status_info_t *amf_status_info_local_var = NULL; + cJSON *guami_list = cJSON_GetObjectItemCaseSensitive(amf_status_infoJSON, "guamiList"); + if (!guami_list) { + ogs_error("OpenAPI_amf_status_info_parseFromJSON() failed [guami_list]"); + goto end; + } + + OpenAPI_list_t *guami_listList; + + cJSON *guami_list_local_nonprimitive; + if (!cJSON_IsArray(guami_list)) { + ogs_error("OpenAPI_amf_status_info_parseFromJSON() failed [guami_list]"); + goto end; + } + + guami_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(guami_list_local_nonprimitive, guami_list ) { + if (!cJSON_IsObject(guami_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_status_info_parseFromJSON() failed [guami_list]"); + goto end; + } + OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local_nonprimitive); + + OpenAPI_list_add(guami_listList, guami_listItem); + } + + cJSON *status_change = cJSON_GetObjectItemCaseSensitive(amf_status_infoJSON, "statusChange"); + if (!status_change) { + ogs_error("OpenAPI_amf_status_info_parseFromJSON() failed [status_change]"); + goto end; + } + + OpenAPI_status_change_e status_changeVariable; + + if (!cJSON_IsString(status_change)) { + ogs_error("OpenAPI_amf_status_info_parseFromJSON() failed [status_change]"); + goto end; + } + status_changeVariable = OpenAPI_status_change_FromString(status_change->valuestring); + + cJSON *target_amf_removal = cJSON_GetObjectItemCaseSensitive(amf_status_infoJSON, "targetAmfRemoval"); + + if (target_amf_removal) { + if (!cJSON_IsString(target_amf_removal)) { + ogs_error("OpenAPI_amf_status_info_parseFromJSON() failed [target_amf_removal]"); + goto end; + } + } + + cJSON *target_amf_failure = cJSON_GetObjectItemCaseSensitive(amf_status_infoJSON, "targetAmfFailure"); + + if (target_amf_failure) { + if (!cJSON_IsString(target_amf_failure)) { + ogs_error("OpenAPI_amf_status_info_parseFromJSON() failed [target_amf_failure]"); + goto end; + } + } + + amf_status_info_local_var = OpenAPI_amf_status_info_create ( + guami_listList, + status_changeVariable, + target_amf_removal ? ogs_strdup(target_amf_removal->valuestring) : NULL, + target_amf_failure ? ogs_strdup(target_amf_failure->valuestring) : NULL + ); + + return amf_status_info_local_var; +end: + return NULL; +} + +OpenAPI_amf_status_info_t *OpenAPI_amf_status_info_copy(OpenAPI_amf_status_info_t *dst, OpenAPI_amf_status_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_status_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_status_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_amf_status_info_free(dst); + dst = OpenAPI_amf_status_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_status_info.h b/lib/sbi/openapi/model/amf_status_info.h new file mode 100644 index 000000000..fdb6cfeee --- /dev/null +++ b/lib/sbi/openapi/model/amf_status_info.h @@ -0,0 +1,46 @@ +/* + * amf_status_info.h + * + * + */ + +#ifndef _OpenAPI_amf_status_info_H_ +#define _OpenAPI_amf_status_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "guami.h" +#include "status_change.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_amf_status_info_s OpenAPI_amf_status_info_t; +typedef struct OpenAPI_amf_status_info_s { + OpenAPI_list_t *guami_list; + OpenAPI_status_change_e status_change; + char *target_amf_removal; + char *target_amf_failure; +} OpenAPI_amf_status_info_t; + +OpenAPI_amf_status_info_t *OpenAPI_amf_status_info_create( + OpenAPI_list_t *guami_list, + OpenAPI_status_change_e status_change, + char *target_amf_removal, + char *target_amf_failure + ); +void OpenAPI_amf_status_info_free(OpenAPI_amf_status_info_t *amf_status_info); +OpenAPI_amf_status_info_t *OpenAPI_amf_status_info_parseFromJSON(cJSON *amf_status_infoJSON); +cJSON *OpenAPI_amf_status_info_convertToJSON(OpenAPI_amf_status_info_t *amf_status_info); +OpenAPI_amf_status_info_t *OpenAPI_amf_status_info_copy(OpenAPI_amf_status_info_t *dst, OpenAPI_amf_status_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_status_info_H_ */ + diff --git a/lib/sbi/openapi/model/amf_subscription_info.c b/lib/sbi/openapi/model/amf_subscription_info.c index 66b86736c..cacf9b170 100644 --- a/lib/sbi/openapi/model/amf_subscription_info.c +++ b/lib/sbi/openapi/model/amf_subscription_info.c @@ -119,3 +119,37 @@ end: return NULL; } +OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_copy(OpenAPI_amf_subscription_info_t *dst, OpenAPI_amf_subscription_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_amf_subscription_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_amf_subscription_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_amf_subscription_info_free(dst); + dst = OpenAPI_amf_subscription_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/amf_subscription_info.h b/lib/sbi/openapi/model/amf_subscription_info.h index ff3d9416c..894c6cffd 100644 --- a/lib/sbi/openapi/model/amf_subscription_info.h +++ b/lib/sbi/openapi/model/amf_subscription_info.h @@ -32,6 +32,7 @@ OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_create( void OpenAPI_amf_subscription_info_free(OpenAPI_amf_subscription_info_t *amf_subscription_info); OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_parseFromJSON(cJSON *amf_subscription_infoJSON); cJSON *OpenAPI_amf_subscription_info_convertToJSON(OpenAPI_amf_subscription_info_t *amf_subscription_info); +OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_copy(OpenAPI_amf_subscription_info_t *dst, OpenAPI_amf_subscription_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/an_node_type.c b/lib/sbi/openapi/model/an_node_type.c index 7c13aebfd..de3750a32 100644 --- a/lib/sbi/openapi/model/an_node_type.c +++ b/lib/sbi/openapi/model/an_node_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_an_node_type_t *OpenAPI_an_node_type_copy(OpenAPI_an_node_type_t *dst, OpenAPI_an_node_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_an_node_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_an_node_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_an_node_type_free(dst); + dst = OpenAPI_an_node_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/an_node_type.h b/lib/sbi/openapi/model/an_node_type.h index 096453bca..b608fb315 100644 --- a/lib/sbi/openapi/model/an_node_type.h +++ b/lib/sbi/openapi/model/an_node_type.h @@ -26,6 +26,7 @@ OpenAPI_an_node_type_t *OpenAPI_an_node_type_create( void OpenAPI_an_node_type_free(OpenAPI_an_node_type_t *an_node_type); OpenAPI_an_node_type_t *OpenAPI_an_node_type_parseFromJSON(cJSON *an_node_typeJSON); cJSON *OpenAPI_an_node_type_convertToJSON(OpenAPI_an_node_type_t *an_node_type); +OpenAPI_an_node_type_t *OpenAPI_an_node_type_copy(OpenAPI_an_node_type_t *dst, OpenAPI_an_node_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/apn_rate_status.c b/lib/sbi/openapi/model/apn_rate_status.c new file mode 100644 index 000000000..526372cd7 --- /dev/null +++ b/lib/sbi/openapi/model/apn_rate_status.c @@ -0,0 +1,181 @@ + +#include +#include +#include +#include "apn_rate_status.h" + +OpenAPI_apn_rate_status_t *OpenAPI_apn_rate_status_create( + int remain_packets_ul, + int remain_packets_dl, + char *validity_time, + int remain_ex_reports_ul, + int remain_ex_reports_dl + ) +{ + OpenAPI_apn_rate_status_t *apn_rate_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_apn_rate_status_t)); + if (!apn_rate_status_local_var) { + return NULL; + } + apn_rate_status_local_var->remain_packets_ul = remain_packets_ul; + apn_rate_status_local_var->remain_packets_dl = remain_packets_dl; + apn_rate_status_local_var->validity_time = validity_time; + apn_rate_status_local_var->remain_ex_reports_ul = remain_ex_reports_ul; + apn_rate_status_local_var->remain_ex_reports_dl = remain_ex_reports_dl; + + return apn_rate_status_local_var; +} + +void OpenAPI_apn_rate_status_free(OpenAPI_apn_rate_status_t *apn_rate_status) +{ + if (NULL == apn_rate_status) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(apn_rate_status->validity_time); + ogs_free(apn_rate_status); +} + +cJSON *OpenAPI_apn_rate_status_convertToJSON(OpenAPI_apn_rate_status_t *apn_rate_status) +{ + cJSON *item = NULL; + + if (apn_rate_status == NULL) { + ogs_error("OpenAPI_apn_rate_status_convertToJSON() failed [ApnRateStatus]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (apn_rate_status->remain_packets_ul) { + if (cJSON_AddNumberToObject(item, "remainPacketsUl", apn_rate_status->remain_packets_ul) == NULL) { + ogs_error("OpenAPI_apn_rate_status_convertToJSON() failed [remain_packets_ul]"); + goto end; + } + } + + if (apn_rate_status->remain_packets_dl) { + if (cJSON_AddNumberToObject(item, "remainPacketsDl", apn_rate_status->remain_packets_dl) == NULL) { + ogs_error("OpenAPI_apn_rate_status_convertToJSON() failed [remain_packets_dl]"); + goto end; + } + } + + if (apn_rate_status->validity_time) { + if (cJSON_AddStringToObject(item, "validityTime", apn_rate_status->validity_time) == NULL) { + ogs_error("OpenAPI_apn_rate_status_convertToJSON() failed [validity_time]"); + goto end; + } + } + + if (apn_rate_status->remain_ex_reports_ul) { + if (cJSON_AddNumberToObject(item, "remainExReportsUl", apn_rate_status->remain_ex_reports_ul) == NULL) { + ogs_error("OpenAPI_apn_rate_status_convertToJSON() failed [remain_ex_reports_ul]"); + goto end; + } + } + + if (apn_rate_status->remain_ex_reports_dl) { + if (cJSON_AddNumberToObject(item, "remainExReportsDl", apn_rate_status->remain_ex_reports_dl) == NULL) { + ogs_error("OpenAPI_apn_rate_status_convertToJSON() failed [remain_ex_reports_dl]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_apn_rate_status_t *OpenAPI_apn_rate_status_parseFromJSON(cJSON *apn_rate_statusJSON) +{ + OpenAPI_apn_rate_status_t *apn_rate_status_local_var = NULL; + cJSON *remain_packets_ul = cJSON_GetObjectItemCaseSensitive(apn_rate_statusJSON, "remainPacketsUl"); + + if (remain_packets_ul) { + if (!cJSON_IsNumber(remain_packets_ul)) { + ogs_error("OpenAPI_apn_rate_status_parseFromJSON() failed [remain_packets_ul]"); + goto end; + } + } + + cJSON *remain_packets_dl = cJSON_GetObjectItemCaseSensitive(apn_rate_statusJSON, "remainPacketsDl"); + + if (remain_packets_dl) { + if (!cJSON_IsNumber(remain_packets_dl)) { + ogs_error("OpenAPI_apn_rate_status_parseFromJSON() failed [remain_packets_dl]"); + goto end; + } + } + + cJSON *validity_time = cJSON_GetObjectItemCaseSensitive(apn_rate_statusJSON, "validityTime"); + + if (validity_time) { + if (!cJSON_IsString(validity_time)) { + ogs_error("OpenAPI_apn_rate_status_parseFromJSON() failed [validity_time]"); + goto end; + } + } + + cJSON *remain_ex_reports_ul = cJSON_GetObjectItemCaseSensitive(apn_rate_statusJSON, "remainExReportsUl"); + + if (remain_ex_reports_ul) { + if (!cJSON_IsNumber(remain_ex_reports_ul)) { + ogs_error("OpenAPI_apn_rate_status_parseFromJSON() failed [remain_ex_reports_ul]"); + goto end; + } + } + + cJSON *remain_ex_reports_dl = cJSON_GetObjectItemCaseSensitive(apn_rate_statusJSON, "remainExReportsDl"); + + if (remain_ex_reports_dl) { + if (!cJSON_IsNumber(remain_ex_reports_dl)) { + ogs_error("OpenAPI_apn_rate_status_parseFromJSON() failed [remain_ex_reports_dl]"); + goto end; + } + } + + apn_rate_status_local_var = OpenAPI_apn_rate_status_create ( + remain_packets_ul ? remain_packets_ul->valuedouble : 0, + remain_packets_dl ? remain_packets_dl->valuedouble : 0, + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + remain_ex_reports_ul ? remain_ex_reports_ul->valuedouble : 0, + remain_ex_reports_dl ? remain_ex_reports_dl->valuedouble : 0 + ); + + return apn_rate_status_local_var; +end: + return NULL; +} + +OpenAPI_apn_rate_status_t *OpenAPI_apn_rate_status_copy(OpenAPI_apn_rate_status_t *dst, OpenAPI_apn_rate_status_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_apn_rate_status_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_apn_rate_status_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_apn_rate_status_free(dst); + dst = OpenAPI_apn_rate_status_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/apn_rate_status.h b/lib/sbi/openapi/model/apn_rate_status.h new file mode 100644 index 000000000..9aefec58e --- /dev/null +++ b/lib/sbi/openapi/model/apn_rate_status.h @@ -0,0 +1,46 @@ +/* + * apn_rate_status.h + * + * + */ + +#ifndef _OpenAPI_apn_rate_status_H_ +#define _OpenAPI_apn_rate_status_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_apn_rate_status_s OpenAPI_apn_rate_status_t; +typedef struct OpenAPI_apn_rate_status_s { + int remain_packets_ul; + int remain_packets_dl; + char *validity_time; + int remain_ex_reports_ul; + int remain_ex_reports_dl; +} OpenAPI_apn_rate_status_t; + +OpenAPI_apn_rate_status_t *OpenAPI_apn_rate_status_create( + int remain_packets_ul, + int remain_packets_dl, + char *validity_time, + int remain_ex_reports_ul, + int remain_ex_reports_dl + ); +void OpenAPI_apn_rate_status_free(OpenAPI_apn_rate_status_t *apn_rate_status); +OpenAPI_apn_rate_status_t *OpenAPI_apn_rate_status_parseFromJSON(cJSON *apn_rate_statusJSON); +cJSON *OpenAPI_apn_rate_status_convertToJSON(OpenAPI_apn_rate_status_t *apn_rate_status); +OpenAPI_apn_rate_status_t *OpenAPI_apn_rate_status_copy(OpenAPI_apn_rate_status_t *dst, OpenAPI_apn_rate_status_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_apn_rate_status_H_ */ + diff --git a/lib/sbi/openapi/model/app_descriptor.c b/lib/sbi/openapi/model/app_descriptor.c index 6e1e74141..5f76dab29 100644 --- a/lib/sbi/openapi/model/app_descriptor.c +++ b/lib/sbi/openapi/model/app_descriptor.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_app_descriptor_t *OpenAPI_app_descriptor_copy(OpenAPI_app_descriptor_t *dst, OpenAPI_app_descriptor_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_app_descriptor_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_app_descriptor_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_app_descriptor_free(dst); + dst = OpenAPI_app_descriptor_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/app_descriptor.h b/lib/sbi/openapi/model/app_descriptor.h index 78f8daa9e..d7fb87c06 100644 --- a/lib/sbi/openapi/model/app_descriptor.h +++ b/lib/sbi/openapi/model/app_descriptor.h @@ -30,6 +30,7 @@ OpenAPI_app_descriptor_t *OpenAPI_app_descriptor_create( void OpenAPI_app_descriptor_free(OpenAPI_app_descriptor_t *app_descriptor); OpenAPI_app_descriptor_t *OpenAPI_app_descriptor_parseFromJSON(cJSON *app_descriptorJSON); cJSON *OpenAPI_app_descriptor_convertToJSON(OpenAPI_app_descriptor_t *app_descriptor); +OpenAPI_app_descriptor_t *OpenAPI_app_descriptor_copy(OpenAPI_app_descriptor_t *dst, OpenAPI_app_descriptor_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/app_port_id.c b/lib/sbi/openapi/model/app_port_id.c index 055edf340..e284d67a3 100644 --- a/lib/sbi/openapi/model/app_port_id.c +++ b/lib/sbi/openapi/model/app_port_id.c @@ -87,3 +87,37 @@ end: return NULL; } +OpenAPI_app_port_id_t *OpenAPI_app_port_id_copy(OpenAPI_app_port_id_t *dst, OpenAPI_app_port_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_app_port_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_app_port_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_app_port_id_free(dst); + dst = OpenAPI_app_port_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/app_port_id.h b/lib/sbi/openapi/model/app_port_id.h index 91717c4d8..d38d4e649 100644 --- a/lib/sbi/openapi/model/app_port_id.h +++ b/lib/sbi/openapi/model/app_port_id.h @@ -30,6 +30,7 @@ OpenAPI_app_port_id_t *OpenAPI_app_port_id_create( void OpenAPI_app_port_id_free(OpenAPI_app_port_id_t *app_port_id); OpenAPI_app_port_id_t *OpenAPI_app_port_id_parseFromJSON(cJSON *app_port_idJSON); cJSON *OpenAPI_app_port_id_convertToJSON(OpenAPI_app_port_id_t *app_port_id); +OpenAPI_app_port_id_t *OpenAPI_app_port_id_copy(OpenAPI_app_port_id_t *dst, OpenAPI_app_port_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/application_data_change_notif.c b/lib/sbi/openapi/model/application_data_change_notif.c index 6c0d28a3e..7bcd6eecd 100644 --- a/lib/sbi/openapi/model/application_data_change_notif.c +++ b/lib/sbi/openapi/model/application_data_change_notif.c @@ -170,3 +170,37 @@ end: return NULL; } +OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_copy(OpenAPI_application_data_change_notif_t *dst, OpenAPI_application_data_change_notif_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_application_data_change_notif_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_application_data_change_notif_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + 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_change_notif_free(dst); + dst = OpenAPI_application_data_change_notif_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/application_data_change_notif.h b/lib/sbi/openapi/model/application_data_change_notif.h index 6e1cb290a..33c0cc045 100644 --- a/lib/sbi/openapi/model/application_data_change_notif.h +++ b/lib/sbi/openapi/model/application_data_change_notif.h @@ -40,6 +40,7 @@ OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_c void OpenAPI_application_data_change_notif_free(OpenAPI_application_data_change_notif_t *application_data_change_notif); OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_parseFromJSON(cJSON *application_data_change_notifJSON); cJSON *OpenAPI_application_data_change_notif_convertToJSON(OpenAPI_application_data_change_notif_t *application_data_change_notif); +OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_copy(OpenAPI_application_data_change_notif_t *dst, OpenAPI_application_data_change_notif_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/application_data_subs.c b/lib/sbi/openapi/model/application_data_subs.c index e7e32da64..89bd1eaef 100644 --- a/lib/sbi/openapi/model/application_data_subs.c +++ b/lib/sbi/openapi/model/application_data_subs.c @@ -164,3 +164,37 @@ end: return NULL; } +OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_copy(OpenAPI_application_data_subs_t *dst, OpenAPI_application_data_subs_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_application_data_subs_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_application_data_subs_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + 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_subs_free(dst); + dst = OpenAPI_application_data_subs_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/application_data_subs.h b/lib/sbi/openapi/model/application_data_subs.h index 6b86f44d9..7f6f33201 100644 --- a/lib/sbi/openapi/model/application_data_subs.h +++ b/lib/sbi/openapi/model/application_data_subs.h @@ -35,6 +35,7 @@ OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_create( void OpenAPI_application_data_subs_free(OpenAPI_application_data_subs_t *application_data_subs); OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_parseFromJSON(cJSON *application_data_subsJSON); cJSON *OpenAPI_application_data_subs_convertToJSON(OpenAPI_application_data_subs_t *application_data_subs); +OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_copy(OpenAPI_application_data_subs_t *dst, OpenAPI_application_data_subs_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/area.c b/lib/sbi/openapi/model/area.c index 76edd9bc5..3d7bce1fc 100644 --- a/lib/sbi/openapi/model/area.c +++ b/lib/sbi/openapi/model/area.c @@ -112,3 +112,37 @@ end: return NULL; } +OpenAPI_area_t *OpenAPI_area_copy(OpenAPI_area_t *dst, OpenAPI_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_area_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_area_free(dst); + dst = OpenAPI_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/area.h b/lib/sbi/openapi/model/area.h index f97e2dad5..4092e15e8 100644 --- a/lib/sbi/openapi/model/area.h +++ b/lib/sbi/openapi/model/area.h @@ -30,6 +30,7 @@ OpenAPI_area_t *OpenAPI_area_create( void OpenAPI_area_free(OpenAPI_area_t *area); OpenAPI_area_t *OpenAPI_area_parseFromJSON(cJSON *areaJSON); cJSON *OpenAPI_area_convertToJSON(OpenAPI_area_t *area); +OpenAPI_area_t *OpenAPI_area_copy(OpenAPI_area_t *dst, OpenAPI_area_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/area_of_validity.c b/lib/sbi/openapi/model/area_of_validity.c new file mode 100644 index 000000000..951df9182 --- /dev/null +++ b/lib/sbi/openapi/model/area_of_validity.c @@ -0,0 +1,140 @@ + +#include +#include +#include +#include "area_of_validity.h" + +OpenAPI_area_of_validity_t *OpenAPI_area_of_validity_create( + OpenAPI_list_t *tai_list + ) +{ + OpenAPI_area_of_validity_t *area_of_validity_local_var = OpenAPI_malloc(sizeof(OpenAPI_area_of_validity_t)); + if (!area_of_validity_local_var) { + return NULL; + } + area_of_validity_local_var->tai_list = tai_list; + + return area_of_validity_local_var; +} + +void OpenAPI_area_of_validity_free(OpenAPI_area_of_validity_t *area_of_validity) +{ + if (NULL == area_of_validity) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(area_of_validity->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(area_of_validity->tai_list); + ogs_free(area_of_validity); +} + +cJSON *OpenAPI_area_of_validity_convertToJSON(OpenAPI_area_of_validity_t *area_of_validity) +{ + cJSON *item = NULL; + + if (area_of_validity == NULL) { + ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [AreaOfValidity]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!area_of_validity->tai_list) { + ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [tai_list]"); + goto end; + } + + OpenAPI_lnode_t *tai_list_node; + if (area_of_validity->tai_list) { + OpenAPI_list_for_each(area_of_validity->tai_list, tai_list_node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(tai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_area_of_validity_t *OpenAPI_area_of_validity_parseFromJSON(cJSON *area_of_validityJSON) +{ + OpenAPI_area_of_validity_t *area_of_validity_local_var = NULL; + cJSON *tai_list = cJSON_GetObjectItemCaseSensitive(area_of_validityJSON, "taiList"); + if (!tai_list) { + ogs_error("OpenAPI_area_of_validity_parseFromJSON() failed [tai_list]"); + goto end; + } + + OpenAPI_list_t *tai_listList; + + cJSON *tai_list_local_nonprimitive; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_area_of_validity_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local_nonprimitive, tai_list ) { + if (!cJSON_IsObject(tai_list_local_nonprimitive)) { + ogs_error("OpenAPI_area_of_validity_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local_nonprimitive); + + OpenAPI_list_add(tai_listList, tai_listItem); + } + + area_of_validity_local_var = OpenAPI_area_of_validity_create ( + tai_listList + ); + + return area_of_validity_local_var; +end: + return NULL; +} + +OpenAPI_area_of_validity_t *OpenAPI_area_of_validity_copy(OpenAPI_area_of_validity_t *dst, OpenAPI_area_of_validity_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_area_of_validity_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_area_of_validity_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_area_of_validity_free(dst); + dst = OpenAPI_area_of_validity_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/area_of_validity.h b/lib/sbi/openapi/model/area_of_validity.h new file mode 100644 index 000000000..4ae9648ea --- /dev/null +++ b/lib/sbi/openapi/model/area_of_validity.h @@ -0,0 +1,39 @@ +/* + * area_of_validity.h + * + * + */ + +#ifndef _OpenAPI_area_of_validity_H_ +#define _OpenAPI_area_of_validity_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_area_of_validity_s OpenAPI_area_of_validity_t; +typedef struct OpenAPI_area_of_validity_s { + OpenAPI_list_t *tai_list; +} OpenAPI_area_of_validity_t; + +OpenAPI_area_of_validity_t *OpenAPI_area_of_validity_create( + OpenAPI_list_t *tai_list + ); +void OpenAPI_area_of_validity_free(OpenAPI_area_of_validity_t *area_of_validity); +OpenAPI_area_of_validity_t *OpenAPI_area_of_validity_parseFromJSON(cJSON *area_of_validityJSON); +cJSON *OpenAPI_area_of_validity_convertToJSON(OpenAPI_area_of_validity_t *area_of_validity); +OpenAPI_area_of_validity_t *OpenAPI_area_of_validity_copy(OpenAPI_area_of_validity_t *dst, OpenAPI_area_of_validity_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_area_of_validity_H_ */ + diff --git a/lib/sbi/openapi/model/arp.c b/lib/sbi/openapi/model/arp.c index fc346b182..36cea1305 100644 --- a/lib/sbi/openapi/model/arp.c +++ b/lib/sbi/openapi/model/arp.c @@ -6,8 +6,8 @@ OpenAPI_arp_t *OpenAPI_arp_create( int priority_level, - OpenAPI_preemption_capability_t *preempt_cap, - OpenAPI_preemption_vulnerability_t *preempt_vuln + OpenAPI_preemption_capability_e preempt_cap, + OpenAPI_preemption_vulnerability_e preempt_vuln ) { OpenAPI_arp_t *arp_local_var = OpenAPI_malloc(sizeof(OpenAPI_arp_t)); @@ -27,8 +27,6 @@ void OpenAPI_arp_free(OpenAPI_arp_t *arp) return; } OpenAPI_lnode_t *node; - OpenAPI_preemption_capability_free(arp->preempt_cap); - OpenAPI_preemption_vulnerability_free(arp->preempt_vuln); ogs_free(arp); } @@ -55,13 +53,7 @@ cJSON *OpenAPI_arp_convertToJSON(OpenAPI_arp_t *arp) ogs_error("OpenAPI_arp_convertToJSON() failed [preempt_cap]"); goto end; } - cJSON *preempt_cap_local_JSON = OpenAPI_preemption_capability_convertToJSON(arp->preempt_cap); - if (preempt_cap_local_JSON == NULL) { - ogs_error("OpenAPI_arp_convertToJSON() failed [preempt_cap]"); - goto end; - } - cJSON_AddItemToObject(item, "preemptCap", preempt_cap_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "preemptCap", OpenAPI_preemption_capability_ToString(arp->preempt_cap)) == NULL) { ogs_error("OpenAPI_arp_convertToJSON() failed [preempt_cap]"); goto end; } @@ -70,13 +62,7 @@ cJSON *OpenAPI_arp_convertToJSON(OpenAPI_arp_t *arp) ogs_error("OpenAPI_arp_convertToJSON() failed [preempt_vuln]"); goto end; } - cJSON *preempt_vuln_local_JSON = OpenAPI_preemption_vulnerability_convertToJSON(arp->preempt_vuln); - if (preempt_vuln_local_JSON == NULL) { - ogs_error("OpenAPI_arp_convertToJSON() failed [preempt_vuln]"); - goto end; - } - cJSON_AddItemToObject(item, "preemptVuln", preempt_vuln_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "preemptVuln", OpenAPI_preemption_vulnerability_ToString(arp->preempt_vuln)) == NULL) { ogs_error("OpenAPI_arp_convertToJSON() failed [preempt_vuln]"); goto end; } @@ -106,9 +92,13 @@ OpenAPI_arp_t *OpenAPI_arp_parseFromJSON(cJSON *arpJSON) goto end; } - OpenAPI_preemption_capability_t *preempt_cap_local_nonprim = NULL; + OpenAPI_preemption_capability_e preempt_capVariable; - preempt_cap_local_nonprim = OpenAPI_preemption_capability_parseFromJSON(preempt_cap); + if (!cJSON_IsString(preempt_cap)) { + ogs_error("OpenAPI_arp_parseFromJSON() failed [preempt_cap]"); + goto end; + } + preempt_capVariable = OpenAPI_preemption_capability_FromString(preempt_cap->valuestring); cJSON *preempt_vuln = cJSON_GetObjectItemCaseSensitive(arpJSON, "preemptVuln"); if (!preempt_vuln) { @@ -116,14 +106,18 @@ OpenAPI_arp_t *OpenAPI_arp_parseFromJSON(cJSON *arpJSON) goto end; } - OpenAPI_preemption_vulnerability_t *preempt_vuln_local_nonprim = NULL; + OpenAPI_preemption_vulnerability_e preempt_vulnVariable; - preempt_vuln_local_nonprim = OpenAPI_preemption_vulnerability_parseFromJSON(preempt_vuln); + if (!cJSON_IsString(preempt_vuln)) { + ogs_error("OpenAPI_arp_parseFromJSON() failed [preempt_vuln]"); + goto end; + } + preempt_vulnVariable = OpenAPI_preemption_vulnerability_FromString(preempt_vuln->valuestring); arp_local_var = OpenAPI_arp_create ( priority_level->valuedouble, - preempt_cap_local_nonprim, - preempt_vuln_local_nonprim + preempt_capVariable, + preempt_vulnVariable ); return arp_local_var; @@ -131,3 +125,37 @@ end: return NULL; } +OpenAPI_arp_t *OpenAPI_arp_copy(OpenAPI_arp_t *dst, OpenAPI_arp_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_arp_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_arp_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_arp_free(dst); + dst = OpenAPI_arp_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/arp.h b/lib/sbi/openapi/model/arp.h index 154d4bbe4..8e4a437ab 100644 --- a/lib/sbi/openapi/model/arp.h +++ b/lib/sbi/openapi/model/arp.h @@ -22,18 +22,19 @@ extern "C" { typedef struct OpenAPI_arp_s OpenAPI_arp_t; typedef struct OpenAPI_arp_s { int priority_level; - struct OpenAPI_preemption_capability_s *preempt_cap; - struct OpenAPI_preemption_vulnerability_s *preempt_vuln; + OpenAPI_preemption_capability_e preempt_cap; + OpenAPI_preemption_vulnerability_e preempt_vuln; } OpenAPI_arp_t; OpenAPI_arp_t *OpenAPI_arp_create( int priority_level, - OpenAPI_preemption_capability_t *preempt_cap, - OpenAPI_preemption_vulnerability_t *preempt_vuln + OpenAPI_preemption_capability_e preempt_cap, + OpenAPI_preemption_vulnerability_e preempt_vuln ); void OpenAPI_arp_free(OpenAPI_arp_t *arp); OpenAPI_arp_t *OpenAPI_arp_parseFromJSON(cJSON *arpJSON); cJSON *OpenAPI_arp_convertToJSON(OpenAPI_arp_t *arp); +OpenAPI_arp_t *OpenAPI_arp_copy(OpenAPI_arp_t *dst, OpenAPI_arp_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/assign_ebi_data.c b/lib/sbi/openapi/model/assign_ebi_data.c new file mode 100644 index 000000000..13bfc7397 --- /dev/null +++ b/lib/sbi/openapi/model/assign_ebi_data.c @@ -0,0 +1,226 @@ + +#include +#include +#include +#include "assign_ebi_data.h" + +OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_create( + int pdu_session_id, + OpenAPI_list_t *arp_list, + OpenAPI_list_t *released_ebi_list, + OpenAPI_guami_t *old_guami + ) +{ + OpenAPI_assign_ebi_data_t *assign_ebi_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_assign_ebi_data_t)); + if (!assign_ebi_data_local_var) { + return NULL; + } + assign_ebi_data_local_var->pdu_session_id = pdu_session_id; + assign_ebi_data_local_var->arp_list = arp_list; + assign_ebi_data_local_var->released_ebi_list = released_ebi_list; + assign_ebi_data_local_var->old_guami = old_guami; + + return assign_ebi_data_local_var; +} + +void OpenAPI_assign_ebi_data_free(OpenAPI_assign_ebi_data_t *assign_ebi_data) +{ + if (NULL == assign_ebi_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(assign_ebi_data->arp_list, node) { + OpenAPI_arp_free(node->data); + } + OpenAPI_list_free(assign_ebi_data->arp_list); + OpenAPI_list_for_each(assign_ebi_data->released_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(assign_ebi_data->released_ebi_list); + OpenAPI_guami_free(assign_ebi_data->old_guami); + ogs_free(assign_ebi_data); +} + +cJSON *OpenAPI_assign_ebi_data_convertToJSON(OpenAPI_assign_ebi_data_t *assign_ebi_data) +{ + cJSON *item = NULL; + + if (assign_ebi_data == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [AssignEbiData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!assign_ebi_data->pdu_session_id) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "pduSessionId", assign_ebi_data->pdu_session_id) == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + + if (assign_ebi_data->arp_list) { + cJSON *arp_listList = cJSON_AddArrayToObject(item, "arpList"); + if (arp_listList == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [arp_list]"); + goto end; + } + + OpenAPI_lnode_t *arp_list_node; + if (assign_ebi_data->arp_list) { + OpenAPI_list_for_each(assign_ebi_data->arp_list, arp_list_node) { + cJSON *itemLocal = OpenAPI_arp_convertToJSON(arp_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [arp_list]"); + goto end; + } + cJSON_AddItemToArray(arp_listList, itemLocal); + } + } + } + + if (assign_ebi_data->released_ebi_list) { + cJSON *released_ebi_list = cJSON_AddArrayToObject(item, "releasedEbiList"); + if (released_ebi_list == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [released_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *released_ebi_list_node; + OpenAPI_list_for_each(assign_ebi_data->released_ebi_list, released_ebi_list_node) { + if (cJSON_AddNumberToObject(released_ebi_list, "", *(double *)released_ebi_list_node->data) == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [released_ebi_list]"); + goto end; + } + } + } + + if (assign_ebi_data->old_guami) { + cJSON *old_guami_local_JSON = OpenAPI_guami_convertToJSON(assign_ebi_data->old_guami); + if (old_guami_local_JSON == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [old_guami]"); + goto end; + } + cJSON_AddItemToObject(item, "oldGuami", old_guami_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [old_guami]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_parseFromJSON(cJSON *assign_ebi_dataJSON) +{ + OpenAPI_assign_ebi_data_t *assign_ebi_data_local_var = NULL; + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "pduSessionId"); + if (!pdu_session_id) { + ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + cJSON *arp_list = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "arpList"); + + OpenAPI_list_t *arp_listList; + if (arp_list) { + cJSON *arp_list_local_nonprimitive; + if (!cJSON_IsArray(arp_list)) { + ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [arp_list]"); + goto end; + } + + arp_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(arp_list_local_nonprimitive, arp_list ) { + if (!cJSON_IsObject(arp_list_local_nonprimitive)) { + ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [arp_list]"); + goto end; + } + OpenAPI_arp_t *arp_listItem = OpenAPI_arp_parseFromJSON(arp_list_local_nonprimitive); + + OpenAPI_list_add(arp_listList, arp_listItem); + } + } + + cJSON *released_ebi_list = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "releasedEbiList"); + + OpenAPI_list_t *released_ebi_listList; + if (released_ebi_list) { + cJSON *released_ebi_list_local; + if (!cJSON_IsArray(released_ebi_list)) { + ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [released_ebi_list]"); + goto end; + } + released_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(released_ebi_list_local, released_ebi_list) { + if (!cJSON_IsNumber(released_ebi_list_local)) { + ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [released_ebi_list]"); + goto end; + } + OpenAPI_list_add(released_ebi_listList, &released_ebi_list_local->valuedouble); + } + } + + cJSON *old_guami = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "oldGuami"); + + OpenAPI_guami_t *old_guami_local_nonprim = NULL; + if (old_guami) { + old_guami_local_nonprim = OpenAPI_guami_parseFromJSON(old_guami); + } + + assign_ebi_data_local_var = OpenAPI_assign_ebi_data_create ( + pdu_session_id->valuedouble, + arp_list ? arp_listList : NULL, + released_ebi_list ? released_ebi_listList : NULL, + old_guami ? old_guami_local_nonprim : NULL + ); + + return assign_ebi_data_local_var; +end: + return NULL; +} + +OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_copy(OpenAPI_assign_ebi_data_t *dst, OpenAPI_assign_ebi_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_assign_ebi_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_assign_ebi_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_assign_ebi_data_free(dst); + dst = OpenAPI_assign_ebi_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/assign_ebi_data.h b/lib/sbi/openapi/model/assign_ebi_data.h new file mode 100644 index 000000000..3ffc7a473 --- /dev/null +++ b/lib/sbi/openapi/model/assign_ebi_data.h @@ -0,0 +1,46 @@ +/* + * assign_ebi_data.h + * + * + */ + +#ifndef _OpenAPI_assign_ebi_data_H_ +#define _OpenAPI_assign_ebi_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "arp.h" +#include "guami.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_assign_ebi_data_s OpenAPI_assign_ebi_data_t; +typedef struct OpenAPI_assign_ebi_data_s { + int pdu_session_id; + OpenAPI_list_t *arp_list; + OpenAPI_list_t *released_ebi_list; + struct OpenAPI_guami_s *old_guami; +} OpenAPI_assign_ebi_data_t; + +OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_create( + int pdu_session_id, + OpenAPI_list_t *arp_list, + OpenAPI_list_t *released_ebi_list, + OpenAPI_guami_t *old_guami + ); +void OpenAPI_assign_ebi_data_free(OpenAPI_assign_ebi_data_t *assign_ebi_data); +OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_parseFromJSON(cJSON *assign_ebi_dataJSON); +cJSON *OpenAPI_assign_ebi_data_convertToJSON(OpenAPI_assign_ebi_data_t *assign_ebi_data); +OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_copy(OpenAPI_assign_ebi_data_t *dst, OpenAPI_assign_ebi_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_assign_ebi_data_H_ */ + diff --git a/lib/sbi/openapi/model/assign_ebi_error.c b/lib/sbi/openapi/model/assign_ebi_error.c new file mode 100644 index 000000000..45e1c37b4 --- /dev/null +++ b/lib/sbi/openapi/model/assign_ebi_error.c @@ -0,0 +1,143 @@ + +#include +#include +#include +#include "assign_ebi_error.h" + +OpenAPI_assign_ebi_error_t *OpenAPI_assign_ebi_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_assign_ebi_failed_t *failure_details + ) +{ + OpenAPI_assign_ebi_error_t *assign_ebi_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_assign_ebi_error_t)); + if (!assign_ebi_error_local_var) { + return NULL; + } + assign_ebi_error_local_var->error = error; + assign_ebi_error_local_var->failure_details = failure_details; + + return assign_ebi_error_local_var; +} + +void OpenAPI_assign_ebi_error_free(OpenAPI_assign_ebi_error_t *assign_ebi_error) +{ + if (NULL == assign_ebi_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(assign_ebi_error->error); + OpenAPI_assign_ebi_failed_free(assign_ebi_error->failure_details); + ogs_free(assign_ebi_error); +} + +cJSON *OpenAPI_assign_ebi_error_convertToJSON(OpenAPI_assign_ebi_error_t *assign_ebi_error) +{ + cJSON *item = NULL; + + if (assign_ebi_error == NULL) { + ogs_error("OpenAPI_assign_ebi_error_convertToJSON() failed [AssignEbiError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!assign_ebi_error->error) { + ogs_error("OpenAPI_assign_ebi_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(assign_ebi_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_assign_ebi_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_assign_ebi_error_convertToJSON() failed [error]"); + goto end; + } + + if (!assign_ebi_error->failure_details) { + ogs_error("OpenAPI_assign_ebi_error_convertToJSON() failed [failure_details]"); + goto end; + } + cJSON *failure_details_local_JSON = OpenAPI_assign_ebi_failed_convertToJSON(assign_ebi_error->failure_details); + if (failure_details_local_JSON == NULL) { + ogs_error("OpenAPI_assign_ebi_error_convertToJSON() failed [failure_details]"); + goto end; + } + cJSON_AddItemToObject(item, "failureDetails", failure_details_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_assign_ebi_error_convertToJSON() failed [failure_details]"); + goto end; + } + +end: + return item; +} + +OpenAPI_assign_ebi_error_t *OpenAPI_assign_ebi_error_parseFromJSON(cJSON *assign_ebi_errorJSON) +{ + OpenAPI_assign_ebi_error_t *assign_ebi_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(assign_ebi_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_assign_ebi_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *failure_details = cJSON_GetObjectItemCaseSensitive(assign_ebi_errorJSON, "failureDetails"); + if (!failure_details) { + ogs_error("OpenAPI_assign_ebi_error_parseFromJSON() failed [failure_details]"); + goto end; + } + + OpenAPI_assign_ebi_failed_t *failure_details_local_nonprim = NULL; + + failure_details_local_nonprim = OpenAPI_assign_ebi_failed_parseFromJSON(failure_details); + + assign_ebi_error_local_var = OpenAPI_assign_ebi_error_create ( + error_local_nonprim, + failure_details_local_nonprim + ); + + return assign_ebi_error_local_var; +end: + return NULL; +} + +OpenAPI_assign_ebi_error_t *OpenAPI_assign_ebi_error_copy(OpenAPI_assign_ebi_error_t *dst, OpenAPI_assign_ebi_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_assign_ebi_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_assign_ebi_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_assign_ebi_error_free(dst); + dst = OpenAPI_assign_ebi_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/assign_ebi_error.h b/lib/sbi/openapi/model/assign_ebi_error.h new file mode 100644 index 000000000..74e5f8570 --- /dev/null +++ b/lib/sbi/openapi/model/assign_ebi_error.h @@ -0,0 +1,42 @@ +/* + * assign_ebi_error.h + * + * + */ + +#ifndef _OpenAPI_assign_ebi_error_H_ +#define _OpenAPI_assign_ebi_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "assign_ebi_failed.h" +#include "problem_details.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_assign_ebi_error_s OpenAPI_assign_ebi_error_t; +typedef struct OpenAPI_assign_ebi_error_s { + struct OpenAPI_problem_details_s *error; + struct OpenAPI_assign_ebi_failed_s *failure_details; +} OpenAPI_assign_ebi_error_t; + +OpenAPI_assign_ebi_error_t *OpenAPI_assign_ebi_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_assign_ebi_failed_t *failure_details + ); +void OpenAPI_assign_ebi_error_free(OpenAPI_assign_ebi_error_t *assign_ebi_error); +OpenAPI_assign_ebi_error_t *OpenAPI_assign_ebi_error_parseFromJSON(cJSON *assign_ebi_errorJSON); +cJSON *OpenAPI_assign_ebi_error_convertToJSON(OpenAPI_assign_ebi_error_t *assign_ebi_error); +OpenAPI_assign_ebi_error_t *OpenAPI_assign_ebi_error_copy(OpenAPI_assign_ebi_error_t *dst, OpenAPI_assign_ebi_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_assign_ebi_error_H_ */ + diff --git a/lib/sbi/openapi/model/assign_ebi_failed.c b/lib/sbi/openapi/model/assign_ebi_failed.c new file mode 100644 index 000000000..b9824e247 --- /dev/null +++ b/lib/sbi/openapi/model/assign_ebi_failed.c @@ -0,0 +1,159 @@ + +#include +#include +#include +#include "assign_ebi_failed.h" + +OpenAPI_assign_ebi_failed_t *OpenAPI_assign_ebi_failed_create( + int pdu_session_id, + OpenAPI_list_t *failed_arp_list + ) +{ + OpenAPI_assign_ebi_failed_t *assign_ebi_failed_local_var = OpenAPI_malloc(sizeof(OpenAPI_assign_ebi_failed_t)); + if (!assign_ebi_failed_local_var) { + return NULL; + } + assign_ebi_failed_local_var->pdu_session_id = pdu_session_id; + assign_ebi_failed_local_var->failed_arp_list = failed_arp_list; + + return assign_ebi_failed_local_var; +} + +void OpenAPI_assign_ebi_failed_free(OpenAPI_assign_ebi_failed_t *assign_ebi_failed) +{ + if (NULL == assign_ebi_failed) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(assign_ebi_failed->failed_arp_list, node) { + OpenAPI_arp_free(node->data); + } + OpenAPI_list_free(assign_ebi_failed->failed_arp_list); + ogs_free(assign_ebi_failed); +} + +cJSON *OpenAPI_assign_ebi_failed_convertToJSON(OpenAPI_assign_ebi_failed_t *assign_ebi_failed) +{ + cJSON *item = NULL; + + if (assign_ebi_failed == NULL) { + ogs_error("OpenAPI_assign_ebi_failed_convertToJSON() failed [AssignEbiFailed]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!assign_ebi_failed->pdu_session_id) { + ogs_error("OpenAPI_assign_ebi_failed_convertToJSON() failed [pdu_session_id]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "pduSessionId", assign_ebi_failed->pdu_session_id) == NULL) { + ogs_error("OpenAPI_assign_ebi_failed_convertToJSON() failed [pdu_session_id]"); + goto end; + } + + if (assign_ebi_failed->failed_arp_list) { + cJSON *failed_arp_listList = cJSON_AddArrayToObject(item, "failedArpList"); + if (failed_arp_listList == NULL) { + ogs_error("OpenAPI_assign_ebi_failed_convertToJSON() failed [failed_arp_list]"); + goto end; + } + + OpenAPI_lnode_t *failed_arp_list_node; + if (assign_ebi_failed->failed_arp_list) { + OpenAPI_list_for_each(assign_ebi_failed->failed_arp_list, failed_arp_list_node) { + cJSON *itemLocal = OpenAPI_arp_convertToJSON(failed_arp_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_assign_ebi_failed_convertToJSON() failed [failed_arp_list]"); + goto end; + } + cJSON_AddItemToArray(failed_arp_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_assign_ebi_failed_t *OpenAPI_assign_ebi_failed_parseFromJSON(cJSON *assign_ebi_failedJSON) +{ + OpenAPI_assign_ebi_failed_t *assign_ebi_failed_local_var = NULL; + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(assign_ebi_failedJSON, "pduSessionId"); + if (!pdu_session_id) { + ogs_error("OpenAPI_assign_ebi_failed_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_assign_ebi_failed_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + cJSON *failed_arp_list = cJSON_GetObjectItemCaseSensitive(assign_ebi_failedJSON, "failedArpList"); + + OpenAPI_list_t *failed_arp_listList; + if (failed_arp_list) { + cJSON *failed_arp_list_local_nonprimitive; + if (!cJSON_IsArray(failed_arp_list)) { + ogs_error("OpenAPI_assign_ebi_failed_parseFromJSON() failed [failed_arp_list]"); + goto end; + } + + failed_arp_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(failed_arp_list_local_nonprimitive, failed_arp_list ) { + if (!cJSON_IsObject(failed_arp_list_local_nonprimitive)) { + ogs_error("OpenAPI_assign_ebi_failed_parseFromJSON() failed [failed_arp_list]"); + goto end; + } + OpenAPI_arp_t *failed_arp_listItem = OpenAPI_arp_parseFromJSON(failed_arp_list_local_nonprimitive); + + OpenAPI_list_add(failed_arp_listList, failed_arp_listItem); + } + } + + assign_ebi_failed_local_var = OpenAPI_assign_ebi_failed_create ( + pdu_session_id->valuedouble, + failed_arp_list ? failed_arp_listList : NULL + ); + + return assign_ebi_failed_local_var; +end: + return NULL; +} + +OpenAPI_assign_ebi_failed_t *OpenAPI_assign_ebi_failed_copy(OpenAPI_assign_ebi_failed_t *dst, OpenAPI_assign_ebi_failed_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_assign_ebi_failed_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_assign_ebi_failed_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_assign_ebi_failed_free(dst); + dst = OpenAPI_assign_ebi_failed_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/assign_ebi_failed.h b/lib/sbi/openapi/model/assign_ebi_failed.h new file mode 100644 index 000000000..5d29796d5 --- /dev/null +++ b/lib/sbi/openapi/model/assign_ebi_failed.h @@ -0,0 +1,41 @@ +/* + * assign_ebi_failed.h + * + * + */ + +#ifndef _OpenAPI_assign_ebi_failed_H_ +#define _OpenAPI_assign_ebi_failed_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "arp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_assign_ebi_failed_s OpenAPI_assign_ebi_failed_t; +typedef struct OpenAPI_assign_ebi_failed_s { + int pdu_session_id; + OpenAPI_list_t *failed_arp_list; +} OpenAPI_assign_ebi_failed_t; + +OpenAPI_assign_ebi_failed_t *OpenAPI_assign_ebi_failed_create( + int pdu_session_id, + OpenAPI_list_t *failed_arp_list + ); +void OpenAPI_assign_ebi_failed_free(OpenAPI_assign_ebi_failed_t *assign_ebi_failed); +OpenAPI_assign_ebi_failed_t *OpenAPI_assign_ebi_failed_parseFromJSON(cJSON *assign_ebi_failedJSON); +cJSON *OpenAPI_assign_ebi_failed_convertToJSON(OpenAPI_assign_ebi_failed_t *assign_ebi_failed); +OpenAPI_assign_ebi_failed_t *OpenAPI_assign_ebi_failed_copy(OpenAPI_assign_ebi_failed_t *dst, OpenAPI_assign_ebi_failed_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_assign_ebi_failed_H_ */ + diff --git a/lib/sbi/openapi/model/assigned_ebi_data.c b/lib/sbi/openapi/model/assigned_ebi_data.c new file mode 100644 index 000000000..6721bcb6f --- /dev/null +++ b/lib/sbi/openapi/model/assigned_ebi_data.c @@ -0,0 +1,257 @@ + +#include +#include +#include +#include "assigned_ebi_data.h" + +OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_create( + int pdu_session_id, + OpenAPI_list_t *assigned_ebi_list, + OpenAPI_list_t *failed_arp_list, + OpenAPI_list_t *released_ebi_list + ) +{ + OpenAPI_assigned_ebi_data_t *assigned_ebi_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_assigned_ebi_data_t)); + if (!assigned_ebi_data_local_var) { + return NULL; + } + assigned_ebi_data_local_var->pdu_session_id = pdu_session_id; + assigned_ebi_data_local_var->assigned_ebi_list = assigned_ebi_list; + assigned_ebi_data_local_var->failed_arp_list = failed_arp_list; + assigned_ebi_data_local_var->released_ebi_list = released_ebi_list; + + return assigned_ebi_data_local_var; +} + +void OpenAPI_assigned_ebi_data_free(OpenAPI_assigned_ebi_data_t *assigned_ebi_data) +{ + if (NULL == assigned_ebi_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(assigned_ebi_data->assigned_ebi_list, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(assigned_ebi_data->assigned_ebi_list); + OpenAPI_list_for_each(assigned_ebi_data->failed_arp_list, node) { + OpenAPI_arp_free(node->data); + } + OpenAPI_list_free(assigned_ebi_data->failed_arp_list); + OpenAPI_list_for_each(assigned_ebi_data->released_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(assigned_ebi_data->released_ebi_list); + ogs_free(assigned_ebi_data); +} + +cJSON *OpenAPI_assigned_ebi_data_convertToJSON(OpenAPI_assigned_ebi_data_t *assigned_ebi_data) +{ + cJSON *item = NULL; + + if (assigned_ebi_data == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [AssignedEbiData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!assigned_ebi_data->pdu_session_id) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "pduSessionId", assigned_ebi_data->pdu_session_id) == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + + if (!assigned_ebi_data->assigned_ebi_list) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [assigned_ebi_list]"); + goto end; + } + cJSON *assigned_ebi_listList = cJSON_AddArrayToObject(item, "assignedEbiList"); + if (assigned_ebi_listList == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [assigned_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *assigned_ebi_list_node; + if (assigned_ebi_data->assigned_ebi_list) { + OpenAPI_list_for_each(assigned_ebi_data->assigned_ebi_list, assigned_ebi_list_node) { + cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(assigned_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [assigned_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(assigned_ebi_listList, itemLocal); + } + } + + if (assigned_ebi_data->failed_arp_list) { + cJSON *failed_arp_listList = cJSON_AddArrayToObject(item, "failedArpList"); + if (failed_arp_listList == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [failed_arp_list]"); + goto end; + } + + OpenAPI_lnode_t *failed_arp_list_node; + if (assigned_ebi_data->failed_arp_list) { + OpenAPI_list_for_each(assigned_ebi_data->failed_arp_list, failed_arp_list_node) { + cJSON *itemLocal = OpenAPI_arp_convertToJSON(failed_arp_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [failed_arp_list]"); + goto end; + } + cJSON_AddItemToArray(failed_arp_listList, itemLocal); + } + } + } + + if (assigned_ebi_data->released_ebi_list) { + cJSON *released_ebi_list = cJSON_AddArrayToObject(item, "releasedEbiList"); + if (released_ebi_list == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [released_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *released_ebi_list_node; + OpenAPI_list_for_each(assigned_ebi_data->released_ebi_list, released_ebi_list_node) { + if (cJSON_AddNumberToObject(released_ebi_list, "", *(double *)released_ebi_list_node->data) == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [released_ebi_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_parseFromJSON(cJSON *assigned_ebi_dataJSON) +{ + OpenAPI_assigned_ebi_data_t *assigned_ebi_data_local_var = NULL; + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(assigned_ebi_dataJSON, "pduSessionId"); + if (!pdu_session_id) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + cJSON *assigned_ebi_list = cJSON_GetObjectItemCaseSensitive(assigned_ebi_dataJSON, "assignedEbiList"); + if (!assigned_ebi_list) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [assigned_ebi_list]"); + goto end; + } + + OpenAPI_list_t *assigned_ebi_listList; + + cJSON *assigned_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(assigned_ebi_list)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [assigned_ebi_list]"); + goto end; + } + + assigned_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(assigned_ebi_list_local_nonprimitive, assigned_ebi_list ) { + if (!cJSON_IsObject(assigned_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [assigned_ebi_list]"); + goto end; + } + OpenAPI_ebi_arp_mapping_t *assigned_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(assigned_ebi_list_local_nonprimitive); + + OpenAPI_list_add(assigned_ebi_listList, assigned_ebi_listItem); + } + + cJSON *failed_arp_list = cJSON_GetObjectItemCaseSensitive(assigned_ebi_dataJSON, "failedArpList"); + + OpenAPI_list_t *failed_arp_listList; + if (failed_arp_list) { + cJSON *failed_arp_list_local_nonprimitive; + if (!cJSON_IsArray(failed_arp_list)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [failed_arp_list]"); + goto end; + } + + failed_arp_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(failed_arp_list_local_nonprimitive, failed_arp_list ) { + if (!cJSON_IsObject(failed_arp_list_local_nonprimitive)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [failed_arp_list]"); + goto end; + } + OpenAPI_arp_t *failed_arp_listItem = OpenAPI_arp_parseFromJSON(failed_arp_list_local_nonprimitive); + + OpenAPI_list_add(failed_arp_listList, failed_arp_listItem); + } + } + + cJSON *released_ebi_list = cJSON_GetObjectItemCaseSensitive(assigned_ebi_dataJSON, "releasedEbiList"); + + OpenAPI_list_t *released_ebi_listList; + if (released_ebi_list) { + cJSON *released_ebi_list_local; + if (!cJSON_IsArray(released_ebi_list)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [released_ebi_list]"); + goto end; + } + released_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(released_ebi_list_local, released_ebi_list) { + if (!cJSON_IsNumber(released_ebi_list_local)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [released_ebi_list]"); + goto end; + } + OpenAPI_list_add(released_ebi_listList, &released_ebi_list_local->valuedouble); + } + } + + assigned_ebi_data_local_var = OpenAPI_assigned_ebi_data_create ( + pdu_session_id->valuedouble, + assigned_ebi_listList, + failed_arp_list ? failed_arp_listList : NULL, + released_ebi_list ? released_ebi_listList : NULL + ); + + return assigned_ebi_data_local_var; +end: + return NULL; +} + +OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_copy(OpenAPI_assigned_ebi_data_t *dst, OpenAPI_assigned_ebi_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_assigned_ebi_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_assigned_ebi_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_assigned_ebi_data_free(dst); + dst = OpenAPI_assigned_ebi_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/assigned_ebi_data.h b/lib/sbi/openapi/model/assigned_ebi_data.h new file mode 100644 index 000000000..6ac2fbdd4 --- /dev/null +++ b/lib/sbi/openapi/model/assigned_ebi_data.h @@ -0,0 +1,46 @@ +/* + * assigned_ebi_data.h + * + * + */ + +#ifndef _OpenAPI_assigned_ebi_data_H_ +#define _OpenAPI_assigned_ebi_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "arp.h" +#include "ebi_arp_mapping.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_assigned_ebi_data_s OpenAPI_assigned_ebi_data_t; +typedef struct OpenAPI_assigned_ebi_data_s { + int pdu_session_id; + OpenAPI_list_t *assigned_ebi_list; + OpenAPI_list_t *failed_arp_list; + OpenAPI_list_t *released_ebi_list; +} OpenAPI_assigned_ebi_data_t; + +OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_create( + int pdu_session_id, + OpenAPI_list_t *assigned_ebi_list, + OpenAPI_list_t *failed_arp_list, + OpenAPI_list_t *released_ebi_list + ); +void OpenAPI_assigned_ebi_data_free(OpenAPI_assigned_ebi_data_t *assigned_ebi_data); +OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_parseFromJSON(cJSON *assigned_ebi_dataJSON); +cJSON *OpenAPI_assigned_ebi_data_convertToJSON(OpenAPI_assigned_ebi_data_t *assigned_ebi_data); +OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_copy(OpenAPI_assigned_ebi_data_t *dst, OpenAPI_assigned_ebi_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_assigned_ebi_data_H_ */ + diff --git a/lib/sbi/openapi/model/association_type.c b/lib/sbi/openapi/model/association_type.c index b9acc3c19..9db72d309 100644 --- a/lib/sbi/openapi/model/association_type.c +++ b/lib/sbi/openapi/model/association_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_association_type_t *OpenAPI_association_type_copy(OpenAPI_association_type_t *dst, OpenAPI_association_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_association_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_association_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_association_type_free(dst); + dst = OpenAPI_association_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/association_type.h b/lib/sbi/openapi/model/association_type.h index a5fdacf59..a7a1993ff 100644 --- a/lib/sbi/openapi/model/association_type.h +++ b/lib/sbi/openapi/model/association_type.h @@ -26,6 +26,7 @@ OpenAPI_association_type_t *OpenAPI_association_type_create( void OpenAPI_association_type_free(OpenAPI_association_type_t *association_type); OpenAPI_association_type_t *OpenAPI_association_type_parseFromJSON(cJSON *association_typeJSON); cJSON *OpenAPI_association_type_convertToJSON(OpenAPI_association_type_t *association_type); +OpenAPI_association_type_t *OpenAPI_association_type_copy(OpenAPI_association_type_t *dst, OpenAPI_association_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/atom.c b/lib/sbi/openapi/model/atom.c index 8b3206b0a..06b0c3abc 100644 --- a/lib/sbi/openapi/model/atom.c +++ b/lib/sbi/openapi/model/atom.c @@ -60,7 +60,7 @@ cJSON *OpenAPI_atom_convertToJSON(OpenAPI_atom_t *atom) goto end; } - if (atom->negative >= 0) { + if (atom->negative) { if (cJSON_AddBoolToObject(item, "negative", atom->negative) == NULL) { ogs_error("OpenAPI_atom_convertToJSON() failed [negative]"); goto end; @@ -118,3 +118,37 @@ end: return NULL; } +OpenAPI_atom_t *OpenAPI_atom_copy(OpenAPI_atom_t *dst, OpenAPI_atom_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_atom_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_atom_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_atom_free(dst); + dst = OpenAPI_atom_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/atom.h b/lib/sbi/openapi/model/atom.h index 4f8046854..512a4a94b 100644 --- a/lib/sbi/openapi/model/atom.h +++ b/lib/sbi/openapi/model/atom.h @@ -32,6 +32,7 @@ OpenAPI_atom_t *OpenAPI_atom_create( void OpenAPI_atom_free(OpenAPI_atom_t *atom); OpenAPI_atom_t *OpenAPI_atom_parseFromJSON(cJSON *atomJSON); cJSON *OpenAPI_atom_convertToJSON(OpenAPI_atom_t *atom); +OpenAPI_atom_t *OpenAPI_atom_copy(OpenAPI_atom_t *dst, OpenAPI_atom_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/atsss_capability.c b/lib/sbi/openapi/model/atsss_capability.c index 55482d17b..432e87662 100644 --- a/lib/sbi/openapi/model/atsss_capability.c +++ b/lib/sbi/openapi/model/atsss_capability.c @@ -38,14 +38,14 @@ cJSON *OpenAPI_atsss_capability_convertToJSON(OpenAPI_atsss_capability_t *atsss_ } item = cJSON_CreateObject(); - if (atsss_capability->atsss_ll >= 0) { + if (atsss_capability->atsss_ll) { if (cJSON_AddBoolToObject(item, "atsssLL", atsss_capability->atsss_ll) == NULL) { ogs_error("OpenAPI_atsss_capability_convertToJSON() failed [atsss_ll]"); goto end; } } - if (atsss_capability->mptcp >= 0) { + if (atsss_capability->mptcp) { if (cJSON_AddBoolToObject(item, "mptcp", atsss_capability->mptcp) == NULL) { ogs_error("OpenAPI_atsss_capability_convertToJSON() failed [mptcp]"); goto end; @@ -87,3 +87,37 @@ end: return NULL; } +OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_copy(OpenAPI_atsss_capability_t *dst, OpenAPI_atsss_capability_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_atsss_capability_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_atsss_capability_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_atsss_capability_free(dst); + dst = OpenAPI_atsss_capability_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/atsss_capability.h b/lib/sbi/openapi/model/atsss_capability.h index 38881b57b..06489c3cb 100644 --- a/lib/sbi/openapi/model/atsss_capability.h +++ b/lib/sbi/openapi/model/atsss_capability.h @@ -30,6 +30,7 @@ OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create( void OpenAPI_atsss_capability_free(OpenAPI_atsss_capability_t *atsss_capability); OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_parseFromJSON(cJSON *atsss_capabilityJSON); cJSON *OpenAPI_atsss_capability_convertToJSON(OpenAPI_atsss_capability_t *atsss_capability); +OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_copy(OpenAPI_atsss_capability_t *dst, OpenAPI_atsss_capability_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ausf_info.c b/lib/sbi/openapi/model/ausf_info.c index 0105f1d5a..edb69d2c2 100644 --- a/lib/sbi/openapi/model/ausf_info.c +++ b/lib/sbi/openapi/model/ausf_info.c @@ -162,3 +162,37 @@ end: return NULL; } +OpenAPI_ausf_info_t *OpenAPI_ausf_info_copy(OpenAPI_ausf_info_t *dst, OpenAPI_ausf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ausf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ausf_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_ausf_info_free(dst); + dst = OpenAPI_ausf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ausf_info.h b/lib/sbi/openapi/model/ausf_info.h index caef626c8..6b337b899 100644 --- a/lib/sbi/openapi/model/ausf_info.h +++ b/lib/sbi/openapi/model/ausf_info.h @@ -33,6 +33,7 @@ OpenAPI_ausf_info_t *OpenAPI_ausf_info_create( void OpenAPI_ausf_info_free(OpenAPI_ausf_info_t *ausf_info); OpenAPI_ausf_info_t *OpenAPI_ausf_info_parseFromJSON(cJSON *ausf_infoJSON); cJSON *OpenAPI_ausf_info_convertToJSON(OpenAPI_ausf_info_t *ausf_info); +OpenAPI_ausf_info_t *OpenAPI_ausf_info_copy(OpenAPI_ausf_info_t *dst, OpenAPI_ausf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/auth_event.c b/lib/sbi/openapi/model/auth_event.c index f7bc3bffa..c427bf3a5 100644 --- a/lib/sbi/openapi/model/auth_event.c +++ b/lib/sbi/openapi/model/auth_event.c @@ -170,3 +170,37 @@ end: return NULL; } +OpenAPI_auth_event_t *OpenAPI_auth_event_copy(OpenAPI_auth_event_t *dst, OpenAPI_auth_event_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_auth_event_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_auth_event_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_auth_event_free(dst); + dst = OpenAPI_auth_event_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/auth_event.h b/lib/sbi/openapi/model/auth_event.h index 6726bc5de..fee6dd1de 100644 --- a/lib/sbi/openapi/model/auth_event.h +++ b/lib/sbi/openapi/model/auth_event.h @@ -37,6 +37,7 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create( void OpenAPI_auth_event_free(OpenAPI_auth_event_t *auth_event); OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON); cJSON *OpenAPI_auth_event_convertToJSON(OpenAPI_auth_event_t *auth_event); +OpenAPI_auth_event_t *OpenAPI_auth_event_copy(OpenAPI_auth_event_t *dst, OpenAPI_auth_event_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/authentication_info.c b/lib/sbi/openapi/model/authentication_info.c index 887d56f20..2a73e0ffa 100644 --- a/lib/sbi/openapi/model/authentication_info.c +++ b/lib/sbi/openapi/model/authentication_info.c @@ -227,3 +227,37 @@ end: return NULL; } +OpenAPI_authentication_info_t *OpenAPI_authentication_info_copy(OpenAPI_authentication_info_t *dst, OpenAPI_authentication_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_authentication_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_authentication_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_authentication_info_free(dst); + dst = OpenAPI_authentication_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/authentication_info.h b/lib/sbi/openapi/model/authentication_info.h index 5a46ea2e8..7cf72bc9e 100644 --- a/lib/sbi/openapi/model/authentication_info.h +++ b/lib/sbi/openapi/model/authentication_info.h @@ -44,6 +44,7 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_create( void OpenAPI_authentication_info_free(OpenAPI_authentication_info_t *authentication_info); OpenAPI_authentication_info_t *OpenAPI_authentication_info_parseFromJSON(cJSON *authentication_infoJSON); cJSON *OpenAPI_authentication_info_convertToJSON(OpenAPI_authentication_info_t *authentication_info); +OpenAPI_authentication_info_t *OpenAPI_authentication_info_copy(OpenAPI_authentication_info_t *dst, OpenAPI_authentication_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/authentication_info_request.c b/lib/sbi/openapi/model/authentication_info_request.c index 82ece5bb6..4c2962337 100644 --- a/lib/sbi/openapi/model/authentication_info_request.c +++ b/lib/sbi/openapi/model/authentication_info_request.c @@ -163,3 +163,37 @@ end: return NULL; } +OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_copy(OpenAPI_authentication_info_request_t *dst, OpenAPI_authentication_info_request_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_authentication_info_request_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_authentication_info_request_free(dst); + dst = OpenAPI_authentication_info_request_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/authentication_info_request.h b/lib/sbi/openapi/model/authentication_info_request.h index d6927d1a7..13c65ace9 100644 --- a/lib/sbi/openapi/model/authentication_info_request.h +++ b/lib/sbi/openapi/model/authentication_info_request.h @@ -37,6 +37,7 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat void OpenAPI_authentication_info_request_free(OpenAPI_authentication_info_request_t *authentication_info_request); OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parseFromJSON(cJSON *authentication_info_requestJSON); cJSON *OpenAPI_authentication_info_request_convertToJSON(OpenAPI_authentication_info_request_t *authentication_info_request); +OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_copy(OpenAPI_authentication_info_request_t *dst, OpenAPI_authentication_info_request_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/authentication_info_result.c b/lib/sbi/openapi/model/authentication_info_result.c index 26a1ad3ea..66da282b6 100644 --- a/lib/sbi/openapi/model/authentication_info_result.c +++ b/lib/sbi/openapi/model/authentication_info_result.c @@ -139,3 +139,37 @@ end: return NULL; } +OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_copy(OpenAPI_authentication_info_result_t *dst, OpenAPI_authentication_info_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_authentication_info_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_authentication_info_result_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_authentication_info_result_free(dst); + dst = OpenAPI_authentication_info_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/authentication_info_result.h b/lib/sbi/openapi/model/authentication_info_result.h index a81d1b805..f941ed9a9 100644 --- a/lib/sbi/openapi/model/authentication_info_result.h +++ b/lib/sbi/openapi/model/authentication_info_result.h @@ -36,6 +36,7 @@ OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_create( void OpenAPI_authentication_info_result_free(OpenAPI_authentication_info_result_t *authentication_info_result); OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_parseFromJSON(cJSON *authentication_info_resultJSON); cJSON *OpenAPI_authentication_info_result_convertToJSON(OpenAPI_authentication_info_result_t *authentication_info_result); +OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_copy(OpenAPI_authentication_info_result_t *dst, OpenAPI_authentication_info_result_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/authentication_subscription.c b/lib/sbi/openapi/model/authentication_subscription.c index b08bcdbda..0481704fe 100644 --- a/lib/sbi/openapi/model/authentication_subscription.c +++ b/lib/sbi/openapi/model/authentication_subscription.c @@ -123,7 +123,7 @@ cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_ } } - if (authentication_subscription->vector_generation_in_hss >= 0) { + if (authentication_subscription->vector_generation_in_hss) { if (cJSON_AddBoolToObject(item, "vectorGenerationInHss", authentication_subscription->vector_generation_in_hss) == NULL) { ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [vector_generation_in_hss]"); goto end; @@ -238,3 +238,37 @@ end: return NULL; } +OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_copy(OpenAPI_authentication_subscription_t *dst, OpenAPI_authentication_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_authentication_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_authentication_subscription_free(dst); + dst = OpenAPI_authentication_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/authentication_subscription.h b/lib/sbi/openapi/model/authentication_subscription.h index 3c613398c..d1e9b411e 100644 --- a/lib/sbi/openapi/model/authentication_subscription.h +++ b/lib/sbi/openapi/model/authentication_subscription.h @@ -46,6 +46,7 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat void OpenAPI_authentication_subscription_free(OpenAPI_authentication_subscription_t *authentication_subscription); OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parseFromJSON(cJSON *authentication_subscriptionJSON); cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_subscription_t *authentication_subscription); +OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_copy(OpenAPI_authentication_subscription_t *dst, OpenAPI_authentication_subscription_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/authentication_vector.c b/lib/sbi/openapi/model/authentication_vector.c index e0a2faa49..3d88df606 100644 --- a/lib/sbi/openapi/model/authentication_vector.c +++ b/lib/sbi/openapi/model/authentication_vector.c @@ -225,3 +225,37 @@ end: return NULL; } +OpenAPI_authentication_vector_t *OpenAPI_authentication_vector_copy(OpenAPI_authentication_vector_t *dst, OpenAPI_authentication_vector_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_authentication_vector_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_authentication_vector_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_authentication_vector_free(dst); + dst = OpenAPI_authentication_vector_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/authentication_vector.h b/lib/sbi/openapi/model/authentication_vector.h index 2c1420f9a..4be13e2f8 100644 --- a/lib/sbi/openapi/model/authentication_vector.h +++ b/lib/sbi/openapi/model/authentication_vector.h @@ -45,6 +45,7 @@ OpenAPI_authentication_vector_t *OpenAPI_authentication_vector_create( void OpenAPI_authentication_vector_free(OpenAPI_authentication_vector_t *authentication_vector); OpenAPI_authentication_vector_t *OpenAPI_authentication_vector_parseFromJSON(cJSON *authentication_vectorJSON); cJSON *OpenAPI_authentication_vector_convertToJSON(OpenAPI_authentication_vector_t *authentication_vector); +OpenAPI_authentication_vector_t *OpenAPI_authentication_vector_copy(OpenAPI_authentication_vector_t *dst, OpenAPI_authentication_vector_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/authorization_data.c b/lib/sbi/openapi/model/authorization_data.c index 3edbf356b..802963fb4 100644 --- a/lib/sbi/openapi/model/authorization_data.c +++ b/lib/sbi/openapi/model/authorization_data.c @@ -124,3 +124,37 @@ end: return NULL; } +OpenAPI_authorization_data_t *OpenAPI_authorization_data_copy(OpenAPI_authorization_data_t *dst, OpenAPI_authorization_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_authorization_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_authorization_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_authorization_data_free(dst); + dst = OpenAPI_authorization_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/authorization_data.h b/lib/sbi/openapi/model/authorization_data.h index c7330fdf5..388c623c3 100644 --- a/lib/sbi/openapi/model/authorization_data.h +++ b/lib/sbi/openapi/model/authorization_data.h @@ -31,6 +31,7 @@ OpenAPI_authorization_data_t *OpenAPI_authorization_data_create( void OpenAPI_authorization_data_free(OpenAPI_authorization_data_t *authorization_data); OpenAPI_authorization_data_t *OpenAPI_authorization_data_parseFromJSON(cJSON *authorization_dataJSON); cJSON *OpenAPI_authorization_data_convertToJSON(OpenAPI_authorization_data_t *authorization_data); +OpenAPI_authorization_data_t *OpenAPI_authorization_data_copy(OpenAPI_authorization_data_t *dst, OpenAPI_authorization_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/av5_g_he_aka.c b/lib/sbi/openapi/model/av5_g_he_aka.c index 961e2c911..29cb58c7c 100644 --- a/lib/sbi/openapi/model/av5_g_he_aka.c +++ b/lib/sbi/openapi/model/av5_g_he_aka.c @@ -165,3 +165,37 @@ end: return NULL; } +OpenAPI_av5_g_he_aka_t *OpenAPI_av5_g_he_aka_copy(OpenAPI_av5_g_he_aka_t *dst, OpenAPI_av5_g_he_aka_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_av5_g_he_aka_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_av5_g_he_aka_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_av5_g_he_aka_free(dst); + dst = OpenAPI_av5_g_he_aka_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/av5_g_he_aka.h b/lib/sbi/openapi/model/av5_g_he_aka.h index f81a315b1..cc0421452 100644 --- a/lib/sbi/openapi/model/av5_g_he_aka.h +++ b/lib/sbi/openapi/model/av5_g_he_aka.h @@ -37,6 +37,7 @@ OpenAPI_av5_g_he_aka_t *OpenAPI_av5_g_he_aka_create( void OpenAPI_av5_g_he_aka_free(OpenAPI_av5_g_he_aka_t *av5_g_he_aka); OpenAPI_av5_g_he_aka_t *OpenAPI_av5_g_he_aka_parseFromJSON(cJSON *av5_g_he_akaJSON); cJSON *OpenAPI_av5_g_he_aka_convertToJSON(OpenAPI_av5_g_he_aka_t *av5_g_he_aka); +OpenAPI_av5_g_he_aka_t *OpenAPI_av5_g_he_aka_copy(OpenAPI_av5_g_he_aka_t *dst, OpenAPI_av5_g_he_aka_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/av5g_aka.c b/lib/sbi/openapi/model/av5g_aka.c index fd41f1037..d1b343a84 100644 --- a/lib/sbi/openapi/model/av5g_aka.c +++ b/lib/sbi/openapi/model/av5g_aka.c @@ -124,3 +124,37 @@ end: return NULL; } +OpenAPI_av5g_aka_t *OpenAPI_av5g_aka_copy(OpenAPI_av5g_aka_t *dst, OpenAPI_av5g_aka_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_av5g_aka_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_av5g_aka_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_av5g_aka_free(dst); + dst = OpenAPI_av5g_aka_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/av5g_aka.h b/lib/sbi/openapi/model/av5g_aka.h index 0495df9db..d0508b56c 100644 --- a/lib/sbi/openapi/model/av5g_aka.h +++ b/lib/sbi/openapi/model/av5g_aka.h @@ -32,6 +32,7 @@ OpenAPI_av5g_aka_t *OpenAPI_av5g_aka_create( void OpenAPI_av5g_aka_free(OpenAPI_av5g_aka_t *av5g_aka); OpenAPI_av5g_aka_t *OpenAPI_av5g_aka_parseFromJSON(cJSON *av5g_akaJSON); cJSON *OpenAPI_av5g_aka_convertToJSON(OpenAPI_av5g_aka_t *av5g_aka); +OpenAPI_av5g_aka_t *OpenAPI_av5g_aka_copy(OpenAPI_av5g_aka_t *dst, OpenAPI_av5g_aka_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/av_eap_aka_prime.c b/lib/sbi/openapi/model/av_eap_aka_prime.c index 09303d285..04b8cbf94 100644 --- a/lib/sbi/openapi/model/av_eap_aka_prime.c +++ b/lib/sbi/openapi/model/av_eap_aka_prime.c @@ -185,3 +185,37 @@ end: return NULL; } +OpenAPI_av_eap_aka_prime_t *OpenAPI_av_eap_aka_prime_copy(OpenAPI_av_eap_aka_prime_t *dst, OpenAPI_av_eap_aka_prime_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_av_eap_aka_prime_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_av_eap_aka_prime_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_av_eap_aka_prime_free(dst); + dst = OpenAPI_av_eap_aka_prime_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/av_eap_aka_prime.h b/lib/sbi/openapi/model/av_eap_aka_prime.h index baf6e74e3..bb8dfd072 100644 --- a/lib/sbi/openapi/model/av_eap_aka_prime.h +++ b/lib/sbi/openapi/model/av_eap_aka_prime.h @@ -39,6 +39,7 @@ OpenAPI_av_eap_aka_prime_t *OpenAPI_av_eap_aka_prime_create( void OpenAPI_av_eap_aka_prime_free(OpenAPI_av_eap_aka_prime_t *av_eap_aka_prime); OpenAPI_av_eap_aka_prime_t *OpenAPI_av_eap_aka_prime_parseFromJSON(cJSON *av_eap_aka_primeJSON); cJSON *OpenAPI_av_eap_aka_prime_convertToJSON(OpenAPI_av_eap_aka_prime_t *av_eap_aka_prime); +OpenAPI_av_eap_aka_prime_t *OpenAPI_av_eap_aka_prime_copy(OpenAPI_av_eap_aka_prime_t *dst, OpenAPI_av_eap_aka_prime_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/av_eps_aka.c b/lib/sbi/openapi/model/av_eps_aka.c index d4ea6cc36..8dc18a492 100644 --- a/lib/sbi/openapi/model/av_eps_aka.c +++ b/lib/sbi/openapi/model/av_eps_aka.c @@ -178,3 +178,37 @@ end: return NULL; } +OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_copy(OpenAPI_av_eps_aka_t *dst, OpenAPI_av_eps_aka_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_av_eps_aka_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_av_eps_aka_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_av_eps_aka_free(dst); + dst = OpenAPI_av_eps_aka_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/av_eps_aka.h b/lib/sbi/openapi/model/av_eps_aka.h index d55be36bd..e7ad906e8 100644 --- a/lib/sbi/openapi/model/av_eps_aka.h +++ b/lib/sbi/openapi/model/av_eps_aka.h @@ -37,6 +37,7 @@ OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_create( void OpenAPI_av_eps_aka_free(OpenAPI_av_eps_aka_t *av_eps_aka); OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_parseFromJSON(cJSON *av_eps_akaJSON); cJSON *OpenAPI_av_eps_aka_convertToJSON(OpenAPI_av_eps_aka_t *av_eps_aka); +OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_copy(OpenAPI_av_eps_aka_t *dst, OpenAPI_av_eps_aka_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/av_ims_gba_eap_aka.c b/lib/sbi/openapi/model/av_ims_gba_eap_aka.c index 7140f100e..3b524efe4 100644 --- a/lib/sbi/openapi/model/av_ims_gba_eap_aka.c +++ b/lib/sbi/openapi/model/av_ims_gba_eap_aka.c @@ -203,3 +203,37 @@ end: return NULL; } +OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_copy(OpenAPI_av_ims_gba_eap_aka_t *dst, OpenAPI_av_ims_gba_eap_aka_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_av_ims_gba_eap_aka_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_av_ims_gba_eap_aka_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_av_ims_gba_eap_aka_free(dst); + dst = OpenAPI_av_ims_gba_eap_aka_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/av_ims_gba_eap_aka.h b/lib/sbi/openapi/model/av_ims_gba_eap_aka.h index e0dbefea5..9804c3c6e 100644 --- a/lib/sbi/openapi/model/av_ims_gba_eap_aka.h +++ b/lib/sbi/openapi/model/av_ims_gba_eap_aka.h @@ -39,6 +39,7 @@ OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_create( void OpenAPI_av_ims_gba_eap_aka_free(OpenAPI_av_ims_gba_eap_aka_t *av_ims_gba_eap_aka); OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_parseFromJSON(cJSON *av_ims_gba_eap_akaJSON); cJSON *OpenAPI_av_ims_gba_eap_aka_convertToJSON(OpenAPI_av_ims_gba_eap_aka_t *av_ims_gba_eap_aka); +OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_copy(OpenAPI_av_ims_gba_eap_aka_t *dst, OpenAPI_av_ims_gba_eap_aka_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/backup_amf_info.c b/lib/sbi/openapi/model/backup_amf_info.c index 12aa5a4ac..663162fc8 100644 --- a/lib/sbi/openapi/model/backup_amf_info.c +++ b/lib/sbi/openapi/model/backup_amf_info.c @@ -124,3 +124,37 @@ end: return NULL; } +OpenAPI_backup_amf_info_t *OpenAPI_backup_amf_info_copy(OpenAPI_backup_amf_info_t *dst, OpenAPI_backup_amf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_backup_amf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_backup_amf_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_backup_amf_info_free(dst); + dst = OpenAPI_backup_amf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/backup_amf_info.h b/lib/sbi/openapi/model/backup_amf_info.h index 0091c093c..eed0a3fc0 100644 --- a/lib/sbi/openapi/model/backup_amf_info.h +++ b/lib/sbi/openapi/model/backup_amf_info.h @@ -31,6 +31,7 @@ OpenAPI_backup_amf_info_t *OpenAPI_backup_amf_info_create( void OpenAPI_backup_amf_info_free(OpenAPI_backup_amf_info_t *backup_amf_info); OpenAPI_backup_amf_info_t *OpenAPI_backup_amf_info_parseFromJSON(cJSON *backup_amf_infoJSON); cJSON *OpenAPI_backup_amf_info_convertToJSON(OpenAPI_backup_amf_info_t *backup_amf_info); +OpenAPI_backup_amf_info_t *OpenAPI_backup_amf_info_copy(OpenAPI_backup_amf_info_t *dst, OpenAPI_backup_amf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/battery_indication.c b/lib/sbi/openapi/model/battery_indication.c index d22b21336..49392f37d 100644 --- a/lib/sbi/openapi/model/battery_indication.c +++ b/lib/sbi/openapi/model/battery_indication.c @@ -40,21 +40,21 @@ cJSON *OpenAPI_battery_indication_convertToJSON(OpenAPI_battery_indication_t *ba } item = cJSON_CreateObject(); - if (battery_indication->battery_ind >= 0) { + if (battery_indication->battery_ind) { if (cJSON_AddBoolToObject(item, "batteryInd", battery_indication->battery_ind) == NULL) { ogs_error("OpenAPI_battery_indication_convertToJSON() failed [battery_ind]"); goto end; } } - if (battery_indication->replaceable_ind >= 0) { + if (battery_indication->replaceable_ind) { if (cJSON_AddBoolToObject(item, "replaceableInd", battery_indication->replaceable_ind) == NULL) { ogs_error("OpenAPI_battery_indication_convertToJSON() failed [replaceable_ind]"); goto end; } } - if (battery_indication->rechargeable_ind >= 0) { + if (battery_indication->rechargeable_ind) { if (cJSON_AddBoolToObject(item, "rechargeableInd", battery_indication->rechargeable_ind) == NULL) { ogs_error("OpenAPI_battery_indication_convertToJSON() failed [rechargeable_ind]"); goto end; @@ -106,3 +106,37 @@ end: return NULL; } +OpenAPI_battery_indication_t *OpenAPI_battery_indication_copy(OpenAPI_battery_indication_t *dst, OpenAPI_battery_indication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_battery_indication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_battery_indication_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_battery_indication_free(dst); + dst = OpenAPI_battery_indication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/battery_indication.h b/lib/sbi/openapi/model/battery_indication.h index d57319dcd..6988a2487 100644 --- a/lib/sbi/openapi/model/battery_indication.h +++ b/lib/sbi/openapi/model/battery_indication.h @@ -32,6 +32,7 @@ OpenAPI_battery_indication_t *OpenAPI_battery_indication_create( void OpenAPI_battery_indication_free(OpenAPI_battery_indication_t *battery_indication); OpenAPI_battery_indication_t *OpenAPI_battery_indication_parseFromJSON(cJSON *battery_indicationJSON); cJSON *OpenAPI_battery_indication_convertToJSON(OpenAPI_battery_indication_t *battery_indication); +OpenAPI_battery_indication_t *OpenAPI_battery_indication_copy(OpenAPI_battery_indication_t *dst, OpenAPI_battery_indication_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/battery_indication_rm.c b/lib/sbi/openapi/model/battery_indication_rm.c index 43af2a9a1..2d5fda39e 100644 --- a/lib/sbi/openapi/model/battery_indication_rm.c +++ b/lib/sbi/openapi/model/battery_indication_rm.c @@ -40,21 +40,21 @@ cJSON *OpenAPI_battery_indication_rm_convertToJSON(OpenAPI_battery_indication_rm } item = cJSON_CreateObject(); - if (battery_indication_rm->battery_ind >= 0) { + if (battery_indication_rm->battery_ind) { if (cJSON_AddBoolToObject(item, "batteryInd", battery_indication_rm->battery_ind) == NULL) { ogs_error("OpenAPI_battery_indication_rm_convertToJSON() failed [battery_ind]"); goto end; } } - if (battery_indication_rm->replaceable_ind >= 0) { + if (battery_indication_rm->replaceable_ind) { if (cJSON_AddBoolToObject(item, "replaceableInd", battery_indication_rm->replaceable_ind) == NULL) { ogs_error("OpenAPI_battery_indication_rm_convertToJSON() failed [replaceable_ind]"); goto end; } } - if (battery_indication_rm->rechargeable_ind >= 0) { + if (battery_indication_rm->rechargeable_ind) { if (cJSON_AddBoolToObject(item, "rechargeableInd", battery_indication_rm->rechargeable_ind) == NULL) { ogs_error("OpenAPI_battery_indication_rm_convertToJSON() failed [rechargeable_ind]"); goto end; @@ -106,3 +106,37 @@ end: return NULL; } +OpenAPI_battery_indication_rm_t *OpenAPI_battery_indication_rm_copy(OpenAPI_battery_indication_rm_t *dst, OpenAPI_battery_indication_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_battery_indication_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_battery_indication_rm_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_battery_indication_rm_free(dst); + dst = OpenAPI_battery_indication_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/battery_indication_rm.h b/lib/sbi/openapi/model/battery_indication_rm.h index 8ebf8770b..e4d3c39a1 100644 --- a/lib/sbi/openapi/model/battery_indication_rm.h +++ b/lib/sbi/openapi/model/battery_indication_rm.h @@ -34,6 +34,7 @@ OpenAPI_battery_indication_rm_t *OpenAPI_battery_indication_rm_create( void OpenAPI_battery_indication_rm_free(OpenAPI_battery_indication_rm_t *battery_indication_rm); OpenAPI_battery_indication_rm_t *OpenAPI_battery_indication_rm_parseFromJSON(cJSON *battery_indication_rmJSON); cJSON *OpenAPI_battery_indication_rm_convertToJSON(OpenAPI_battery_indication_rm_t *battery_indication_rm); +OpenAPI_battery_indication_rm_t *OpenAPI_battery_indication_rm_copy(OpenAPI_battery_indication_rm_t *dst, OpenAPI_battery_indication_rm_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/bdt_data.c b/lib/sbi/openapi/model/bdt_data.c index d2280e16b..5f440e262 100644 --- a/lib/sbi/openapi/model/bdt_data.c +++ b/lib/sbi/openapi/model/bdt_data.c @@ -234,3 +234,37 @@ end: return NULL; } +OpenAPI_bdt_data_t *OpenAPI_bdt_data_copy(OpenAPI_bdt_data_t *dst, OpenAPI_bdt_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bdt_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bdt_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_bdt_data_free(dst); + dst = OpenAPI_bdt_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bdt_data.h b/lib/sbi/openapi/model/bdt_data.h index f5b02bb34..db817db96 100644 --- a/lib/sbi/openapi/model/bdt_data.h +++ b/lib/sbi/openapi/model/bdt_data.h @@ -46,6 +46,7 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_create( void OpenAPI_bdt_data_free(OpenAPI_bdt_data_t *bdt_data); OpenAPI_bdt_data_t *OpenAPI_bdt_data_parseFromJSON(cJSON *bdt_dataJSON); cJSON *OpenAPI_bdt_data_convertToJSON(OpenAPI_bdt_data_t *bdt_data); +OpenAPI_bdt_data_t *OpenAPI_bdt_data_copy(OpenAPI_bdt_data_t *dst, OpenAPI_bdt_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/bdt_policy_data.c b/lib/sbi/openapi/model/bdt_policy_data.c index 02556f085..1c9fa9e80 100644 --- a/lib/sbi/openapi/model/bdt_policy_data.c +++ b/lib/sbi/openapi/model/bdt_policy_data.c @@ -158,3 +158,37 @@ end: return NULL; } +OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_copy(OpenAPI_bdt_policy_data_t *dst, OpenAPI_bdt_policy_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bdt_policy_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bdt_policy_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_bdt_policy_data_free(dst); + dst = OpenAPI_bdt_policy_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bdt_policy_data.h b/lib/sbi/openapi/model/bdt_policy_data.h index d3631c8a8..708239cbd 100644 --- a/lib/sbi/openapi/model/bdt_policy_data.h +++ b/lib/sbi/openapi/model/bdt_policy_data.h @@ -37,6 +37,7 @@ OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_create( void OpenAPI_bdt_policy_data_free(OpenAPI_bdt_policy_data_t *bdt_policy_data); OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_parseFromJSON(cJSON *bdt_policy_dataJSON); cJSON *OpenAPI_bdt_policy_data_convertToJSON(OpenAPI_bdt_policy_data_t *bdt_policy_data); +OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_copy(OpenAPI_bdt_policy_data_t *dst, OpenAPI_bdt_policy_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/bdt_policy_data_patch.c b/lib/sbi/openapi/model/bdt_policy_data_patch.c index f23394314..b5067c220 100644 --- a/lib/sbi/openapi/model/bdt_policy_data_patch.c +++ b/lib/sbi/openapi/model/bdt_policy_data_patch.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_bdt_policy_data_patch_t *OpenAPI_bdt_policy_data_patch_copy(OpenAPI_bdt_policy_data_patch_t *dst, OpenAPI_bdt_policy_data_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bdt_policy_data_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bdt_policy_data_patch_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_bdt_policy_data_patch_free(dst); + dst = OpenAPI_bdt_policy_data_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bdt_policy_data_patch.h b/lib/sbi/openapi/model/bdt_policy_data_patch.h index f24327bf9..67a2c2e36 100644 --- a/lib/sbi/openapi/model/bdt_policy_data_patch.h +++ b/lib/sbi/openapi/model/bdt_policy_data_patch.h @@ -28,6 +28,7 @@ OpenAPI_bdt_policy_data_patch_t *OpenAPI_bdt_policy_data_patch_create( void OpenAPI_bdt_policy_data_patch_free(OpenAPI_bdt_policy_data_patch_t *bdt_policy_data_patch); OpenAPI_bdt_policy_data_patch_t *OpenAPI_bdt_policy_data_patch_parseFromJSON(cJSON *bdt_policy_data_patchJSON); cJSON *OpenAPI_bdt_policy_data_patch_convertToJSON(OpenAPI_bdt_policy_data_patch_t *bdt_policy_data_patch); +OpenAPI_bdt_policy_data_patch_t *OpenAPI_bdt_policy_data_patch_copy(OpenAPI_bdt_policy_data_patch_t *dst, OpenAPI_bdt_policy_data_patch_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/bsf_info.c b/lib/sbi/openapi/model/bsf_info.c index ace4c42a8..e12de259b 100644 --- a/lib/sbi/openapi/model/bsf_info.c +++ b/lib/sbi/openapi/model/bsf_info.c @@ -235,3 +235,37 @@ end: return NULL; } +OpenAPI_bsf_info_t *OpenAPI_bsf_info_copy(OpenAPI_bsf_info_t *dst, OpenAPI_bsf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bsf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bsf_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_bsf_info_free(dst); + dst = OpenAPI_bsf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bsf_info.h b/lib/sbi/openapi/model/bsf_info.h index 2851fc7cd..dcbcf7b56 100644 --- a/lib/sbi/openapi/model/bsf_info.h +++ b/lib/sbi/openapi/model/bsf_info.h @@ -36,6 +36,7 @@ OpenAPI_bsf_info_t *OpenAPI_bsf_info_create( void OpenAPI_bsf_info_free(OpenAPI_bsf_info_t *bsf_info); OpenAPI_bsf_info_t *OpenAPI_bsf_info_parseFromJSON(cJSON *bsf_infoJSON); cJSON *OpenAPI_bsf_info_convertToJSON(OpenAPI_bsf_info_t *bsf_info); +OpenAPI_bsf_info_t *OpenAPI_bsf_info_copy(OpenAPI_bsf_info_t *dst, OpenAPI_bsf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cag_ack_data.c b/lib/sbi/openapi/model/cag_ack_data.c index 7d62ecdd2..7c338bfc0 100644 --- a/lib/sbi/openapi/model/cag_ack_data.c +++ b/lib/sbi/openapi/model/cag_ack_data.c @@ -100,3 +100,37 @@ end: return NULL; } +OpenAPI_cag_ack_data_t *OpenAPI_cag_ack_data_copy(OpenAPI_cag_ack_data_t *dst, OpenAPI_cag_ack_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cag_ack_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cag_ack_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_cag_ack_data_free(dst); + dst = OpenAPI_cag_ack_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cag_ack_data.h b/lib/sbi/openapi/model/cag_ack_data.h index afc912e61..de9b540fe 100644 --- a/lib/sbi/openapi/model/cag_ack_data.h +++ b/lib/sbi/openapi/model/cag_ack_data.h @@ -31,6 +31,7 @@ OpenAPI_cag_ack_data_t *OpenAPI_cag_ack_data_create( void OpenAPI_cag_ack_data_free(OpenAPI_cag_ack_data_t *cag_ack_data); OpenAPI_cag_ack_data_t *OpenAPI_cag_ack_data_parseFromJSON(cJSON *cag_ack_dataJSON); cJSON *OpenAPI_cag_ack_data_convertToJSON(OpenAPI_cag_ack_data_t *cag_ack_data); +OpenAPI_cag_ack_data_t *OpenAPI_cag_ack_data_copy(OpenAPI_cag_ack_data_t *dst, OpenAPI_cag_ack_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cag_data.c b/lib/sbi/openapi/model/cag_data.c index 9b2298af7..0bf255b38 100644 --- a/lib/sbi/openapi/model/cag_data.c +++ b/lib/sbi/openapi/model/cag_data.c @@ -127,3 +127,37 @@ end: return NULL; } +OpenAPI_cag_data_t *OpenAPI_cag_data_copy(OpenAPI_cag_data_t *dst, OpenAPI_cag_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cag_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cag_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_cag_data_free(dst); + dst = OpenAPI_cag_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cag_data.h b/lib/sbi/openapi/model/cag_data.h index d4004e95a..cf4c6b4e5 100644 --- a/lib/sbi/openapi/model/cag_data.h +++ b/lib/sbi/openapi/model/cag_data.h @@ -31,6 +31,7 @@ OpenAPI_cag_data_t *OpenAPI_cag_data_create( void OpenAPI_cag_data_free(OpenAPI_cag_data_t *cag_data); OpenAPI_cag_data_t *OpenAPI_cag_data_parseFromJSON(cJSON *cag_dataJSON); cJSON *OpenAPI_cag_data_convertToJSON(OpenAPI_cag_data_t *cag_data); +OpenAPI_cag_data_t *OpenAPI_cag_data_copy(OpenAPI_cag_data_t *dst, OpenAPI_cag_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cag_info.c b/lib/sbi/openapi/model/cag_info.c index ba31a5c8c..6590d83fa 100644 --- a/lib/sbi/openapi/model/cag_info.c +++ b/lib/sbi/openapi/model/cag_info.c @@ -60,7 +60,7 @@ cJSON *OpenAPI_cag_info_convertToJSON(OpenAPI_cag_info_t *cag_info) } } - if (cag_info->cag_only_indicator >= 0) { + if (cag_info->cag_only_indicator) { if (cJSON_AddBoolToObject(item, "cagOnlyIndicator", cag_info->cag_only_indicator) == NULL) { ogs_error("OpenAPI_cag_info_convertToJSON() failed [cag_only_indicator]"); goto end; @@ -116,3 +116,37 @@ end: return NULL; } +OpenAPI_cag_info_t *OpenAPI_cag_info_copy(OpenAPI_cag_info_t *dst, OpenAPI_cag_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cag_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cag_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_cag_info_free(dst); + dst = OpenAPI_cag_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cag_info.h b/lib/sbi/openapi/model/cag_info.h index 07878d60e..920a99baf 100644 --- a/lib/sbi/openapi/model/cag_info.h +++ b/lib/sbi/openapi/model/cag_info.h @@ -30,6 +30,7 @@ OpenAPI_cag_info_t *OpenAPI_cag_info_create( void OpenAPI_cag_info_free(OpenAPI_cag_info_t *cag_info); OpenAPI_cag_info_t *OpenAPI_cag_info_parseFromJSON(cJSON *cag_infoJSON); cJSON *OpenAPI_cag_info_convertToJSON(OpenAPI_cag_info_t *cag_info); +OpenAPI_cag_info_t *OpenAPI_cag_info_copy(OpenAPI_cag_info_t *dst, OpenAPI_cag_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cause.c b/lib/sbi/openapi/model/cause.c new file mode 100644 index 000000000..15433fca4 --- /dev/null +++ b/lib/sbi/openapi/model/cause.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "cause.h" + +OpenAPI_cause_t *OpenAPI_cause_create( + ) +{ + OpenAPI_cause_t *cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_cause_t)); + if (!cause_local_var) { + return NULL; + } + + return cause_local_var; +} + +void OpenAPI_cause_free(OpenAPI_cause_t *cause) +{ + if (NULL == cause) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(cause); +} + +cJSON *OpenAPI_cause_convertToJSON(OpenAPI_cause_t *cause) +{ + cJSON *item = NULL; + + if (cause == NULL) { + ogs_error("OpenAPI_cause_convertToJSON() failed [Cause]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_cause_t *OpenAPI_cause_parseFromJSON(cJSON *causeJSON) +{ + OpenAPI_cause_t *cause_local_var = NULL; + cause_local_var = OpenAPI_cause_create ( + ); + + return cause_local_var; +end: + return NULL; +} + +OpenAPI_cause_t *OpenAPI_cause_copy(OpenAPI_cause_t *dst, OpenAPI_cause_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cause_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cause_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_cause_free(dst); + dst = OpenAPI_cause_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cause.h b/lib/sbi/openapi/model/cause.h new file mode 100644 index 000000000..ebafc39c3 --- /dev/null +++ b/lib/sbi/openapi/model/cause.h @@ -0,0 +1,36 @@ +/* + * cause.h + * + * Possible values are - REL_DUE_TO_HO - EPS_FALLBACK - REL_DUE_TO_UP_SEC - DNN_CONGESTION - S_NSSAI_CONGESTION - REL_DUE_TO_REACTIVATION - 5G_AN_NOT_RESPONDING - REL_DUE_TO_SLICE_NOT_AVAILABLE - REL_DUE_TO_DUPLICATE_SESSION_ID - PDU_SESSION_STATUS_MISMATCH - HO_FAILURE - INSUFFICIENT_UP_RESOURCES - PDU_SESSION_HANDED_OVER - PDU_SESSION_RESUMED - CN_ASSISTED_RAN_PARAMETER_TUNING - ISMF_CONTEXT_TRANSFER - SMF_CONTEXT_TRANSFER - REL_DUE_TO_PS_TO_CS_HO - REL_DUE_TO_SUBSCRIPTION_CHANGE - HO_CANCEL - REL_DUE_TO_SLICE_NOT_AUTHORIZED - PDU_SESSION_HAND_OVER_FAILURE - DDN_FAILURE_STATUS + */ + +#ifndef _OpenAPI_cause_H_ +#define _OpenAPI_cause_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_cause_s OpenAPI_cause_t; +typedef struct OpenAPI_cause_s { +} OpenAPI_cause_t; + +OpenAPI_cause_t *OpenAPI_cause_create( + ); +void OpenAPI_cause_free(OpenAPI_cause_t *cause); +OpenAPI_cause_t *OpenAPI_cause_parseFromJSON(cJSON *causeJSON); +cJSON *OpenAPI_cause_convertToJSON(OpenAPI_cause_t *cause); +OpenAPI_cause_t *OpenAPI_cause_copy(OpenAPI_cause_t *dst, OpenAPI_cause_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_cause_H_ */ + diff --git a/lib/sbi/openapi/model/change_item.c b/lib/sbi/openapi/model/change_item.c index e306a893c..85350aa5a 100644 --- a/lib/sbi/openapi/model/change_item.c +++ b/lib/sbi/openapi/model/change_item.c @@ -160,3 +160,37 @@ end: return NULL; } +OpenAPI_change_item_t *OpenAPI_change_item_copy(OpenAPI_change_item_t *dst, OpenAPI_change_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_change_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_change_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_change_item_free(dst); + dst = OpenAPI_change_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/change_item.h b/lib/sbi/openapi/model/change_item.h index fd99a856d..d3939d31d 100644 --- a/lib/sbi/openapi/model/change_item.h +++ b/lib/sbi/openapi/model/change_item.h @@ -37,6 +37,7 @@ OpenAPI_change_item_t *OpenAPI_change_item_create( void OpenAPI_change_item_free(OpenAPI_change_item_t *change_item); OpenAPI_change_item_t *OpenAPI_change_item_parseFromJSON(cJSON *change_itemJSON); cJSON *OpenAPI_change_item_convertToJSON(OpenAPI_change_item_t *change_item); +OpenAPI_change_item_t *OpenAPI_change_item_copy(OpenAPI_change_item_t *dst, OpenAPI_change_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/charging_information.c b/lib/sbi/openapi/model/charging_information.c index a1b46996a..b14de62b9 100644 --- a/lib/sbi/openapi/model/charging_information.c +++ b/lib/sbi/openapi/model/charging_information.c @@ -179,3 +179,37 @@ end: return NULL; } +OpenAPI_charging_information_t *OpenAPI_charging_information_copy(OpenAPI_charging_information_t *dst, OpenAPI_charging_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_charging_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_charging_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_charging_information_free(dst); + dst = OpenAPI_charging_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/charging_information.h b/lib/sbi/openapi/model/charging_information.h index ef4dd5da6..c3c3ea23d 100644 --- a/lib/sbi/openapi/model/charging_information.h +++ b/lib/sbi/openapi/model/charging_information.h @@ -38,6 +38,7 @@ OpenAPI_charging_information_t *OpenAPI_charging_information_create( void OpenAPI_charging_information_free(OpenAPI_charging_information_t *charging_information); OpenAPI_charging_information_t *OpenAPI_charging_information_parseFromJSON(cJSON *charging_informationJSON); cJSON *OpenAPI_charging_information_convertToJSON(OpenAPI_charging_information_t *charging_information); +OpenAPI_charging_information_t *OpenAPI_charging_information_copy(OpenAPI_charging_information_t *dst, OpenAPI_charging_information_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/chf_info.c b/lib/sbi/openapi/model/chf_info.c index 84aee413c..c5a2d4125 100644 --- a/lib/sbi/openapi/model/chf_info.c +++ b/lib/sbi/openapi/model/chf_info.c @@ -219,3 +219,37 @@ end: return NULL; } +OpenAPI_chf_info_t *OpenAPI_chf_info_copy(OpenAPI_chf_info_t *dst, OpenAPI_chf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_chf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_chf_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_chf_info_free(dst); + dst = OpenAPI_chf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/chf_info.h b/lib/sbi/openapi/model/chf_info.h index 7c84c7c45..fe67367fb 100644 --- a/lib/sbi/openapi/model/chf_info.h +++ b/lib/sbi/openapi/model/chf_info.h @@ -37,6 +37,7 @@ OpenAPI_chf_info_t *OpenAPI_chf_info_create( void OpenAPI_chf_info_free(OpenAPI_chf_info_t *chf_info); OpenAPI_chf_info_t *OpenAPI_chf_info_parseFromJSON(cJSON *chf_infoJSON); cJSON *OpenAPI_chf_info_convertToJSON(OpenAPI_chf_info_t *chf_info); +OpenAPI_chf_info_t *OpenAPI_chf_info_copy(OpenAPI_chf_info_t *dst, OpenAPI_chf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/chf_service_info.c b/lib/sbi/openapi/model/chf_service_info.c index e9610b519..a6804cc87 100644 --- a/lib/sbi/openapi/model/chf_service_info.c +++ b/lib/sbi/openapi/model/chf_service_info.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_chf_service_info_t *OpenAPI_chf_service_info_copy(OpenAPI_chf_service_info_t *dst, OpenAPI_chf_service_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_chf_service_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_chf_service_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_chf_service_info_free(dst); + dst = OpenAPI_chf_service_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/chf_service_info.h b/lib/sbi/openapi/model/chf_service_info.h index fa1fa0f74..48b60f0e4 100644 --- a/lib/sbi/openapi/model/chf_service_info.h +++ b/lib/sbi/openapi/model/chf_service_info.h @@ -30,6 +30,7 @@ OpenAPI_chf_service_info_t *OpenAPI_chf_service_info_create( void OpenAPI_chf_service_info_free(OpenAPI_chf_service_info_t *chf_service_info); OpenAPI_chf_service_info_t *OpenAPI_chf_service_info_parseFromJSON(cJSON *chf_service_infoJSON); cJSON *OpenAPI_chf_service_info_convertToJSON(OpenAPI_chf_service_info_t *chf_service_info); +OpenAPI_chf_service_info_t *OpenAPI_chf_service_info_copy(OpenAPI_chf_service_info_t *dst, OpenAPI_chf_service_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ciphering_algorithm.c b/lib/sbi/openapi/model/ciphering_algorithm.c new file mode 100644 index 000000000..60b473271 --- /dev/null +++ b/lib/sbi/openapi/model/ciphering_algorithm.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ciphering_algorithm.h" + +char* OpenAPI_ciphering_algorithm_ToString(OpenAPI_ciphering_algorithm_e ciphering_algorithm) +{ + const char *ciphering_algorithmArray[] = { "NULL", "NEA0", "NEA1", "NEA2", "NEA3" }; + size_t sizeofArray = sizeof(ciphering_algorithmArray) / sizeof(ciphering_algorithmArray[0]); + if (ciphering_algorithm < sizeofArray) + return (char *)ciphering_algorithmArray[ciphering_algorithm]; + else + return (char *)"Unknown"; +} + +OpenAPI_ciphering_algorithm_e OpenAPI_ciphering_algorithm_FromString(char* ciphering_algorithm) +{ + int stringToReturn = 0; + const char *ciphering_algorithmArray[] = { "NULL", "NEA0", "NEA1", "NEA2", "NEA3" }; + size_t sizeofArray = sizeof(ciphering_algorithmArray) / sizeof(ciphering_algorithmArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ciphering_algorithm, ciphering_algorithmArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ciphering_algorithm.h b/lib/sbi/openapi/model/ciphering_algorithm.h new file mode 100644 index 000000000..4ff701f8d --- /dev/null +++ b/lib/sbi/openapi/model/ciphering_algorithm.h @@ -0,0 +1,31 @@ +/* + * ciphering_algorithm.h + * + * + */ + +#ifndef _OpenAPI_ciphering_algorithm_H_ +#define _OpenAPI_ciphering_algorithm_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_ciphering_algorithm_NULL = 0, OpenAPI_ciphering_algorithm_NEA0, OpenAPI_ciphering_algorithm_NEA1, OpenAPI_ciphering_algorithm_NEA2, OpenAPI_ciphering_algorithm_NEA3 } OpenAPI_ciphering_algorithm_e; + +char* OpenAPI_ciphering_algorithm_ToString(OpenAPI_ciphering_algorithm_e ciphering_algorithm); + +OpenAPI_ciphering_algorithm_e OpenAPI_ciphering_algorithm_FromString(char* ciphering_algorithm); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ciphering_algorithm_H_ */ + diff --git a/lib/sbi/openapi/model/civic_address.c b/lib/sbi/openapi/model/civic_address.c index 2fee7ec37..0ce902275 100644 --- a/lib/sbi/openapi/model/civic_address.c +++ b/lib/sbi/openapi/model/civic_address.c @@ -669,3 +669,37 @@ end: return NULL; } +OpenAPI_civic_address_t *OpenAPI_civic_address_copy(OpenAPI_civic_address_t *dst, OpenAPI_civic_address_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_civic_address_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_civic_address_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_civic_address_free(dst); + dst = OpenAPI_civic_address_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/civic_address.h b/lib/sbi/openapi/model/civic_address.h index eaae24998..19639b837 100644 --- a/lib/sbi/openapi/model/civic_address.h +++ b/lib/sbi/openapi/model/civic_address.h @@ -88,6 +88,7 @@ OpenAPI_civic_address_t *OpenAPI_civic_address_create( void OpenAPI_civic_address_free(OpenAPI_civic_address_t *civic_address); OpenAPI_civic_address_t *OpenAPI_civic_address_parseFromJSON(cJSON *civic_addressJSON); cJSON *OpenAPI_civic_address_convertToJSON(OpenAPI_civic_address_t *civic_address); +OpenAPI_civic_address_t *OpenAPI_civic_address_copy(OpenAPI_civic_address_t *dst, OpenAPI_civic_address_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cm_info.c b/lib/sbi/openapi/model/cm_info.c index 45b3e1c29..047114d63 100644 --- a/lib/sbi/openapi/model/cm_info.c +++ b/lib/sbi/openapi/model/cm_info.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_cm_info_t *OpenAPI_cm_info_copy(OpenAPI_cm_info_t *dst, OpenAPI_cm_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cm_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cm_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_cm_info_free(dst); + dst = OpenAPI_cm_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cm_info.h b/lib/sbi/openapi/model/cm_info.h index aa72ead8f..ce20fac8b 100644 --- a/lib/sbi/openapi/model/cm_info.h +++ b/lib/sbi/openapi/model/cm_info.h @@ -32,6 +32,7 @@ OpenAPI_cm_info_t *OpenAPI_cm_info_create( void OpenAPI_cm_info_free(OpenAPI_cm_info_t *cm_info); OpenAPI_cm_info_t *OpenAPI_cm_info_parseFromJSON(cJSON *cm_infoJSON); cJSON *OpenAPI_cm_info_convertToJSON(OpenAPI_cm_info_t *cm_info); +OpenAPI_cm_info_t *OpenAPI_cm_info_copy(OpenAPI_cm_info_t *dst, OpenAPI_cm_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cm_info_report.c b/lib/sbi/openapi/model/cm_info_report.c index a8f610f68..ade221151 100644 --- a/lib/sbi/openapi/model/cm_info_report.c +++ b/lib/sbi/openapi/model/cm_info_report.c @@ -154,3 +154,37 @@ end: return NULL; } +OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_copy(OpenAPI_cm_info_report_t *dst, OpenAPI_cm_info_report_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cm_info_report_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cm_info_report_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_cm_info_report_free(dst); + dst = OpenAPI_cm_info_report_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cm_info_report.h b/lib/sbi/openapi/model/cm_info_report.h index 9adda09b8..035b75faa 100644 --- a/lib/sbi/openapi/model/cm_info_report.h +++ b/lib/sbi/openapi/model/cm_info_report.h @@ -31,6 +31,7 @@ OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_create( void OpenAPI_cm_info_report_free(OpenAPI_cm_info_report_t *cm_info_report); OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_parseFromJSON(cJSON *cm_info_reportJSON); cJSON *OpenAPI_cm_info_report_convertToJSON(OpenAPI_cm_info_report_t *cm_info_report); +OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_copy(OpenAPI_cm_info_report_t *dst, OpenAPI_cm_info_report_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cm_state.c b/lib/sbi/openapi/model/cm_state.c index 95061fe1d..daf1d6a01 100644 --- a/lib/sbi/openapi/model/cm_state.c +++ b/lib/sbi/openapi/model/cm_state.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_cm_state_t *OpenAPI_cm_state_copy(OpenAPI_cm_state_t *dst, OpenAPI_cm_state_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cm_state_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cm_state_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_cm_state_free(dst); + dst = OpenAPI_cm_state_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cm_state.h b/lib/sbi/openapi/model/cm_state.h index 20d356d27..c5809ec8d 100644 --- a/lib/sbi/openapi/model/cm_state.h +++ b/lib/sbi/openapi/model/cm_state.h @@ -26,6 +26,7 @@ OpenAPI_cm_state_t *OpenAPI_cm_state_create( void OpenAPI_cm_state_free(OpenAPI_cm_state_t *cm_state); OpenAPI_cm_state_t *OpenAPI_cm_state_parseFromJSON(cJSON *cm_stateJSON); cJSON *OpenAPI_cm_state_convertToJSON(OpenAPI_cm_state_t *cm_state); +OpenAPI_cm_state_t *OpenAPI_cm_state_copy(OpenAPI_cm_state_t *dst, OpenAPI_cm_state_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cn_assisted_ran_para.c b/lib/sbi/openapi/model/cn_assisted_ran_para.c new file mode 100644 index 000000000..a4e15bfe3 --- /dev/null +++ b/lib/sbi/openapi/model/cn_assisted_ran_para.c @@ -0,0 +1,243 @@ + +#include +#include +#include +#include "cn_assisted_ran_para.h" + +OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_create( + OpenAPI_stationary_indication_t *stationary_indication, + int communication_duration_time, + int periodic_time, + OpenAPI_scheduled_communication_time_t *scheduled_communication_time, + OpenAPI_scheduled_communication_type_t *scheduled_communication_type, + OpenAPI_traffic_profile_t *traffic_profile, + OpenAPI_battery_indication_t *battery_indication + ) +{ + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_var = OpenAPI_malloc(sizeof(OpenAPI_cn_assisted_ran_para_t)); + if (!cn_assisted_ran_para_local_var) { + return NULL; + } + cn_assisted_ran_para_local_var->stationary_indication = stationary_indication; + cn_assisted_ran_para_local_var->communication_duration_time = communication_duration_time; + cn_assisted_ran_para_local_var->periodic_time = periodic_time; + cn_assisted_ran_para_local_var->scheduled_communication_time = scheduled_communication_time; + cn_assisted_ran_para_local_var->scheduled_communication_type = scheduled_communication_type; + cn_assisted_ran_para_local_var->traffic_profile = traffic_profile; + cn_assisted_ran_para_local_var->battery_indication = battery_indication; + + return cn_assisted_ran_para_local_var; +} + +void OpenAPI_cn_assisted_ran_para_free(OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para) +{ + if (NULL == cn_assisted_ran_para) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_stationary_indication_free(cn_assisted_ran_para->stationary_indication); + OpenAPI_scheduled_communication_time_free(cn_assisted_ran_para->scheduled_communication_time); + OpenAPI_scheduled_communication_type_free(cn_assisted_ran_para->scheduled_communication_type); + OpenAPI_traffic_profile_free(cn_assisted_ran_para->traffic_profile); + OpenAPI_battery_indication_free(cn_assisted_ran_para->battery_indication); + ogs_free(cn_assisted_ran_para); +} + +cJSON *OpenAPI_cn_assisted_ran_para_convertToJSON(OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para) +{ + cJSON *item = NULL; + + if (cn_assisted_ran_para == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [CnAssistedRanPara]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cn_assisted_ran_para->stationary_indication) { + cJSON *stationary_indication_local_JSON = OpenAPI_stationary_indication_convertToJSON(cn_assisted_ran_para->stationary_indication); + if (stationary_indication_local_JSON == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [stationary_indication]"); + goto end; + } + cJSON_AddItemToObject(item, "stationaryIndication", stationary_indication_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [stationary_indication]"); + goto end; + } + } + + if (cn_assisted_ran_para->communication_duration_time) { + if (cJSON_AddNumberToObject(item, "communicationDurationTime", cn_assisted_ran_para->communication_duration_time) == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [communication_duration_time]"); + goto end; + } + } + + if (cn_assisted_ran_para->periodic_time) { + if (cJSON_AddNumberToObject(item, "periodicTime", cn_assisted_ran_para->periodic_time) == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [periodic_time]"); + goto end; + } + } + + if (cn_assisted_ran_para->scheduled_communication_time) { + cJSON *scheduled_communication_time_local_JSON = OpenAPI_scheduled_communication_time_convertToJSON(cn_assisted_ran_para->scheduled_communication_time); + if (scheduled_communication_time_local_JSON == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [scheduled_communication_time]"); + goto end; + } + cJSON_AddItemToObject(item, "scheduledCommunicationTime", scheduled_communication_time_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [scheduled_communication_time]"); + goto end; + } + } + + if (cn_assisted_ran_para->scheduled_communication_type) { + cJSON *scheduled_communication_type_local_JSON = OpenAPI_scheduled_communication_type_convertToJSON(cn_assisted_ran_para->scheduled_communication_type); + if (scheduled_communication_type_local_JSON == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [scheduled_communication_type]"); + goto end; + } + cJSON_AddItemToObject(item, "scheduledCommunicationType", scheduled_communication_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [scheduled_communication_type]"); + goto end; + } + } + + if (cn_assisted_ran_para->traffic_profile) { + cJSON *traffic_profile_local_JSON = OpenAPI_traffic_profile_convertToJSON(cn_assisted_ran_para->traffic_profile); + if (traffic_profile_local_JSON == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [traffic_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "trafficProfile", traffic_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [traffic_profile]"); + goto end; + } + } + + if (cn_assisted_ran_para->battery_indication) { + cJSON *battery_indication_local_JSON = OpenAPI_battery_indication_convertToJSON(cn_assisted_ran_para->battery_indication); + if (battery_indication_local_JSON == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [battery_indication]"); + goto end; + } + cJSON_AddItemToObject(item, "batteryIndication", battery_indication_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [battery_indication]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_parseFromJSON(cJSON *cn_assisted_ran_paraJSON) +{ + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_var = NULL; + cJSON *stationary_indication = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "stationaryIndication"); + + OpenAPI_stationary_indication_t *stationary_indication_local_nonprim = NULL; + if (stationary_indication) { + stationary_indication_local_nonprim = OpenAPI_stationary_indication_parseFromJSON(stationary_indication); + } + + cJSON *communication_duration_time = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "communicationDurationTime"); + + if (communication_duration_time) { + if (!cJSON_IsNumber(communication_duration_time)) { + ogs_error("OpenAPI_cn_assisted_ran_para_parseFromJSON() failed [communication_duration_time]"); + goto end; + } + } + + cJSON *periodic_time = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "periodicTime"); + + if (periodic_time) { + if (!cJSON_IsNumber(periodic_time)) { + ogs_error("OpenAPI_cn_assisted_ran_para_parseFromJSON() failed [periodic_time]"); + goto end; + } + } + + cJSON *scheduled_communication_time = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "scheduledCommunicationTime"); + + OpenAPI_scheduled_communication_time_t *scheduled_communication_time_local_nonprim = NULL; + if (scheduled_communication_time) { + scheduled_communication_time_local_nonprim = OpenAPI_scheduled_communication_time_parseFromJSON(scheduled_communication_time); + } + + cJSON *scheduled_communication_type = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "scheduledCommunicationType"); + + OpenAPI_scheduled_communication_type_t *scheduled_communication_type_local_nonprim = NULL; + if (scheduled_communication_type) { + scheduled_communication_type_local_nonprim = OpenAPI_scheduled_communication_type_parseFromJSON(scheduled_communication_type); + } + + cJSON *traffic_profile = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "trafficProfile"); + + OpenAPI_traffic_profile_t *traffic_profile_local_nonprim = NULL; + if (traffic_profile) { + traffic_profile_local_nonprim = OpenAPI_traffic_profile_parseFromJSON(traffic_profile); + } + + cJSON *battery_indication = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "batteryIndication"); + + OpenAPI_battery_indication_t *battery_indication_local_nonprim = NULL; + if (battery_indication) { + battery_indication_local_nonprim = OpenAPI_battery_indication_parseFromJSON(battery_indication); + } + + cn_assisted_ran_para_local_var = OpenAPI_cn_assisted_ran_para_create ( + stationary_indication ? stationary_indication_local_nonprim : NULL, + communication_duration_time ? communication_duration_time->valuedouble : 0, + periodic_time ? periodic_time->valuedouble : 0, + scheduled_communication_time ? scheduled_communication_time_local_nonprim : NULL, + scheduled_communication_type ? scheduled_communication_type_local_nonprim : NULL, + traffic_profile ? traffic_profile_local_nonprim : NULL, + battery_indication ? battery_indication_local_nonprim : NULL + ); + + return cn_assisted_ran_para_local_var; +end: + return NULL; +} + +OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_copy(OpenAPI_cn_assisted_ran_para_t *dst, OpenAPI_cn_assisted_ran_para_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cn_assisted_ran_para_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_cn_assisted_ran_para_free(dst); + dst = OpenAPI_cn_assisted_ran_para_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cn_assisted_ran_para.h b/lib/sbi/openapi/model/cn_assisted_ran_para.h new file mode 100644 index 000000000..670eed104 --- /dev/null +++ b/lib/sbi/openapi/model/cn_assisted_ran_para.h @@ -0,0 +1,55 @@ +/* + * cn_assisted_ran_para.h + * + * + */ + +#ifndef _OpenAPI_cn_assisted_ran_para_H_ +#define _OpenAPI_cn_assisted_ran_para_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "battery_indication.h" +#include "scheduled_communication_time.h" +#include "scheduled_communication_type.h" +#include "stationary_indication.h" +#include "traffic_profile.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_cn_assisted_ran_para_s OpenAPI_cn_assisted_ran_para_t; +typedef struct OpenAPI_cn_assisted_ran_para_s { + struct OpenAPI_stationary_indication_s *stationary_indication; + int communication_duration_time; + int periodic_time; + struct OpenAPI_scheduled_communication_time_s *scheduled_communication_time; + struct OpenAPI_scheduled_communication_type_s *scheduled_communication_type; + struct OpenAPI_traffic_profile_s *traffic_profile; + struct OpenAPI_battery_indication_s *battery_indication; +} OpenAPI_cn_assisted_ran_para_t; + +OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_create( + OpenAPI_stationary_indication_t *stationary_indication, + int communication_duration_time, + int periodic_time, + OpenAPI_scheduled_communication_time_t *scheduled_communication_time, + OpenAPI_scheduled_communication_type_t *scheduled_communication_type, + OpenAPI_traffic_profile_t *traffic_profile, + OpenAPI_battery_indication_t *battery_indication + ); +void OpenAPI_cn_assisted_ran_para_free(OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para); +OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_parseFromJSON(cJSON *cn_assisted_ran_paraJSON); +cJSON *OpenAPI_cn_assisted_ran_para_convertToJSON(OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para); +OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_copy(OpenAPI_cn_assisted_ran_para_t *dst, OpenAPI_cn_assisted_ran_para_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_cn_assisted_ran_para_H_ */ + diff --git a/lib/sbi/openapi/model/cnf.c b/lib/sbi/openapi/model/cnf.c index 00b6b8107..af91569fb 100644 --- a/lib/sbi/openapi/model/cnf.c +++ b/lib/sbi/openapi/model/cnf.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_cnf_t *OpenAPI_cnf_copy(OpenAPI_cnf_t *dst, OpenAPI_cnf_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cnf_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cnf_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_cnf_free(dst); + dst = OpenAPI_cnf_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cnf.h b/lib/sbi/openapi/model/cnf.h index 63b25213c..83cc46230 100644 --- a/lib/sbi/openapi/model/cnf.h +++ b/lib/sbi/openapi/model/cnf.h @@ -29,6 +29,7 @@ OpenAPI_cnf_t *OpenAPI_cnf_create( void OpenAPI_cnf_free(OpenAPI_cnf_t *cnf); OpenAPI_cnf_t *OpenAPI_cnf_parseFromJSON(cJSON *cnfJSON); cJSON *OpenAPI_cnf_convertToJSON(OpenAPI_cnf_t *cnf); +OpenAPI_cnf_t *OpenAPI_cnf_copy(OpenAPI_cnf_t *dst, OpenAPI_cnf_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/cnf_unit.c b/lib/sbi/openapi/model/cnf_unit.c index c4ef1de33..53acbf40a 100644 --- a/lib/sbi/openapi/model/cnf_unit.c +++ b/lib/sbi/openapi/model/cnf_unit.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_copy(OpenAPI_cnf_unit_t *dst, OpenAPI_cnf_unit_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cnf_unit_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cnf_unit_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_cnf_unit_free(dst); + dst = OpenAPI_cnf_unit_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cnf_unit.h b/lib/sbi/openapi/model/cnf_unit.h index 2fbb608ce..3a0a6f2a6 100644 --- a/lib/sbi/openapi/model/cnf_unit.h +++ b/lib/sbi/openapi/model/cnf_unit.h @@ -29,6 +29,7 @@ OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_create( void OpenAPI_cnf_unit_free(OpenAPI_cnf_unit_t *cnf_unit); OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_parseFromJSON(cJSON *cnf_unitJSON); cJSON *OpenAPI_cnf_unit_convertToJSON(OpenAPI_cnf_unit_t *cnf_unit); +OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_copy(OpenAPI_cnf_unit_t *dst, OpenAPI_cnf_unit_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/communication_characteristics.c b/lib/sbi/openapi/model/communication_characteristics.c index 2e998350d..27e78b834 100644 --- a/lib/sbi/openapi/model/communication_characteristics.c +++ b/lib/sbi/openapi/model/communication_characteristics.c @@ -188,3 +188,37 @@ end: return NULL; } +OpenAPI_communication_characteristics_t *OpenAPI_communication_characteristics_copy(OpenAPI_communication_characteristics_t *dst, OpenAPI_communication_characteristics_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_communication_characteristics_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_communication_characteristics_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_communication_characteristics_free(dst); + dst = OpenAPI_communication_characteristics_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/communication_characteristics.h b/lib/sbi/openapi/model/communication_characteristics.h index 58bfcb30d..f4500909d 100644 --- a/lib/sbi/openapi/model/communication_characteristics.h +++ b/lib/sbi/openapi/model/communication_characteristics.h @@ -43,6 +43,7 @@ OpenAPI_communication_characteristics_t *OpenAPI_communication_characteristics_c void OpenAPI_communication_characteristics_free(OpenAPI_communication_characteristics_t *communication_characteristics); OpenAPI_communication_characteristics_t *OpenAPI_communication_characteristics_parseFromJSON(cJSON *communication_characteristicsJSON); cJSON *OpenAPI_communication_characteristics_convertToJSON(OpenAPI_communication_characteristics_t *communication_characteristics); +OpenAPI_communication_characteristics_t *OpenAPI_communication_characteristics_copy(OpenAPI_communication_characteristics_t *dst, OpenAPI_communication_characteristics_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/complex_query.c b/lib/sbi/openapi/model/complex_query.c index e065a1a53..bc267cc23 100644 --- a/lib/sbi/openapi/model/complex_query.c +++ b/lib/sbi/openapi/model/complex_query.c @@ -159,3 +159,37 @@ end: return NULL; } +OpenAPI_complex_query_t *OpenAPI_complex_query_copy(OpenAPI_complex_query_t *dst, OpenAPI_complex_query_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_complex_query_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_complex_query_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_complex_query_free(dst); + dst = OpenAPI_complex_query_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/complex_query.h b/lib/sbi/openapi/model/complex_query.h index a620ecdc0..f35b2a2dc 100644 --- a/lib/sbi/openapi/model/complex_query.h +++ b/lib/sbi/openapi/model/complex_query.h @@ -34,6 +34,7 @@ OpenAPI_complex_query_t *OpenAPI_complex_query_create( void OpenAPI_complex_query_free(OpenAPI_complex_query_t *complex_query); OpenAPI_complex_query_t *OpenAPI_complex_query_parseFromJSON(cJSON *complex_queryJSON); cJSON *OpenAPI_complex_query_convertToJSON(OpenAPI_complex_query_t *complex_query); +OpenAPI_complex_query_t *OpenAPI_complex_query_copy(OpenAPI_complex_query_t *dst, OpenAPI_complex_query_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/configuration_parameters_eutra.c b/lib/sbi/openapi/model/configuration_parameters_eutra.c index 093e78262..99b2ac3db 100644 --- a/lib/sbi/openapi/model/configuration_parameters_eutra.c +++ b/lib/sbi/openapi/model/configuration_parameters_eutra.c @@ -249,3 +249,37 @@ end: return NULL; } +OpenAPI_configuration_parameters_eutra_t *OpenAPI_configuration_parameters_eutra_copy(OpenAPI_configuration_parameters_eutra_t *dst, OpenAPI_configuration_parameters_eutra_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_configuration_parameters_eutra_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_configuration_parameters_eutra_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_configuration_parameters_eutra_free(dst); + dst = OpenAPI_configuration_parameters_eutra_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/configuration_parameters_eutra.h b/lib/sbi/openapi/model/configuration_parameters_eutra.h index afb143496..eea3013e3 100644 --- a/lib/sbi/openapi/model/configuration_parameters_eutra.h +++ b/lib/sbi/openapi/model/configuration_parameters_eutra.h @@ -38,6 +38,7 @@ OpenAPI_configuration_parameters_eutra_t *OpenAPI_configuration_parameters_eutra void OpenAPI_configuration_parameters_eutra_free(OpenAPI_configuration_parameters_eutra_t *configuration_parameters_eutra); OpenAPI_configuration_parameters_eutra_t *OpenAPI_configuration_parameters_eutra_parseFromJSON(cJSON *configuration_parameters_eutraJSON); cJSON *OpenAPI_configuration_parameters_eutra_convertToJSON(OpenAPI_configuration_parameters_eutra_t *configuration_parameters_eutra); +OpenAPI_configuration_parameters_eutra_t *OpenAPI_configuration_parameters_eutra_copy(OpenAPI_configuration_parameters_eutra_t *dst, OpenAPI_configuration_parameters_eutra_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/configuration_parameters_nr.c b/lib/sbi/openapi/model/configuration_parameters_nr.c index 1ea1d6abd..dc2e80657 100644 --- a/lib/sbi/openapi/model/configuration_parameters_nr.c +++ b/lib/sbi/openapi/model/configuration_parameters_nr.c @@ -349,3 +349,37 @@ end: return NULL; } +OpenAPI_configuration_parameters_nr_t *OpenAPI_configuration_parameters_nr_copy(OpenAPI_configuration_parameters_nr_t *dst, OpenAPI_configuration_parameters_nr_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_configuration_parameters_nr_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_configuration_parameters_nr_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_configuration_parameters_nr_free(dst); + dst = OpenAPI_configuration_parameters_nr_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/configuration_parameters_nr.h b/lib/sbi/openapi/model/configuration_parameters_nr.h index 0c948465e..4826d8fe6 100644 --- a/lib/sbi/openapi/model/configuration_parameters_nr.h +++ b/lib/sbi/openapi/model/configuration_parameters_nr.h @@ -42,6 +42,7 @@ OpenAPI_configuration_parameters_nr_t *OpenAPI_configuration_parameters_nr_creat void OpenAPI_configuration_parameters_nr_free(OpenAPI_configuration_parameters_nr_t *configuration_parameters_nr); OpenAPI_configuration_parameters_nr_t *OpenAPI_configuration_parameters_nr_parseFromJSON(cJSON *configuration_parameters_nrJSON); cJSON *OpenAPI_configuration_parameters_nr_convertToJSON(OpenAPI_configuration_parameters_nr_t *configuration_parameters_nr); +OpenAPI_configuration_parameters_nr_t *OpenAPI_configuration_parameters_nr_copy(OpenAPI_configuration_parameters_nr_t *dst, OpenAPI_configuration_parameters_nr_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/configured_snssai.c b/lib/sbi/openapi/model/configured_snssai.c new file mode 100644 index 000000000..4acfe45a2 --- /dev/null +++ b/lib/sbi/openapi/model/configured_snssai.c @@ -0,0 +1,138 @@ + +#include +#include +#include +#include "configured_snssai.h" + +OpenAPI_configured_snssai_t *OpenAPI_configured_snssai_create( + OpenAPI_snssai_t *configured_snssai, + OpenAPI_snssai_t *mapped_home_snssai + ) +{ + OpenAPI_configured_snssai_t *configured_snssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_configured_snssai_t)); + if (!configured_snssai_local_var) { + return NULL; + } + configured_snssai_local_var->configured_snssai = configured_snssai; + configured_snssai_local_var->mapped_home_snssai = mapped_home_snssai; + + return configured_snssai_local_var; +} + +void OpenAPI_configured_snssai_free(OpenAPI_configured_snssai_t *configured_snssai) +{ + if (NULL == configured_snssai) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_snssai_free(configured_snssai->configured_snssai); + OpenAPI_snssai_free(configured_snssai->mapped_home_snssai); + ogs_free(configured_snssai); +} + +cJSON *OpenAPI_configured_snssai_convertToJSON(OpenAPI_configured_snssai_t *configured_snssai) +{ + cJSON *item = NULL; + + if (configured_snssai == NULL) { + ogs_error("OpenAPI_configured_snssai_convertToJSON() failed [ConfiguredSnssai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!configured_snssai->configured_snssai) { + ogs_error("OpenAPI_configured_snssai_convertToJSON() failed [configured_snssai]"); + goto end; + } + cJSON *configured_snssai_local_JSON = OpenAPI_snssai_convertToJSON(configured_snssai->configured_snssai); + if (configured_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_configured_snssai_convertToJSON() failed [configured_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "configuredSnssai", configured_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_configured_snssai_convertToJSON() failed [configured_snssai]"); + goto end; + } + + if (configured_snssai->mapped_home_snssai) { + cJSON *mapped_home_snssai_local_JSON = OpenAPI_snssai_convertToJSON(configured_snssai->mapped_home_snssai); + if (mapped_home_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_configured_snssai_convertToJSON() failed [mapped_home_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "mappedHomeSnssai", mapped_home_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_configured_snssai_convertToJSON() failed [mapped_home_snssai]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_configured_snssai_t *OpenAPI_configured_snssai_parseFromJSON(cJSON *configured_snssaiJSON) +{ + OpenAPI_configured_snssai_t *configured_snssai_local_var = NULL; + cJSON *configured_snssai = cJSON_GetObjectItemCaseSensitive(configured_snssaiJSON, "configuredSnssai"); + if (!configured_snssai) { + ogs_error("OpenAPI_configured_snssai_parseFromJSON() failed [configured_snssai]"); + goto end; + } + + OpenAPI_snssai_t *configured_snssai_local_nonprim = NULL; + + configured_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(configured_snssai); + + cJSON *mapped_home_snssai = cJSON_GetObjectItemCaseSensitive(configured_snssaiJSON, "mappedHomeSnssai"); + + OpenAPI_snssai_t *mapped_home_snssai_local_nonprim = NULL; + if (mapped_home_snssai) { + mapped_home_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(mapped_home_snssai); + } + + configured_snssai_local_var = OpenAPI_configured_snssai_create ( + configured_snssai_local_nonprim, + mapped_home_snssai ? mapped_home_snssai_local_nonprim : NULL + ); + + return configured_snssai_local_var; +end: + return NULL; +} + +OpenAPI_configured_snssai_t *OpenAPI_configured_snssai_copy(OpenAPI_configured_snssai_t *dst, OpenAPI_configured_snssai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_configured_snssai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_configured_snssai_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_configured_snssai_free(dst); + dst = OpenAPI_configured_snssai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/configured_snssai.h b/lib/sbi/openapi/model/configured_snssai.h new file mode 100644 index 000000000..ea28f83b4 --- /dev/null +++ b/lib/sbi/openapi/model/configured_snssai.h @@ -0,0 +1,41 @@ +/* + * configured_snssai.h + * + * + */ + +#ifndef _OpenAPI_configured_snssai_H_ +#define _OpenAPI_configured_snssai_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_configured_snssai_s OpenAPI_configured_snssai_t; +typedef struct OpenAPI_configured_snssai_s { + struct OpenAPI_snssai_s *configured_snssai; + struct OpenAPI_snssai_s *mapped_home_snssai; +} OpenAPI_configured_snssai_t; + +OpenAPI_configured_snssai_t *OpenAPI_configured_snssai_create( + OpenAPI_snssai_t *configured_snssai, + OpenAPI_snssai_t *mapped_home_snssai + ); +void OpenAPI_configured_snssai_free(OpenAPI_configured_snssai_t *configured_snssai); +OpenAPI_configured_snssai_t *OpenAPI_configured_snssai_parseFromJSON(cJSON *configured_snssaiJSON); +cJSON *OpenAPI_configured_snssai_convertToJSON(OpenAPI_configured_snssai_t *configured_snssai); +OpenAPI_configured_snssai_t *OpenAPI_configured_snssai_copy(OpenAPI_configured_snssai_t *dst, OpenAPI_configured_snssai_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_configured_snssai_H_ */ + diff --git a/lib/sbi/openapi/model/confirmation_data.c b/lib/sbi/openapi/model/confirmation_data.c index 2a63a95f0..e72e2e6af 100644 --- a/lib/sbi/openapi/model/confirmation_data.c +++ b/lib/sbi/openapi/model/confirmation_data.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_confirmation_data_t *OpenAPI_confirmation_data_copy(OpenAPI_confirmation_data_t *dst, OpenAPI_confirmation_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_confirmation_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_confirmation_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_confirmation_data_free(dst); + dst = OpenAPI_confirmation_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/confirmation_data.h b/lib/sbi/openapi/model/confirmation_data.h index 7ccfab53f..06f09f276 100644 --- a/lib/sbi/openapi/model/confirmation_data.h +++ b/lib/sbi/openapi/model/confirmation_data.h @@ -28,6 +28,7 @@ OpenAPI_confirmation_data_t *OpenAPI_confirmation_data_create( void OpenAPI_confirmation_data_free(OpenAPI_confirmation_data_t *confirmation_data); OpenAPI_confirmation_data_t *OpenAPI_confirmation_data_parseFromJSON(cJSON *confirmation_dataJSON); cJSON *OpenAPI_confirmation_data_convertToJSON(OpenAPI_confirmation_data_t *confirmation_data); +OpenAPI_confirmation_data_t *OpenAPI_confirmation_data_copy(OpenAPI_confirmation_data_t *dst, OpenAPI_confirmation_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/confirmation_data_response.c b/lib/sbi/openapi/model/confirmation_data_response.c index c157a84af..baa35686a 100644 --- a/lib/sbi/openapi/model/confirmation_data_response.c +++ b/lib/sbi/openapi/model/confirmation_data_response.c @@ -115,3 +115,37 @@ end: return NULL; } +OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_copy(OpenAPI_confirmation_data_response_t *dst, OpenAPI_confirmation_data_response_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_confirmation_data_response_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_confirmation_data_response_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_confirmation_data_response_free(dst); + dst = OpenAPI_confirmation_data_response_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/confirmation_data_response.h b/lib/sbi/openapi/model/confirmation_data_response.h index 341ac77b3..0f1132d4c 100644 --- a/lib/sbi/openapi/model/confirmation_data_response.h +++ b/lib/sbi/openapi/model/confirmation_data_response.h @@ -33,6 +33,7 @@ OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_create( void OpenAPI_confirmation_data_response_free(OpenAPI_confirmation_data_response_t *confirmation_data_response); OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_parseFromJSON(cJSON *confirmation_data_responseJSON); cJSON *OpenAPI_confirmation_data_response_convertToJSON(OpenAPI_confirmation_data_response_t *confirmation_data_response); +OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_copy(OpenAPI_confirmation_data_response_t *dst, OpenAPI_confirmation_data_response_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/context_data_set_name.c b/lib/sbi/openapi/model/context_data_set_name.c index 5d7de9f15..a3ca41c96 100644 --- a/lib/sbi/openapi/model/context_data_set_name.c +++ b/lib/sbi/openapi/model/context_data_set_name.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_copy(OpenAPI_context_data_set_name_t *dst, OpenAPI_context_data_set_name_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_context_data_set_name_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_context_data_set_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_context_data_set_name_free(dst); + dst = OpenAPI_context_data_set_name_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/context_data_set_name.h b/lib/sbi/openapi/model/context_data_set_name.h index fabfcfc0a..dcb355d12 100644 --- a/lib/sbi/openapi/model/context_data_set_name.h +++ b/lib/sbi/openapi/model/context_data_set_name.h @@ -26,6 +26,7 @@ OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_create( void OpenAPI_context_data_set_name_free(OpenAPI_context_data_set_name_t *context_data_set_name); OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_parseFromJSON(cJSON *context_data_set_nameJSON); cJSON *OpenAPI_context_data_set_name_convertToJSON(OpenAPI_context_data_set_name_t *context_data_set_name); +OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_copy(OpenAPI_context_data_set_name_t *dst, OpenAPI_context_data_set_name_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/context_data_sets.c b/lib/sbi/openapi/model/context_data_sets.c index 6f073dbec..a442b8512 100644 --- a/lib/sbi/openapi/model/context_data_sets.c +++ b/lib/sbi/openapi/model/context_data_sets.c @@ -345,3 +345,37 @@ end: return NULL; } +OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_copy(OpenAPI_context_data_sets_t *dst, OpenAPI_context_data_sets_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_context_data_sets_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_context_data_sets_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_context_data_sets_free(dst); + dst = OpenAPI_context_data_sets_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/context_data_sets.h b/lib/sbi/openapi/model/context_data_sets.h index a4805d85a..3eea7912e 100644 --- a/lib/sbi/openapi/model/context_data_sets.h +++ b/lib/sbi/openapi/model/context_data_sets.h @@ -49,6 +49,7 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( void OpenAPI_context_data_sets_free(OpenAPI_context_data_sets_t *context_data_sets); OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_parseFromJSON(cJSON *context_data_setsJSON); cJSON *OpenAPI_context_data_sets_convertToJSON(OpenAPI_context_data_sets_t *context_data_sets); +OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_copy(OpenAPI_context_data_sets_t *dst, OpenAPI_context_data_sets_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/core_network_type.c b/lib/sbi/openapi/model/core_network_type.c index 8eb78d46a..9c6a64dd5 100644 --- a/lib/sbi/openapi/model/core_network_type.c +++ b/lib/sbi/openapi/model/core_network_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_core_network_type_t *OpenAPI_core_network_type_copy(OpenAPI_core_network_type_t *dst, OpenAPI_core_network_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_core_network_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_core_network_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_core_network_type_free(dst); + dst = OpenAPI_core_network_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/core_network_type.h b/lib/sbi/openapi/model/core_network_type.h index 22d27d780..5c5f2275a 100644 --- a/lib/sbi/openapi/model/core_network_type.h +++ b/lib/sbi/openapi/model/core_network_type.h @@ -26,6 +26,7 @@ OpenAPI_core_network_type_t *OpenAPI_core_network_type_create( void OpenAPI_core_network_type_free(OpenAPI_core_network_type_t *core_network_type); OpenAPI_core_network_type_t *OpenAPI_core_network_type_parseFromJSON(cJSON *core_network_typeJSON); cJSON *OpenAPI_core_network_type_convertToJSON(OpenAPI_core_network_type_t *core_network_type); +OpenAPI_core_network_type_t *OpenAPI_core_network_type_copy(OpenAPI_core_network_type_t *dst, OpenAPI_core_network_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/data_change_notify.c b/lib/sbi/openapi/model/data_change_notify.c index 8dc9ab80d..f4987b21a 100644 --- a/lib/sbi/openapi/model/data_change_notify.c +++ b/lib/sbi/openapi/model/data_change_notify.c @@ -286,3 +286,37 @@ end: return NULL; } +OpenAPI_data_change_notify_t *OpenAPI_data_change_notify_copy(OpenAPI_data_change_notify_t *dst, OpenAPI_data_change_notify_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_data_change_notify_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_data_change_notify_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_data_change_notify_free(dst); + dst = OpenAPI_data_change_notify_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/data_change_notify.h b/lib/sbi/openapi/model/data_change_notify.h index 95b5b12c4..f46d7a498 100644 --- a/lib/sbi/openapi/model/data_change_notify.h +++ b/lib/sbi/openapi/model/data_change_notify.h @@ -41,6 +41,7 @@ OpenAPI_data_change_notify_t *OpenAPI_data_change_notify_create( void OpenAPI_data_change_notify_free(OpenAPI_data_change_notify_t *data_change_notify); OpenAPI_data_change_notify_t *OpenAPI_data_change_notify_parseFromJSON(cJSON *data_change_notifyJSON); cJSON *OpenAPI_data_change_notify_convertToJSON(OpenAPI_data_change_notify_t *data_change_notify); +OpenAPI_data_change_notify_t *OpenAPI_data_change_notify_copy(OpenAPI_data_change_notify_t *dst, OpenAPI_data_change_notify_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/data_filter.c b/lib/sbi/openapi/model/data_filter.c index 9de34d0ab..40373e29f 100644 --- a/lib/sbi/openapi/model/data_filter.c +++ b/lib/sbi/openapi/model/data_filter.c @@ -429,3 +429,37 @@ end: return NULL; } +OpenAPI_data_filter_t *OpenAPI_data_filter_copy(OpenAPI_data_filter_t *dst, OpenAPI_data_filter_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_data_filter_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_data_filter_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_data_filter_free(dst); + dst = OpenAPI_data_filter_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/data_filter.h b/lib/sbi/openapi/model/data_filter.h index 13c6dddcd..db1ef3dd2 100644 --- a/lib/sbi/openapi/model/data_filter.h +++ b/lib/sbi/openapi/model/data_filter.h @@ -46,6 +46,7 @@ OpenAPI_data_filter_t *OpenAPI_data_filter_create( void OpenAPI_data_filter_free(OpenAPI_data_filter_t *data_filter); OpenAPI_data_filter_t *OpenAPI_data_filter_parseFromJSON(cJSON *data_filterJSON); cJSON *OpenAPI_data_filter_convertToJSON(OpenAPI_data_filter_t *data_filter); +OpenAPI_data_filter_t *OpenAPI_data_filter_copy(OpenAPI_data_filter_t *dst, OpenAPI_data_filter_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/data_ind.c b/lib/sbi/openapi/model/data_ind.c index 6c6aa361d..ebbd00145 100644 --- a/lib/sbi/openapi/model/data_ind.c +++ b/lib/sbi/openapi/model/data_ind.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_data_ind_t *OpenAPI_data_ind_copy(OpenAPI_data_ind_t *dst, OpenAPI_data_ind_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_data_ind_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_data_ind_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_data_ind_free(dst); + dst = OpenAPI_data_ind_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/data_ind.h b/lib/sbi/openapi/model/data_ind.h index 6ade1f101..651c211b2 100644 --- a/lib/sbi/openapi/model/data_ind.h +++ b/lib/sbi/openapi/model/data_ind.h @@ -26,6 +26,7 @@ OpenAPI_data_ind_t *OpenAPI_data_ind_create( void OpenAPI_data_ind_free(OpenAPI_data_ind_t *data_ind); OpenAPI_data_ind_t *OpenAPI_data_ind_parseFromJSON(cJSON *data_indJSON); cJSON *OpenAPI_data_ind_convertToJSON(OpenAPI_data_ind_t *data_ind); +OpenAPI_data_ind_t *OpenAPI_data_ind_copy(OpenAPI_data_ind_t *dst, OpenAPI_data_ind_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/data_set_id.c b/lib/sbi/openapi/model/data_set_id.c index a2d9eec60..e64f60c48 100644 --- a/lib/sbi/openapi/model/data_set_id.c +++ b/lib/sbi/openapi/model/data_set_id.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_data_set_id_t *OpenAPI_data_set_id_copy(OpenAPI_data_set_id_t *dst, OpenAPI_data_set_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_data_set_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_data_set_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_data_set_id_free(dst); + dst = OpenAPI_data_set_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/data_set_id.h b/lib/sbi/openapi/model/data_set_id.h index c0a4bfd44..3e4ae34d6 100644 --- a/lib/sbi/openapi/model/data_set_id.h +++ b/lib/sbi/openapi/model/data_set_id.h @@ -26,6 +26,7 @@ OpenAPI_data_set_id_t *OpenAPI_data_set_id_create( void OpenAPI_data_set_id_free(OpenAPI_data_set_id_t *data_set_id); OpenAPI_data_set_id_t *OpenAPI_data_set_id_parseFromJSON(cJSON *data_set_idJSON); cJSON *OpenAPI_data_set_id_convertToJSON(OpenAPI_data_set_id_t *data_set_id); +OpenAPI_data_set_id_t *OpenAPI_data_set_id_copy(OpenAPI_data_set_id_t *dst, OpenAPI_data_set_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/data_set_name.c b/lib/sbi/openapi/model/data_set_name.c index d477ad539..f4e5af02a 100644 --- a/lib/sbi/openapi/model/data_set_name.c +++ b/lib/sbi/openapi/model/data_set_name.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_data_set_name_t *OpenAPI_data_set_name_copy(OpenAPI_data_set_name_t *dst, OpenAPI_data_set_name_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_data_set_name_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_data_set_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_data_set_name_free(dst); + dst = OpenAPI_data_set_name_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/data_set_name.h b/lib/sbi/openapi/model/data_set_name.h index 89318bd3b..d7f64979b 100644 --- a/lib/sbi/openapi/model/data_set_name.h +++ b/lib/sbi/openapi/model/data_set_name.h @@ -26,6 +26,7 @@ OpenAPI_data_set_name_t *OpenAPI_data_set_name_create( void OpenAPI_data_set_name_free(OpenAPI_data_set_name_t *data_set_name); OpenAPI_data_set_name_t *OpenAPI_data_set_name_parseFromJSON(cJSON *data_set_nameJSON); cJSON *OpenAPI_data_set_name_convertToJSON(OpenAPI_data_set_name_t *data_set_name); +OpenAPI_data_set_name_t *OpenAPI_data_set_name_copy(OpenAPI_data_set_name_t *dst, OpenAPI_data_set_name_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/datalink_reporting_configuration.c b/lib/sbi/openapi/model/datalink_reporting_configuration.c index 67865a93f..fe77deccf 100644 --- a/lib/sbi/openapi/model/datalink_reporting_configuration.c +++ b/lib/sbi/openapi/model/datalink_reporting_configuration.c @@ -193,3 +193,37 @@ end: return NULL; } +OpenAPI_datalink_reporting_configuration_t *OpenAPI_datalink_reporting_configuration_copy(OpenAPI_datalink_reporting_configuration_t *dst, OpenAPI_datalink_reporting_configuration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_datalink_reporting_configuration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_datalink_reporting_configuration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_datalink_reporting_configuration_free(dst); + dst = OpenAPI_datalink_reporting_configuration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/datalink_reporting_configuration.h b/lib/sbi/openapi/model/datalink_reporting_configuration.h index d55ffe459..1cb02a37e 100644 --- a/lib/sbi/openapi/model/datalink_reporting_configuration.h +++ b/lib/sbi/openapi/model/datalink_reporting_configuration.h @@ -37,6 +37,7 @@ OpenAPI_datalink_reporting_configuration_t *OpenAPI_datalink_reporting_configura void OpenAPI_datalink_reporting_configuration_free(OpenAPI_datalink_reporting_configuration_t *datalink_reporting_configuration); OpenAPI_datalink_reporting_configuration_t *OpenAPI_datalink_reporting_configuration_parseFromJSON(cJSON *datalink_reporting_configurationJSON); cJSON *OpenAPI_datalink_reporting_configuration_convertToJSON(OpenAPI_datalink_reporting_configuration_t *datalink_reporting_configuration); +OpenAPI_datalink_reporting_configuration_t *OpenAPI_datalink_reporting_configuration_copy(OpenAPI_datalink_reporting_configuration_t *dst, OpenAPI_datalink_reporting_configuration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ddd_traffic_descriptor.c b/lib/sbi/openapi/model/ddd_traffic_descriptor.c index ec58d90e0..2be0b3237 100644 --- a/lib/sbi/openapi/model/ddd_traffic_descriptor.c +++ b/lib/sbi/openapi/model/ddd_traffic_descriptor.c @@ -128,3 +128,37 @@ end: return NULL; } +OpenAPI_ddd_traffic_descriptor_t *OpenAPI_ddd_traffic_descriptor_copy(OpenAPI_ddd_traffic_descriptor_t *dst, OpenAPI_ddd_traffic_descriptor_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ddd_traffic_descriptor_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ddd_traffic_descriptor_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ddd_traffic_descriptor_free(dst); + dst = OpenAPI_ddd_traffic_descriptor_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ddd_traffic_descriptor.h b/lib/sbi/openapi/model/ddd_traffic_descriptor.h index 4b29ee0c4..f604c665f 100644 --- a/lib/sbi/openapi/model/ddd_traffic_descriptor.h +++ b/lib/sbi/openapi/model/ddd_traffic_descriptor.h @@ -34,6 +34,7 @@ OpenAPI_ddd_traffic_descriptor_t *OpenAPI_ddd_traffic_descriptor_create( void OpenAPI_ddd_traffic_descriptor_free(OpenAPI_ddd_traffic_descriptor_t *ddd_traffic_descriptor); OpenAPI_ddd_traffic_descriptor_t *OpenAPI_ddd_traffic_descriptor_parseFromJSON(cJSON *ddd_traffic_descriptorJSON); cJSON *OpenAPI_ddd_traffic_descriptor_convertToJSON(OpenAPI_ddd_traffic_descriptor_t *ddd_traffic_descriptor); +OpenAPI_ddd_traffic_descriptor_t *OpenAPI_ddd_traffic_descriptor_copy(OpenAPI_ddd_traffic_descriptor_t *dst, OpenAPI_ddd_traffic_descriptor_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ddn_failure_subs.c b/lib/sbi/openapi/model/ddn_failure_subs.c new file mode 100644 index 000000000..5c51569d9 --- /dev/null +++ b/lib/sbi/openapi/model/ddn_failure_subs.c @@ -0,0 +1,154 @@ + +#include +#include +#include +#include "ddn_failure_subs.h" + +OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_create( + int ddn_failure_subs_ind, + OpenAPI_list_t *ddd_traffic_descriptor_list + ) +{ + OpenAPI_ddn_failure_subs_t *ddn_failure_subs_local_var = OpenAPI_malloc(sizeof(OpenAPI_ddn_failure_subs_t)); + if (!ddn_failure_subs_local_var) { + return NULL; + } + ddn_failure_subs_local_var->ddn_failure_subs_ind = ddn_failure_subs_ind; + ddn_failure_subs_local_var->ddd_traffic_descriptor_list = ddd_traffic_descriptor_list; + + return ddn_failure_subs_local_var; +} + +void OpenAPI_ddn_failure_subs_free(OpenAPI_ddn_failure_subs_t *ddn_failure_subs) +{ + if (NULL == ddn_failure_subs) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(ddn_failure_subs->ddd_traffic_descriptor_list, node) { + OpenAPI_ddd_traffic_descriptor_free(node->data); + } + OpenAPI_list_free(ddn_failure_subs->ddd_traffic_descriptor_list); + ogs_free(ddn_failure_subs); +} + +cJSON *OpenAPI_ddn_failure_subs_convertToJSON(OpenAPI_ddn_failure_subs_t *ddn_failure_subs) +{ + cJSON *item = NULL; + + if (ddn_failure_subs == NULL) { + ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed [DdnFailureSubs]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ddn_failure_subs->ddn_failure_subs_ind) { + if (cJSON_AddBoolToObject(item, "ddnFailureSubsInd", ddn_failure_subs->ddn_failure_subs_ind) == NULL) { + ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed [ddn_failure_subs_ind]"); + goto end; + } + } + + if (ddn_failure_subs->ddd_traffic_descriptor_list) { + cJSON *ddd_traffic_descriptor_listList = cJSON_AddArrayToObject(item, "dddTrafficDescriptorList"); + if (ddd_traffic_descriptor_listList == NULL) { + ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + + OpenAPI_lnode_t *ddd_traffic_descriptor_list_node; + if (ddn_failure_subs->ddd_traffic_descriptor_list) { + OpenAPI_list_for_each(ddn_failure_subs->ddd_traffic_descriptor_list, ddd_traffic_descriptor_list_node) { + cJSON *itemLocal = OpenAPI_ddd_traffic_descriptor_convertToJSON(ddd_traffic_descriptor_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + cJSON_AddItemToArray(ddd_traffic_descriptor_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_parseFromJSON(cJSON *ddn_failure_subsJSON) +{ + OpenAPI_ddn_failure_subs_t *ddn_failure_subs_local_var = NULL; + cJSON *ddn_failure_subs_ind = cJSON_GetObjectItemCaseSensitive(ddn_failure_subsJSON, "ddnFailureSubsInd"); + + if (ddn_failure_subs_ind) { + if (!cJSON_IsBool(ddn_failure_subs_ind)) { + ogs_error("OpenAPI_ddn_failure_subs_parseFromJSON() failed [ddn_failure_subs_ind]"); + goto end; + } + } + + cJSON *ddd_traffic_descriptor_list = cJSON_GetObjectItemCaseSensitive(ddn_failure_subsJSON, "dddTrafficDescriptorList"); + + OpenAPI_list_t *ddd_traffic_descriptor_listList; + if (ddd_traffic_descriptor_list) { + cJSON *ddd_traffic_descriptor_list_local_nonprimitive; + if (!cJSON_IsArray(ddd_traffic_descriptor_list)) { + ogs_error("OpenAPI_ddn_failure_subs_parseFromJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + + ddd_traffic_descriptor_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ddd_traffic_descriptor_list_local_nonprimitive, ddd_traffic_descriptor_list ) { + if (!cJSON_IsObject(ddd_traffic_descriptor_list_local_nonprimitive)) { + ogs_error("OpenAPI_ddn_failure_subs_parseFromJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + OpenAPI_ddd_traffic_descriptor_t *ddd_traffic_descriptor_listItem = OpenAPI_ddd_traffic_descriptor_parseFromJSON(ddd_traffic_descriptor_list_local_nonprimitive); + + OpenAPI_list_add(ddd_traffic_descriptor_listList, ddd_traffic_descriptor_listItem); + } + } + + ddn_failure_subs_local_var = OpenAPI_ddn_failure_subs_create ( + ddn_failure_subs_ind ? ddn_failure_subs_ind->valueint : 0, + ddd_traffic_descriptor_list ? ddd_traffic_descriptor_listList : NULL + ); + + return ddn_failure_subs_local_var; +end: + return NULL; +} + +OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_copy(OpenAPI_ddn_failure_subs_t *dst, OpenAPI_ddn_failure_subs_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ddn_failure_subs_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ddn_failure_subs_free(dst); + dst = OpenAPI_ddn_failure_subs_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ddn_failure_subs.h b/lib/sbi/openapi/model/ddn_failure_subs.h new file mode 100644 index 000000000..7c2d9f645 --- /dev/null +++ b/lib/sbi/openapi/model/ddn_failure_subs.h @@ -0,0 +1,41 @@ +/* + * ddn_failure_subs.h + * + * + */ + +#ifndef _OpenAPI_ddn_failure_subs_H_ +#define _OpenAPI_ddn_failure_subs_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ddd_traffic_descriptor.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ddn_failure_subs_s OpenAPI_ddn_failure_subs_t; +typedef struct OpenAPI_ddn_failure_subs_s { + int ddn_failure_subs_ind; + OpenAPI_list_t *ddd_traffic_descriptor_list; +} OpenAPI_ddn_failure_subs_t; + +OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_create( + int ddn_failure_subs_ind, + OpenAPI_list_t *ddd_traffic_descriptor_list + ); +void OpenAPI_ddn_failure_subs_free(OpenAPI_ddn_failure_subs_t *ddn_failure_subs); +OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_parseFromJSON(cJSON *ddn_failure_subsJSON); +cJSON *OpenAPI_ddn_failure_subs_convertToJSON(OpenAPI_ddn_failure_subs_t *ddn_failure_subs); +OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_copy(OpenAPI_ddn_failure_subs_t *dst, OpenAPI_ddn_failure_subs_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ddn_failure_subs_H_ */ + diff --git a/lib/sbi/openapi/model/default_notification_subscription.c b/lib/sbi/openapi/model/default_notification_subscription.c index ac04328fe..0a4d39d24 100644 --- a/lib/sbi/openapi/model/default_notification_subscription.c +++ b/lib/sbi/openapi/model/default_notification_subscription.c @@ -8,7 +8,7 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr OpenAPI_notification_type_e notification_type, char *callback_uri, OpenAPI_n1_message_class_e n1_message_class, - OpenAPI_n2_information_class_t *n2_information_class, + OpenAPI_n2_information_class_e n2_information_class, OpenAPI_list_t *versions ) { @@ -32,7 +32,6 @@ void OpenAPI_default_notification_subscription_free(OpenAPI_default_notification } OpenAPI_lnode_t *node; ogs_free(default_notification_subscription->callback_uri); - OpenAPI_n2_information_class_free(default_notification_subscription->n2_information_class); OpenAPI_list_for_each(default_notification_subscription->versions, node) { ogs_free(node->data); } @@ -76,13 +75,7 @@ cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_n } if (default_notification_subscription->n2_information_class) { - cJSON *n2_information_class_local_JSON = OpenAPI_n2_information_class_convertToJSON(default_notification_subscription->n2_information_class); - if (n2_information_class_local_JSON == NULL) { - ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [n2_information_class]"); - goto end; - } - cJSON_AddItemToObject(item, "n2InformationClass", n2_information_class_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "n2InformationClass", OpenAPI_n2_information_class_ToString(default_notification_subscription->n2_information_class)) == NULL) { ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [n2_information_class]"); goto end; } @@ -150,9 +143,13 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr cJSON *n2_information_class = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "n2InformationClass"); - OpenAPI_n2_information_class_t *n2_information_class_local_nonprim = NULL; + OpenAPI_n2_information_class_e n2_information_classVariable; if (n2_information_class) { - n2_information_class_local_nonprim = OpenAPI_n2_information_class_parseFromJSON(n2_information_class); + if (!cJSON_IsString(n2_information_class)) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [n2_information_class]"); + goto end; + } + n2_information_classVariable = OpenAPI_n2_information_class_FromString(n2_information_class->valuestring); } cJSON *versions = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "versions"); @@ -179,7 +176,7 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr notification_typeVariable, ogs_strdup(callback_uri->valuestring), n1_message_class ? n1_message_classVariable : 0, - n2_information_class ? n2_information_class_local_nonprim : NULL, + n2_information_class ? n2_information_classVariable : 0, versions ? versionsList : NULL ); @@ -188,3 +185,37 @@ end: return NULL; } +OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_copy(OpenAPI_default_notification_subscription_t *dst, OpenAPI_default_notification_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_default_notification_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_default_notification_subscription_free(dst); + dst = OpenAPI_default_notification_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/default_notification_subscription.h b/lib/sbi/openapi/model/default_notification_subscription.h index 0a223ef0f..9f35bcba3 100644 --- a/lib/sbi/openapi/model/default_notification_subscription.h +++ b/lib/sbi/openapi/model/default_notification_subscription.h @@ -25,7 +25,7 @@ typedef struct OpenAPI_default_notification_subscription_s { OpenAPI_notification_type_e notification_type; char *callback_uri; OpenAPI_n1_message_class_e n1_message_class; - struct OpenAPI_n2_information_class_s *n2_information_class; + OpenAPI_n2_information_class_e n2_information_class; OpenAPI_list_t *versions; } OpenAPI_default_notification_subscription_t; @@ -33,12 +33,13 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr OpenAPI_notification_type_e notification_type, char *callback_uri, OpenAPI_n1_message_class_e n1_message_class, - OpenAPI_n2_information_class_t *n2_information_class, + OpenAPI_n2_information_class_e n2_information_class, OpenAPI_list_t *versions ); void OpenAPI_default_notification_subscription_free(OpenAPI_default_notification_subscription_t *default_notification_subscription); OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_parseFromJSON(cJSON *default_notification_subscriptionJSON); cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_notification_subscription_t *default_notification_subscription); +OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_copy(OpenAPI_default_notification_subscription_t *dst, OpenAPI_default_notification_subscription_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/deregistration_data.c b/lib/sbi/openapi/model/deregistration_data.c index c66d1ee65..05de70278 100644 --- a/lib/sbi/openapi/model/deregistration_data.c +++ b/lib/sbi/openapi/model/deregistration_data.c @@ -143,3 +143,37 @@ end: return NULL; } +OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_copy(OpenAPI_deregistration_data_t *dst, OpenAPI_deregistration_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_deregistration_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_deregistration_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_deregistration_data_free(dst); + dst = OpenAPI_deregistration_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/deregistration_data.h b/lib/sbi/openapi/model/deregistration_data.h index 098c3b543..3a257ba10 100644 --- a/lib/sbi/openapi/model/deregistration_data.h +++ b/lib/sbi/openapi/model/deregistration_data.h @@ -36,6 +36,7 @@ OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_create( void OpenAPI_deregistration_data_free(OpenAPI_deregistration_data_t *deregistration_data); OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_parseFromJSON(cJSON *deregistration_dataJSON); cJSON *OpenAPI_deregistration_data_convertToJSON(OpenAPI_deregistration_data_t *deregistration_data); +OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_copy(OpenAPI_deregistration_data_t *dst, OpenAPI_deregistration_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/deregistration_reason.c b/lib/sbi/openapi/model/deregistration_reason.c index 1559c6660..46c902001 100644 --- a/lib/sbi/openapi/model/deregistration_reason.c +++ b/lib/sbi/openapi/model/deregistration_reason.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_copy(OpenAPI_deregistration_reason_t *dst, OpenAPI_deregistration_reason_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_deregistration_reason_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_deregistration_reason_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_deregistration_reason_free(dst); + dst = OpenAPI_deregistration_reason_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/deregistration_reason.h b/lib/sbi/openapi/model/deregistration_reason.h index fded1f76d..4262cd700 100644 --- a/lib/sbi/openapi/model/deregistration_reason.h +++ b/lib/sbi/openapi/model/deregistration_reason.h @@ -26,6 +26,7 @@ OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_create( void OpenAPI_deregistration_reason_free(OpenAPI_deregistration_reason_t *deregistration_reason); OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_parseFromJSON(cJSON *deregistration_reasonJSON); cJSON *OpenAPI_deregistration_reason_convertToJSON(OpenAPI_deregistration_reason_t *deregistration_reason); +OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_copy(OpenAPI_deregistration_reason_t *dst, OpenAPI_deregistration_reason_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dl_data_delivery_status.c b/lib/sbi/openapi/model/dl_data_delivery_status.c index 0e0be9330..62a147044 100644 --- a/lib/sbi/openapi/model/dl_data_delivery_status.c +++ b/lib/sbi/openapi/model/dl_data_delivery_status.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_copy(OpenAPI_dl_data_delivery_status_t *dst, OpenAPI_dl_data_delivery_status_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dl_data_delivery_status_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dl_data_delivery_status_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dl_data_delivery_status_free(dst); + dst = OpenAPI_dl_data_delivery_status_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dl_data_delivery_status.h b/lib/sbi/openapi/model/dl_data_delivery_status.h index 2f8401e31..5bf518ef8 100644 --- a/lib/sbi/openapi/model/dl_data_delivery_status.h +++ b/lib/sbi/openapi/model/dl_data_delivery_status.h @@ -26,6 +26,7 @@ OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_create( void OpenAPI_dl_data_delivery_status_free(OpenAPI_dl_data_delivery_status_t *dl_data_delivery_status); OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_parseFromJSON(cJSON *dl_data_delivery_statusJSON); cJSON *OpenAPI_dl_data_delivery_status_convertToJSON(OpenAPI_dl_data_delivery_status_t *dl_data_delivery_status); +OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_copy(OpenAPI_dl_data_delivery_status_t *dst, OpenAPI_dl_data_delivery_status_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnai_change_type.c b/lib/sbi/openapi/model/dnai_change_type.c index 73a597bcf..70a8ad368 100644 --- a/lib/sbi/openapi/model/dnai_change_type.c +++ b/lib/sbi/openapi/model/dnai_change_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_copy(OpenAPI_dnai_change_type_t *dst, OpenAPI_dnai_change_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnai_change_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnai_change_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnai_change_type_free(dst); + dst = OpenAPI_dnai_change_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnai_change_type.h b/lib/sbi/openapi/model/dnai_change_type.h index 50eda7c12..9da883d07 100644 --- a/lib/sbi/openapi/model/dnai_change_type.h +++ b/lib/sbi/openapi/model/dnai_change_type.h @@ -26,6 +26,7 @@ OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_create( void OpenAPI_dnai_change_type_free(OpenAPI_dnai_change_type_t *dnai_change_type); OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_parseFromJSON(cJSON *dnai_change_typeJSON); cJSON *OpenAPI_dnai_change_type_convertToJSON(OpenAPI_dnai_change_type_t *dnai_change_type); +OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_copy(OpenAPI_dnai_change_type_t *dst, OpenAPI_dnai_change_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnai_information.c b/lib/sbi/openapi/model/dnai_information.c new file mode 100644 index 000000000..9525b889a --- /dev/null +++ b/lib/sbi/openapi/model/dnai_information.c @@ -0,0 +1,148 @@ + +#include +#include +#include +#include "dnai_information.h" + +OpenAPI_dnai_information_t *OpenAPI_dnai_information_create( + char *dnai, + int no_dnai_change_ind, + int no_local_psa_change_ind + ) +{ + OpenAPI_dnai_information_t *dnai_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnai_information_t)); + if (!dnai_information_local_var) { + return NULL; + } + dnai_information_local_var->dnai = dnai; + dnai_information_local_var->no_dnai_change_ind = no_dnai_change_ind; + dnai_information_local_var->no_local_psa_change_ind = no_local_psa_change_ind; + + return dnai_information_local_var; +} + +void OpenAPI_dnai_information_free(OpenAPI_dnai_information_t *dnai_information) +{ + if (NULL == dnai_information) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(dnai_information->dnai); + ogs_free(dnai_information); +} + +cJSON *OpenAPI_dnai_information_convertToJSON(OpenAPI_dnai_information_t *dnai_information) +{ + cJSON *item = NULL; + + if (dnai_information == NULL) { + ogs_error("OpenAPI_dnai_information_convertToJSON() failed [DnaiInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnai_information->dnai) { + ogs_error("OpenAPI_dnai_information_convertToJSON() failed [dnai]"); + goto end; + } + if (cJSON_AddStringToObject(item, "dnai", dnai_information->dnai) == NULL) { + ogs_error("OpenAPI_dnai_information_convertToJSON() failed [dnai]"); + goto end; + } + + if (dnai_information->no_dnai_change_ind) { + if (cJSON_AddBoolToObject(item, "noDnaiChangeInd", dnai_information->no_dnai_change_ind) == NULL) { + ogs_error("OpenAPI_dnai_information_convertToJSON() failed [no_dnai_change_ind]"); + goto end; + } + } + + if (dnai_information->no_local_psa_change_ind) { + if (cJSON_AddBoolToObject(item, "noLocalPsaChangeInd", dnai_information->no_local_psa_change_ind) == NULL) { + ogs_error("OpenAPI_dnai_information_convertToJSON() failed [no_local_psa_change_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_dnai_information_t *OpenAPI_dnai_information_parseFromJSON(cJSON *dnai_informationJSON) +{ + OpenAPI_dnai_information_t *dnai_information_local_var = NULL; + cJSON *dnai = cJSON_GetObjectItemCaseSensitive(dnai_informationJSON, "dnai"); + if (!dnai) { + ogs_error("OpenAPI_dnai_information_parseFromJSON() failed [dnai]"); + goto end; + } + + + if (!cJSON_IsString(dnai)) { + ogs_error("OpenAPI_dnai_information_parseFromJSON() failed [dnai]"); + goto end; + } + + cJSON *no_dnai_change_ind = cJSON_GetObjectItemCaseSensitive(dnai_informationJSON, "noDnaiChangeInd"); + + if (no_dnai_change_ind) { + if (!cJSON_IsBool(no_dnai_change_ind)) { + ogs_error("OpenAPI_dnai_information_parseFromJSON() failed [no_dnai_change_ind]"); + goto end; + } + } + + cJSON *no_local_psa_change_ind = cJSON_GetObjectItemCaseSensitive(dnai_informationJSON, "noLocalPsaChangeInd"); + + if (no_local_psa_change_ind) { + if (!cJSON_IsBool(no_local_psa_change_ind)) { + ogs_error("OpenAPI_dnai_information_parseFromJSON() failed [no_local_psa_change_ind]"); + goto end; + } + } + + dnai_information_local_var = OpenAPI_dnai_information_create ( + ogs_strdup(dnai->valuestring), + no_dnai_change_ind ? no_dnai_change_ind->valueint : 0, + no_local_psa_change_ind ? no_local_psa_change_ind->valueint : 0 + ); + + return dnai_information_local_var; +end: + return NULL; +} + +OpenAPI_dnai_information_t *OpenAPI_dnai_information_copy(OpenAPI_dnai_information_t *dst, OpenAPI_dnai_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnai_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnai_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnai_information_free(dst); + dst = OpenAPI_dnai_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnai_information.h b/lib/sbi/openapi/model/dnai_information.h new file mode 100644 index 000000000..1c4bc58dd --- /dev/null +++ b/lib/sbi/openapi/model/dnai_information.h @@ -0,0 +1,42 @@ +/* + * dnai_information.h + * + * + */ + +#ifndef _OpenAPI_dnai_information_H_ +#define _OpenAPI_dnai_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnai_information_s OpenAPI_dnai_information_t; +typedef struct OpenAPI_dnai_information_s { + char *dnai; + int no_dnai_change_ind; + int no_local_psa_change_ind; +} OpenAPI_dnai_information_t; + +OpenAPI_dnai_information_t *OpenAPI_dnai_information_create( + char *dnai, + int no_dnai_change_ind, + int no_local_psa_change_ind + ); +void OpenAPI_dnai_information_free(OpenAPI_dnai_information_t *dnai_information); +OpenAPI_dnai_information_t *OpenAPI_dnai_information_parseFromJSON(cJSON *dnai_informationJSON); +cJSON *OpenAPI_dnai_information_convertToJSON(OpenAPI_dnai_information_t *dnai_information); +OpenAPI_dnai_information_t *OpenAPI_dnai_information_copy(OpenAPI_dnai_information_t *dst, OpenAPI_dnai_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnai_information_H_ */ + diff --git a/lib/sbi/openapi/model/dnf.c b/lib/sbi/openapi/model/dnf.c index 6ce3df829..4452e521c 100644 --- a/lib/sbi/openapi/model/dnf.c +++ b/lib/sbi/openapi/model/dnf.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_dnf_t *OpenAPI_dnf_copy(OpenAPI_dnf_t *dst, OpenAPI_dnf_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnf_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnf_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnf_free(dst); + dst = OpenAPI_dnf_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnf.h b/lib/sbi/openapi/model/dnf.h index a603152fd..82459ce5e 100644 --- a/lib/sbi/openapi/model/dnf.h +++ b/lib/sbi/openapi/model/dnf.h @@ -29,6 +29,7 @@ OpenAPI_dnf_t *OpenAPI_dnf_create( void OpenAPI_dnf_free(OpenAPI_dnf_t *dnf); OpenAPI_dnf_t *OpenAPI_dnf_parseFromJSON(cJSON *dnfJSON); cJSON *OpenAPI_dnf_convertToJSON(OpenAPI_dnf_t *dnf); +OpenAPI_dnf_t *OpenAPI_dnf_copy(OpenAPI_dnf_t *dst, OpenAPI_dnf_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnf_unit.c b/lib/sbi/openapi/model/dnf_unit.c index 2f399af47..938cf6b1d 100644 --- a/lib/sbi/openapi/model/dnf_unit.c +++ b/lib/sbi/openapi/model/dnf_unit.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_dnf_unit_t *OpenAPI_dnf_unit_copy(OpenAPI_dnf_unit_t *dst, OpenAPI_dnf_unit_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnf_unit_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnf_unit_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnf_unit_free(dst); + dst = OpenAPI_dnf_unit_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnf_unit.h b/lib/sbi/openapi/model/dnf_unit.h index 42f84a74e..0e6641eda 100644 --- a/lib/sbi/openapi/model/dnf_unit.h +++ b/lib/sbi/openapi/model/dnf_unit.h @@ -29,6 +29,7 @@ OpenAPI_dnf_unit_t *OpenAPI_dnf_unit_create( void OpenAPI_dnf_unit_free(OpenAPI_dnf_unit_t *dnf_unit); OpenAPI_dnf_unit_t *OpenAPI_dnf_unit_parseFromJSON(cJSON *dnf_unitJSON); cJSON *OpenAPI_dnf_unit_convertToJSON(OpenAPI_dnf_unit_t *dnf_unit); +OpenAPI_dnf_unit_t *OpenAPI_dnf_unit_copy(OpenAPI_dnf_unit_t *dst, OpenAPI_dnf_unit_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnn_configuration.c b/lib/sbi/openapi/model/dnn_configuration.c index a3432d7f7..19c545fbb 100644 --- a/lib/sbi/openapi/model/dnn_configuration.c +++ b/lib/sbi/openapi/model/dnn_configuration.c @@ -119,7 +119,7 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ goto end; } - if (dnn_configuration->iwk_eps_ind >= 0) { + if (dnn_configuration->iwk_eps_ind) { if (cJSON_AddBoolToObject(item, "iwkEpsInd", dnn_configuration->iwk_eps_ind) == NULL) { ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [iwk_eps_ind]"); goto end; @@ -199,7 +199,7 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ } } - if (dnn_configuration->invoke_nef_selection >= 0) { + if (dnn_configuration->invoke_nef_selection) { if (cJSON_AddBoolToObject(item, "invokeNefSelection", dnn_configuration->invoke_nef_selection) == NULL) { ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [invoke_nef_selection]"); goto end; @@ -226,7 +226,7 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ } } - if (dnn_configuration->redundant_session_allowed >= 0) { + if (dnn_configuration->redundant_session_allowed) { if (cJSON_AddBoolToObject(item, "redundantSessionAllowed", dnn_configuration->redundant_session_allowed) == NULL) { ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [redundant_session_allowed]"); goto end; @@ -286,7 +286,7 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ } } - if (dnn_configuration->atsss_allowed >= 0) { + if (dnn_configuration->atsss_allowed) { if (cJSON_AddBoolToObject(item, "atsssAllowed", dnn_configuration->atsss_allowed) == NULL) { ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [atsss_allowed]"); goto end; @@ -514,3 +514,37 @@ end: return NULL; } +OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_copy(OpenAPI_dnn_configuration_t *dst, OpenAPI_dnn_configuration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_configuration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnn_configuration_free(dst); + dst = OpenAPI_dnn_configuration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_configuration.h b/lib/sbi/openapi/model/dnn_configuration.h index c871b9e41..e124a640b 100644 --- a/lib/sbi/openapi/model/dnn_configuration.h +++ b/lib/sbi/openapi/model/dnn_configuration.h @@ -70,6 +70,7 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( void OpenAPI_dnn_configuration_free(OpenAPI_dnn_configuration_t *dnn_configuration); OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_configurationJSON); cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_configuration); +OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_copy(OpenAPI_dnn_configuration_t *dst, OpenAPI_dnn_configuration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnn_info.c b/lib/sbi/openapi/model/dnn_info.c index 491527668..6c1c0c0d6 100644 --- a/lib/sbi/openapi/model/dnn_info.c +++ b/lib/sbi/openapi/model/dnn_info.c @@ -54,28 +54,28 @@ cJSON *OpenAPI_dnn_info_convertToJSON(OpenAPI_dnn_info_t *dnn_info) goto end; } - if (dnn_info->default_dnn_indicator >= 0) { + if (dnn_info->default_dnn_indicator) { if (cJSON_AddBoolToObject(item, "defaultDnnIndicator", dnn_info->default_dnn_indicator) == NULL) { ogs_error("OpenAPI_dnn_info_convertToJSON() failed [default_dnn_indicator]"); goto end; } } - if (dnn_info->lbo_roaming_allowed >= 0) { + if (dnn_info->lbo_roaming_allowed) { if (cJSON_AddBoolToObject(item, "lboRoamingAllowed", dnn_info->lbo_roaming_allowed) == NULL) { ogs_error("OpenAPI_dnn_info_convertToJSON() failed [lbo_roaming_allowed]"); goto end; } } - if (dnn_info->iwk_eps_ind >= 0) { + if (dnn_info->iwk_eps_ind) { if (cJSON_AddBoolToObject(item, "iwkEpsInd", dnn_info->iwk_eps_ind) == NULL) { ogs_error("OpenAPI_dnn_info_convertToJSON() failed [iwk_eps_ind]"); goto end; } } - if (dnn_info->dnn_barred >= 0) { + if (dnn_info->dnn_barred) { if (cJSON_AddBoolToObject(item, "dnnBarred", dnn_info->dnn_barred) == NULL) { ogs_error("OpenAPI_dnn_info_convertToJSON() failed [dnn_barred]"); goto end; @@ -150,3 +150,37 @@ end: return NULL; } +OpenAPI_dnn_info_t *OpenAPI_dnn_info_copy(OpenAPI_dnn_info_t *dst, OpenAPI_dnn_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_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_dnn_info_free(dst); + dst = OpenAPI_dnn_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_info.h b/lib/sbi/openapi/model/dnn_info.h index b3523ad0f..2ac901cc4 100644 --- a/lib/sbi/openapi/model/dnn_info.h +++ b/lib/sbi/openapi/model/dnn_info.h @@ -36,6 +36,7 @@ OpenAPI_dnn_info_t *OpenAPI_dnn_info_create( void OpenAPI_dnn_info_free(OpenAPI_dnn_info_t *dnn_info); OpenAPI_dnn_info_t *OpenAPI_dnn_info_parseFromJSON(cJSON *dnn_infoJSON); cJSON *OpenAPI_dnn_info_convertToJSON(OpenAPI_dnn_info_t *dnn_info); +OpenAPI_dnn_info_t *OpenAPI_dnn_info_copy(OpenAPI_dnn_info_t *dst, OpenAPI_dnn_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnn_route_selection_descriptor.c b/lib/sbi/openapi/model/dnn_route_selection_descriptor.c index 33c05cb31..18b8b39f0 100644 --- a/lib/sbi/openapi/model/dnn_route_selection_descriptor.c +++ b/lib/sbi/openapi/model/dnn_route_selection_descriptor.c @@ -28,13 +28,7 @@ void OpenAPI_dnn_route_selection_descriptor_free(OpenAPI_dnn_route_selection_des } OpenAPI_lnode_t *node; ogs_free(dnn_route_selection_descriptor->dnn); - OpenAPI_list_for_each(dnn_route_selection_descriptor->ssc_modes, node) { - OpenAPI_ssc_mode_free(node->data); - } OpenAPI_list_free(dnn_route_selection_descriptor->ssc_modes); - OpenAPI_list_for_each(dnn_route_selection_descriptor->pdu_sess_types, node) { - OpenAPI_pdu_session_type_free(node->data); - } OpenAPI_list_free(dnn_route_selection_descriptor->pdu_sess_types); ogs_free(dnn_route_selection_descriptor); } @@ -59,41 +53,31 @@ cJSON *OpenAPI_dnn_route_selection_descriptor_convertToJSON(OpenAPI_dnn_route_se } if (dnn_route_selection_descriptor->ssc_modes) { - cJSON *ssc_modesList = cJSON_AddArrayToObject(item, "sscModes"); - if (ssc_modesList == NULL) { + cJSON *ssc_modes = cJSON_AddArrayToObject(item, "sscModes"); + if (ssc_modes == NULL) { ogs_error("OpenAPI_dnn_route_selection_descriptor_convertToJSON() failed [ssc_modes]"); goto end; } - OpenAPI_lnode_t *ssc_modes_node; - if (dnn_route_selection_descriptor->ssc_modes) { - OpenAPI_list_for_each(dnn_route_selection_descriptor->ssc_modes, ssc_modes_node) { - cJSON *itemLocal = OpenAPI_ssc_mode_convertToJSON(ssc_modes_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_dnn_route_selection_descriptor_convertToJSON() failed [ssc_modes]"); - goto end; - } - cJSON_AddItemToArray(ssc_modesList, itemLocal); + OpenAPI_list_for_each(dnn_route_selection_descriptor->ssc_modes, ssc_modes_node) { + if (cJSON_AddStringToObject(ssc_modes, "", OpenAPI_ssc_mode_ToString((OpenAPI_ssc_mode_e)ssc_modes_node->data)) == NULL) { + ogs_error("OpenAPI_dnn_route_selection_descriptor_convertToJSON() failed [ssc_modes]"); + goto end; } } } if (dnn_route_selection_descriptor->pdu_sess_types) { - cJSON *pdu_sess_typesList = cJSON_AddArrayToObject(item, "pduSessTypes"); - if (pdu_sess_typesList == NULL) { + cJSON *pdu_sess_types = cJSON_AddArrayToObject(item, "pduSessTypes"); + if (pdu_sess_types == NULL) { ogs_error("OpenAPI_dnn_route_selection_descriptor_convertToJSON() failed [pdu_sess_types]"); goto end; } - OpenAPI_lnode_t *pdu_sess_types_node; - if (dnn_route_selection_descriptor->pdu_sess_types) { - OpenAPI_list_for_each(dnn_route_selection_descriptor->pdu_sess_types, pdu_sess_types_node) { - cJSON *itemLocal = OpenAPI_pdu_session_type_convertToJSON(pdu_sess_types_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_dnn_route_selection_descriptor_convertToJSON() failed [pdu_sess_types]"); - goto end; - } - cJSON_AddItemToArray(pdu_sess_typesList, itemLocal); + OpenAPI_list_for_each(dnn_route_selection_descriptor->pdu_sess_types, pdu_sess_types_node) { + if (cJSON_AddStringToObject(pdu_sess_types, "", OpenAPI_pdu_session_type_ToString((OpenAPI_pdu_session_type_e)pdu_sess_types_node->data)) == NULL) { + ogs_error("OpenAPI_dnn_route_selection_descriptor_convertToJSON() failed [pdu_sess_types]"); + goto end; } } } @@ -130,13 +114,12 @@ OpenAPI_dnn_route_selection_descriptor_t *OpenAPI_dnn_route_selection_descriptor ssc_modesList = OpenAPI_list_create(); cJSON_ArrayForEach(ssc_modes_local_nonprimitive, ssc_modes ) { - if (!cJSON_IsObject(ssc_modes_local_nonprimitive)) { + if (!cJSON_IsString(ssc_modes_local_nonprimitive)) { ogs_error("OpenAPI_dnn_route_selection_descriptor_parseFromJSON() failed [ssc_modes]"); goto end; } - OpenAPI_ssc_mode_t *ssc_modesItem = OpenAPI_ssc_mode_parseFromJSON(ssc_modes_local_nonprimitive); - OpenAPI_list_add(ssc_modesList, ssc_modesItem); + OpenAPI_list_add(ssc_modesList, (void *)OpenAPI_ssc_mode_FromString(ssc_modes_local_nonprimitive->valuestring)); } } @@ -153,13 +136,12 @@ OpenAPI_dnn_route_selection_descriptor_t *OpenAPI_dnn_route_selection_descriptor pdu_sess_typesList = OpenAPI_list_create(); cJSON_ArrayForEach(pdu_sess_types_local_nonprimitive, pdu_sess_types ) { - if (!cJSON_IsObject(pdu_sess_types_local_nonprimitive)) { + if (!cJSON_IsString(pdu_sess_types_local_nonprimitive)) { ogs_error("OpenAPI_dnn_route_selection_descriptor_parseFromJSON() failed [pdu_sess_types]"); goto end; } - OpenAPI_pdu_session_type_t *pdu_sess_typesItem = OpenAPI_pdu_session_type_parseFromJSON(pdu_sess_types_local_nonprimitive); - OpenAPI_list_add(pdu_sess_typesList, pdu_sess_typesItem); + OpenAPI_list_add(pdu_sess_typesList, (void *)OpenAPI_pdu_session_type_FromString(pdu_sess_types_local_nonprimitive->valuestring)); } } @@ -174,3 +156,37 @@ end: return NULL; } +OpenAPI_dnn_route_selection_descriptor_t *OpenAPI_dnn_route_selection_descriptor_copy(OpenAPI_dnn_route_selection_descriptor_t *dst, OpenAPI_dnn_route_selection_descriptor_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_route_selection_descriptor_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_route_selection_descriptor_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnn_route_selection_descriptor_free(dst); + dst = OpenAPI_dnn_route_selection_descriptor_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_route_selection_descriptor.h b/lib/sbi/openapi/model/dnn_route_selection_descriptor.h index a307bdbf9..90ae94b65 100644 --- a/lib/sbi/openapi/model/dnn_route_selection_descriptor.h +++ b/lib/sbi/openapi/model/dnn_route_selection_descriptor.h @@ -34,6 +34,7 @@ OpenAPI_dnn_route_selection_descriptor_t *OpenAPI_dnn_route_selection_descriptor void OpenAPI_dnn_route_selection_descriptor_free(OpenAPI_dnn_route_selection_descriptor_t *dnn_route_selection_descriptor); OpenAPI_dnn_route_selection_descriptor_t *OpenAPI_dnn_route_selection_descriptor_parseFromJSON(cJSON *dnn_route_selection_descriptorJSON); cJSON *OpenAPI_dnn_route_selection_descriptor_convertToJSON(OpenAPI_dnn_route_selection_descriptor_t *dnn_route_selection_descriptor); +OpenAPI_dnn_route_selection_descriptor_t *OpenAPI_dnn_route_selection_descriptor_copy(OpenAPI_dnn_route_selection_descriptor_t *dst, OpenAPI_dnn_route_selection_descriptor_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnn_selection_mode.c b/lib/sbi/openapi/model/dnn_selection_mode.c new file mode 100644 index 000000000..803472933 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_selection_mode.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "dnn_selection_mode.h" + +OpenAPI_dnn_selection_mode_t *OpenAPI_dnn_selection_mode_create( + ) +{ + OpenAPI_dnn_selection_mode_t *dnn_selection_mode_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnn_selection_mode_t)); + if (!dnn_selection_mode_local_var) { + return NULL; + } + + return dnn_selection_mode_local_var; +} + +void OpenAPI_dnn_selection_mode_free(OpenAPI_dnn_selection_mode_t *dnn_selection_mode) +{ + if (NULL == dnn_selection_mode) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(dnn_selection_mode); +} + +cJSON *OpenAPI_dnn_selection_mode_convertToJSON(OpenAPI_dnn_selection_mode_t *dnn_selection_mode) +{ + cJSON *item = NULL; + + if (dnn_selection_mode == NULL) { + ogs_error("OpenAPI_dnn_selection_mode_convertToJSON() failed [DnnSelectionMode]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_dnn_selection_mode_t *OpenAPI_dnn_selection_mode_parseFromJSON(cJSON *dnn_selection_modeJSON) +{ + OpenAPI_dnn_selection_mode_t *dnn_selection_mode_local_var = NULL; + dnn_selection_mode_local_var = OpenAPI_dnn_selection_mode_create ( + ); + + return dnn_selection_mode_local_var; +end: + return NULL; +} + +OpenAPI_dnn_selection_mode_t *OpenAPI_dnn_selection_mode_copy(OpenAPI_dnn_selection_mode_t *dst, OpenAPI_dnn_selection_mode_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_selection_mode_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_selection_mode_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnn_selection_mode_free(dst); + dst = OpenAPI_dnn_selection_mode_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_selection_mode.h b/lib/sbi/openapi/model/dnn_selection_mode.h new file mode 100644 index 000000000..0fefd53b0 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_selection_mode.h @@ -0,0 +1,36 @@ +/* + * dnn_selection_mode.h + * + * Possible values are - VERIFIED - UE_DNN_NOT_VERIFIED - NW_DNN_NOT_VERIFIED + */ + +#ifndef _OpenAPI_dnn_selection_mode_H_ +#define _OpenAPI_dnn_selection_mode_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnn_selection_mode_s OpenAPI_dnn_selection_mode_t; +typedef struct OpenAPI_dnn_selection_mode_s { +} OpenAPI_dnn_selection_mode_t; + +OpenAPI_dnn_selection_mode_t *OpenAPI_dnn_selection_mode_create( + ); +void OpenAPI_dnn_selection_mode_free(OpenAPI_dnn_selection_mode_t *dnn_selection_mode); +OpenAPI_dnn_selection_mode_t *OpenAPI_dnn_selection_mode_parseFromJSON(cJSON *dnn_selection_modeJSON); +cJSON *OpenAPI_dnn_selection_mode_convertToJSON(OpenAPI_dnn_selection_mode_t *dnn_selection_mode); +OpenAPI_dnn_selection_mode_t *OpenAPI_dnn_selection_mode_copy(OpenAPI_dnn_selection_mode_t *dst, OpenAPI_dnn_selection_mode_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_selection_mode_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_smf_info_item.c b/lib/sbi/openapi/model/dnn_smf_info_item.c index 2dfdaecfa..7d2d5dbbd 100644 --- a/lib/sbi/openapi/model/dnn_smf_info_item.c +++ b/lib/sbi/openapi/model/dnn_smf_info_item.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_copy(OpenAPI_dnn_smf_info_item_t *dst, OpenAPI_dnn_smf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_smf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_smf_info_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnn_smf_info_item_free(dst); + dst = OpenAPI_dnn_smf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_smf_info_item.h b/lib/sbi/openapi/model/dnn_smf_info_item.h index 95e69546d..128f058e4 100644 --- a/lib/sbi/openapi/model/dnn_smf_info_item.h +++ b/lib/sbi/openapi/model/dnn_smf_info_item.h @@ -28,6 +28,7 @@ OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_create( void OpenAPI_dnn_smf_info_item_free(OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item); OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_parseFromJSON(cJSON *dnn_smf_info_itemJSON); cJSON *OpenAPI_dnn_smf_info_item_convertToJSON(OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item); +OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_copy(OpenAPI_dnn_smf_info_item_t *dst, OpenAPI_dnn_smf_info_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnn_upf_info_item.c b/lib/sbi/openapi/model/dnn_upf_info_item.c index 5dd47820f..c6108c80d 100644 --- a/lib/sbi/openapi/model/dnn_upf_info_item.c +++ b/lib/sbi/openapi/model/dnn_upf_info_item.c @@ -36,9 +36,6 @@ void OpenAPI_dnn_upf_info_item_free(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_it ogs_free(node->data); } OpenAPI_list_free(dnn_upf_info_item->dnai_list); - OpenAPI_list_for_each(dnn_upf_info_item->pdu_session_types, node) { - OpenAPI_pdu_session_type_free(node->data); - } OpenAPI_list_free(dnn_upf_info_item->pdu_session_types); OpenAPI_list_for_each(dnn_upf_info_item->ipv4_address_ranges, node) { OpenAPI_ipv4_address_range_free(node->data); @@ -87,21 +84,16 @@ cJSON *OpenAPI_dnn_upf_info_item_convertToJSON(OpenAPI_dnn_upf_info_item_t *dnn_ } if (dnn_upf_info_item->pdu_session_types) { - cJSON *pdu_session_typesList = cJSON_AddArrayToObject(item, "pduSessionTypes"); - if (pdu_session_typesList == NULL) { + cJSON *pdu_session_types = cJSON_AddArrayToObject(item, "pduSessionTypes"); + if (pdu_session_types == NULL) { ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [pdu_session_types]"); goto end; } - OpenAPI_lnode_t *pdu_session_types_node; - if (dnn_upf_info_item->pdu_session_types) { - OpenAPI_list_for_each(dnn_upf_info_item->pdu_session_types, pdu_session_types_node) { - cJSON *itemLocal = OpenAPI_pdu_session_type_convertToJSON(pdu_session_types_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [pdu_session_types]"); - goto end; - } - cJSON_AddItemToArray(pdu_session_typesList, itemLocal); + OpenAPI_list_for_each(dnn_upf_info_item->pdu_session_types, pdu_session_types_node) { + if (cJSON_AddStringToObject(pdu_session_types, "", OpenAPI_pdu_session_type_ToString((OpenAPI_pdu_session_type_e)pdu_session_types_node->data)) == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [pdu_session_types]"); + goto end; } } } @@ -198,13 +190,12 @@ OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_parseFromJSON(cJSON *dnn_ pdu_session_typesList = OpenAPI_list_create(); cJSON_ArrayForEach(pdu_session_types_local_nonprimitive, pdu_session_types ) { - if (!cJSON_IsObject(pdu_session_types_local_nonprimitive)) { + if (!cJSON_IsString(pdu_session_types_local_nonprimitive)) { ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [pdu_session_types]"); goto end; } - OpenAPI_pdu_session_type_t *pdu_session_typesItem = OpenAPI_pdu_session_type_parseFromJSON(pdu_session_types_local_nonprimitive); - OpenAPI_list_add(pdu_session_typesList, pdu_session_typesItem); + OpenAPI_list_add(pdu_session_typesList, (void *)OpenAPI_pdu_session_type_FromString(pdu_session_types_local_nonprimitive->valuestring)); } } @@ -267,3 +258,37 @@ end: return NULL; } +OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_copy(OpenAPI_dnn_upf_info_item_t *dst, OpenAPI_dnn_upf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_upf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dnn_upf_info_item_free(dst); + dst = OpenAPI_dnn_upf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_upf_info_item.h b/lib/sbi/openapi/model/dnn_upf_info_item.h index 756ae68cf..d409fcbf2 100644 --- a/lib/sbi/openapi/model/dnn_upf_info_item.h +++ b/lib/sbi/openapi/model/dnn_upf_info_item.h @@ -39,6 +39,7 @@ OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_create( void OpenAPI_dnn_upf_info_item_free(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item); OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_parseFromJSON(cJSON *dnn_upf_info_itemJSON); cJSON *OpenAPI_dnn_upf_info_item_convertToJSON(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item); +OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_copy(OpenAPI_dnn_upf_info_item_t *dst, OpenAPI_dnn_upf_info_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/domain_name_protocol.c b/lib/sbi/openapi/model/domain_name_protocol.c index d7e322449..c79b800dd 100644 --- a/lib/sbi/openapi/model/domain_name_protocol.c +++ b/lib/sbi/openapi/model/domain_name_protocol.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_domain_name_protocol_t *OpenAPI_domain_name_protocol_copy(OpenAPI_domain_name_protocol_t *dst, OpenAPI_domain_name_protocol_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_domain_name_protocol_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_domain_name_protocol_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_domain_name_protocol_free(dst); + dst = OpenAPI_domain_name_protocol_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/domain_name_protocol.h b/lib/sbi/openapi/model/domain_name_protocol.h index 1d0d7f53c..1e3d83dd0 100644 --- a/lib/sbi/openapi/model/domain_name_protocol.h +++ b/lib/sbi/openapi/model/domain_name_protocol.h @@ -26,6 +26,7 @@ OpenAPI_domain_name_protocol_t *OpenAPI_domain_name_protocol_create( void OpenAPI_domain_name_protocol_free(OpenAPI_domain_name_protocol_t *domain_name_protocol); OpenAPI_domain_name_protocol_t *OpenAPI_domain_name_protocol_parseFromJSON(cJSON *domain_name_protocolJSON); cJSON *OpenAPI_domain_name_protocol_convertToJSON(OpenAPI_domain_name_protocol_t *domain_name_protocol); +OpenAPI_domain_name_protocol_t *OpenAPI_domain_name_protocol_copy(OpenAPI_domain_name_protocol_t *dst, OpenAPI_domain_name_protocol_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dynamic5_qi.c b/lib/sbi/openapi/model/dynamic5_qi.c new file mode 100644 index 000000000..dd890c85d --- /dev/null +++ b/lib/sbi/openapi/model/dynamic5_qi.c @@ -0,0 +1,244 @@ + +#include +#include +#include +#include "dynamic5_qi.h" + +OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_create( + OpenAPI_qos_resource_type_t *resource_type, + int priority_level, + int packet_delay_budget, + char *packet_err_rate, + int aver_window, + int max_data_burst_vol, + int ext_max_data_burst_vol + ) +{ + OpenAPI_dynamic5_qi_t *dynamic5_qi_local_var = OpenAPI_malloc(sizeof(OpenAPI_dynamic5_qi_t)); + if (!dynamic5_qi_local_var) { + return NULL; + } + dynamic5_qi_local_var->resource_type = resource_type; + dynamic5_qi_local_var->priority_level = priority_level; + dynamic5_qi_local_var->packet_delay_budget = packet_delay_budget; + dynamic5_qi_local_var->packet_err_rate = packet_err_rate; + dynamic5_qi_local_var->aver_window = aver_window; + dynamic5_qi_local_var->max_data_burst_vol = max_data_burst_vol; + dynamic5_qi_local_var->ext_max_data_burst_vol = ext_max_data_burst_vol; + + return dynamic5_qi_local_var; +} + +void OpenAPI_dynamic5_qi_free(OpenAPI_dynamic5_qi_t *dynamic5_qi) +{ + if (NULL == dynamic5_qi) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_qos_resource_type_free(dynamic5_qi->resource_type); + ogs_free(dynamic5_qi->packet_err_rate); + ogs_free(dynamic5_qi); +} + +cJSON *OpenAPI_dynamic5_qi_convertToJSON(OpenAPI_dynamic5_qi_t *dynamic5_qi) +{ + cJSON *item = NULL; + + if (dynamic5_qi == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [Dynamic5Qi]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dynamic5_qi->resource_type) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [resource_type]"); + goto end; + } + cJSON *resource_type_local_JSON = OpenAPI_qos_resource_type_convertToJSON(dynamic5_qi->resource_type); + if (resource_type_local_JSON == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [resource_type]"); + goto end; + } + cJSON_AddItemToObject(item, "resourceType", resource_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [resource_type]"); + goto end; + } + + if (!dynamic5_qi->priority_level) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [priority_level]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "priorityLevel", dynamic5_qi->priority_level) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [priority_level]"); + goto end; + } + + if (!dynamic5_qi->packet_delay_budget) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [packet_delay_budget]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "packetDelayBudget", dynamic5_qi->packet_delay_budget) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [packet_delay_budget]"); + goto end; + } + + if (!dynamic5_qi->packet_err_rate) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [packet_err_rate]"); + goto end; + } + if (cJSON_AddStringToObject(item, "packetErrRate", dynamic5_qi->packet_err_rate) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [packet_err_rate]"); + goto end; + } + + if (dynamic5_qi->aver_window) { + if (cJSON_AddNumberToObject(item, "averWindow", dynamic5_qi->aver_window) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [aver_window]"); + goto end; + } + } + + if (dynamic5_qi->max_data_burst_vol) { + if (cJSON_AddNumberToObject(item, "maxDataBurstVol", dynamic5_qi->max_data_burst_vol) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [max_data_burst_vol]"); + goto end; + } + } + + if (dynamic5_qi->ext_max_data_burst_vol) { + if (cJSON_AddNumberToObject(item, "extMaxDataBurstVol", dynamic5_qi->ext_max_data_burst_vol) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [ext_max_data_burst_vol]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_parseFromJSON(cJSON *dynamic5_qiJSON) +{ + OpenAPI_dynamic5_qi_t *dynamic5_qi_local_var = NULL; + cJSON *resource_type = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "resourceType"); + if (!resource_type) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [resource_type]"); + goto end; + } + + OpenAPI_qos_resource_type_t *resource_type_local_nonprim = NULL; + + resource_type_local_nonprim = OpenAPI_qos_resource_type_parseFromJSON(resource_type); + + cJSON *priority_level = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "priorityLevel"); + if (!priority_level) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [priority_level]"); + goto end; + } + + + if (!cJSON_IsNumber(priority_level)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [priority_level]"); + goto end; + } + + cJSON *packet_delay_budget = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "packetDelayBudget"); + if (!packet_delay_budget) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [packet_delay_budget]"); + goto end; + } + + + if (!cJSON_IsNumber(packet_delay_budget)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [packet_delay_budget]"); + goto end; + } + + cJSON *packet_err_rate = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "packetErrRate"); + if (!packet_err_rate) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [packet_err_rate]"); + goto end; + } + + + if (!cJSON_IsString(packet_err_rate)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [packet_err_rate]"); + goto end; + } + + cJSON *aver_window = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "averWindow"); + + if (aver_window) { + if (!cJSON_IsNumber(aver_window)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [aver_window]"); + goto end; + } + } + + cJSON *max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "maxDataBurstVol"); + + if (max_data_burst_vol) { + if (!cJSON_IsNumber(max_data_burst_vol)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [max_data_burst_vol]"); + goto end; + } + } + + cJSON *ext_max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "extMaxDataBurstVol"); + + if (ext_max_data_burst_vol) { + if (!cJSON_IsNumber(ext_max_data_burst_vol)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [ext_max_data_burst_vol]"); + goto end; + } + } + + dynamic5_qi_local_var = OpenAPI_dynamic5_qi_create ( + resource_type_local_nonprim, + priority_level->valuedouble, + packet_delay_budget->valuedouble, + ogs_strdup(packet_err_rate->valuestring), + aver_window ? aver_window->valuedouble : 0, + max_data_burst_vol ? max_data_burst_vol->valuedouble : 0, + ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0 + ); + + return dynamic5_qi_local_var; +end: + return NULL; +} + +OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_copy(OpenAPI_dynamic5_qi_t *dst, OpenAPI_dynamic5_qi_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dynamic5_qi_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_dynamic5_qi_free(dst); + dst = OpenAPI_dynamic5_qi_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dynamic5_qi.h b/lib/sbi/openapi/model/dynamic5_qi.h new file mode 100644 index 000000000..c1f9df527 --- /dev/null +++ b/lib/sbi/openapi/model/dynamic5_qi.h @@ -0,0 +1,51 @@ +/* + * dynamic5_qi.h + * + * + */ + +#ifndef _OpenAPI_dynamic5_qi_H_ +#define _OpenAPI_dynamic5_qi_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "qos_resource_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dynamic5_qi_s OpenAPI_dynamic5_qi_t; +typedef struct OpenAPI_dynamic5_qi_s { + struct OpenAPI_qos_resource_type_s *resource_type; + int priority_level; + int packet_delay_budget; + char *packet_err_rate; + int aver_window; + int max_data_burst_vol; + int ext_max_data_burst_vol; +} OpenAPI_dynamic5_qi_t; + +OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_create( + OpenAPI_qos_resource_type_t *resource_type, + int priority_level, + int packet_delay_budget, + char *packet_err_rate, + int aver_window, + int max_data_burst_vol, + int ext_max_data_burst_vol + ); +void OpenAPI_dynamic5_qi_free(OpenAPI_dynamic5_qi_t *dynamic5_qi); +OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_parseFromJSON(cJSON *dynamic5_qiJSON); +cJSON *OpenAPI_dynamic5_qi_convertToJSON(OpenAPI_dynamic5_qi_t *dynamic5_qi); +OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_copy(OpenAPI_dynamic5_qi_t *dst, OpenAPI_dynamic5_qi_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dynamic5_qi_H_ */ + diff --git a/lib/sbi/openapi/model/eap_session.c b/lib/sbi/openapi/model/eap_session.c index c5c162bb5..30462f805 100644 --- a/lib/sbi/openapi/model/eap_session.c +++ b/lib/sbi/openapi/model/eap_session.c @@ -188,3 +188,37 @@ end: return NULL; } +OpenAPI_eap_session_t *OpenAPI_eap_session_copy(OpenAPI_eap_session_t *dst, OpenAPI_eap_session_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eap_session_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eap_session_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_eap_session_free(dst); + dst = OpenAPI_eap_session_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eap_session.h b/lib/sbi/openapi/model/eap_session.h index 24e49dd16..b7bf9b420 100644 --- a/lib/sbi/openapi/model/eap_session.h +++ b/lib/sbi/openapi/model/eap_session.h @@ -38,6 +38,7 @@ OpenAPI_eap_session_t *OpenAPI_eap_session_create( void OpenAPI_eap_session_free(OpenAPI_eap_session_t *eap_session); OpenAPI_eap_session_t *OpenAPI_eap_session_parseFromJSON(cJSON *eap_sessionJSON); cJSON *OpenAPI_eap_session_convertToJSON(OpenAPI_eap_session_t *eap_session); +OpenAPI_eap_session_t *OpenAPI_eap_session_copy(OpenAPI_eap_session_t *dst, OpenAPI_eap_session_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ebi_arp_mapping.c b/lib/sbi/openapi/model/ebi_arp_mapping.c new file mode 100644 index 000000000..39ff5874c --- /dev/null +++ b/lib/sbi/openapi/model/ebi_arp_mapping.c @@ -0,0 +1,138 @@ + +#include +#include +#include +#include "ebi_arp_mapping.h" + +OpenAPI_ebi_arp_mapping_t *OpenAPI_ebi_arp_mapping_create( + int eps_bearer_id, + OpenAPI_arp_t *arp + ) +{ + OpenAPI_ebi_arp_mapping_t *ebi_arp_mapping_local_var = OpenAPI_malloc(sizeof(OpenAPI_ebi_arp_mapping_t)); + if (!ebi_arp_mapping_local_var) { + return NULL; + } + ebi_arp_mapping_local_var->eps_bearer_id = eps_bearer_id; + ebi_arp_mapping_local_var->arp = arp; + + return ebi_arp_mapping_local_var; +} + +void OpenAPI_ebi_arp_mapping_free(OpenAPI_ebi_arp_mapping_t *ebi_arp_mapping) +{ + if (NULL == ebi_arp_mapping) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_arp_free(ebi_arp_mapping->arp); + ogs_free(ebi_arp_mapping); +} + +cJSON *OpenAPI_ebi_arp_mapping_convertToJSON(OpenAPI_ebi_arp_mapping_t *ebi_arp_mapping) +{ + cJSON *item = NULL; + + if (ebi_arp_mapping == NULL) { + ogs_error("OpenAPI_ebi_arp_mapping_convertToJSON() failed [EbiArpMapping]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ebi_arp_mapping->eps_bearer_id) { + ogs_error("OpenAPI_ebi_arp_mapping_convertToJSON() failed [eps_bearer_id]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "epsBearerId", ebi_arp_mapping->eps_bearer_id) == NULL) { + ogs_error("OpenAPI_ebi_arp_mapping_convertToJSON() failed [eps_bearer_id]"); + goto end; + } + + if (!ebi_arp_mapping->arp) { + ogs_error("OpenAPI_ebi_arp_mapping_convertToJSON() failed [arp]"); + goto end; + } + cJSON *arp_local_JSON = OpenAPI_arp_convertToJSON(ebi_arp_mapping->arp); + if (arp_local_JSON == NULL) { + ogs_error("OpenAPI_ebi_arp_mapping_convertToJSON() failed [arp]"); + goto end; + } + cJSON_AddItemToObject(item, "arp", arp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ebi_arp_mapping_convertToJSON() failed [arp]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ebi_arp_mapping_t *OpenAPI_ebi_arp_mapping_parseFromJSON(cJSON *ebi_arp_mappingJSON) +{ + OpenAPI_ebi_arp_mapping_t *ebi_arp_mapping_local_var = NULL; + cJSON *eps_bearer_id = cJSON_GetObjectItemCaseSensitive(ebi_arp_mappingJSON, "epsBearerId"); + if (!eps_bearer_id) { + ogs_error("OpenAPI_ebi_arp_mapping_parseFromJSON() failed [eps_bearer_id]"); + goto end; + } + + + if (!cJSON_IsNumber(eps_bearer_id)) { + ogs_error("OpenAPI_ebi_arp_mapping_parseFromJSON() failed [eps_bearer_id]"); + goto end; + } + + cJSON *arp = cJSON_GetObjectItemCaseSensitive(ebi_arp_mappingJSON, "arp"); + if (!arp) { + ogs_error("OpenAPI_ebi_arp_mapping_parseFromJSON() failed [arp]"); + goto end; + } + + OpenAPI_arp_t *arp_local_nonprim = NULL; + + arp_local_nonprim = OpenAPI_arp_parseFromJSON(arp); + + ebi_arp_mapping_local_var = OpenAPI_ebi_arp_mapping_create ( + eps_bearer_id->valuedouble, + arp_local_nonprim + ); + + return ebi_arp_mapping_local_var; +end: + return NULL; +} + +OpenAPI_ebi_arp_mapping_t *OpenAPI_ebi_arp_mapping_copy(OpenAPI_ebi_arp_mapping_t *dst, OpenAPI_ebi_arp_mapping_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ebi_arp_mapping_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ebi_arp_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_ebi_arp_mapping_free(dst); + dst = OpenAPI_ebi_arp_mapping_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ebi_arp_mapping.h b/lib/sbi/openapi/model/ebi_arp_mapping.h new file mode 100644 index 000000000..f066e3246 --- /dev/null +++ b/lib/sbi/openapi/model/ebi_arp_mapping.h @@ -0,0 +1,41 @@ +/* + * ebi_arp_mapping.h + * + * + */ + +#ifndef _OpenAPI_ebi_arp_mapping_H_ +#define _OpenAPI_ebi_arp_mapping_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "arp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ebi_arp_mapping_s OpenAPI_ebi_arp_mapping_t; +typedef struct OpenAPI_ebi_arp_mapping_s { + int eps_bearer_id; + struct OpenAPI_arp_s *arp; +} OpenAPI_ebi_arp_mapping_t; + +OpenAPI_ebi_arp_mapping_t *OpenAPI_ebi_arp_mapping_create( + int eps_bearer_id, + OpenAPI_arp_t *arp + ); +void OpenAPI_ebi_arp_mapping_free(OpenAPI_ebi_arp_mapping_t *ebi_arp_mapping); +OpenAPI_ebi_arp_mapping_t *OpenAPI_ebi_arp_mapping_parseFromJSON(cJSON *ebi_arp_mappingJSON); +cJSON *OpenAPI_ebi_arp_mapping_convertToJSON(OpenAPI_ebi_arp_mapping_t *ebi_arp_mapping); +OpenAPI_ebi_arp_mapping_t *OpenAPI_ebi_arp_mapping_copy(OpenAPI_ebi_arp_mapping_t *dst, OpenAPI_ebi_arp_mapping_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ebi_arp_mapping_H_ */ + diff --git a/lib/sbi/openapi/model/ec_restriction.c b/lib/sbi/openapi/model/ec_restriction.c index 17574f9e0..285a0a701 100644 --- a/lib/sbi/openapi/model/ec_restriction.c +++ b/lib/sbi/openapi/model/ec_restriction.c @@ -148,3 +148,37 @@ end: return NULL; } +OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_copy(OpenAPI_ec_restriction_t *dst, OpenAPI_ec_restriction_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ec_restriction_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ec_restriction_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ec_restriction_free(dst); + dst = OpenAPI_ec_restriction_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ec_restriction.h b/lib/sbi/openapi/model/ec_restriction.h index 16b4cd023..e91a21315 100644 --- a/lib/sbi/openapi/model/ec_restriction.h +++ b/lib/sbi/openapi/model/ec_restriction.h @@ -33,6 +33,7 @@ OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_create( void OpenAPI_ec_restriction_free(OpenAPI_ec_restriction_t *ec_restriction); OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_parseFromJSON(cJSON *ec_restrictionJSON); cJSON *OpenAPI_ec_restriction_convertToJSON(OpenAPI_ec_restriction_t *ec_restriction); +OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_copy(OpenAPI_ec_restriction_t *dst, OpenAPI_ec_restriction_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ec_restriction_data.c b/lib/sbi/openapi/model/ec_restriction_data.c index 73e1cbc45..f140775fa 100644 --- a/lib/sbi/openapi/model/ec_restriction_data.c +++ b/lib/sbi/openapi/model/ec_restriction_data.c @@ -38,14 +38,14 @@ cJSON *OpenAPI_ec_restriction_data_convertToJSON(OpenAPI_ec_restriction_data_t * } item = cJSON_CreateObject(); - if (ec_restriction_data->ec_mode_a_restricted >= 0) { + if (ec_restriction_data->ec_mode_a_restricted) { if (cJSON_AddBoolToObject(item, "ecModeARestricted", ec_restriction_data->ec_mode_a_restricted) == NULL) { ogs_error("OpenAPI_ec_restriction_data_convertToJSON() failed [ec_mode_a_restricted]"); goto end; } } - if (ec_restriction_data->ec_mode_b_restricted >= 0) { + if (ec_restriction_data->ec_mode_b_restricted) { if (cJSON_AddBoolToObject(item, "ecModeBRestricted", ec_restriction_data->ec_mode_b_restricted) == NULL) { ogs_error("OpenAPI_ec_restriction_data_convertToJSON() failed [ec_mode_b_restricted]"); goto end; @@ -87,3 +87,37 @@ end: return NULL; } +OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_copy(OpenAPI_ec_restriction_data_t *dst, OpenAPI_ec_restriction_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ec_restriction_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ec_restriction_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_ec_restriction_data_free(dst); + dst = OpenAPI_ec_restriction_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ec_restriction_data.h b/lib/sbi/openapi/model/ec_restriction_data.h index 3781b5f7b..cb85f6556 100644 --- a/lib/sbi/openapi/model/ec_restriction_data.h +++ b/lib/sbi/openapi/model/ec_restriction_data.h @@ -30,6 +30,7 @@ OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_create( void OpenAPI_ec_restriction_data_free(OpenAPI_ec_restriction_data_t *ec_restriction_data); OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_parseFromJSON(cJSON *ec_restriction_dataJSON); cJSON *OpenAPI_ec_restriction_data_convertToJSON(OpenAPI_ec_restriction_data_t *ec_restriction_data); +OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_copy(OpenAPI_ec_restriction_data_t *dst, OpenAPI_ec_restriction_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ecgi.c b/lib/sbi/openapi/model/ecgi.c index 4c974321c..b68da2260 100644 --- a/lib/sbi/openapi/model/ecgi.c +++ b/lib/sbi/openapi/model/ecgi.c @@ -123,3 +123,37 @@ end: return NULL; } +OpenAPI_ecgi_t *OpenAPI_ecgi_copy(OpenAPI_ecgi_t *dst, OpenAPI_ecgi_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ecgi_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ecgi_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ecgi_free(dst); + dst = OpenAPI_ecgi_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ecgi.h b/lib/sbi/openapi/model/ecgi.h index 8d6fc88d4..8881671c8 100644 --- a/lib/sbi/openapi/model/ecgi.h +++ b/lib/sbi/openapi/model/ecgi.h @@ -33,6 +33,7 @@ OpenAPI_ecgi_t *OpenAPI_ecgi_create( void OpenAPI_ecgi_free(OpenAPI_ecgi_t *ecgi); OpenAPI_ecgi_t *OpenAPI_ecgi_parseFromJSON(cJSON *ecgiJSON); cJSON *OpenAPI_ecgi_convertToJSON(OpenAPI_ecgi_t *ecgi); +OpenAPI_ecgi_t *OpenAPI_ecgi_copy(OpenAPI_ecgi_t *dst, OpenAPI_ecgi_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/edrx_parameters.c b/lib/sbi/openapi/model/edrx_parameters.c index 2749a1449..51f5437cd 100644 --- a/lib/sbi/openapi/model/edrx_parameters.c +++ b/lib/sbi/openapi/model/edrx_parameters.c @@ -5,7 +5,7 @@ #include "edrx_parameters.h" OpenAPI_edrx_parameters_t *OpenAPI_edrx_parameters_create( - OpenAPI_rat_type_t *rat_type, + OpenAPI_rat_type_e rat_type, char *edrx_value ) { @@ -25,7 +25,6 @@ void OpenAPI_edrx_parameters_free(OpenAPI_edrx_parameters_t *edrx_parameters) return; } OpenAPI_lnode_t *node; - OpenAPI_rat_type_free(edrx_parameters->rat_type); ogs_free(edrx_parameters->edrx_value); ogs_free(edrx_parameters); } @@ -44,13 +43,7 @@ cJSON *OpenAPI_edrx_parameters_convertToJSON(OpenAPI_edrx_parameters_t *edrx_par ogs_error("OpenAPI_edrx_parameters_convertToJSON() failed [rat_type]"); goto end; } - cJSON *rat_type_local_JSON = OpenAPI_rat_type_convertToJSON(edrx_parameters->rat_type); - if (rat_type_local_JSON == NULL) { - ogs_error("OpenAPI_edrx_parameters_convertToJSON() failed [rat_type]"); - goto end; - } - cJSON_AddItemToObject(item, "ratType", rat_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(edrx_parameters->rat_type)) == NULL) { ogs_error("OpenAPI_edrx_parameters_convertToJSON() failed [rat_type]"); goto end; } @@ -77,9 +70,13 @@ OpenAPI_edrx_parameters_t *OpenAPI_edrx_parameters_parseFromJSON(cJSON *edrx_par goto end; } - OpenAPI_rat_type_t *rat_type_local_nonprim = NULL; + OpenAPI_rat_type_e rat_typeVariable; - rat_type_local_nonprim = OpenAPI_rat_type_parseFromJSON(rat_type); + if (!cJSON_IsString(rat_type)) { + ogs_error("OpenAPI_edrx_parameters_parseFromJSON() failed [rat_type]"); + goto end; + } + rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); cJSON *edrx_value = cJSON_GetObjectItemCaseSensitive(edrx_parametersJSON, "edrxValue"); if (!edrx_value) { @@ -94,7 +91,7 @@ OpenAPI_edrx_parameters_t *OpenAPI_edrx_parameters_parseFromJSON(cJSON *edrx_par } edrx_parameters_local_var = OpenAPI_edrx_parameters_create ( - rat_type_local_nonprim, + rat_typeVariable, ogs_strdup(edrx_value->valuestring) ); @@ -103,3 +100,37 @@ end: return NULL; } +OpenAPI_edrx_parameters_t *OpenAPI_edrx_parameters_copy(OpenAPI_edrx_parameters_t *dst, OpenAPI_edrx_parameters_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_edrx_parameters_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_edrx_parameters_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_edrx_parameters_free(dst); + dst = OpenAPI_edrx_parameters_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/edrx_parameters.h b/lib/sbi/openapi/model/edrx_parameters.h index d3b1b8804..b2bf845ca 100644 --- a/lib/sbi/openapi/model/edrx_parameters.h +++ b/lib/sbi/openapi/model/edrx_parameters.h @@ -20,17 +20,18 @@ extern "C" { typedef struct OpenAPI_edrx_parameters_s OpenAPI_edrx_parameters_t; typedef struct OpenAPI_edrx_parameters_s { - struct OpenAPI_rat_type_s *rat_type; + OpenAPI_rat_type_e rat_type; char *edrx_value; } OpenAPI_edrx_parameters_t; OpenAPI_edrx_parameters_t *OpenAPI_edrx_parameters_create( - OpenAPI_rat_type_t *rat_type, + OpenAPI_rat_type_e rat_type, char *edrx_value ); void OpenAPI_edrx_parameters_free(OpenAPI_edrx_parameters_t *edrx_parameters); OpenAPI_edrx_parameters_t *OpenAPI_edrx_parameters_parseFromJSON(cJSON *edrx_parametersJSON); cJSON *OpenAPI_edrx_parameters_convertToJSON(OpenAPI_edrx_parameters_t *edrx_parameters); +OpenAPI_edrx_parameters_t *OpenAPI_edrx_parameters_copy(OpenAPI_edrx_parameters_t *dst, OpenAPI_edrx_parameters_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ee_profile_data.c b/lib/sbi/openapi/model/ee_profile_data.c index 1f3c014bc..79efd8ca9 100644 --- a/lib/sbi/openapi/model/ee_profile_data.c +++ b/lib/sbi/openapi/model/ee_profile_data.c @@ -119,3 +119,37 @@ end: return NULL; } +OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_copy(OpenAPI_ee_profile_data_t *dst, OpenAPI_ee_profile_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ee_profile_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ee_profile_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_ee_profile_data_free(dst); + dst = OpenAPI_ee_profile_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ee_profile_data.h b/lib/sbi/openapi/model/ee_profile_data.h index 3a440e76e..2d2a92dde 100644 --- a/lib/sbi/openapi/model/ee_profile_data.h +++ b/lib/sbi/openapi/model/ee_profile_data.h @@ -31,6 +31,7 @@ OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_create( void OpenAPI_ee_profile_data_free(OpenAPI_ee_profile_data_t *ee_profile_data); OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_parseFromJSON(cJSON *ee_profile_dataJSON); cJSON *OpenAPI_ee_profile_data_convertToJSON(OpenAPI_ee_profile_data_t *ee_profile_data); +OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_copy(OpenAPI_ee_profile_data_t *dst, OpenAPI_ee_profile_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ee_subscription.c b/lib/sbi/openapi/model/ee_subscription.c index 551bf3998..92e897c2f 100644 --- a/lib/sbi/openapi/model/ee_subscription.c +++ b/lib/sbi/openapi/model/ee_subscription.c @@ -196,3 +196,37 @@ end: return NULL; } +OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_copy(OpenAPI_ee_subscription_t *dst, OpenAPI_ee_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ee_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ee_subscription_free(dst); + dst = OpenAPI_ee_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ee_subscription.h b/lib/sbi/openapi/model/ee_subscription.h index 1154e7f5b..983749f2b 100644 --- a/lib/sbi/openapi/model/ee_subscription.h +++ b/lib/sbi/openapi/model/ee_subscription.h @@ -38,6 +38,7 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( void OpenAPI_ee_subscription_free(OpenAPI_ee_subscription_t *ee_subscription); OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_parseFromJSON(cJSON *ee_subscriptionJSON); cJSON *OpenAPI_ee_subscription_convertToJSON(OpenAPI_ee_subscription_t *ee_subscription); +OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_copy(OpenAPI_ee_subscription_t *dst, OpenAPI_ee_subscription_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ellipsoid_arc.c b/lib/sbi/openapi/model/ellipsoid_arc.c index ea3a06d8e..bff860fdd 100644 --- a/lib/sbi/openapi/model/ellipsoid_arc.c +++ b/lib/sbi/openapi/model/ellipsoid_arc.c @@ -227,3 +227,37 @@ end: return NULL; } +OpenAPI_ellipsoid_arc_t *OpenAPI_ellipsoid_arc_copy(OpenAPI_ellipsoid_arc_t *dst, OpenAPI_ellipsoid_arc_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ellipsoid_arc_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ellipsoid_arc_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ellipsoid_arc_free(dst); + dst = OpenAPI_ellipsoid_arc_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ellipsoid_arc.h b/lib/sbi/openapi/model/ellipsoid_arc.h index 027651b75..2f3895955 100644 --- a/lib/sbi/openapi/model/ellipsoid_arc.h +++ b/lib/sbi/openapi/model/ellipsoid_arc.h @@ -44,6 +44,7 @@ OpenAPI_ellipsoid_arc_t *OpenAPI_ellipsoid_arc_create( void OpenAPI_ellipsoid_arc_free(OpenAPI_ellipsoid_arc_t *ellipsoid_arc); OpenAPI_ellipsoid_arc_t *OpenAPI_ellipsoid_arc_parseFromJSON(cJSON *ellipsoid_arcJSON); cJSON *OpenAPI_ellipsoid_arc_convertToJSON(OpenAPI_ellipsoid_arc_t *ellipsoid_arc); +OpenAPI_ellipsoid_arc_t *OpenAPI_ellipsoid_arc_copy(OpenAPI_ellipsoid_arc_t *dst, OpenAPI_ellipsoid_arc_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ellipsoid_arc_all_of.c b/lib/sbi/openapi/model/ellipsoid_arc_all_of.c index d313c54a7..6688a3781 100644 --- a/lib/sbi/openapi/model/ellipsoid_arc_all_of.c +++ b/lib/sbi/openapi/model/ellipsoid_arc_all_of.c @@ -198,3 +198,37 @@ end: return NULL; } +OpenAPI_ellipsoid_arc_all_of_t *OpenAPI_ellipsoid_arc_all_of_copy(OpenAPI_ellipsoid_arc_all_of_t *dst, OpenAPI_ellipsoid_arc_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ellipsoid_arc_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ellipsoid_arc_all_of_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ellipsoid_arc_all_of_free(dst); + dst = OpenAPI_ellipsoid_arc_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ellipsoid_arc_all_of.h b/lib/sbi/openapi/model/ellipsoid_arc_all_of.h index 8ab2ff1da..5f3b20e1e 100644 --- a/lib/sbi/openapi/model/ellipsoid_arc_all_of.h +++ b/lib/sbi/openapi/model/ellipsoid_arc_all_of.h @@ -39,6 +39,7 @@ OpenAPI_ellipsoid_arc_all_of_t *OpenAPI_ellipsoid_arc_all_of_create( void OpenAPI_ellipsoid_arc_all_of_free(OpenAPI_ellipsoid_arc_all_of_t *ellipsoid_arc_all_of); OpenAPI_ellipsoid_arc_all_of_t *OpenAPI_ellipsoid_arc_all_of_parseFromJSON(cJSON *ellipsoid_arc_all_ofJSON); cJSON *OpenAPI_ellipsoid_arc_all_of_convertToJSON(OpenAPI_ellipsoid_arc_all_of_t *ellipsoid_arc_all_of); +OpenAPI_ellipsoid_arc_all_of_t *OpenAPI_ellipsoid_arc_all_of_copy(OpenAPI_ellipsoid_arc_all_of_t *dst, OpenAPI_ellipsoid_arc_all_of_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/emergency_info.c b/lib/sbi/openapi/model/emergency_info.c index 2769d3493..13aaf2386 100644 --- a/lib/sbi/openapi/model/emergency_info.c +++ b/lib/sbi/openapi/model/emergency_info.c @@ -113,3 +113,37 @@ end: return NULL; } +OpenAPI_emergency_info_t *OpenAPI_emergency_info_copy(OpenAPI_emergency_info_t *dst, OpenAPI_emergency_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_emergency_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_emergency_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_emergency_info_free(dst); + dst = OpenAPI_emergency_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/emergency_info.h b/lib/sbi/openapi/model/emergency_info.h index 15ad44126..1e34986d9 100644 --- a/lib/sbi/openapi/model/emergency_info.h +++ b/lib/sbi/openapi/model/emergency_info.h @@ -33,6 +33,7 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_create( void OpenAPI_emergency_info_free(OpenAPI_emergency_info_t *emergency_info); OpenAPI_emergency_info_t *OpenAPI_emergency_info_parseFromJSON(cJSON *emergency_infoJSON); cJSON *OpenAPI_emergency_info_convertToJSON(OpenAPI_emergency_info_t *emergency_info); +OpenAPI_emergency_info_t *OpenAPI_emergency_info_copy(OpenAPI_emergency_info_t *dst, OpenAPI_emergency_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/enhanced_coverage_restriction_data.c b/lib/sbi/openapi/model/enhanced_coverage_restriction_data.c index 883ba3d9e..d76e52405 100644 --- a/lib/sbi/openapi/model/enhanced_coverage_restriction_data.c +++ b/lib/sbi/openapi/model/enhanced_coverage_restriction_data.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_enhanced_coverage_restriction_data_t *OpenAPI_enhanced_coverage_restriction_data_copy(OpenAPI_enhanced_coverage_restriction_data_t *dst, OpenAPI_enhanced_coverage_restriction_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_enhanced_coverage_restriction_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_enhanced_coverage_restriction_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_enhanced_coverage_restriction_data_free(dst); + dst = OpenAPI_enhanced_coverage_restriction_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/enhanced_coverage_restriction_data.h b/lib/sbi/openapi/model/enhanced_coverage_restriction_data.h index 4496d5fd4..c82b082d5 100644 --- a/lib/sbi/openapi/model/enhanced_coverage_restriction_data.h +++ b/lib/sbi/openapi/model/enhanced_coverage_restriction_data.h @@ -29,6 +29,7 @@ OpenAPI_enhanced_coverage_restriction_data_t *OpenAPI_enhanced_coverage_restrict void OpenAPI_enhanced_coverage_restriction_data_free(OpenAPI_enhanced_coverage_restriction_data_t *enhanced_coverage_restriction_data); OpenAPI_enhanced_coverage_restriction_data_t *OpenAPI_enhanced_coverage_restriction_data_parseFromJSON(cJSON *enhanced_coverage_restriction_dataJSON); cJSON *OpenAPI_enhanced_coverage_restriction_data_convertToJSON(OpenAPI_enhanced_coverage_restriction_data_t *enhanced_coverage_restriction_data); +OpenAPI_enhanced_coverage_restriction_data_t *OpenAPI_enhanced_coverage_restriction_data_copy(OpenAPI_enhanced_coverage_restriction_data_t *dst, OpenAPI_enhanced_coverage_restriction_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/eps_bearer_info.c b/lib/sbi/openapi/model/eps_bearer_info.c new file mode 100644 index 000000000..1db1d417f --- /dev/null +++ b/lib/sbi/openapi/model/eps_bearer_info.c @@ -0,0 +1,157 @@ + +#include +#include +#include +#include "eps_bearer_info.h" + +OpenAPI_eps_bearer_info_t *OpenAPI_eps_bearer_info_create( + int ebi, + char pgw_s8u_fteid, + char bearer_level_qo_s + ) +{ + OpenAPI_eps_bearer_info_t *eps_bearer_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_eps_bearer_info_t)); + if (!eps_bearer_info_local_var) { + return NULL; + } + eps_bearer_info_local_var->ebi = ebi; + eps_bearer_info_local_var->pgw_s8u_fteid = pgw_s8u_fteid; + eps_bearer_info_local_var->bearer_level_qo_s = bearer_level_qo_s; + + return eps_bearer_info_local_var; +} + +void OpenAPI_eps_bearer_info_free(OpenAPI_eps_bearer_info_t *eps_bearer_info) +{ + if (NULL == eps_bearer_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(eps_bearer_info); +} + +cJSON *OpenAPI_eps_bearer_info_convertToJSON(OpenAPI_eps_bearer_info_t *eps_bearer_info) +{ + cJSON *item = NULL; + + if (eps_bearer_info == NULL) { + ogs_error("OpenAPI_eps_bearer_info_convertToJSON() failed [EpsBearerInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!eps_bearer_info->ebi) { + ogs_error("OpenAPI_eps_bearer_info_convertToJSON() failed [ebi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "ebi", eps_bearer_info->ebi) == NULL) { + ogs_error("OpenAPI_eps_bearer_info_convertToJSON() failed [ebi]"); + goto end; + } + + if (!eps_bearer_info->pgw_s8u_fteid) { + ogs_error("OpenAPI_eps_bearer_info_convertToJSON() failed [pgw_s8u_fteid]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "pgwS8uFteid", eps_bearer_info->pgw_s8u_fteid) == NULL) { + ogs_error("OpenAPI_eps_bearer_info_convertToJSON() failed [pgw_s8u_fteid]"); + goto end; + } + + if (!eps_bearer_info->bearer_level_qo_s) { + ogs_error("OpenAPI_eps_bearer_info_convertToJSON() failed [bearer_level_qo_s]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "bearerLevelQoS", eps_bearer_info->bearer_level_qo_s) == NULL) { + ogs_error("OpenAPI_eps_bearer_info_convertToJSON() failed [bearer_level_qo_s]"); + goto end; + } + +end: + return item; +} + +OpenAPI_eps_bearer_info_t *OpenAPI_eps_bearer_info_parseFromJSON(cJSON *eps_bearer_infoJSON) +{ + OpenAPI_eps_bearer_info_t *eps_bearer_info_local_var = NULL; + cJSON *ebi = cJSON_GetObjectItemCaseSensitive(eps_bearer_infoJSON, "ebi"); + if (!ebi) { + ogs_error("OpenAPI_eps_bearer_info_parseFromJSON() failed [ebi]"); + goto end; + } + + + if (!cJSON_IsNumber(ebi)) { + ogs_error("OpenAPI_eps_bearer_info_parseFromJSON() failed [ebi]"); + goto end; + } + + cJSON *pgw_s8u_fteid = cJSON_GetObjectItemCaseSensitive(eps_bearer_infoJSON, "pgwS8uFteid"); + if (!pgw_s8u_fteid) { + ogs_error("OpenAPI_eps_bearer_info_parseFromJSON() failed [pgw_s8u_fteid]"); + goto end; + } + + + if (!cJSON_IsNumber(pgw_s8u_fteid)) { + ogs_error("OpenAPI_eps_bearer_info_parseFromJSON() failed [pgw_s8u_fteid]"); + goto end; + } + + cJSON *bearer_level_qo_s = cJSON_GetObjectItemCaseSensitive(eps_bearer_infoJSON, "bearerLevelQoS"); + if (!bearer_level_qo_s) { + ogs_error("OpenAPI_eps_bearer_info_parseFromJSON() failed [bearer_level_qo_s]"); + goto end; + } + + + if (!cJSON_IsNumber(bearer_level_qo_s)) { + ogs_error("OpenAPI_eps_bearer_info_parseFromJSON() failed [bearer_level_qo_s]"); + goto end; + } + + eps_bearer_info_local_var = OpenAPI_eps_bearer_info_create ( + ebi->valuedouble, + pgw_s8u_fteid->valueint, + bearer_level_qo_s->valueint + ); + + return eps_bearer_info_local_var; +end: + return NULL; +} + +OpenAPI_eps_bearer_info_t *OpenAPI_eps_bearer_info_copy(OpenAPI_eps_bearer_info_t *dst, OpenAPI_eps_bearer_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eps_bearer_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eps_bearer_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_eps_bearer_info_free(dst); + dst = OpenAPI_eps_bearer_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eps_bearer_info.h b/lib/sbi/openapi/model/eps_bearer_info.h new file mode 100644 index 000000000..18faa622f --- /dev/null +++ b/lib/sbi/openapi/model/eps_bearer_info.h @@ -0,0 +1,42 @@ +/* + * eps_bearer_info.h + * + * + */ + +#ifndef _OpenAPI_eps_bearer_info_H_ +#define _OpenAPI_eps_bearer_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_eps_bearer_info_s OpenAPI_eps_bearer_info_t; +typedef struct OpenAPI_eps_bearer_info_s { + int ebi; + char pgw_s8u_fteid; + char bearer_level_qo_s; +} OpenAPI_eps_bearer_info_t; + +OpenAPI_eps_bearer_info_t *OpenAPI_eps_bearer_info_create( + int ebi, + char pgw_s8u_fteid, + char bearer_level_qo_s + ); +void OpenAPI_eps_bearer_info_free(OpenAPI_eps_bearer_info_t *eps_bearer_info); +OpenAPI_eps_bearer_info_t *OpenAPI_eps_bearer_info_parseFromJSON(cJSON *eps_bearer_infoJSON); +cJSON *OpenAPI_eps_bearer_info_convertToJSON(OpenAPI_eps_bearer_info_t *eps_bearer_info); +OpenAPI_eps_bearer_info_t *OpenAPI_eps_bearer_info_copy(OpenAPI_eps_bearer_info_t *dst, OpenAPI_eps_bearer_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_eps_bearer_info_H_ */ + diff --git a/lib/sbi/openapi/model/eps_interworking_indication.c b/lib/sbi/openapi/model/eps_interworking_indication.c new file mode 100644 index 000000000..10b844c2b --- /dev/null +++ b/lib/sbi/openapi/model/eps_interworking_indication.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "eps_interworking_indication.h" + +OpenAPI_eps_interworking_indication_t *OpenAPI_eps_interworking_indication_create( + ) +{ + OpenAPI_eps_interworking_indication_t *eps_interworking_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_eps_interworking_indication_t)); + if (!eps_interworking_indication_local_var) { + return NULL; + } + + return eps_interworking_indication_local_var; +} + +void OpenAPI_eps_interworking_indication_free(OpenAPI_eps_interworking_indication_t *eps_interworking_indication) +{ + if (NULL == eps_interworking_indication) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(eps_interworking_indication); +} + +cJSON *OpenAPI_eps_interworking_indication_convertToJSON(OpenAPI_eps_interworking_indication_t *eps_interworking_indication) +{ + cJSON *item = NULL; + + if (eps_interworking_indication == NULL) { + ogs_error("OpenAPI_eps_interworking_indication_convertToJSON() failed [EpsInterworkingIndication]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_eps_interworking_indication_t *OpenAPI_eps_interworking_indication_parseFromJSON(cJSON *eps_interworking_indicationJSON) +{ + OpenAPI_eps_interworking_indication_t *eps_interworking_indication_local_var = NULL; + eps_interworking_indication_local_var = OpenAPI_eps_interworking_indication_create ( + ); + + return eps_interworking_indication_local_var; +end: + return NULL; +} + +OpenAPI_eps_interworking_indication_t *OpenAPI_eps_interworking_indication_copy(OpenAPI_eps_interworking_indication_t *dst, OpenAPI_eps_interworking_indication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eps_interworking_indication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eps_interworking_indication_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_eps_interworking_indication_free(dst); + dst = OpenAPI_eps_interworking_indication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eps_interworking_indication.h b/lib/sbi/openapi/model/eps_interworking_indication.h new file mode 100644 index 000000000..760aebfe9 --- /dev/null +++ b/lib/sbi/openapi/model/eps_interworking_indication.h @@ -0,0 +1,36 @@ +/* + * eps_interworking_indication.h + * + * Possible values are - NONE - WITH_N26 - WITHOUT_N26 - IWK_NON_3GPP + */ + +#ifndef _OpenAPI_eps_interworking_indication_H_ +#define _OpenAPI_eps_interworking_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_eps_interworking_indication_s OpenAPI_eps_interworking_indication_t; +typedef struct OpenAPI_eps_interworking_indication_s { +} OpenAPI_eps_interworking_indication_t; + +OpenAPI_eps_interworking_indication_t *OpenAPI_eps_interworking_indication_create( + ); +void OpenAPI_eps_interworking_indication_free(OpenAPI_eps_interworking_indication_t *eps_interworking_indication); +OpenAPI_eps_interworking_indication_t *OpenAPI_eps_interworking_indication_parseFromJSON(cJSON *eps_interworking_indicationJSON); +cJSON *OpenAPI_eps_interworking_indication_convertToJSON(OpenAPI_eps_interworking_indication_t *eps_interworking_indication); +OpenAPI_eps_interworking_indication_t *OpenAPI_eps_interworking_indication_copy(OpenAPI_eps_interworking_indication_t *dst, OpenAPI_eps_interworking_indication_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_eps_interworking_indication_H_ */ + diff --git a/lib/sbi/openapi/model/eps_interworking_info.c b/lib/sbi/openapi/model/eps_interworking_info.c index e977060db..117231e6a 100644 --- a/lib/sbi/openapi/model/eps_interworking_info.c +++ b/lib/sbi/openapi/model/eps_interworking_info.c @@ -102,3 +102,37 @@ end: return NULL; } +OpenAPI_eps_interworking_info_t *OpenAPI_eps_interworking_info_copy(OpenAPI_eps_interworking_info_t *dst, OpenAPI_eps_interworking_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eps_interworking_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eps_interworking_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_eps_interworking_info_free(dst); + dst = OpenAPI_eps_interworking_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eps_interworking_info.h b/lib/sbi/openapi/model/eps_interworking_info.h index 852a434ec..93b167d14 100644 --- a/lib/sbi/openapi/model/eps_interworking_info.h +++ b/lib/sbi/openapi/model/eps_interworking_info.h @@ -29,6 +29,7 @@ OpenAPI_eps_interworking_info_t *OpenAPI_eps_interworking_info_create( void OpenAPI_eps_interworking_info_free(OpenAPI_eps_interworking_info_t *eps_interworking_info); OpenAPI_eps_interworking_info_t *OpenAPI_eps_interworking_info_parseFromJSON(cJSON *eps_interworking_infoJSON); cJSON *OpenAPI_eps_interworking_info_convertToJSON(OpenAPI_eps_interworking_info_t *eps_interworking_info); +OpenAPI_eps_interworking_info_t *OpenAPI_eps_interworking_info_copy(OpenAPI_eps_interworking_info_t *dst, OpenAPI_eps_interworking_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/eps_iwk_pgw.c b/lib/sbi/openapi/model/eps_iwk_pgw.c index e5a4dffbf..b8e9a3802 100644 --- a/lib/sbi/openapi/model/eps_iwk_pgw.c +++ b/lib/sbi/openapi/model/eps_iwk_pgw.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_copy(OpenAPI_eps_iwk_pgw_t *dst, OpenAPI_eps_iwk_pgw_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eps_iwk_pgw_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eps_iwk_pgw_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_eps_iwk_pgw_free(dst); + dst = OpenAPI_eps_iwk_pgw_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eps_iwk_pgw.h b/lib/sbi/openapi/model/eps_iwk_pgw.h index adcf96dad..9b4b08628 100644 --- a/lib/sbi/openapi/model/eps_iwk_pgw.h +++ b/lib/sbi/openapi/model/eps_iwk_pgw.h @@ -30,6 +30,7 @@ OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_create( void OpenAPI_eps_iwk_pgw_free(OpenAPI_eps_iwk_pgw_t *eps_iwk_pgw); OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_parseFromJSON(cJSON *eps_iwk_pgwJSON); cJSON *OpenAPI_eps_iwk_pgw_convertToJSON(OpenAPI_eps_iwk_pgw_t *eps_iwk_pgw); +OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_copy(OpenAPI_eps_iwk_pgw_t *dst, OpenAPI_eps_iwk_pgw_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/eps_pdn_cnx_info.c b/lib/sbi/openapi/model/eps_pdn_cnx_info.c new file mode 100644 index 000000000..0b95e5475 --- /dev/null +++ b/lib/sbi/openapi/model/eps_pdn_cnx_info.c @@ -0,0 +1,147 @@ + +#include +#include +#include +#include "eps_pdn_cnx_info.h" + +OpenAPI_eps_pdn_cnx_info_t *OpenAPI_eps_pdn_cnx_info_create( + char pgw_s8c_fteid, + char pgw_node_name, + int linked_bearer_id + ) +{ + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_eps_pdn_cnx_info_t)); + if (!eps_pdn_cnx_info_local_var) { + return NULL; + } + eps_pdn_cnx_info_local_var->pgw_s8c_fteid = pgw_s8c_fteid; + eps_pdn_cnx_info_local_var->pgw_node_name = pgw_node_name; + eps_pdn_cnx_info_local_var->linked_bearer_id = linked_bearer_id; + + return eps_pdn_cnx_info_local_var; +} + +void OpenAPI_eps_pdn_cnx_info_free(OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info) +{ + if (NULL == eps_pdn_cnx_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(eps_pdn_cnx_info); +} + +cJSON *OpenAPI_eps_pdn_cnx_info_convertToJSON(OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info) +{ + cJSON *item = NULL; + + if (eps_pdn_cnx_info == NULL) { + ogs_error("OpenAPI_eps_pdn_cnx_info_convertToJSON() failed [EpsPdnCnxInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!eps_pdn_cnx_info->pgw_s8c_fteid) { + ogs_error("OpenAPI_eps_pdn_cnx_info_convertToJSON() failed [pgw_s8c_fteid]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "pgwS8cFteid", eps_pdn_cnx_info->pgw_s8c_fteid) == NULL) { + ogs_error("OpenAPI_eps_pdn_cnx_info_convertToJSON() failed [pgw_s8c_fteid]"); + goto end; + } + + if (eps_pdn_cnx_info->pgw_node_name) { + if (cJSON_AddNumberToObject(item, "pgwNodeName", eps_pdn_cnx_info->pgw_node_name) == NULL) { + ogs_error("OpenAPI_eps_pdn_cnx_info_convertToJSON() failed [pgw_node_name]"); + goto end; + } + } + + if (eps_pdn_cnx_info->linked_bearer_id) { + if (cJSON_AddNumberToObject(item, "linkedBearerId", eps_pdn_cnx_info->linked_bearer_id) == NULL) { + ogs_error("OpenAPI_eps_pdn_cnx_info_convertToJSON() failed [linked_bearer_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_eps_pdn_cnx_info_t *OpenAPI_eps_pdn_cnx_info_parseFromJSON(cJSON *eps_pdn_cnx_infoJSON) +{ + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info_local_var = NULL; + cJSON *pgw_s8c_fteid = cJSON_GetObjectItemCaseSensitive(eps_pdn_cnx_infoJSON, "pgwS8cFteid"); + if (!pgw_s8c_fteid) { + ogs_error("OpenAPI_eps_pdn_cnx_info_parseFromJSON() failed [pgw_s8c_fteid]"); + goto end; + } + + + if (!cJSON_IsNumber(pgw_s8c_fteid)) { + ogs_error("OpenAPI_eps_pdn_cnx_info_parseFromJSON() failed [pgw_s8c_fteid]"); + goto end; + } + + cJSON *pgw_node_name = cJSON_GetObjectItemCaseSensitive(eps_pdn_cnx_infoJSON, "pgwNodeName"); + + if (pgw_node_name) { + if (!cJSON_IsNumber(pgw_node_name)) { + ogs_error("OpenAPI_eps_pdn_cnx_info_parseFromJSON() failed [pgw_node_name]"); + goto end; + } + } + + cJSON *linked_bearer_id = cJSON_GetObjectItemCaseSensitive(eps_pdn_cnx_infoJSON, "linkedBearerId"); + + if (linked_bearer_id) { + if (!cJSON_IsNumber(linked_bearer_id)) { + ogs_error("OpenAPI_eps_pdn_cnx_info_parseFromJSON() failed [linked_bearer_id]"); + goto end; + } + } + + eps_pdn_cnx_info_local_var = OpenAPI_eps_pdn_cnx_info_create ( + pgw_s8c_fteid->valueint, + pgw_node_name ? pgw_node_name->valueint : 0, + linked_bearer_id ? linked_bearer_id->valuedouble : 0 + ); + + return eps_pdn_cnx_info_local_var; +end: + return NULL; +} + +OpenAPI_eps_pdn_cnx_info_t *OpenAPI_eps_pdn_cnx_info_copy(OpenAPI_eps_pdn_cnx_info_t *dst, OpenAPI_eps_pdn_cnx_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eps_pdn_cnx_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eps_pdn_cnx_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_eps_pdn_cnx_info_free(dst); + dst = OpenAPI_eps_pdn_cnx_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eps_pdn_cnx_info.h b/lib/sbi/openapi/model/eps_pdn_cnx_info.h new file mode 100644 index 000000000..bb44509f6 --- /dev/null +++ b/lib/sbi/openapi/model/eps_pdn_cnx_info.h @@ -0,0 +1,42 @@ +/* + * eps_pdn_cnx_info.h + * + * + */ + +#ifndef _OpenAPI_eps_pdn_cnx_info_H_ +#define _OpenAPI_eps_pdn_cnx_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_eps_pdn_cnx_info_s OpenAPI_eps_pdn_cnx_info_t; +typedef struct OpenAPI_eps_pdn_cnx_info_s { + char pgw_s8c_fteid; + char pgw_node_name; + int linked_bearer_id; +} OpenAPI_eps_pdn_cnx_info_t; + +OpenAPI_eps_pdn_cnx_info_t *OpenAPI_eps_pdn_cnx_info_create( + char pgw_s8c_fteid, + char pgw_node_name, + int linked_bearer_id + ); +void OpenAPI_eps_pdn_cnx_info_free(OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info); +OpenAPI_eps_pdn_cnx_info_t *OpenAPI_eps_pdn_cnx_info_parseFromJSON(cJSON *eps_pdn_cnx_infoJSON); +cJSON *OpenAPI_eps_pdn_cnx_info_convertToJSON(OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info); +OpenAPI_eps_pdn_cnx_info_t *OpenAPI_eps_pdn_cnx_info_copy(OpenAPI_eps_pdn_cnx_info_t *dst, OpenAPI_eps_pdn_cnx_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_eps_pdn_cnx_info_H_ */ + diff --git a/lib/sbi/openapi/model/eth_flow_description.c b/lib/sbi/openapi/model/eth_flow_description.c index 62fd59b86..16ccc71d8 100644 --- a/lib/sbi/openapi/model/eth_flow_description.c +++ b/lib/sbi/openapi/model/eth_flow_description.c @@ -241,3 +241,37 @@ end: return NULL; } +OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_copy(OpenAPI_eth_flow_description_t *dst, OpenAPI_eth_flow_description_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eth_flow_description_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eth_flow_description_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_eth_flow_description_free(dst); + dst = OpenAPI_eth_flow_description_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eth_flow_description.h b/lib/sbi/openapi/model/eth_flow_description.h index 3f1711d1f..48e318558 100644 --- a/lib/sbi/openapi/model/eth_flow_description.h +++ b/lib/sbi/openapi/model/eth_flow_description.h @@ -43,6 +43,7 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_create( void OpenAPI_eth_flow_description_free(OpenAPI_eth_flow_description_t *eth_flow_description); OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_parseFromJSON(cJSON *eth_flow_descriptionJSON); cJSON *OpenAPI_eth_flow_description_convertToJSON(OpenAPI_eth_flow_description_t *eth_flow_description); +OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_copy(OpenAPI_eth_flow_description_t *dst, OpenAPI_eth_flow_description_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/eutra_location.c b/lib/sbi/openapi/model/eutra_location.c index 6b5f22af2..e5b30434e 100644 --- a/lib/sbi/openapi/model/eutra_location.c +++ b/lib/sbi/openapi/model/eutra_location.c @@ -89,7 +89,7 @@ cJSON *OpenAPI_eutra_location_convertToJSON(OpenAPI_eutra_location_t *eutra_loca goto end; } - if (eutra_location->ignore_ecgi >= 0) { + if (eutra_location->ignore_ecgi) { if (cJSON_AddBoolToObject(item, "ignoreEcgi", eutra_location->ignore_ecgi) == NULL) { ogs_error("OpenAPI_eutra_location_convertToJSON() failed [ignore_ecgi]"); goto end; @@ -253,3 +253,37 @@ end: return NULL; } +OpenAPI_eutra_location_t *OpenAPI_eutra_location_copy(OpenAPI_eutra_location_t *dst, OpenAPI_eutra_location_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eutra_location_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eutra_location_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_eutra_location_free(dst); + dst = OpenAPI_eutra_location_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eutra_location.h b/lib/sbi/openapi/model/eutra_location.h index 79b72769e..ec1b3ce9a 100644 --- a/lib/sbi/openapi/model/eutra_location.h +++ b/lib/sbi/openapi/model/eutra_location.h @@ -47,6 +47,7 @@ OpenAPI_eutra_location_t *OpenAPI_eutra_location_create( void OpenAPI_eutra_location_free(OpenAPI_eutra_location_t *eutra_location); OpenAPI_eutra_location_t *OpenAPI_eutra_location_parseFromJSON(cJSON *eutra_locationJSON); cJSON *OpenAPI_eutra_location_convertToJSON(OpenAPI_eutra_location_t *eutra_location); +OpenAPI_eutra_location_t *OpenAPI_eutra_location_copy(OpenAPI_eutra_location_t *dst, OpenAPI_eutra_location_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/event_id.c b/lib/sbi/openapi/model/event_id.c index 4fed99423..170314f8f 100644 --- a/lib/sbi/openapi/model/event_id.c +++ b/lib/sbi/openapi/model/event_id.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_event_id_t *OpenAPI_event_id_copy(OpenAPI_event_id_t *dst, OpenAPI_event_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_event_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_event_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_event_id_free(dst); + dst = OpenAPI_event_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/event_id.h b/lib/sbi/openapi/model/event_id.h index f137fd6d3..0cb92a855 100644 --- a/lib/sbi/openapi/model/event_id.h +++ b/lib/sbi/openapi/model/event_id.h @@ -26,6 +26,7 @@ OpenAPI_event_id_t *OpenAPI_event_id_create( void OpenAPI_event_id_free(OpenAPI_event_id_t *event_id); OpenAPI_event_id_t *OpenAPI_event_id_parseFromJSON(cJSON *event_idJSON); cJSON *OpenAPI_event_id_convertToJSON(OpenAPI_event_id_t *event_id); +OpenAPI_event_id_t *OpenAPI_event_id_copy(OpenAPI_event_id_t *dst, OpenAPI_event_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/event_report_mode.c b/lib/sbi/openapi/model/event_report_mode.c index 88d5c937c..ea3549c17 100644 --- a/lib/sbi/openapi/model/event_report_mode.c +++ b/lib/sbi/openapi/model/event_report_mode.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_event_report_mode_t *OpenAPI_event_report_mode_copy(OpenAPI_event_report_mode_t *dst, OpenAPI_event_report_mode_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_event_report_mode_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_event_report_mode_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_event_report_mode_free(dst); + dst = OpenAPI_event_report_mode_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/event_report_mode.h b/lib/sbi/openapi/model/event_report_mode.h index eb86f4289..158b71ec6 100644 --- a/lib/sbi/openapi/model/event_report_mode.h +++ b/lib/sbi/openapi/model/event_report_mode.h @@ -26,6 +26,7 @@ OpenAPI_event_report_mode_t *OpenAPI_event_report_mode_create( void OpenAPI_event_report_mode_free(OpenAPI_event_report_mode_t *event_report_mode); OpenAPI_event_report_mode_t *OpenAPI_event_report_mode_parseFromJSON(cJSON *event_report_modeJSON); cJSON *OpenAPI_event_report_mode_convertToJSON(OpenAPI_event_report_mode_t *event_report_mode); +OpenAPI_event_report_mode_t *OpenAPI_event_report_mode_copy(OpenAPI_event_report_mode_t *dst, OpenAPI_event_report_mode_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/event_type.c b/lib/sbi/openapi/model/event_type.c index 4c8e683b4..5414d9bfb 100644 --- a/lib/sbi/openapi/model/event_type.c +++ b/lib/sbi/openapi/model/event_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_event_type_t *OpenAPI_event_type_copy(OpenAPI_event_type_t *dst, OpenAPI_event_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_event_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_event_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_event_type_free(dst); + dst = OpenAPI_event_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/event_type.h b/lib/sbi/openapi/model/event_type.h index f0dfba92a..60ef8b43e 100644 --- a/lib/sbi/openapi/model/event_type.h +++ b/lib/sbi/openapi/model/event_type.h @@ -26,6 +26,7 @@ OpenAPI_event_type_t *OpenAPI_event_type_create( void OpenAPI_event_type_free(OpenAPI_event_type_t *event_type); OpenAPI_event_type_t *OpenAPI_event_type_parseFromJSON(cJSON *event_typeJSON); cJSON *OpenAPI_event_type_convertToJSON(OpenAPI_event_type_t *event_type); +OpenAPI_event_type_t *OpenAPI_event_type_copy(OpenAPI_event_type_t *dst, OpenAPI_event_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/exemption_ind.c b/lib/sbi/openapi/model/exemption_ind.c new file mode 100644 index 000000000..a81ca6ed4 --- /dev/null +++ b/lib/sbi/openapi/model/exemption_ind.c @@ -0,0 +1,142 @@ + +#include +#include +#include +#include "exemption_ind.h" + +OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_create( + int dnn_congestion, + int snssai_only_congestion, + int snssai_dnn_congestion + ) +{ + OpenAPI_exemption_ind_t *exemption_ind_local_var = OpenAPI_malloc(sizeof(OpenAPI_exemption_ind_t)); + if (!exemption_ind_local_var) { + return NULL; + } + exemption_ind_local_var->dnn_congestion = dnn_congestion; + exemption_ind_local_var->snssai_only_congestion = snssai_only_congestion; + exemption_ind_local_var->snssai_dnn_congestion = snssai_dnn_congestion; + + return exemption_ind_local_var; +} + +void OpenAPI_exemption_ind_free(OpenAPI_exemption_ind_t *exemption_ind) +{ + if (NULL == exemption_ind) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(exemption_ind); +} + +cJSON *OpenAPI_exemption_ind_convertToJSON(OpenAPI_exemption_ind_t *exemption_ind) +{ + cJSON *item = NULL; + + if (exemption_ind == NULL) { + ogs_error("OpenAPI_exemption_ind_convertToJSON() failed [ExemptionInd]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (exemption_ind->dnn_congestion) { + if (cJSON_AddBoolToObject(item, "dnnCongestion", exemption_ind->dnn_congestion) == NULL) { + ogs_error("OpenAPI_exemption_ind_convertToJSON() failed [dnn_congestion]"); + goto end; + } + } + + if (exemption_ind->snssai_only_congestion) { + if (cJSON_AddBoolToObject(item, "snssaiOnlyCongestion", exemption_ind->snssai_only_congestion) == NULL) { + ogs_error("OpenAPI_exemption_ind_convertToJSON() failed [snssai_only_congestion]"); + goto end; + } + } + + if (exemption_ind->snssai_dnn_congestion) { + if (cJSON_AddBoolToObject(item, "snssaiDnnCongestion", exemption_ind->snssai_dnn_congestion) == NULL) { + ogs_error("OpenAPI_exemption_ind_convertToJSON() failed [snssai_dnn_congestion]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_parseFromJSON(cJSON *exemption_indJSON) +{ + OpenAPI_exemption_ind_t *exemption_ind_local_var = NULL; + cJSON *dnn_congestion = cJSON_GetObjectItemCaseSensitive(exemption_indJSON, "dnnCongestion"); + + if (dnn_congestion) { + if (!cJSON_IsBool(dnn_congestion)) { + ogs_error("OpenAPI_exemption_ind_parseFromJSON() failed [dnn_congestion]"); + goto end; + } + } + + cJSON *snssai_only_congestion = cJSON_GetObjectItemCaseSensitive(exemption_indJSON, "snssaiOnlyCongestion"); + + if (snssai_only_congestion) { + if (!cJSON_IsBool(snssai_only_congestion)) { + ogs_error("OpenAPI_exemption_ind_parseFromJSON() failed [snssai_only_congestion]"); + goto end; + } + } + + cJSON *snssai_dnn_congestion = cJSON_GetObjectItemCaseSensitive(exemption_indJSON, "snssaiDnnCongestion"); + + if (snssai_dnn_congestion) { + if (!cJSON_IsBool(snssai_dnn_congestion)) { + ogs_error("OpenAPI_exemption_ind_parseFromJSON() failed [snssai_dnn_congestion]"); + goto end; + } + } + + exemption_ind_local_var = OpenAPI_exemption_ind_create ( + dnn_congestion ? dnn_congestion->valueint : 0, + snssai_only_congestion ? snssai_only_congestion->valueint : 0, + snssai_dnn_congestion ? snssai_dnn_congestion->valueint : 0 + ); + + return exemption_ind_local_var; +end: + return NULL; +} + +OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_copy(OpenAPI_exemption_ind_t *dst, OpenAPI_exemption_ind_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_exemption_ind_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_exemption_ind_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_exemption_ind_free(dst); + dst = OpenAPI_exemption_ind_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/exemption_ind.h b/lib/sbi/openapi/model/exemption_ind.h new file mode 100644 index 000000000..4bfa0182b --- /dev/null +++ b/lib/sbi/openapi/model/exemption_ind.h @@ -0,0 +1,42 @@ +/* + * exemption_ind.h + * + * + */ + +#ifndef _OpenAPI_exemption_ind_H_ +#define _OpenAPI_exemption_ind_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_exemption_ind_s OpenAPI_exemption_ind_t; +typedef struct OpenAPI_exemption_ind_s { + int dnn_congestion; + int snssai_only_congestion; + int snssai_dnn_congestion; +} OpenAPI_exemption_ind_t; + +OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_create( + int dnn_congestion, + int snssai_only_congestion, + int snssai_dnn_congestion + ); +void OpenAPI_exemption_ind_free(OpenAPI_exemption_ind_t *exemption_ind); +OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_parseFromJSON(cJSON *exemption_indJSON); +cJSON *OpenAPI_exemption_ind_convertToJSON(OpenAPI_exemption_ind_t *exemption_ind); +OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_copy(OpenAPI_exemption_ind_t *dst, OpenAPI_exemption_ind_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_exemption_ind_H_ */ + diff --git a/lib/sbi/openapi/model/expected_ue_behavior.c b/lib/sbi/openapi/model/expected_ue_behavior.c new file mode 100644 index 000000000..08f682b8e --- /dev/null +++ b/lib/sbi/openapi/model/expected_ue_behavior.c @@ -0,0 +1,165 @@ + +#include +#include +#include +#include "expected_ue_behavior.h" + +OpenAPI_expected_ue_behavior_t *OpenAPI_expected_ue_behavior_create( + OpenAPI_list_t *exp_move_trajectory, + char *validity_time + ) +{ + OpenAPI_expected_ue_behavior_t *expected_ue_behavior_local_var = OpenAPI_malloc(sizeof(OpenAPI_expected_ue_behavior_t)); + if (!expected_ue_behavior_local_var) { + return NULL; + } + expected_ue_behavior_local_var->exp_move_trajectory = exp_move_trajectory; + expected_ue_behavior_local_var->validity_time = validity_time; + + return expected_ue_behavior_local_var; +} + +void OpenAPI_expected_ue_behavior_free(OpenAPI_expected_ue_behavior_t *expected_ue_behavior) +{ + if (NULL == expected_ue_behavior) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(expected_ue_behavior->exp_move_trajectory, node) { + OpenAPI_user_location_free(node->data); + } + OpenAPI_list_free(expected_ue_behavior->exp_move_trajectory); + ogs_free(expected_ue_behavior->validity_time); + ogs_free(expected_ue_behavior); +} + +cJSON *OpenAPI_expected_ue_behavior_convertToJSON(OpenAPI_expected_ue_behavior_t *expected_ue_behavior) +{ + cJSON *item = NULL; + + if (expected_ue_behavior == NULL) { + ogs_error("OpenAPI_expected_ue_behavior_convertToJSON() failed [ExpectedUeBehavior]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!expected_ue_behavior->exp_move_trajectory) { + ogs_error("OpenAPI_expected_ue_behavior_convertToJSON() failed [exp_move_trajectory]"); + goto end; + } + cJSON *exp_move_trajectoryList = cJSON_AddArrayToObject(item, "expMoveTrajectory"); + if (exp_move_trajectoryList == NULL) { + ogs_error("OpenAPI_expected_ue_behavior_convertToJSON() failed [exp_move_trajectory]"); + goto end; + } + + OpenAPI_lnode_t *exp_move_trajectory_node; + if (expected_ue_behavior->exp_move_trajectory) { + OpenAPI_list_for_each(expected_ue_behavior->exp_move_trajectory, exp_move_trajectory_node) { + cJSON *itemLocal = OpenAPI_user_location_convertToJSON(exp_move_trajectory_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_expected_ue_behavior_convertToJSON() failed [exp_move_trajectory]"); + goto end; + } + cJSON_AddItemToArray(exp_move_trajectoryList, itemLocal); + } + } + + if (!expected_ue_behavior->validity_time) { + ogs_error("OpenAPI_expected_ue_behavior_convertToJSON() failed [validity_time]"); + goto end; + } + if (cJSON_AddStringToObject(item, "validityTime", expected_ue_behavior->validity_time) == NULL) { + ogs_error("OpenAPI_expected_ue_behavior_convertToJSON() failed [validity_time]"); + goto end; + } + +end: + return item; +} + +OpenAPI_expected_ue_behavior_t *OpenAPI_expected_ue_behavior_parseFromJSON(cJSON *expected_ue_behaviorJSON) +{ + OpenAPI_expected_ue_behavior_t *expected_ue_behavior_local_var = NULL; + cJSON *exp_move_trajectory = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviorJSON, "expMoveTrajectory"); + if (!exp_move_trajectory) { + ogs_error("OpenAPI_expected_ue_behavior_parseFromJSON() failed [exp_move_trajectory]"); + goto end; + } + + OpenAPI_list_t *exp_move_trajectoryList; + + cJSON *exp_move_trajectory_local_nonprimitive; + if (!cJSON_IsArray(exp_move_trajectory)) { + ogs_error("OpenAPI_expected_ue_behavior_parseFromJSON() failed [exp_move_trajectory]"); + goto end; + } + + exp_move_trajectoryList = OpenAPI_list_create(); + + cJSON_ArrayForEach(exp_move_trajectory_local_nonprimitive, exp_move_trajectory ) { + if (!cJSON_IsObject(exp_move_trajectory_local_nonprimitive)) { + ogs_error("OpenAPI_expected_ue_behavior_parseFromJSON() failed [exp_move_trajectory]"); + goto end; + } + OpenAPI_user_location_t *exp_move_trajectoryItem = OpenAPI_user_location_parseFromJSON(exp_move_trajectory_local_nonprimitive); + + OpenAPI_list_add(exp_move_trajectoryList, exp_move_trajectoryItem); + } + + cJSON *validity_time = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviorJSON, "validityTime"); + if (!validity_time) { + ogs_error("OpenAPI_expected_ue_behavior_parseFromJSON() failed [validity_time]"); + goto end; + } + + + if (!cJSON_IsString(validity_time)) { + ogs_error("OpenAPI_expected_ue_behavior_parseFromJSON() failed [validity_time]"); + goto end; + } + + expected_ue_behavior_local_var = OpenAPI_expected_ue_behavior_create ( + exp_move_trajectoryList, + ogs_strdup(validity_time->valuestring) + ); + + return expected_ue_behavior_local_var; +end: + return NULL; +} + +OpenAPI_expected_ue_behavior_t *OpenAPI_expected_ue_behavior_copy(OpenAPI_expected_ue_behavior_t *dst, OpenAPI_expected_ue_behavior_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_expected_ue_behavior_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_expected_ue_behavior_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_expected_ue_behavior_free(dst); + dst = OpenAPI_expected_ue_behavior_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/expected_ue_behavior.h b/lib/sbi/openapi/model/expected_ue_behavior.h new file mode 100644 index 000000000..f019c3040 --- /dev/null +++ b/lib/sbi/openapi/model/expected_ue_behavior.h @@ -0,0 +1,41 @@ +/* + * expected_ue_behavior.h + * + * + */ + +#ifndef _OpenAPI_expected_ue_behavior_H_ +#define _OpenAPI_expected_ue_behavior_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_expected_ue_behavior_s OpenAPI_expected_ue_behavior_t; +typedef struct OpenAPI_expected_ue_behavior_s { + OpenAPI_list_t *exp_move_trajectory; + char *validity_time; +} OpenAPI_expected_ue_behavior_t; + +OpenAPI_expected_ue_behavior_t *OpenAPI_expected_ue_behavior_create( + OpenAPI_list_t *exp_move_trajectory, + char *validity_time + ); +void OpenAPI_expected_ue_behavior_free(OpenAPI_expected_ue_behavior_t *expected_ue_behavior); +OpenAPI_expected_ue_behavior_t *OpenAPI_expected_ue_behavior_parseFromJSON(cJSON *expected_ue_behaviorJSON); +cJSON *OpenAPI_expected_ue_behavior_convertToJSON(OpenAPI_expected_ue_behavior_t *expected_ue_behavior); +OpenAPI_expected_ue_behavior_t *OpenAPI_expected_ue_behavior_copy(OpenAPI_expected_ue_behavior_t *dst, OpenAPI_expected_ue_behavior_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_expected_ue_behavior_H_ */ + diff --git a/lib/sbi/openapi/model/expected_ue_behaviour.c b/lib/sbi/openapi/model/expected_ue_behaviour.c index 2006af4fe..b385fe925 100644 --- a/lib/sbi/openapi/model/expected_ue_behaviour.c +++ b/lib/sbi/openapi/model/expected_ue_behaviour.c @@ -326,3 +326,37 @@ end: return NULL; } +OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_copy(OpenAPI_expected_ue_behaviour_t *dst, OpenAPI_expected_ue_behaviour_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_expected_ue_behaviour_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_expected_ue_behaviour_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_expected_ue_behaviour_free(dst); + dst = OpenAPI_expected_ue_behaviour_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/expected_ue_behaviour.h b/lib/sbi/openapi/model/expected_ue_behaviour.h index 8e3d754cf..e82149812 100644 --- a/lib/sbi/openapi/model/expected_ue_behaviour.h +++ b/lib/sbi/openapi/model/expected_ue_behaviour.h @@ -54,6 +54,7 @@ OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_create( void OpenAPI_expected_ue_behaviour_free(OpenAPI_expected_ue_behaviour_t *expected_ue_behaviour); OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_parseFromJSON(cJSON *expected_ue_behaviourJSON); cJSON *OpenAPI_expected_ue_behaviour_convertToJSON(OpenAPI_expected_ue_behaviour_t *expected_ue_behaviour); +OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_copy(OpenAPI_expected_ue_behaviour_t *dst, OpenAPI_expected_ue_behaviour_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/expected_ue_behaviour_data.c b/lib/sbi/openapi/model/expected_ue_behaviour_data.c index e3741631c..25295c053 100644 --- a/lib/sbi/openapi/model/expected_ue_behaviour_data.c +++ b/lib/sbi/openapi/model/expected_ue_behaviour_data.c @@ -277,3 +277,37 @@ end: return NULL; } +OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_copy(OpenAPI_expected_ue_behaviour_data_t *dst, OpenAPI_expected_ue_behaviour_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_expected_ue_behaviour_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_expected_ue_behaviour_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_expected_ue_behaviour_data_free(dst); + dst = OpenAPI_expected_ue_behaviour_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/expected_ue_behaviour_data.h b/lib/sbi/openapi/model/expected_ue_behaviour_data.h index 387be2091..13f113241 100644 --- a/lib/sbi/openapi/model/expected_ue_behaviour_data.h +++ b/lib/sbi/openapi/model/expected_ue_behaviour_data.h @@ -50,6 +50,7 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_create( void OpenAPI_expected_ue_behaviour_data_free(OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_data); OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFromJSON(cJSON *expected_ue_behaviour_dataJSON); cJSON *OpenAPI_expected_ue_behaviour_data_convertToJSON(OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_data); +OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_copy(OpenAPI_expected_ue_behaviour_data_t *dst, OpenAPI_expected_ue_behaviour_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/exposure_data_change_notification.c b/lib/sbi/openapi/model/exposure_data_change_notification.c index 778f68fb5..dc0a5c7d4 100644 --- a/lib/sbi/openapi/model/exposure_data_change_notification.c +++ b/lib/sbi/openapi/model/exposure_data_change_notification.c @@ -186,3 +186,37 @@ end: return NULL; } +OpenAPI_exposure_data_change_notification_t *OpenAPI_exposure_data_change_notification_copy(OpenAPI_exposure_data_change_notification_t *dst, OpenAPI_exposure_data_change_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_exposure_data_change_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_exposure_data_change_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_exposure_data_change_notification_free(dst); + dst = OpenAPI_exposure_data_change_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/exposure_data_change_notification.h b/lib/sbi/openapi/model/exposure_data_change_notification.h index 7c6896965..29388ceb3 100644 --- a/lib/sbi/openapi/model/exposure_data_change_notification.h +++ b/lib/sbi/openapi/model/exposure_data_change_notification.h @@ -36,6 +36,7 @@ OpenAPI_exposure_data_change_notification_t *OpenAPI_exposure_data_change_notifi void OpenAPI_exposure_data_change_notification_free(OpenAPI_exposure_data_change_notification_t *exposure_data_change_notification); OpenAPI_exposure_data_change_notification_t *OpenAPI_exposure_data_change_notification_parseFromJSON(cJSON *exposure_data_change_notificationJSON); cJSON *OpenAPI_exposure_data_change_notification_convertToJSON(OpenAPI_exposure_data_change_notification_t *exposure_data_change_notification); +OpenAPI_exposure_data_change_notification_t *OpenAPI_exposure_data_change_notification_copy(OpenAPI_exposure_data_change_notification_t *dst, OpenAPI_exposure_data_change_notification_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/exposure_data_subscription.c b/lib/sbi/openapi/model/exposure_data_subscription.c index 6ea852b47..94dfce897 100644 --- a/lib/sbi/openapi/model/exposure_data_subscription.c +++ b/lib/sbi/openapi/model/exposure_data_subscription.c @@ -162,3 +162,37 @@ end: return NULL; } +OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_copy(OpenAPI_exposure_data_subscription_t *dst, OpenAPI_exposure_data_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_exposure_data_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_exposure_data_subscription_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_exposure_data_subscription_free(dst); + dst = OpenAPI_exposure_data_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/exposure_data_subscription.h b/lib/sbi/openapi/model/exposure_data_subscription.h index 35dc2f76e..2cafc0e79 100644 --- a/lib/sbi/openapi/model/exposure_data_subscription.h +++ b/lib/sbi/openapi/model/exposure_data_subscription.h @@ -34,6 +34,7 @@ OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_create( void OpenAPI_exposure_data_subscription_free(OpenAPI_exposure_data_subscription_t *exposure_data_subscription); OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_parseFromJSON(cJSON *exposure_data_subscriptionJSON); cJSON *OpenAPI_exposure_data_subscription_convertToJSON(OpenAPI_exposure_data_subscription_t *exposure_data_subscription); +OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_copy(OpenAPI_exposure_data_subscription_t *dst, OpenAPI_exposure_data_subscription_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/external_client_type.c b/lib/sbi/openapi/model/external_client_type.c index 5830fd234..15c4cac82 100644 --- a/lib/sbi/openapi/model/external_client_type.c +++ b/lib/sbi/openapi/model/external_client_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_external_client_type_t *OpenAPI_external_client_type_copy(OpenAPI_external_client_type_t *dst, OpenAPI_external_client_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_external_client_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_external_client_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_external_client_type_free(dst); + dst = OpenAPI_external_client_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/external_client_type.h b/lib/sbi/openapi/model/external_client_type.h index 5ace4bd33..b63825032 100644 --- a/lib/sbi/openapi/model/external_client_type.h +++ b/lib/sbi/openapi/model/external_client_type.h @@ -26,6 +26,7 @@ OpenAPI_external_client_type_t *OpenAPI_external_client_type_create( void OpenAPI_external_client_type_free(OpenAPI_external_client_type_t *external_client_type); OpenAPI_external_client_type_t *OpenAPI_external_client_type_parseFromJSON(cJSON *external_client_typeJSON); cJSON *OpenAPI_external_client_type_convertToJSON(OpenAPI_external_client_type_t *external_client_type); +OpenAPI_external_client_type_t *OpenAPI_external_client_type_copy(OpenAPI_external_client_type_t *dst, OpenAPI_external_client_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/external_unrelated_class.c b/lib/sbi/openapi/model/external_unrelated_class.c index 5a9af18c5..43e480167 100644 --- a/lib/sbi/openapi/model/external_unrelated_class.c +++ b/lib/sbi/openapi/model/external_unrelated_class.c @@ -199,3 +199,37 @@ end: return NULL; } +OpenAPI_external_unrelated_class_t *OpenAPI_external_unrelated_class_copy(OpenAPI_external_unrelated_class_t *dst, OpenAPI_external_unrelated_class_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_external_unrelated_class_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_external_unrelated_class_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_external_unrelated_class_free(dst); + dst = OpenAPI_external_unrelated_class_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/external_unrelated_class.h b/lib/sbi/openapi/model/external_unrelated_class.h index a7696c346..ecfba6232 100644 --- a/lib/sbi/openapi/model/external_unrelated_class.h +++ b/lib/sbi/openapi/model/external_unrelated_class.h @@ -35,6 +35,7 @@ OpenAPI_external_unrelated_class_t *OpenAPI_external_unrelated_class_create( void OpenAPI_external_unrelated_class_free(OpenAPI_external_unrelated_class_t *external_unrelated_class); OpenAPI_external_unrelated_class_t *OpenAPI_external_unrelated_class_parseFromJSON(cJSON *external_unrelated_classJSON); cJSON *OpenAPI_external_unrelated_class_convertToJSON(OpenAPI_external_unrelated_class_t *external_unrelated_class); +OpenAPI_external_unrelated_class_t *OpenAPI_external_unrelated_class_copy(OpenAPI_external_unrelated_class_t *dst, OpenAPI_external_unrelated_class_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/flow_direction.c b/lib/sbi/openapi/model/flow_direction.c index ba35074e1..971695bda 100644 --- a/lib/sbi/openapi/model/flow_direction.c +++ b/lib/sbi/openapi/model/flow_direction.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_flow_direction_t *OpenAPI_flow_direction_copy(OpenAPI_flow_direction_t *dst, OpenAPI_flow_direction_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_flow_direction_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_flow_direction_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_flow_direction_free(dst); + dst = OpenAPI_flow_direction_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/flow_direction.h b/lib/sbi/openapi/model/flow_direction.h index 8a52ff43c..4e02f8133 100644 --- a/lib/sbi/openapi/model/flow_direction.h +++ b/lib/sbi/openapi/model/flow_direction.h @@ -26,6 +26,7 @@ OpenAPI_flow_direction_t *OpenAPI_flow_direction_create( void OpenAPI_flow_direction_free(OpenAPI_flow_direction_t *flow_direction); OpenAPI_flow_direction_t *OpenAPI_flow_direction_parseFromJSON(cJSON *flow_directionJSON); cJSON *OpenAPI_flow_direction_convertToJSON(OpenAPI_flow_direction_t *flow_direction); +OpenAPI_flow_direction_t *OpenAPI_flow_direction_copy(OpenAPI_flow_direction_t *dst, OpenAPI_flow_direction_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/flow_info.c b/lib/sbi/openapi/model/flow_info.c index 097151e88..474f62fff 100644 --- a/lib/sbi/openapi/model/flow_info.c +++ b/lib/sbi/openapi/model/flow_info.c @@ -116,3 +116,37 @@ end: return NULL; } +OpenAPI_flow_info_t *OpenAPI_flow_info_copy(OpenAPI_flow_info_t *dst, OpenAPI_flow_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_flow_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_flow_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_flow_info_free(dst); + dst = OpenAPI_flow_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/flow_info.h b/lib/sbi/openapi/model/flow_info.h index 72a343e58..b4db71506 100644 --- a/lib/sbi/openapi/model/flow_info.h +++ b/lib/sbi/openapi/model/flow_info.h @@ -30,6 +30,7 @@ OpenAPI_flow_info_t *OpenAPI_flow_info_create( void OpenAPI_flow_info_free(OpenAPI_flow_info_t *flow_info); OpenAPI_flow_info_t *OpenAPI_flow_info_parseFromJSON(cJSON *flow_infoJSON); cJSON *OpenAPI_flow_info_convertToJSON(OpenAPI_flow_info_t *flow_info); +OpenAPI_flow_info_t *OpenAPI_flow_info_copy(OpenAPI_flow_info_t *dst, OpenAPI_flow_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/frame_route_info.c b/lib/sbi/openapi/model/frame_route_info.c index 57d331069..4b808bf27 100644 --- a/lib/sbi/openapi/model/frame_route_info.c +++ b/lib/sbi/openapi/model/frame_route_info.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_frame_route_info_t *OpenAPI_frame_route_info_copy(OpenAPI_frame_route_info_t *dst, OpenAPI_frame_route_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_frame_route_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_frame_route_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_frame_route_info_free(dst); + dst = OpenAPI_frame_route_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/frame_route_info.h b/lib/sbi/openapi/model/frame_route_info.h index cecb47cef..fffa3c7a9 100644 --- a/lib/sbi/openapi/model/frame_route_info.h +++ b/lib/sbi/openapi/model/frame_route_info.h @@ -30,6 +30,7 @@ OpenAPI_frame_route_info_t *OpenAPI_frame_route_info_create( void OpenAPI_frame_route_info_free(OpenAPI_frame_route_info_t *frame_route_info); OpenAPI_frame_route_info_t *OpenAPI_frame_route_info_parseFromJSON(cJSON *frame_route_infoJSON); cJSON *OpenAPI_frame_route_info_convertToJSON(OpenAPI_frame_route_info_t *frame_route_info); +OpenAPI_frame_route_info_t *OpenAPI_frame_route_info_copy(OpenAPI_frame_route_info_t *dst, OpenAPI_frame_route_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/g_nb_id.c b/lib/sbi/openapi/model/g_nb_id.c index c9e6cde39..89edfc0e1 100644 --- a/lib/sbi/openapi/model/g_nb_id.c +++ b/lib/sbi/openapi/model/g_nb_id.c @@ -98,3 +98,37 @@ end: return NULL; } +OpenAPI_g_nb_id_t *OpenAPI_g_nb_id_copy(OpenAPI_g_nb_id_t *dst, OpenAPI_g_nb_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_g_nb_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_g_nb_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_g_nb_id_free(dst); + dst = OpenAPI_g_nb_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/g_nb_id.h b/lib/sbi/openapi/model/g_nb_id.h index c2cf49018..47eeac12a 100644 --- a/lib/sbi/openapi/model/g_nb_id.h +++ b/lib/sbi/openapi/model/g_nb_id.h @@ -30,6 +30,7 @@ OpenAPI_g_nb_id_t *OpenAPI_g_nb_id_create( void OpenAPI_g_nb_id_free(OpenAPI_g_nb_id_t *g_nb_id); OpenAPI_g_nb_id_t *OpenAPI_g_nb_id_parseFromJSON(cJSON *g_nb_idJSON); cJSON *OpenAPI_g_nb_id_convertToJSON(OpenAPI_g_nb_id_t *g_nb_id); +OpenAPI_g_nb_id_t *OpenAPI_g_nb_id_copy(OpenAPI_g_nb_id_t *dst, OpenAPI_g_nb_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/gad_shape.c b/lib/sbi/openapi/model/gad_shape.c index 9429e8d0a..60477a630 100644 --- a/lib/sbi/openapi/model/gad_shape.c +++ b/lib/sbi/openapi/model/gad_shape.c @@ -78,3 +78,37 @@ end: return NULL; } +OpenAPI_gad_shape_t *OpenAPI_gad_shape_copy(OpenAPI_gad_shape_t *dst, OpenAPI_gad_shape_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_gad_shape_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_gad_shape_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_gad_shape_free(dst); + dst = OpenAPI_gad_shape_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/gad_shape.h b/lib/sbi/openapi/model/gad_shape.h index d235c7f23..f978d2c55 100644 --- a/lib/sbi/openapi/model/gad_shape.h +++ b/lib/sbi/openapi/model/gad_shape.h @@ -29,6 +29,7 @@ OpenAPI_gad_shape_t *OpenAPI_gad_shape_create( void OpenAPI_gad_shape_free(OpenAPI_gad_shape_t *gad_shape); OpenAPI_gad_shape_t *OpenAPI_gad_shape_parseFromJSON(cJSON *gad_shapeJSON); cJSON *OpenAPI_gad_shape_convertToJSON(OpenAPI_gad_shape_t *gad_shape); +OpenAPI_gad_shape_t *OpenAPI_gad_shape_copy(OpenAPI_gad_shape_t *dst, OpenAPI_gad_shape_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/gbr_qos_flow_information.c b/lib/sbi/openapi/model/gbr_qos_flow_information.c new file mode 100644 index 000000000..5e9552d61 --- /dev/null +++ b/lib/sbi/openapi/model/gbr_qos_flow_information.c @@ -0,0 +1,247 @@ + +#include +#include +#include +#include "gbr_qos_flow_information.h" + +OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_create( + char *max_fbr_dl, + char *max_fbr_ul, + char *gua_fbr_dl, + char *gua_fbr_ul, + OpenAPI_notification_control_t *notif_control, + int max_packet_loss_rate_dl, + int max_packet_loss_rate_ul + ) +{ + OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_gbr_qos_flow_information_t)); + if (!gbr_qos_flow_information_local_var) { + return NULL; + } + gbr_qos_flow_information_local_var->max_fbr_dl = max_fbr_dl; + gbr_qos_flow_information_local_var->max_fbr_ul = max_fbr_ul; + gbr_qos_flow_information_local_var->gua_fbr_dl = gua_fbr_dl; + gbr_qos_flow_information_local_var->gua_fbr_ul = gua_fbr_ul; + gbr_qos_flow_information_local_var->notif_control = notif_control; + gbr_qos_flow_information_local_var->max_packet_loss_rate_dl = max_packet_loss_rate_dl; + gbr_qos_flow_information_local_var->max_packet_loss_rate_ul = max_packet_loss_rate_ul; + + return gbr_qos_flow_information_local_var; +} + +void OpenAPI_gbr_qos_flow_information_free(OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_information) +{ + if (NULL == gbr_qos_flow_information) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(gbr_qos_flow_information->max_fbr_dl); + ogs_free(gbr_qos_flow_information->max_fbr_ul); + ogs_free(gbr_qos_flow_information->gua_fbr_dl); + ogs_free(gbr_qos_flow_information->gua_fbr_ul); + OpenAPI_notification_control_free(gbr_qos_flow_information->notif_control); + ogs_free(gbr_qos_flow_information); +} + +cJSON *OpenAPI_gbr_qos_flow_information_convertToJSON(OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_information) +{ + cJSON *item = NULL; + + if (gbr_qos_flow_information == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [GbrQosFlowInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!gbr_qos_flow_information->max_fbr_dl) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [max_fbr_dl]"); + goto end; + } + if (cJSON_AddStringToObject(item, "maxFbrDl", gbr_qos_flow_information->max_fbr_dl) == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [max_fbr_dl]"); + goto end; + } + + if (!gbr_qos_flow_information->max_fbr_ul) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [max_fbr_ul]"); + goto end; + } + if (cJSON_AddStringToObject(item, "maxFbrUl", gbr_qos_flow_information->max_fbr_ul) == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [max_fbr_ul]"); + goto end; + } + + if (!gbr_qos_flow_information->gua_fbr_dl) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [gua_fbr_dl]"); + goto end; + } + if (cJSON_AddStringToObject(item, "guaFbrDl", gbr_qos_flow_information->gua_fbr_dl) == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [gua_fbr_dl]"); + goto end; + } + + if (!gbr_qos_flow_information->gua_fbr_ul) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [gua_fbr_ul]"); + goto end; + } + if (cJSON_AddStringToObject(item, "guaFbrUl", gbr_qos_flow_information->gua_fbr_ul) == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [gua_fbr_ul]"); + goto end; + } + + if (gbr_qos_flow_information->notif_control) { + cJSON *notif_control_local_JSON = OpenAPI_notification_control_convertToJSON(gbr_qos_flow_information->notif_control); + if (notif_control_local_JSON == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [notif_control]"); + goto end; + } + cJSON_AddItemToObject(item, "notifControl", notif_control_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [notif_control]"); + goto end; + } + } + + if (gbr_qos_flow_information->max_packet_loss_rate_dl) { + if (cJSON_AddNumberToObject(item, "maxPacketLossRateDl", gbr_qos_flow_information->max_packet_loss_rate_dl) == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [max_packet_loss_rate_dl]"); + goto end; + } + } + + if (gbr_qos_flow_information->max_packet_loss_rate_ul) { + if (cJSON_AddNumberToObject(item, "maxPacketLossRateUl", gbr_qos_flow_information->max_packet_loss_rate_ul) == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [max_packet_loss_rate_ul]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_parseFromJSON(cJSON *gbr_qos_flow_informationJSON) +{ + OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_information_local_var = NULL; + cJSON *max_fbr_dl = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "maxFbrDl"); + if (!max_fbr_dl) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [max_fbr_dl]"); + goto end; + } + + + if (!cJSON_IsString(max_fbr_dl)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [max_fbr_dl]"); + goto end; + } + + cJSON *max_fbr_ul = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "maxFbrUl"); + if (!max_fbr_ul) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [max_fbr_ul]"); + goto end; + } + + + if (!cJSON_IsString(max_fbr_ul)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [max_fbr_ul]"); + goto end; + } + + cJSON *gua_fbr_dl = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "guaFbrDl"); + if (!gua_fbr_dl) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [gua_fbr_dl]"); + goto end; + } + + + if (!cJSON_IsString(gua_fbr_dl)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [gua_fbr_dl]"); + goto end; + } + + cJSON *gua_fbr_ul = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "guaFbrUl"); + if (!gua_fbr_ul) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [gua_fbr_ul]"); + goto end; + } + + + if (!cJSON_IsString(gua_fbr_ul)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [gua_fbr_ul]"); + goto end; + } + + cJSON *notif_control = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "notifControl"); + + OpenAPI_notification_control_t *notif_control_local_nonprim = NULL; + if (notif_control) { + notif_control_local_nonprim = OpenAPI_notification_control_parseFromJSON(notif_control); + } + + cJSON *max_packet_loss_rate_dl = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "maxPacketLossRateDl"); + + if (max_packet_loss_rate_dl) { + if (!cJSON_IsNumber(max_packet_loss_rate_dl)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [max_packet_loss_rate_dl]"); + goto end; + } + } + + cJSON *max_packet_loss_rate_ul = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "maxPacketLossRateUl"); + + if (max_packet_loss_rate_ul) { + if (!cJSON_IsNumber(max_packet_loss_rate_ul)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [max_packet_loss_rate_ul]"); + goto end; + } + } + + gbr_qos_flow_information_local_var = OpenAPI_gbr_qos_flow_information_create ( + ogs_strdup(max_fbr_dl->valuestring), + ogs_strdup(max_fbr_ul->valuestring), + ogs_strdup(gua_fbr_dl->valuestring), + ogs_strdup(gua_fbr_ul->valuestring), + notif_control ? notif_control_local_nonprim : NULL, + max_packet_loss_rate_dl ? max_packet_loss_rate_dl->valuedouble : 0, + max_packet_loss_rate_ul ? max_packet_loss_rate_ul->valuedouble : 0 + ); + + return gbr_qos_flow_information_local_var; +end: + return NULL; +} + +OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_copy(OpenAPI_gbr_qos_flow_information_t *dst, OpenAPI_gbr_qos_flow_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_gbr_qos_flow_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_gbr_qos_flow_information_free(dst); + dst = OpenAPI_gbr_qos_flow_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/gbr_qos_flow_information.h b/lib/sbi/openapi/model/gbr_qos_flow_information.h new file mode 100644 index 000000000..89d2751f3 --- /dev/null +++ b/lib/sbi/openapi/model/gbr_qos_flow_information.h @@ -0,0 +1,51 @@ +/* + * gbr_qos_flow_information.h + * + * + */ + +#ifndef _OpenAPI_gbr_qos_flow_information_H_ +#define _OpenAPI_gbr_qos_flow_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "notification_control.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_gbr_qos_flow_information_s OpenAPI_gbr_qos_flow_information_t; +typedef struct OpenAPI_gbr_qos_flow_information_s { + char *max_fbr_dl; + char *max_fbr_ul; + char *gua_fbr_dl; + char *gua_fbr_ul; + struct OpenAPI_notification_control_s *notif_control; + int max_packet_loss_rate_dl; + int max_packet_loss_rate_ul; +} OpenAPI_gbr_qos_flow_information_t; + +OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_create( + char *max_fbr_dl, + char *max_fbr_ul, + char *gua_fbr_dl, + char *gua_fbr_ul, + OpenAPI_notification_control_t *notif_control, + int max_packet_loss_rate_dl, + int max_packet_loss_rate_ul + ); +void OpenAPI_gbr_qos_flow_information_free(OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_information); +OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_parseFromJSON(cJSON *gbr_qos_flow_informationJSON); +cJSON *OpenAPI_gbr_qos_flow_information_convertToJSON(OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_information); +OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_copy(OpenAPI_gbr_qos_flow_information_t *dst, OpenAPI_gbr_qos_flow_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_gbr_qos_flow_information_H_ */ + diff --git a/lib/sbi/openapi/model/geographic_area.c b/lib/sbi/openapi/model/geographic_area.c index 14a310c63..cc5d391bb 100644 --- a/lib/sbi/openapi/model/geographic_area.c +++ b/lib/sbi/openapi/model/geographic_area.c @@ -383,3 +383,37 @@ end: return NULL; } +OpenAPI_geographic_area_t *OpenAPI_geographic_area_copy(OpenAPI_geographic_area_t *dst, OpenAPI_geographic_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_geographic_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_geographic_area_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_geographic_area_free(dst); + dst = OpenAPI_geographic_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/geographic_area.h b/lib/sbi/openapi/model/geographic_area.h index 8f2a42090..21cd87a01 100644 --- a/lib/sbi/openapi/model/geographic_area.h +++ b/lib/sbi/openapi/model/geographic_area.h @@ -60,6 +60,7 @@ OpenAPI_geographic_area_t *OpenAPI_geographic_area_create( void OpenAPI_geographic_area_free(OpenAPI_geographic_area_t *geographic_area); OpenAPI_geographic_area_t *OpenAPI_geographic_area_parseFromJSON(cJSON *geographic_areaJSON); cJSON *OpenAPI_geographic_area_convertToJSON(OpenAPI_geographic_area_t *geographic_area); +OpenAPI_geographic_area_t *OpenAPI_geographic_area_copy(OpenAPI_geographic_area_t *dst, OpenAPI_geographic_area_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/geographical_coordinates.c b/lib/sbi/openapi/model/geographical_coordinates.c index 830adb23e..5c361d026 100644 --- a/lib/sbi/openapi/model/geographical_coordinates.c +++ b/lib/sbi/openapi/model/geographical_coordinates.c @@ -97,3 +97,37 @@ end: return NULL; } +OpenAPI_geographical_coordinates_t *OpenAPI_geographical_coordinates_copy(OpenAPI_geographical_coordinates_t *dst, OpenAPI_geographical_coordinates_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_geographical_coordinates_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_geographical_coordinates_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_geographical_coordinates_free(dst); + dst = OpenAPI_geographical_coordinates_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/geographical_coordinates.h b/lib/sbi/openapi/model/geographical_coordinates.h index b01f3bbc3..41afd1755 100644 --- a/lib/sbi/openapi/model/geographical_coordinates.h +++ b/lib/sbi/openapi/model/geographical_coordinates.h @@ -30,6 +30,7 @@ OpenAPI_geographical_coordinates_t *OpenAPI_geographical_coordinates_create( void OpenAPI_geographical_coordinates_free(OpenAPI_geographical_coordinates_t *geographical_coordinates); OpenAPI_geographical_coordinates_t *OpenAPI_geographical_coordinates_parseFromJSON(cJSON *geographical_coordinatesJSON); cJSON *OpenAPI_geographical_coordinates_convertToJSON(OpenAPI_geographical_coordinates_t *geographical_coordinates); +OpenAPI_geographical_coordinates_t *OpenAPI_geographical_coordinates_copy(OpenAPI_geographical_coordinates_t *dst, OpenAPI_geographical_coordinates_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/global_ran_node_id.c b/lib/sbi/openapi/model/global_ran_node_id.c index 4037e1ee8..f13ed2218 100644 --- a/lib/sbi/openapi/model/global_ran_node_id.c +++ b/lib/sbi/openapi/model/global_ran_node_id.c @@ -182,3 +182,37 @@ end: return NULL; } +OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_copy(OpenAPI_global_ran_node_id_t *dst, OpenAPI_global_ran_node_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_global_ran_node_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_global_ran_node_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_global_ran_node_id_free(dst); + dst = OpenAPI_global_ran_node_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/global_ran_node_id.h b/lib/sbi/openapi/model/global_ran_node_id.h index 0102e4d7b..102532978 100644 --- a/lib/sbi/openapi/model/global_ran_node_id.h +++ b/lib/sbi/openapi/model/global_ran_node_id.h @@ -40,6 +40,7 @@ OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_create( void OpenAPI_global_ran_node_id_free(OpenAPI_global_ran_node_id_t *global_ran_node_id); OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_parseFromJSON(cJSON *global_ran_node_idJSON); cJSON *OpenAPI_global_ran_node_id_convertToJSON(OpenAPI_global_ran_node_id_t *global_ran_node_id); +OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_copy(OpenAPI_global_ran_node_id_t *dst, OpenAPI_global_ran_node_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/gmlc_info.c b/lib/sbi/openapi/model/gmlc_info.c index 1ca7c8a7c..8001069aa 100644 --- a/lib/sbi/openapi/model/gmlc_info.c +++ b/lib/sbi/openapi/model/gmlc_info.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_copy(OpenAPI_gmlc_info_t *dst, OpenAPI_gmlc_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_gmlc_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_gmlc_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_gmlc_info_free(dst); + dst = OpenAPI_gmlc_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/gmlc_info.h b/lib/sbi/openapi/model/gmlc_info.h index e9452010d..82047e0f6 100644 --- a/lib/sbi/openapi/model/gmlc_info.h +++ b/lib/sbi/openapi/model/gmlc_info.h @@ -29,6 +29,7 @@ OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_create( void OpenAPI_gmlc_info_free(OpenAPI_gmlc_info_t *gmlc_info); OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_parseFromJSON(cJSON *gmlc_infoJSON); cJSON *OpenAPI_gmlc_info_convertToJSON(OpenAPI_gmlc_info_t *gmlc_info); +OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_copy(OpenAPI_gmlc_info_t *dst, OpenAPI_gmlc_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/group_identifiers.c b/lib/sbi/openapi/model/group_identifiers.c index 99bdb89fb..79535f8b2 100644 --- a/lib/sbi/openapi/model/group_identifiers.c +++ b/lib/sbi/openapi/model/group_identifiers.c @@ -139,3 +139,37 @@ end: return NULL; } +OpenAPI_group_identifiers_t *OpenAPI_group_identifiers_copy(OpenAPI_group_identifiers_t *dst, OpenAPI_group_identifiers_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_group_identifiers_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_group_identifiers_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_group_identifiers_free(dst); + dst = OpenAPI_group_identifiers_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/group_identifiers.h b/lib/sbi/openapi/model/group_identifiers.h index e12d13dac..9a0138150 100644 --- a/lib/sbi/openapi/model/group_identifiers.h +++ b/lib/sbi/openapi/model/group_identifiers.h @@ -33,6 +33,7 @@ OpenAPI_group_identifiers_t *OpenAPI_group_identifiers_create( void OpenAPI_group_identifiers_free(OpenAPI_group_identifiers_t *group_identifiers); OpenAPI_group_identifiers_t *OpenAPI_group_identifiers_parseFromJSON(cJSON *group_identifiersJSON); cJSON *OpenAPI_group_identifiers_convertToJSON(OpenAPI_group_identifiers_t *group_identifiers); +OpenAPI_group_identifiers_t *OpenAPI_group_identifiers_copy(OpenAPI_group_identifiers_t *dst, OpenAPI_group_identifiers_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/guami.c b/lib/sbi/openapi/model/guami.c index 1420d1f2c..04ef03c5b 100644 --- a/lib/sbi/openapi/model/guami.c +++ b/lib/sbi/openapi/model/guami.c @@ -103,3 +103,37 @@ end: return NULL; } +OpenAPI_guami_t *OpenAPI_guami_copy(OpenAPI_guami_t *dst, OpenAPI_guami_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_guami_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_guami_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_guami_free(dst); + dst = OpenAPI_guami_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/guami.h b/lib/sbi/openapi/model/guami.h index 98e80a7a2..eda0483e4 100644 --- a/lib/sbi/openapi/model/guami.h +++ b/lib/sbi/openapi/model/guami.h @@ -31,6 +31,7 @@ OpenAPI_guami_t *OpenAPI_guami_create( void OpenAPI_guami_free(OpenAPI_guami_t *guami); OpenAPI_guami_t *OpenAPI_guami_parseFromJSON(cJSON *guamiJSON); cJSON *OpenAPI_guami_convertToJSON(OpenAPI_guami_t *guami); +OpenAPI_guami_t *OpenAPI_guami_copy(OpenAPI_guami_t *dst, OpenAPI_guami_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/guami_list_cond.c b/lib/sbi/openapi/model/guami_list_cond.c index 39f09f601..ac14d19aa 100644 --- a/lib/sbi/openapi/model/guami_list_cond.c +++ b/lib/sbi/openapi/model/guami_list_cond.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_guami_list_cond_t *OpenAPI_guami_list_cond_copy(OpenAPI_guami_list_cond_t *dst, OpenAPI_guami_list_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_guami_list_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_guami_list_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_guami_list_cond_free(dst); + dst = OpenAPI_guami_list_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/guami_list_cond.h b/lib/sbi/openapi/model/guami_list_cond.h index fe9663ac4..43d77f863 100644 --- a/lib/sbi/openapi/model/guami_list_cond.h +++ b/lib/sbi/openapi/model/guami_list_cond.h @@ -29,6 +29,7 @@ OpenAPI_guami_list_cond_t *OpenAPI_guami_list_cond_create( void OpenAPI_guami_list_cond_free(OpenAPI_guami_list_cond_t *guami_list_cond); OpenAPI_guami_list_cond_t *OpenAPI_guami_list_cond_parseFromJSON(cJSON *guami_list_condJSON); cJSON *OpenAPI_guami_list_cond_convertToJSON(OpenAPI_guami_list_cond_t *guami_list_cond); +OpenAPI_guami_list_cond_t *OpenAPI_guami_list_cond_copy(OpenAPI_guami_list_cond_t *dst, OpenAPI_guami_list_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/hfc_node_id.c b/lib/sbi/openapi/model/hfc_node_id.c index d94bf3443..a7091f934 100644 --- a/lib/sbi/openapi/model/hfc_node_id.c +++ b/lib/sbi/openapi/model/hfc_node_id.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_hfc_node_id_t *OpenAPI_hfc_node_id_copy(OpenAPI_hfc_node_id_t *dst, OpenAPI_hfc_node_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hfc_node_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hfc_node_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_hfc_node_id_free(dst); + dst = OpenAPI_hfc_node_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hfc_node_id.h b/lib/sbi/openapi/model/hfc_node_id.h index ced8a1d36..e59de4211 100644 --- a/lib/sbi/openapi/model/hfc_node_id.h +++ b/lib/sbi/openapi/model/hfc_node_id.h @@ -28,6 +28,7 @@ OpenAPI_hfc_node_id_t *OpenAPI_hfc_node_id_create( void OpenAPI_hfc_node_id_free(OpenAPI_hfc_node_id_t *hfc_node_id); OpenAPI_hfc_node_id_t *OpenAPI_hfc_node_id_parseFromJSON(cJSON *hfc_node_idJSON); cJSON *OpenAPI_hfc_node_id_convertToJSON(OpenAPI_hfc_node_id_t *hfc_node_id); +OpenAPI_hfc_node_id_t *OpenAPI_hfc_node_id_copy(OpenAPI_hfc_node_id_t *dst, OpenAPI_hfc_node_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ho_state.c b/lib/sbi/openapi/model/ho_state.c new file mode 100644 index 000000000..9a68d7a86 --- /dev/null +++ b/lib/sbi/openapi/model/ho_state.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "ho_state.h" + +OpenAPI_ho_state_t *OpenAPI_ho_state_create( + ) +{ + OpenAPI_ho_state_t *ho_state_local_var = OpenAPI_malloc(sizeof(OpenAPI_ho_state_t)); + if (!ho_state_local_var) { + return NULL; + } + + return ho_state_local_var; +} + +void OpenAPI_ho_state_free(OpenAPI_ho_state_t *ho_state) +{ + if (NULL == ho_state) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ho_state); +} + +cJSON *OpenAPI_ho_state_convertToJSON(OpenAPI_ho_state_t *ho_state) +{ + cJSON *item = NULL; + + if (ho_state == NULL) { + ogs_error("OpenAPI_ho_state_convertToJSON() failed [HoState]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_ho_state_t *OpenAPI_ho_state_parseFromJSON(cJSON *ho_stateJSON) +{ + OpenAPI_ho_state_t *ho_state_local_var = NULL; + ho_state_local_var = OpenAPI_ho_state_create ( + ); + + return ho_state_local_var; +end: + return NULL; +} + +OpenAPI_ho_state_t *OpenAPI_ho_state_copy(OpenAPI_ho_state_t *dst, OpenAPI_ho_state_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ho_state_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ho_state_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ho_state_free(dst); + dst = OpenAPI_ho_state_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ho_state.h b/lib/sbi/openapi/model/ho_state.h new file mode 100644 index 000000000..9b1862f1b --- /dev/null +++ b/lib/sbi/openapi/model/ho_state.h @@ -0,0 +1,36 @@ +/* + * ho_state.h + * + * Possible values are - NONE - PREPARING - PREPARED - COMPLETED - CANCELLED + */ + +#ifndef _OpenAPI_ho_state_H_ +#define _OpenAPI_ho_state_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_ho_state_s OpenAPI_ho_state_t; +typedef struct OpenAPI_ho_state_s { +} OpenAPI_ho_state_t; + +OpenAPI_ho_state_t *OpenAPI_ho_state_create( + ); +void OpenAPI_ho_state_free(OpenAPI_ho_state_t *ho_state); +OpenAPI_ho_state_t *OpenAPI_ho_state_parseFromJSON(cJSON *ho_stateJSON); +cJSON *OpenAPI_ho_state_convertToJSON(OpenAPI_ho_state_t *ho_state); +OpenAPI_ho_state_t *OpenAPI_ho_state_copy(OpenAPI_ho_state_t *dst, OpenAPI_ho_state_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ho_state_H_ */ + diff --git a/lib/sbi/openapi/model/hsmf_update_data.c b/lib/sbi/openapi/model/hsmf_update_data.c new file mode 100644 index 000000000..68652a52b --- /dev/null +++ b/lib/sbi/openapi/model/hsmf_update_data.c @@ -0,0 +1,1485 @@ + +#include +#include +#include +#include "hsmf_update_data.h" + +OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( + OpenAPI_request_indication_t *request_indication, + char *pei, + OpenAPI_tunnel_info_t *vcn_tunnel_info, + OpenAPI_tunnel_info_t *icn_tunnel_info, + OpenAPI_tunnel_info_t *additional_cn_tunnel_info, + OpenAPI_plmn_id_nid_t *serving_network, + OpenAPI_access_type_e an_type, + OpenAPI_access_type_e additional_an_type, + OpenAPI_rat_type_e rat_type, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + int pause_charging, + int pti, + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue, + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info, + OpenAPI_list_t *qos_flows_rel_notify_list, + OpenAPI_list_t *qos_flows_notify_list, + OpenAPI_list_t *notify_list, + OpenAPI_list_t *eps_bearer_id, + int ho_preparation_indication, + OpenAPI_list_t *revoke_ebi_list, + OpenAPI_cause_t *cause, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + int always_on_requested, + OpenAPI_eps_interworking_indication_t *eps_interworking_ind, + OpenAPI_list_t *secondary_rat_usage_report, + OpenAPI_list_t *secondary_rat_usage_info, + int an_type_can_be_changed, + OpenAPI_ma_release_indication_t *ma_release_ind, + int ma_nw_upgrade_ind, + int ma_request_ind, + OpenAPI_unavailable_access_indication_t *unavailable_access_ind, + OpenAPI_list_t *psa_info, + OpenAPI_ulcl_bp_information_t *ulcl_bp_info, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_presence_state_t *presence_in_ladn, + char *vsmf_pdu_session_uri, + char *vsmf_id, + char *v_smf_service_instance_id, + char *ismf_pdu_session_uri, + char *ismf_id, + char *i_smf_service_instance_id, + int dl_serving_plmn_rate_ctl, + OpenAPI_list_t *dnai_list, + char *supported_features, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, + OpenAPI_vplmn_qos_t *vplmn_qos + ) +{ + OpenAPI_hsmf_update_data_t *hsmf_update_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_hsmf_update_data_t)); + if (!hsmf_update_data_local_var) { + return NULL; + } + hsmf_update_data_local_var->request_indication = request_indication; + hsmf_update_data_local_var->pei = pei; + hsmf_update_data_local_var->vcn_tunnel_info = vcn_tunnel_info; + hsmf_update_data_local_var->icn_tunnel_info = icn_tunnel_info; + hsmf_update_data_local_var->additional_cn_tunnel_info = additional_cn_tunnel_info; + hsmf_update_data_local_var->serving_network = serving_network; + hsmf_update_data_local_var->an_type = an_type; + hsmf_update_data_local_var->additional_an_type = additional_an_type; + hsmf_update_data_local_var->rat_type = rat_type; + hsmf_update_data_local_var->ue_location = ue_location; + hsmf_update_data_local_var->ue_time_zone = ue_time_zone; + hsmf_update_data_local_var->add_ue_location = add_ue_location; + hsmf_update_data_local_var->pause_charging = pause_charging; + hsmf_update_data_local_var->pti = pti; + hsmf_update_data_local_var->n1_sm_info_from_ue = n1_sm_info_from_ue; + hsmf_update_data_local_var->unknown_n1_sm_info = unknown_n1_sm_info; + hsmf_update_data_local_var->qos_flows_rel_notify_list = qos_flows_rel_notify_list; + hsmf_update_data_local_var->qos_flows_notify_list = qos_flows_notify_list; + hsmf_update_data_local_var->notify_list = notify_list; + hsmf_update_data_local_var->eps_bearer_id = eps_bearer_id; + hsmf_update_data_local_var->ho_preparation_indication = ho_preparation_indication; + hsmf_update_data_local_var->revoke_ebi_list = revoke_ebi_list; + hsmf_update_data_local_var->cause = cause; + hsmf_update_data_local_var->ng_ap_cause = ng_ap_cause; + hsmf_update_data_local_var->_5g_mm_cause_value = _5g_mm_cause_value; + hsmf_update_data_local_var->always_on_requested = always_on_requested; + hsmf_update_data_local_var->eps_interworking_ind = eps_interworking_ind; + hsmf_update_data_local_var->secondary_rat_usage_report = secondary_rat_usage_report; + hsmf_update_data_local_var->secondary_rat_usage_info = secondary_rat_usage_info; + hsmf_update_data_local_var->an_type_can_be_changed = an_type_can_be_changed; + hsmf_update_data_local_var->ma_release_ind = ma_release_ind; + hsmf_update_data_local_var->ma_nw_upgrade_ind = ma_nw_upgrade_ind; + hsmf_update_data_local_var->ma_request_ind = ma_request_ind; + hsmf_update_data_local_var->unavailable_access_ind = unavailable_access_ind; + hsmf_update_data_local_var->psa_info = psa_info; + hsmf_update_data_local_var->ulcl_bp_info = ulcl_bp_info; + hsmf_update_data_local_var->n4_info = n4_info; + hsmf_update_data_local_var->n4_info_ext1 = n4_info_ext1; + hsmf_update_data_local_var->n4_info_ext2 = n4_info_ext2; + hsmf_update_data_local_var->presence_in_ladn = presence_in_ladn; + hsmf_update_data_local_var->vsmf_pdu_session_uri = vsmf_pdu_session_uri; + hsmf_update_data_local_var->vsmf_id = vsmf_id; + hsmf_update_data_local_var->v_smf_service_instance_id = v_smf_service_instance_id; + hsmf_update_data_local_var->ismf_pdu_session_uri = ismf_pdu_session_uri; + hsmf_update_data_local_var->ismf_id = ismf_id; + hsmf_update_data_local_var->i_smf_service_instance_id = i_smf_service_instance_id; + hsmf_update_data_local_var->dl_serving_plmn_rate_ctl = dl_serving_plmn_rate_ctl; + hsmf_update_data_local_var->dnai_list = dnai_list; + hsmf_update_data_local_var->supported_features = supported_features; + hsmf_update_data_local_var->roaming_charging_profile = roaming_charging_profile; + hsmf_update_data_local_var->mo_exp_data_ind = mo_exp_data_ind; + hsmf_update_data_local_var->mo_exp_data_counter = mo_exp_data_counter; + hsmf_update_data_local_var->vplmn_qos = vplmn_qos; + + return hsmf_update_data_local_var; +} + +void OpenAPI_hsmf_update_data_free(OpenAPI_hsmf_update_data_t *hsmf_update_data) +{ + if (NULL == hsmf_update_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_request_indication_free(hsmf_update_data->request_indication); + ogs_free(hsmf_update_data->pei); + OpenAPI_tunnel_info_free(hsmf_update_data->vcn_tunnel_info); + OpenAPI_tunnel_info_free(hsmf_update_data->icn_tunnel_info); + OpenAPI_tunnel_info_free(hsmf_update_data->additional_cn_tunnel_info); + OpenAPI_plmn_id_nid_free(hsmf_update_data->serving_network); + OpenAPI_user_location_free(hsmf_update_data->ue_location); + ogs_free(hsmf_update_data->ue_time_zone); + OpenAPI_user_location_free(hsmf_update_data->add_ue_location); + OpenAPI_ref_to_binary_data_free(hsmf_update_data->n1_sm_info_from_ue); + OpenAPI_ref_to_binary_data_free(hsmf_update_data->unknown_n1_sm_info); + OpenAPI_list_for_each(hsmf_update_data->qos_flows_rel_notify_list, node) { + OpenAPI_qos_flow_item_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->qos_flows_rel_notify_list); + OpenAPI_list_for_each(hsmf_update_data->qos_flows_notify_list, node) { + OpenAPI_qos_flow_notify_item_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->qos_flows_notify_list); + OpenAPI_list_for_each(hsmf_update_data->notify_list, node) { + OpenAPI_pdu_session_notify_item_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->notify_list); + OpenAPI_list_for_each(hsmf_update_data->eps_bearer_id, node) { + ogs_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->eps_bearer_id); + OpenAPI_list_for_each(hsmf_update_data->revoke_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->revoke_ebi_list); + OpenAPI_cause_free(hsmf_update_data->cause); + OpenAPI_ng_ap_cause_free(hsmf_update_data->ng_ap_cause); + OpenAPI_eps_interworking_indication_free(hsmf_update_data->eps_interworking_ind); + OpenAPI_list_for_each(hsmf_update_data->secondary_rat_usage_report, node) { + OpenAPI_secondary_rat_usage_report_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->secondary_rat_usage_report); + OpenAPI_list_for_each(hsmf_update_data->secondary_rat_usage_info, node) { + OpenAPI_secondary_rat_usage_info_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->secondary_rat_usage_info); + OpenAPI_ma_release_indication_free(hsmf_update_data->ma_release_ind); + OpenAPI_unavailable_access_indication_free(hsmf_update_data->unavailable_access_ind); + OpenAPI_list_for_each(hsmf_update_data->psa_info, node) { + OpenAPI_psa_information_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->psa_info); + OpenAPI_ulcl_bp_information_free(hsmf_update_data->ulcl_bp_info); + OpenAPI_n4_information_free(hsmf_update_data->n4_info); + OpenAPI_n4_information_free(hsmf_update_data->n4_info_ext1); + OpenAPI_n4_information_free(hsmf_update_data->n4_info_ext2); + OpenAPI_presence_state_free(hsmf_update_data->presence_in_ladn); + ogs_free(hsmf_update_data->vsmf_pdu_session_uri); + ogs_free(hsmf_update_data->vsmf_id); + ogs_free(hsmf_update_data->v_smf_service_instance_id); + ogs_free(hsmf_update_data->ismf_pdu_session_uri); + ogs_free(hsmf_update_data->ismf_id); + ogs_free(hsmf_update_data->i_smf_service_instance_id); + OpenAPI_list_for_each(hsmf_update_data->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->dnai_list); + ogs_free(hsmf_update_data->supported_features); + OpenAPI_roaming_charging_profile_free(hsmf_update_data->roaming_charging_profile); + OpenAPI_mo_exception_data_flag_free(hsmf_update_data->mo_exp_data_ind); + OpenAPI_mo_exp_data_counter_free(hsmf_update_data->mo_exp_data_counter); + OpenAPI_vplmn_qos_free(hsmf_update_data->vplmn_qos); + ogs_free(hsmf_update_data); +} + +cJSON *OpenAPI_hsmf_update_data_convertToJSON(OpenAPI_hsmf_update_data_t *hsmf_update_data) +{ + cJSON *item = NULL; + + if (hsmf_update_data == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [HsmfUpdateData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!hsmf_update_data->request_indication) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [request_indication]"); + goto end; + } + cJSON *request_indication_local_JSON = OpenAPI_request_indication_convertToJSON(hsmf_update_data->request_indication); + if (request_indication_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [request_indication]"); + goto end; + } + cJSON_AddItemToObject(item, "requestIndication", request_indication_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [request_indication]"); + goto end; + } + + if (hsmf_update_data->pei) { + if (cJSON_AddStringToObject(item, "pei", hsmf_update_data->pei) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [pei]"); + goto end; + } + } + + if (hsmf_update_data->vcn_tunnel_info) { + cJSON *vcn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(hsmf_update_data->vcn_tunnel_info); + if (vcn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [vcn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "vcnTunnelInfo", vcn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [vcn_tunnel_info]"); + goto end; + } + } + + if (hsmf_update_data->icn_tunnel_info) { + cJSON *icn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(hsmf_update_data->icn_tunnel_info); + if (icn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [icn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "icnTunnelInfo", icn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [icn_tunnel_info]"); + goto end; + } + } + + if (hsmf_update_data->additional_cn_tunnel_info) { + cJSON *additional_cn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(hsmf_update_data->additional_cn_tunnel_info); + if (additional_cn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [additional_cn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "additionalCnTunnelInfo", additional_cn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [additional_cn_tunnel_info]"); + goto end; + } + } + + if (hsmf_update_data->serving_network) { + cJSON *serving_network_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(hsmf_update_data->serving_network); + if (serving_network_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [serving_network]"); + goto end; + } + cJSON_AddItemToObject(item, "servingNetwork", serving_network_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [serving_network]"); + goto end; + } + } + + if (hsmf_update_data->an_type) { + if (cJSON_AddStringToObject(item, "anType", OpenAPI_access_type_ToString(hsmf_update_data->an_type)) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [an_type]"); + goto end; + } + } + + if (hsmf_update_data->additional_an_type) { + if (cJSON_AddStringToObject(item, "additionalAnType", OpenAPI_access_type_ToString(hsmf_update_data->additional_an_type)) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [additional_an_type]"); + goto end; + } + } + + if (hsmf_update_data->rat_type) { + if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(hsmf_update_data->rat_type)) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [rat_type]"); + goto end; + } + } + + if (hsmf_update_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(hsmf_update_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + + if (hsmf_update_data->ue_time_zone) { + if (cJSON_AddStringToObject(item, "ueTimeZone", hsmf_update_data->ue_time_zone) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ue_time_zone]"); + goto end; + } + } + + if (hsmf_update_data->add_ue_location) { + cJSON *add_ue_location_local_JSON = OpenAPI_user_location_convertToJSON(hsmf_update_data->add_ue_location); + if (add_ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "addUeLocation", add_ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + } + + if (hsmf_update_data->pause_charging) { + if (cJSON_AddBoolToObject(item, "pauseCharging", hsmf_update_data->pause_charging) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [pause_charging]"); + goto end; + } + } + + if (hsmf_update_data->pti) { + if (cJSON_AddNumberToObject(item, "pti", hsmf_update_data->pti) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [pti]"); + goto end; + } + } + + if (hsmf_update_data->n1_sm_info_from_ue) { + cJSON *n1_sm_info_from_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(hsmf_update_data->n1_sm_info_from_ue); + if (n1_sm_info_from_ue_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [n1_sm_info_from_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoFromUe", n1_sm_info_from_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [n1_sm_info_from_ue]"); + goto end; + } + } + + if (hsmf_update_data->unknown_n1_sm_info) { + cJSON *unknown_n1_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(hsmf_update_data->unknown_n1_sm_info); + if (unknown_n1_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [unknown_n1_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "unknownN1SmInfo", unknown_n1_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [unknown_n1_sm_info]"); + goto end; + } + } + + if (hsmf_update_data->qos_flows_rel_notify_list) { + cJSON *qos_flows_rel_notify_listList = cJSON_AddArrayToObject(item, "qosFlowsRelNotifyList"); + if (qos_flows_rel_notify_listList == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [qos_flows_rel_notify_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_rel_notify_list_node; + if (hsmf_update_data->qos_flows_rel_notify_list) { + OpenAPI_list_for_each(hsmf_update_data->qos_flows_rel_notify_list, qos_flows_rel_notify_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_item_convertToJSON(qos_flows_rel_notify_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [qos_flows_rel_notify_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_rel_notify_listList, itemLocal); + } + } + } + + if (hsmf_update_data->qos_flows_notify_list) { + cJSON *qos_flows_notify_listList = cJSON_AddArrayToObject(item, "qosFlowsNotifyList"); + if (qos_flows_notify_listList == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [qos_flows_notify_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_notify_list_node; + if (hsmf_update_data->qos_flows_notify_list) { + OpenAPI_list_for_each(hsmf_update_data->qos_flows_notify_list, qos_flows_notify_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_notify_item_convertToJSON(qos_flows_notify_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [qos_flows_notify_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_notify_listList, itemLocal); + } + } + } + + if (hsmf_update_data->notify_list) { + cJSON *notify_listList = cJSON_AddArrayToObject(item, "NotifyList"); + if (notify_listList == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [notify_list]"); + goto end; + } + + OpenAPI_lnode_t *notify_list_node; + if (hsmf_update_data->notify_list) { + OpenAPI_list_for_each(hsmf_update_data->notify_list, notify_list_node) { + cJSON *itemLocal = OpenAPI_pdu_session_notify_item_convertToJSON(notify_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [notify_list]"); + goto end; + } + cJSON_AddItemToArray(notify_listList, itemLocal); + } + } + } + + if (hsmf_update_data->eps_bearer_id) { + cJSON *eps_bearer_id = cJSON_AddArrayToObject(item, "epsBearerId"); + if (eps_bearer_id == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [eps_bearer_id]"); + goto end; + } + + OpenAPI_lnode_t *eps_bearer_id_node; + OpenAPI_list_for_each(hsmf_update_data->eps_bearer_id, eps_bearer_id_node) { + if (cJSON_AddNumberToObject(eps_bearer_id, "", *(double *)eps_bearer_id_node->data) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [eps_bearer_id]"); + goto end; + } + } + } + + if (hsmf_update_data->ho_preparation_indication) { + if (cJSON_AddBoolToObject(item, "hoPreparationIndication", hsmf_update_data->ho_preparation_indication) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ho_preparation_indication]"); + goto end; + } + } + + if (hsmf_update_data->revoke_ebi_list) { + cJSON *revoke_ebi_list = cJSON_AddArrayToObject(item, "revokeEbiList"); + if (revoke_ebi_list == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [revoke_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *revoke_ebi_list_node; + OpenAPI_list_for_each(hsmf_update_data->revoke_ebi_list, revoke_ebi_list_node) { + if (cJSON_AddNumberToObject(revoke_ebi_list, "", *(double *)revoke_ebi_list_node->data) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [revoke_ebi_list]"); + goto end; + } + } + } + + if (hsmf_update_data->cause) { + cJSON *cause_local_JSON = OpenAPI_cause_convertToJSON(hsmf_update_data->cause); + if (cause_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [cause]"); + goto end; + } + cJSON_AddItemToObject(item, "cause", cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [cause]"); + goto end; + } + } + + if (hsmf_update_data->ng_ap_cause) { + cJSON *ng_ap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(hsmf_update_data->ng_ap_cause); + if (ng_ap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngApCause", ng_ap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + } + + if (hsmf_update_data->_5g_mm_cause_value) { + if (cJSON_AddNumberToObject(item, "5gMmCauseValue", hsmf_update_data->_5g_mm_cause_value) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + if (hsmf_update_data->always_on_requested) { + if (cJSON_AddBoolToObject(item, "alwaysOnRequested", hsmf_update_data->always_on_requested) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [always_on_requested]"); + goto end; + } + } + + if (hsmf_update_data->eps_interworking_ind) { + cJSON *eps_interworking_ind_local_JSON = OpenAPI_eps_interworking_indication_convertToJSON(hsmf_update_data->eps_interworking_ind); + if (eps_interworking_ind_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [eps_interworking_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "epsInterworkingInd", eps_interworking_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [eps_interworking_ind]"); + goto end; + } + } + + if (hsmf_update_data->secondary_rat_usage_report) { + cJSON *secondary_rat_usage_reportList = cJSON_AddArrayToObject(item, "secondaryRatUsageReport"); + if (secondary_rat_usage_reportList == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [secondary_rat_usage_report]"); + goto end; + } + + OpenAPI_lnode_t *secondary_rat_usage_report_node; + if (hsmf_update_data->secondary_rat_usage_report) { + OpenAPI_list_for_each(hsmf_update_data->secondary_rat_usage_report, secondary_rat_usage_report_node) { + cJSON *itemLocal = OpenAPI_secondary_rat_usage_report_convertToJSON(secondary_rat_usage_report_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [secondary_rat_usage_report]"); + goto end; + } + cJSON_AddItemToArray(secondary_rat_usage_reportList, itemLocal); + } + } + } + + if (hsmf_update_data->secondary_rat_usage_info) { + cJSON *secondary_rat_usage_infoList = cJSON_AddArrayToObject(item, "secondaryRatUsageInfo"); + if (secondary_rat_usage_infoList == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [secondary_rat_usage_info]"); + goto end; + } + + OpenAPI_lnode_t *secondary_rat_usage_info_node; + if (hsmf_update_data->secondary_rat_usage_info) { + OpenAPI_list_for_each(hsmf_update_data->secondary_rat_usage_info, secondary_rat_usage_info_node) { + cJSON *itemLocal = OpenAPI_secondary_rat_usage_info_convertToJSON(secondary_rat_usage_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [secondary_rat_usage_info]"); + goto end; + } + cJSON_AddItemToArray(secondary_rat_usage_infoList, itemLocal); + } + } + } + + if (hsmf_update_data->an_type_can_be_changed) { + if (cJSON_AddBoolToObject(item, "anTypeCanBeChanged", hsmf_update_data->an_type_can_be_changed) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [an_type_can_be_changed]"); + goto end; + } + } + + if (hsmf_update_data->ma_release_ind) { + cJSON *ma_release_ind_local_JSON = OpenAPI_ma_release_indication_convertToJSON(hsmf_update_data->ma_release_ind); + if (ma_release_ind_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ma_release_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "maReleaseInd", ma_release_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ma_release_ind]"); + goto end; + } + } + + if (hsmf_update_data->ma_nw_upgrade_ind) { + if (cJSON_AddBoolToObject(item, "maNwUpgradeInd", hsmf_update_data->ma_nw_upgrade_ind) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ma_nw_upgrade_ind]"); + goto end; + } + } + + if (hsmf_update_data->ma_request_ind) { + if (cJSON_AddBoolToObject(item, "maRequestInd", hsmf_update_data->ma_request_ind) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ma_request_ind]"); + goto end; + } + } + + if (hsmf_update_data->unavailable_access_ind) { + cJSON *unavailable_access_ind_local_JSON = OpenAPI_unavailable_access_indication_convertToJSON(hsmf_update_data->unavailable_access_ind); + if (unavailable_access_ind_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [unavailable_access_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "unavailableAccessInd", unavailable_access_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [unavailable_access_ind]"); + goto end; + } + } + + if (hsmf_update_data->psa_info) { + cJSON *psa_infoList = cJSON_AddArrayToObject(item, "psaInfo"); + if (psa_infoList == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [psa_info]"); + goto end; + } + + OpenAPI_lnode_t *psa_info_node; + if (hsmf_update_data->psa_info) { + OpenAPI_list_for_each(hsmf_update_data->psa_info, psa_info_node) { + cJSON *itemLocal = OpenAPI_psa_information_convertToJSON(psa_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [psa_info]"); + goto end; + } + cJSON_AddItemToArray(psa_infoList, itemLocal); + } + } + } + + if (hsmf_update_data->ulcl_bp_info) { + cJSON *ulcl_bp_info_local_JSON = OpenAPI_ulcl_bp_information_convertToJSON(hsmf_update_data->ulcl_bp_info); + if (ulcl_bp_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ulcl_bp_info]"); + goto end; + } + cJSON_AddItemToObject(item, "ulclBpInfo", ulcl_bp_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ulcl_bp_info]"); + goto end; + } + } + + if (hsmf_update_data->n4_info) { + cJSON *n4_info_local_JSON = OpenAPI_n4_information_convertToJSON(hsmf_update_data->n4_info); + if (n4_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [n4_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n4Info", n4_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [n4_info]"); + goto end; + } + } + + if (hsmf_update_data->n4_info_ext1) { + cJSON *n4_info_ext1_local_JSON = OpenAPI_n4_information_convertToJSON(hsmf_update_data->n4_info_ext1); + if (n4_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt1", n4_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + } + + if (hsmf_update_data->n4_info_ext2) { + cJSON *n4_info_ext2_local_JSON = OpenAPI_n4_information_convertToJSON(hsmf_update_data->n4_info_ext2); + if (n4_info_ext2_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt2", n4_info_ext2_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + } + + if (hsmf_update_data->presence_in_ladn) { + cJSON *presence_in_ladn_local_JSON = OpenAPI_presence_state_convertToJSON(hsmf_update_data->presence_in_ladn); + if (presence_in_ladn_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [presence_in_ladn]"); + goto end; + } + cJSON_AddItemToObject(item, "presenceInLadn", presence_in_ladn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [presence_in_ladn]"); + goto end; + } + } + + if (hsmf_update_data->vsmf_pdu_session_uri) { + if (cJSON_AddStringToObject(item, "vsmfPduSessionUri", hsmf_update_data->vsmf_pdu_session_uri) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [vsmf_pdu_session_uri]"); + goto end; + } + } + + if (hsmf_update_data->vsmf_id) { + if (cJSON_AddStringToObject(item, "vsmfId", hsmf_update_data->vsmf_id) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [vsmf_id]"); + goto end; + } + } + + if (hsmf_update_data->v_smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "vSmfServiceInstanceId", hsmf_update_data->v_smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [v_smf_service_instance_id]"); + goto end; + } + } + + if (hsmf_update_data->ismf_pdu_session_uri) { + if (cJSON_AddStringToObject(item, "ismfPduSessionUri", hsmf_update_data->ismf_pdu_session_uri) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ismf_pdu_session_uri]"); + goto end; + } + } + + if (hsmf_update_data->ismf_id) { + if (cJSON_AddStringToObject(item, "ismfId", hsmf_update_data->ismf_id) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [ismf_id]"); + goto end; + } + } + + if (hsmf_update_data->i_smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "iSmfServiceInstanceId", hsmf_update_data->i_smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [i_smf_service_instance_id]"); + goto end; + } + } + + if (hsmf_update_data->dl_serving_plmn_rate_ctl) { + if (cJSON_AddNumberToObject(item, "dlServingPlmnRateCtl", hsmf_update_data->dl_serving_plmn_rate_ctl) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [dl_serving_plmn_rate_ctl]"); + goto end; + } + } + + if (hsmf_update_data->dnai_list) { + cJSON *dnai_list = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_list == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [dnai_list]"); + goto end; + } + + OpenAPI_lnode_t *dnai_list_node; + OpenAPI_list_for_each(hsmf_update_data->dnai_list, dnai_list_node) { + if (cJSON_AddStringToObject(dnai_list, "", (char*)dnai_list_node->data) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (hsmf_update_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", hsmf_update_data->supported_features) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (hsmf_update_data->roaming_charging_profile) { + cJSON *roaming_charging_profile_local_JSON = OpenAPI_roaming_charging_profile_convertToJSON(hsmf_update_data->roaming_charging_profile); + if (roaming_charging_profile_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "roamingChargingProfile", roaming_charging_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + } + + if (hsmf_update_data->mo_exp_data_ind) { + cJSON *mo_exp_data_ind_local_JSON = OpenAPI_mo_exception_data_flag_convertToJSON(hsmf_update_data->mo_exp_data_ind); + if (mo_exp_data_ind_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [mo_exp_data_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataInd", mo_exp_data_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [mo_exp_data_ind]"); + goto end; + } + } + + if (hsmf_update_data->mo_exp_data_counter) { + cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(hsmf_update_data->mo_exp_data_counter); + if (mo_exp_data_counter_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataCounter", mo_exp_data_counter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + } + + if (hsmf_update_data->vplmn_qos) { + cJSON *vplmn_qos_local_JSON = OpenAPI_vplmn_qos_convertToJSON(hsmf_update_data->vplmn_qos); + if (vplmn_qos_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [vplmn_qos]"); + goto end; + } + cJSON_AddItemToObject(item, "vplmnQos", vplmn_qos_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [vplmn_qos]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_update_dataJSON) +{ + OpenAPI_hsmf_update_data_t *hsmf_update_data_local_var = NULL; + cJSON *request_indication = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "requestIndication"); + if (!request_indication) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [request_indication]"); + goto end; + } + + OpenAPI_request_indication_t *request_indication_local_nonprim = NULL; + + request_indication_local_nonprim = OpenAPI_request_indication_parseFromJSON(request_indication); + + cJSON *pei = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "pei"); + + if (pei) { + if (!cJSON_IsString(pei)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [pei]"); + goto end; + } + } + + cJSON *vcn_tunnel_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "vcnTunnelInfo"); + + OpenAPI_tunnel_info_t *vcn_tunnel_info_local_nonprim = NULL; + if (vcn_tunnel_info) { + vcn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(vcn_tunnel_info); + } + + cJSON *icn_tunnel_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "icnTunnelInfo"); + + OpenAPI_tunnel_info_t *icn_tunnel_info_local_nonprim = NULL; + if (icn_tunnel_info) { + icn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(icn_tunnel_info); + } + + cJSON *additional_cn_tunnel_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "additionalCnTunnelInfo"); + + OpenAPI_tunnel_info_t *additional_cn_tunnel_info_local_nonprim = NULL; + if (additional_cn_tunnel_info) { + additional_cn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(additional_cn_tunnel_info); + } + + cJSON *serving_network = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "servingNetwork"); + + OpenAPI_plmn_id_nid_t *serving_network_local_nonprim = NULL; + if (serving_network) { + serving_network_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(serving_network); + } + + cJSON *an_type = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "anType"); + + OpenAPI_access_type_e an_typeVariable; + if (an_type) { + if (!cJSON_IsString(an_type)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [an_type]"); + goto end; + } + an_typeVariable = OpenAPI_access_type_FromString(an_type->valuestring); + } + + cJSON *additional_an_type = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "additionalAnType"); + + OpenAPI_access_type_e additional_an_typeVariable; + if (additional_an_type) { + if (!cJSON_IsString(additional_an_type)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [additional_an_type]"); + goto end; + } + additional_an_typeVariable = OpenAPI_access_type_FromString(additional_an_type->valuestring); + } + + cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "ratType"); + + OpenAPI_rat_type_e rat_typeVariable; + if (rat_type) { + if (!cJSON_IsString(rat_type)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [rat_type]"); + goto end; + } + rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "ueTimeZone"); + + if (ue_time_zone) { + if (!cJSON_IsString(ue_time_zone)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [ue_time_zone]"); + goto end; + } + } + + cJSON *add_ue_location = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "addUeLocation"); + + OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL; + if (add_ue_location) { + add_ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(add_ue_location); + } + + cJSON *pause_charging = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "pauseCharging"); + + if (pause_charging) { + if (!cJSON_IsBool(pause_charging)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [pause_charging]"); + goto end; + } + } + + cJSON *pti = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "pti"); + + if (pti) { + if (!cJSON_IsNumber(pti)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [pti]"); + goto end; + } + } + + cJSON *n1_sm_info_from_ue = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "n1SmInfoFromUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue_local_nonprim = NULL; + if (n1_sm_info_from_ue) { + n1_sm_info_from_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_from_ue); + } + + cJSON *unknown_n1_sm_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "unknownN1SmInfo"); + + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info_local_nonprim = NULL; + if (unknown_n1_sm_info) { + unknown_n1_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(unknown_n1_sm_info); + } + + cJSON *qos_flows_rel_notify_list = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "qosFlowsRelNotifyList"); + + OpenAPI_list_t *qos_flows_rel_notify_listList; + if (qos_flows_rel_notify_list) { + cJSON *qos_flows_rel_notify_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_rel_notify_list)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [qos_flows_rel_notify_list]"); + goto end; + } + + qos_flows_rel_notify_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_rel_notify_list_local_nonprimitive, qos_flows_rel_notify_list ) { + if (!cJSON_IsObject(qos_flows_rel_notify_list_local_nonprimitive)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [qos_flows_rel_notify_list]"); + goto end; + } + OpenAPI_qos_flow_item_t *qos_flows_rel_notify_listItem = OpenAPI_qos_flow_item_parseFromJSON(qos_flows_rel_notify_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_rel_notify_listList, qos_flows_rel_notify_listItem); + } + } + + cJSON *qos_flows_notify_list = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "qosFlowsNotifyList"); + + OpenAPI_list_t *qos_flows_notify_listList; + if (qos_flows_notify_list) { + cJSON *qos_flows_notify_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_notify_list)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [qos_flows_notify_list]"); + goto end; + } + + qos_flows_notify_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_notify_list_local_nonprimitive, qos_flows_notify_list ) { + if (!cJSON_IsObject(qos_flows_notify_list_local_nonprimitive)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [qos_flows_notify_list]"); + goto end; + } + OpenAPI_qos_flow_notify_item_t *qos_flows_notify_listItem = OpenAPI_qos_flow_notify_item_parseFromJSON(qos_flows_notify_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_notify_listList, qos_flows_notify_listItem); + } + } + + cJSON *notify_list = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "NotifyList"); + + OpenAPI_list_t *notify_listList; + if (notify_list) { + cJSON *notify_list_local_nonprimitive; + if (!cJSON_IsArray(notify_list)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [notify_list]"); + goto end; + } + + notify_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(notify_list_local_nonprimitive, notify_list ) { + if (!cJSON_IsObject(notify_list_local_nonprimitive)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [notify_list]"); + goto end; + } + OpenAPI_pdu_session_notify_item_t *notify_listItem = OpenAPI_pdu_session_notify_item_parseFromJSON(notify_list_local_nonprimitive); + + OpenAPI_list_add(notify_listList, notify_listItem); + } + } + + cJSON *eps_bearer_id = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "epsBearerId"); + + OpenAPI_list_t *eps_bearer_idList; + if (eps_bearer_id) { + cJSON *eps_bearer_id_local; + if (!cJSON_IsArray(eps_bearer_id)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [eps_bearer_id]"); + goto end; + } + eps_bearer_idList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eps_bearer_id_local, eps_bearer_id) { + if (!cJSON_IsNumber(eps_bearer_id_local)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [eps_bearer_id]"); + goto end; + } + OpenAPI_list_add(eps_bearer_idList, &eps_bearer_id_local->valuedouble); + } + } + + cJSON *ho_preparation_indication = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "hoPreparationIndication"); + + if (ho_preparation_indication) { + if (!cJSON_IsBool(ho_preparation_indication)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [ho_preparation_indication]"); + goto end; + } + } + + cJSON *revoke_ebi_list = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "revokeEbiList"); + + OpenAPI_list_t *revoke_ebi_listList; + if (revoke_ebi_list) { + cJSON *revoke_ebi_list_local; + if (!cJSON_IsArray(revoke_ebi_list)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [revoke_ebi_list]"); + goto end; + } + revoke_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(revoke_ebi_list_local, revoke_ebi_list) { + if (!cJSON_IsNumber(revoke_ebi_list_local)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [revoke_ebi_list]"); + goto end; + } + OpenAPI_list_add(revoke_ebi_listList, &revoke_ebi_list_local->valuedouble); + } + } + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "cause"); + + OpenAPI_cause_t *cause_local_nonprim = NULL; + if (cause) { + cause_local_nonprim = OpenAPI_cause_parseFromJSON(cause); + } + + cJSON *ng_ap_cause = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "ngApCause"); + + OpenAPI_ng_ap_cause_t *ng_ap_cause_local_nonprim = NULL; + if (ng_ap_cause) { + ng_ap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ng_ap_cause); + } + + cJSON *_5g_mm_cause_value = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "5gMmCauseValue"); + + if (_5g_mm_cause_value) { + if (!cJSON_IsNumber(_5g_mm_cause_value)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + cJSON *always_on_requested = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "alwaysOnRequested"); + + if (always_on_requested) { + if (!cJSON_IsBool(always_on_requested)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [always_on_requested]"); + goto end; + } + } + + cJSON *eps_interworking_ind = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "epsInterworkingInd"); + + OpenAPI_eps_interworking_indication_t *eps_interworking_ind_local_nonprim = NULL; + if (eps_interworking_ind) { + eps_interworking_ind_local_nonprim = OpenAPI_eps_interworking_indication_parseFromJSON(eps_interworking_ind); + } + + cJSON *secondary_rat_usage_report = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "secondaryRatUsageReport"); + + OpenAPI_list_t *secondary_rat_usage_reportList; + if (secondary_rat_usage_report) { + cJSON *secondary_rat_usage_report_local_nonprimitive; + if (!cJSON_IsArray(secondary_rat_usage_report)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [secondary_rat_usage_report]"); + goto end; + } + + secondary_rat_usage_reportList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_report_local_nonprimitive, secondary_rat_usage_report ) { + if (!cJSON_IsObject(secondary_rat_usage_report_local_nonprimitive)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [secondary_rat_usage_report]"); + goto end; + } + OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_reportItem = OpenAPI_secondary_rat_usage_report_parseFromJSON(secondary_rat_usage_report_local_nonprimitive); + + OpenAPI_list_add(secondary_rat_usage_reportList, secondary_rat_usage_reportItem); + } + } + + cJSON *secondary_rat_usage_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "secondaryRatUsageInfo"); + + OpenAPI_list_t *secondary_rat_usage_infoList; + if (secondary_rat_usage_info) { + cJSON *secondary_rat_usage_info_local_nonprimitive; + if (!cJSON_IsArray(secondary_rat_usage_info)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [secondary_rat_usage_info]"); + goto end; + } + + secondary_rat_usage_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_info_local_nonprimitive, secondary_rat_usage_info ) { + if (!cJSON_IsObject(secondary_rat_usage_info_local_nonprimitive)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [secondary_rat_usage_info]"); + goto end; + } + OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_infoItem = OpenAPI_secondary_rat_usage_info_parseFromJSON(secondary_rat_usage_info_local_nonprimitive); + + OpenAPI_list_add(secondary_rat_usage_infoList, secondary_rat_usage_infoItem); + } + } + + cJSON *an_type_can_be_changed = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "anTypeCanBeChanged"); + + if (an_type_can_be_changed) { + if (!cJSON_IsBool(an_type_can_be_changed)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [an_type_can_be_changed]"); + goto end; + } + } + + cJSON *ma_release_ind = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "maReleaseInd"); + + OpenAPI_ma_release_indication_t *ma_release_ind_local_nonprim = NULL; + if (ma_release_ind) { + ma_release_ind_local_nonprim = OpenAPI_ma_release_indication_parseFromJSON(ma_release_ind); + } + + cJSON *ma_nw_upgrade_ind = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "maNwUpgradeInd"); + + if (ma_nw_upgrade_ind) { + if (!cJSON_IsBool(ma_nw_upgrade_ind)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [ma_nw_upgrade_ind]"); + goto end; + } + } + + cJSON *ma_request_ind = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "maRequestInd"); + + if (ma_request_ind) { + if (!cJSON_IsBool(ma_request_ind)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [ma_request_ind]"); + goto end; + } + } + + cJSON *unavailable_access_ind = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "unavailableAccessInd"); + + OpenAPI_unavailable_access_indication_t *unavailable_access_ind_local_nonprim = NULL; + if (unavailable_access_ind) { + unavailable_access_ind_local_nonprim = OpenAPI_unavailable_access_indication_parseFromJSON(unavailable_access_ind); + } + + cJSON *psa_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "psaInfo"); + + OpenAPI_list_t *psa_infoList; + if (psa_info) { + cJSON *psa_info_local_nonprimitive; + if (!cJSON_IsArray(psa_info)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [psa_info]"); + goto end; + } + + psa_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(psa_info_local_nonprimitive, psa_info ) { + if (!cJSON_IsObject(psa_info_local_nonprimitive)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [psa_info]"); + goto end; + } + OpenAPI_psa_information_t *psa_infoItem = OpenAPI_psa_information_parseFromJSON(psa_info_local_nonprimitive); + + OpenAPI_list_add(psa_infoList, psa_infoItem); + } + } + + cJSON *ulcl_bp_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "ulclBpInfo"); + + OpenAPI_ulcl_bp_information_t *ulcl_bp_info_local_nonprim = NULL; + if (ulcl_bp_info) { + ulcl_bp_info_local_nonprim = OpenAPI_ulcl_bp_information_parseFromJSON(ulcl_bp_info); + } + + cJSON *n4_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "n4Info"); + + OpenAPI_n4_information_t *n4_info_local_nonprim = NULL; + if (n4_info) { + n4_info_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info); + } + + cJSON *n4_info_ext1 = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "n4InfoExt1"); + + OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; + if (n4_info_ext1) { + n4_info_ext1_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext1); + } + + cJSON *n4_info_ext2 = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "n4InfoExt2"); + + OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + if (n4_info_ext2) { + n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); + } + + cJSON *presence_in_ladn = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "presenceInLadn"); + + OpenAPI_presence_state_t *presence_in_ladn_local_nonprim = NULL; + if (presence_in_ladn) { + presence_in_ladn_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_in_ladn); + } + + cJSON *vsmf_pdu_session_uri = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "vsmfPduSessionUri"); + + if (vsmf_pdu_session_uri) { + if (!cJSON_IsString(vsmf_pdu_session_uri)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [vsmf_pdu_session_uri]"); + goto end; + } + } + + cJSON *vsmf_id = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "vsmfId"); + + if (vsmf_id) { + if (!cJSON_IsString(vsmf_id)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [vsmf_id]"); + goto end; + } + } + + cJSON *v_smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "vSmfServiceInstanceId"); + + if (v_smf_service_instance_id) { + if (!cJSON_IsString(v_smf_service_instance_id)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [v_smf_service_instance_id]"); + goto end; + } + } + + cJSON *ismf_pdu_session_uri = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "ismfPduSessionUri"); + + if (ismf_pdu_session_uri) { + if (!cJSON_IsString(ismf_pdu_session_uri)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [ismf_pdu_session_uri]"); + goto end; + } + } + + cJSON *ismf_id = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "ismfId"); + + if (ismf_id) { + if (!cJSON_IsString(ismf_id)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [ismf_id]"); + goto end; + } + } + + cJSON *i_smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "iSmfServiceInstanceId"); + + if (i_smf_service_instance_id) { + if (!cJSON_IsString(i_smf_service_instance_id)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [i_smf_service_instance_id]"); + goto end; + } + } + + cJSON *dl_serving_plmn_rate_ctl = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "dlServingPlmnRateCtl"); + + if (dl_serving_plmn_rate_ctl) { + if (!cJSON_IsNumber(dl_serving_plmn_rate_ctl)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [dl_serving_plmn_rate_ctl]"); + goto end; + } + } + + cJSON *dnai_list = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "dnaiList"); + + OpenAPI_list_t *dnai_listList; + if (dnai_list) { + cJSON *dnai_list_local; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *roaming_charging_profile = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "roamingChargingProfile"); + + OpenAPI_roaming_charging_profile_t *roaming_charging_profile_local_nonprim = NULL; + if (roaming_charging_profile) { + roaming_charging_profile_local_nonprim = OpenAPI_roaming_charging_profile_parseFromJSON(roaming_charging_profile); + } + + cJSON *mo_exp_data_ind = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "moExpDataInd"); + + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind_local_nonprim = NULL; + if (mo_exp_data_ind) { + mo_exp_data_ind_local_nonprim = OpenAPI_mo_exception_data_flag_parseFromJSON(mo_exp_data_ind); + } + + cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "moExpDataCounter"); + + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; + if (mo_exp_data_counter) { + mo_exp_data_counter_local_nonprim = OpenAPI_mo_exp_data_counter_parseFromJSON(mo_exp_data_counter); + } + + cJSON *vplmn_qos = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "vplmnQos"); + + OpenAPI_vplmn_qos_t *vplmn_qos_local_nonprim = NULL; + if (vplmn_qos) { + vplmn_qos_local_nonprim = OpenAPI_vplmn_qos_parseFromJSON(vplmn_qos); + } + + hsmf_update_data_local_var = OpenAPI_hsmf_update_data_create ( + request_indication_local_nonprim, + pei ? ogs_strdup(pei->valuestring) : NULL, + vcn_tunnel_info ? vcn_tunnel_info_local_nonprim : NULL, + icn_tunnel_info ? icn_tunnel_info_local_nonprim : NULL, + additional_cn_tunnel_info ? additional_cn_tunnel_info_local_nonprim : NULL, + serving_network ? serving_network_local_nonprim : NULL, + an_type ? an_typeVariable : 0, + additional_an_type ? additional_an_typeVariable : 0, + rat_type ? rat_typeVariable : 0, + ue_location ? ue_location_local_nonprim : NULL, + ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL, + add_ue_location ? add_ue_location_local_nonprim : NULL, + pause_charging ? pause_charging->valueint : 0, + pti ? pti->valuedouble : 0, + n1_sm_info_from_ue ? n1_sm_info_from_ue_local_nonprim : NULL, + unknown_n1_sm_info ? unknown_n1_sm_info_local_nonprim : NULL, + qos_flows_rel_notify_list ? qos_flows_rel_notify_listList : NULL, + qos_flows_notify_list ? qos_flows_notify_listList : NULL, + notify_list ? notify_listList : NULL, + eps_bearer_id ? eps_bearer_idList : NULL, + ho_preparation_indication ? ho_preparation_indication->valueint : 0, + revoke_ebi_list ? revoke_ebi_listList : NULL, + cause ? cause_local_nonprim : NULL, + ng_ap_cause ? ng_ap_cause_local_nonprim : NULL, + _5g_mm_cause_value ? _5g_mm_cause_value->valuedouble : 0, + always_on_requested ? always_on_requested->valueint : 0, + eps_interworking_ind ? eps_interworking_ind_local_nonprim : NULL, + secondary_rat_usage_report ? secondary_rat_usage_reportList : NULL, + secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL, + an_type_can_be_changed ? an_type_can_be_changed->valueint : 0, + ma_release_ind ? ma_release_ind_local_nonprim : NULL, + ma_nw_upgrade_ind ? ma_nw_upgrade_ind->valueint : 0, + ma_request_ind ? ma_request_ind->valueint : 0, + unavailable_access_ind ? unavailable_access_ind_local_nonprim : NULL, + psa_info ? psa_infoList : NULL, + ulcl_bp_info ? ulcl_bp_info_local_nonprim : NULL, + n4_info ? n4_info_local_nonprim : NULL, + n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL, + presence_in_ladn ? presence_in_ladn_local_nonprim : NULL, + vsmf_pdu_session_uri ? ogs_strdup(vsmf_pdu_session_uri->valuestring) : NULL, + vsmf_id ? ogs_strdup(vsmf_id->valuestring) : NULL, + v_smf_service_instance_id ? ogs_strdup(v_smf_service_instance_id->valuestring) : NULL, + ismf_pdu_session_uri ? ogs_strdup(ismf_pdu_session_uri->valuestring) : NULL, + ismf_id ? ogs_strdup(ismf_id->valuestring) : NULL, + i_smf_service_instance_id ? ogs_strdup(i_smf_service_instance_id->valuestring) : NULL, + dl_serving_plmn_rate_ctl ? dl_serving_plmn_rate_ctl->valuedouble : 0, + dnai_list ? dnai_listList : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, + mo_exp_data_ind ? mo_exp_data_ind_local_nonprim : NULL, + mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, + vplmn_qos ? vplmn_qos_local_nonprim : NULL + ); + + return hsmf_update_data_local_var; +end: + return NULL; +} + +OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_copy(OpenAPI_hsmf_update_data_t *dst, OpenAPI_hsmf_update_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hsmf_update_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hsmf_update_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_hsmf_update_data_free(dst); + dst = OpenAPI_hsmf_update_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hsmf_update_data.h b/lib/sbi/openapi/model/hsmf_update_data.h new file mode 100644 index 000000000..e595b1c9b --- /dev/null +++ b/lib/sbi/openapi/model/hsmf_update_data.h @@ -0,0 +1,167 @@ +/* + * hsmf_update_data.h + * + * + */ + +#ifndef _OpenAPI_hsmf_update_data_H_ +#define _OpenAPI_hsmf_update_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "cause.h" +#include "eps_interworking_indication.h" +#include "ma_release_indication.h" +#include "mo_exception_data_flag.h" +#include "mo_exp_data_counter.h" +#include "n4_information.h" +#include "ng_ap_cause.h" +#include "pdu_session_notify_item.h" +#include "plmn_id_nid.h" +#include "presence_state.h" +#include "psa_information.h" +#include "qos_flow_item.h" +#include "qos_flow_notify_item.h" +#include "rat_type.h" +#include "ref_to_binary_data.h" +#include "request_indication.h" +#include "roaming_charging_profile.h" +#include "secondary_rat_usage_info.h" +#include "secondary_rat_usage_report.h" +#include "tunnel_info.h" +#include "ulcl_bp_information.h" +#include "unavailable_access_indication.h" +#include "user_location.h" +#include "vplmn_qos.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_hsmf_update_data_s OpenAPI_hsmf_update_data_t; +typedef struct OpenAPI_hsmf_update_data_s { + struct OpenAPI_request_indication_s *request_indication; + char *pei; + struct OpenAPI_tunnel_info_s *vcn_tunnel_info; + struct OpenAPI_tunnel_info_s *icn_tunnel_info; + struct OpenAPI_tunnel_info_s *additional_cn_tunnel_info; + struct OpenAPI_plmn_id_nid_s *serving_network; + OpenAPI_access_type_e an_type; + OpenAPI_access_type_e additional_an_type; + OpenAPI_rat_type_e rat_type; + struct OpenAPI_user_location_s *ue_location; + char *ue_time_zone; + struct OpenAPI_user_location_s *add_ue_location; + int pause_charging; + int pti; + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_from_ue; + struct OpenAPI_ref_to_binary_data_s *unknown_n1_sm_info; + OpenAPI_list_t *qos_flows_rel_notify_list; + OpenAPI_list_t *qos_flows_notify_list; + OpenAPI_list_t *notify_list; + OpenAPI_list_t *eps_bearer_id; + int ho_preparation_indication; + OpenAPI_list_t *revoke_ebi_list; + struct OpenAPI_cause_s *cause; + struct OpenAPI_ng_ap_cause_s *ng_ap_cause; + int _5g_mm_cause_value; + int always_on_requested; + struct OpenAPI_eps_interworking_indication_s *eps_interworking_ind; + OpenAPI_list_t *secondary_rat_usage_report; + OpenAPI_list_t *secondary_rat_usage_info; + int an_type_can_be_changed; + struct OpenAPI_ma_release_indication_s *ma_release_ind; + int ma_nw_upgrade_ind; + int ma_request_ind; + struct OpenAPI_unavailable_access_indication_s *unavailable_access_ind; + OpenAPI_list_t *psa_info; + struct OpenAPI_ulcl_bp_information_s *ulcl_bp_info; + struct OpenAPI_n4_information_s *n4_info; + struct OpenAPI_n4_information_s *n4_info_ext1; + struct OpenAPI_n4_information_s *n4_info_ext2; + struct OpenAPI_presence_state_s *presence_in_ladn; + char *vsmf_pdu_session_uri; + char *vsmf_id; + char *v_smf_service_instance_id; + char *ismf_pdu_session_uri; + char *ismf_id; + char *i_smf_service_instance_id; + int dl_serving_plmn_rate_ctl; + OpenAPI_list_t *dnai_list; + char *supported_features; + struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; + struct OpenAPI_mo_exception_data_flag_s *mo_exp_data_ind; + struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; + struct OpenAPI_vplmn_qos_s *vplmn_qos; +} OpenAPI_hsmf_update_data_t; + +OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( + OpenAPI_request_indication_t *request_indication, + char *pei, + OpenAPI_tunnel_info_t *vcn_tunnel_info, + OpenAPI_tunnel_info_t *icn_tunnel_info, + OpenAPI_tunnel_info_t *additional_cn_tunnel_info, + OpenAPI_plmn_id_nid_t *serving_network, + OpenAPI_access_type_e an_type, + OpenAPI_access_type_e additional_an_type, + OpenAPI_rat_type_e rat_type, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + int pause_charging, + int pti, + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue, + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info, + OpenAPI_list_t *qos_flows_rel_notify_list, + OpenAPI_list_t *qos_flows_notify_list, + OpenAPI_list_t *notify_list, + OpenAPI_list_t *eps_bearer_id, + int ho_preparation_indication, + OpenAPI_list_t *revoke_ebi_list, + OpenAPI_cause_t *cause, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + int always_on_requested, + OpenAPI_eps_interworking_indication_t *eps_interworking_ind, + OpenAPI_list_t *secondary_rat_usage_report, + OpenAPI_list_t *secondary_rat_usage_info, + int an_type_can_be_changed, + OpenAPI_ma_release_indication_t *ma_release_ind, + int ma_nw_upgrade_ind, + int ma_request_ind, + OpenAPI_unavailable_access_indication_t *unavailable_access_ind, + OpenAPI_list_t *psa_info, + OpenAPI_ulcl_bp_information_t *ulcl_bp_info, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_presence_state_t *presence_in_ladn, + char *vsmf_pdu_session_uri, + char *vsmf_id, + char *v_smf_service_instance_id, + char *ismf_pdu_session_uri, + char *ismf_id, + char *i_smf_service_instance_id, + int dl_serving_plmn_rate_ctl, + OpenAPI_list_t *dnai_list, + char *supported_features, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, + OpenAPI_vplmn_qos_t *vplmn_qos + ); +void OpenAPI_hsmf_update_data_free(OpenAPI_hsmf_update_data_t *hsmf_update_data); +OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_update_dataJSON); +cJSON *OpenAPI_hsmf_update_data_convertToJSON(OpenAPI_hsmf_update_data_t *hsmf_update_data); +OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_copy(OpenAPI_hsmf_update_data_t *dst, OpenAPI_hsmf_update_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_hsmf_update_data_H_ */ + diff --git a/lib/sbi/openapi/model/hsmf_update_error.c b/lib/sbi/openapi/model/hsmf_update_error.c new file mode 100644 index 000000000..b6b8483ad --- /dev/null +++ b/lib/sbi/openapi/model/hsmf_update_error.c @@ -0,0 +1,216 @@ + +#include +#include +#include +#include "hsmf_update_error.h" + +OpenAPI_hsmf_update_error_t *OpenAPI_hsmf_update_error_create( + OpenAPI_problem_details_t *error, + int pti, + char *n1sm_cause, + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + int back_off_timer, + char *recovery_time + ) +{ + OpenAPI_hsmf_update_error_t *hsmf_update_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_hsmf_update_error_t)); + if (!hsmf_update_error_local_var) { + return NULL; + } + hsmf_update_error_local_var->error = error; + hsmf_update_error_local_var->pti = pti; + hsmf_update_error_local_var->n1sm_cause = n1sm_cause; + hsmf_update_error_local_var->n1_sm_info_to_ue = n1_sm_info_to_ue; + hsmf_update_error_local_var->back_off_timer = back_off_timer; + hsmf_update_error_local_var->recovery_time = recovery_time; + + return hsmf_update_error_local_var; +} + +void OpenAPI_hsmf_update_error_free(OpenAPI_hsmf_update_error_t *hsmf_update_error) +{ + if (NULL == hsmf_update_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(hsmf_update_error->error); + ogs_free(hsmf_update_error->n1sm_cause); + OpenAPI_ref_to_binary_data_free(hsmf_update_error->n1_sm_info_to_ue); + ogs_free(hsmf_update_error->recovery_time); + ogs_free(hsmf_update_error); +} + +cJSON *OpenAPI_hsmf_update_error_convertToJSON(OpenAPI_hsmf_update_error_t *hsmf_update_error) +{ + cJSON *item = NULL; + + if (hsmf_update_error == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [HsmfUpdateError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!hsmf_update_error->error) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(hsmf_update_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [error]"); + goto end; + } + + if (hsmf_update_error->pti) { + if (cJSON_AddNumberToObject(item, "pti", hsmf_update_error->pti) == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [pti]"); + goto end; + } + } + + if (hsmf_update_error->n1sm_cause) { + if (cJSON_AddStringToObject(item, "n1smCause", hsmf_update_error->n1sm_cause) == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [n1sm_cause]"); + goto end; + } + } + + if (hsmf_update_error->n1_sm_info_to_ue) { + cJSON *n1_sm_info_to_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(hsmf_update_error->n1_sm_info_to_ue); + if (n1_sm_info_to_ue_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoToUe", n1_sm_info_to_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + } + + if (hsmf_update_error->back_off_timer) { + if (cJSON_AddNumberToObject(item, "backOffTimer", hsmf_update_error->back_off_timer) == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [back_off_timer]"); + goto end; + } + } + + if (hsmf_update_error->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", hsmf_update_error->recovery_time) == NULL) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed [recovery_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_hsmf_update_error_t *OpenAPI_hsmf_update_error_parseFromJSON(cJSON *hsmf_update_errorJSON) +{ + OpenAPI_hsmf_update_error_t *hsmf_update_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(hsmf_update_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_hsmf_update_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *pti = cJSON_GetObjectItemCaseSensitive(hsmf_update_errorJSON, "pti"); + + if (pti) { + if (!cJSON_IsNumber(pti)) { + ogs_error("OpenAPI_hsmf_update_error_parseFromJSON() failed [pti]"); + goto end; + } + } + + cJSON *n1sm_cause = cJSON_GetObjectItemCaseSensitive(hsmf_update_errorJSON, "n1smCause"); + + if (n1sm_cause) { + if (!cJSON_IsString(n1sm_cause)) { + ogs_error("OpenAPI_hsmf_update_error_parseFromJSON() failed [n1sm_cause]"); + goto end; + } + } + + cJSON *n1_sm_info_to_ue = cJSON_GetObjectItemCaseSensitive(hsmf_update_errorJSON, "n1SmInfoToUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue_local_nonprim = NULL; + if (n1_sm_info_to_ue) { + n1_sm_info_to_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_to_ue); + } + + cJSON *back_off_timer = cJSON_GetObjectItemCaseSensitive(hsmf_update_errorJSON, "backOffTimer"); + + if (back_off_timer) { + if (!cJSON_IsNumber(back_off_timer)) { + ogs_error("OpenAPI_hsmf_update_error_parseFromJSON() failed [back_off_timer]"); + goto end; + } + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(hsmf_update_errorJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_hsmf_update_error_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + hsmf_update_error_local_var = OpenAPI_hsmf_update_error_create ( + error_local_nonprim, + pti ? pti->valuedouble : 0, + n1sm_cause ? ogs_strdup(n1sm_cause->valuestring) : NULL, + n1_sm_info_to_ue ? n1_sm_info_to_ue_local_nonprim : NULL, + back_off_timer ? back_off_timer->valuedouble : 0, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL + ); + + return hsmf_update_error_local_var; +end: + return NULL; +} + +OpenAPI_hsmf_update_error_t *OpenAPI_hsmf_update_error_copy(OpenAPI_hsmf_update_error_t *dst, OpenAPI_hsmf_update_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hsmf_update_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hsmf_update_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_hsmf_update_error_free(dst); + dst = OpenAPI_hsmf_update_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hsmf_update_error.h b/lib/sbi/openapi/model/hsmf_update_error.h new file mode 100644 index 000000000..d49e10904 --- /dev/null +++ b/lib/sbi/openapi/model/hsmf_update_error.h @@ -0,0 +1,50 @@ +/* + * hsmf_update_error.h + * + * + */ + +#ifndef _OpenAPI_hsmf_update_error_H_ +#define _OpenAPI_hsmf_update_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "problem_details.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_hsmf_update_error_s OpenAPI_hsmf_update_error_t; +typedef struct OpenAPI_hsmf_update_error_s { + struct OpenAPI_problem_details_s *error; + int pti; + char *n1sm_cause; + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_to_ue; + int back_off_timer; + char *recovery_time; +} OpenAPI_hsmf_update_error_t; + +OpenAPI_hsmf_update_error_t *OpenAPI_hsmf_update_error_create( + OpenAPI_problem_details_t *error, + int pti, + char *n1sm_cause, + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + int back_off_timer, + char *recovery_time + ); +void OpenAPI_hsmf_update_error_free(OpenAPI_hsmf_update_error_t *hsmf_update_error); +OpenAPI_hsmf_update_error_t *OpenAPI_hsmf_update_error_parseFromJSON(cJSON *hsmf_update_errorJSON); +cJSON *OpenAPI_hsmf_update_error_convertToJSON(OpenAPI_hsmf_update_error_t *hsmf_update_error); +OpenAPI_hsmf_update_error_t *OpenAPI_hsmf_update_error_copy(OpenAPI_hsmf_update_error_t *dst, OpenAPI_hsmf_update_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_hsmf_update_error_H_ */ + diff --git a/lib/sbi/openapi/model/hsmf_updated_data.c b/lib/sbi/openapi/model/hsmf_updated_data.c new file mode 100644 index 000000000..858ecc624 --- /dev/null +++ b/lib/sbi/openapi/model/hsmf_updated_data.c @@ -0,0 +1,287 @@ + +#include +#include +#include +#include "hsmf_updated_data.h" + +OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_list_t *dnai_list, + char *supported_features, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + int ipv6_multi_homing_ind + ) +{ + OpenAPI_hsmf_updated_data_t *hsmf_updated_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_hsmf_updated_data_t)); + if (!hsmf_updated_data_local_var) { + return NULL; + } + hsmf_updated_data_local_var->n1_sm_info_to_ue = n1_sm_info_to_ue; + hsmf_updated_data_local_var->n4_info = n4_info; + hsmf_updated_data_local_var->n4_info_ext1 = n4_info_ext1; + hsmf_updated_data_local_var->n4_info_ext2 = n4_info_ext2; + hsmf_updated_data_local_var->dnai_list = dnai_list; + hsmf_updated_data_local_var->supported_features = supported_features; + hsmf_updated_data_local_var->roaming_charging_profile = roaming_charging_profile; + hsmf_updated_data_local_var->ipv6_multi_homing_ind = ipv6_multi_homing_ind; + + return hsmf_updated_data_local_var; +} + +void OpenAPI_hsmf_updated_data_free(OpenAPI_hsmf_updated_data_t *hsmf_updated_data) +{ + if (NULL == hsmf_updated_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ref_to_binary_data_free(hsmf_updated_data->n1_sm_info_to_ue); + OpenAPI_n4_information_free(hsmf_updated_data->n4_info); + OpenAPI_n4_information_free(hsmf_updated_data->n4_info_ext1); + OpenAPI_n4_information_free(hsmf_updated_data->n4_info_ext2); + OpenAPI_list_for_each(hsmf_updated_data->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(hsmf_updated_data->dnai_list); + ogs_free(hsmf_updated_data->supported_features); + OpenAPI_roaming_charging_profile_free(hsmf_updated_data->roaming_charging_profile); + ogs_free(hsmf_updated_data); +} + +cJSON *OpenAPI_hsmf_updated_data_convertToJSON(OpenAPI_hsmf_updated_data_t *hsmf_updated_data) +{ + cJSON *item = NULL; + + if (hsmf_updated_data == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [HsmfUpdatedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (hsmf_updated_data->n1_sm_info_to_ue) { + cJSON *n1_sm_info_to_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(hsmf_updated_data->n1_sm_info_to_ue); + if (n1_sm_info_to_ue_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoToUe", n1_sm_info_to_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + } + + if (hsmf_updated_data->n4_info) { + cJSON *n4_info_local_JSON = OpenAPI_n4_information_convertToJSON(hsmf_updated_data->n4_info); + if (n4_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [n4_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n4Info", n4_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [n4_info]"); + goto end; + } + } + + if (hsmf_updated_data->n4_info_ext1) { + cJSON *n4_info_ext1_local_JSON = OpenAPI_n4_information_convertToJSON(hsmf_updated_data->n4_info_ext1); + if (n4_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt1", n4_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + } + + if (hsmf_updated_data->n4_info_ext2) { + cJSON *n4_info_ext2_local_JSON = OpenAPI_n4_information_convertToJSON(hsmf_updated_data->n4_info_ext2); + if (n4_info_ext2_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt2", n4_info_ext2_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + } + + if (hsmf_updated_data->dnai_list) { + cJSON *dnai_list = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_list == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [dnai_list]"); + goto end; + } + + OpenAPI_lnode_t *dnai_list_node; + OpenAPI_list_for_each(hsmf_updated_data->dnai_list, dnai_list_node) { + if (cJSON_AddStringToObject(dnai_list, "", (char*)dnai_list_node->data) == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (hsmf_updated_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", hsmf_updated_data->supported_features) == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (hsmf_updated_data->roaming_charging_profile) { + cJSON *roaming_charging_profile_local_JSON = OpenAPI_roaming_charging_profile_convertToJSON(hsmf_updated_data->roaming_charging_profile); + if (roaming_charging_profile_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "roamingChargingProfile", roaming_charging_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + } + + if (hsmf_updated_data->ipv6_multi_homing_ind) { + if (cJSON_AddBoolToObject(item, "ipv6MultiHomingInd", hsmf_updated_data->ipv6_multi_homing_ind) == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [ipv6_multi_homing_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf_updated_dataJSON) +{ + OpenAPI_hsmf_updated_data_t *hsmf_updated_data_local_var = NULL; + cJSON *n1_sm_info_to_ue = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "n1SmInfoToUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue_local_nonprim = NULL; + if (n1_sm_info_to_ue) { + n1_sm_info_to_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_to_ue); + } + + cJSON *n4_info = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "n4Info"); + + OpenAPI_n4_information_t *n4_info_local_nonprim = NULL; + if (n4_info) { + n4_info_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info); + } + + cJSON *n4_info_ext1 = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "n4InfoExt1"); + + OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; + if (n4_info_ext1) { + n4_info_ext1_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext1); + } + + cJSON *n4_info_ext2 = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "n4InfoExt2"); + + OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + if (n4_info_ext2) { + n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); + } + + cJSON *dnai_list = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "dnaiList"); + + OpenAPI_list_t *dnai_listList; + if (dnai_list) { + cJSON *dnai_list_local; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *roaming_charging_profile = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "roamingChargingProfile"); + + OpenAPI_roaming_charging_profile_t *roaming_charging_profile_local_nonprim = NULL; + if (roaming_charging_profile) { + roaming_charging_profile_local_nonprim = OpenAPI_roaming_charging_profile_parseFromJSON(roaming_charging_profile); + } + + cJSON *ipv6_multi_homing_ind = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "ipv6MultiHomingInd"); + + if (ipv6_multi_homing_ind) { + if (!cJSON_IsBool(ipv6_multi_homing_ind)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [ipv6_multi_homing_ind]"); + goto end; + } + } + + hsmf_updated_data_local_var = OpenAPI_hsmf_updated_data_create ( + n1_sm_info_to_ue ? n1_sm_info_to_ue_local_nonprim : NULL, + n4_info ? n4_info_local_nonprim : NULL, + n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL, + dnai_list ? dnai_listList : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, + ipv6_multi_homing_ind ? ipv6_multi_homing_ind->valueint : 0 + ); + + return hsmf_updated_data_local_var; +end: + return NULL; +} + +OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_copy(OpenAPI_hsmf_updated_data_t *dst, OpenAPI_hsmf_updated_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hsmf_updated_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hsmf_updated_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_hsmf_updated_data_free(dst); + dst = OpenAPI_hsmf_updated_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hsmf_updated_data.h b/lib/sbi/openapi/model/hsmf_updated_data.h new file mode 100644 index 000000000..b98208ede --- /dev/null +++ b/lib/sbi/openapi/model/hsmf_updated_data.h @@ -0,0 +1,55 @@ +/* + * hsmf_updated_data.h + * + * + */ + +#ifndef _OpenAPI_hsmf_updated_data_H_ +#define _OpenAPI_hsmf_updated_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n4_information.h" +#include "ref_to_binary_data.h" +#include "roaming_charging_profile.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_hsmf_updated_data_s OpenAPI_hsmf_updated_data_t; +typedef struct OpenAPI_hsmf_updated_data_s { + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_to_ue; + struct OpenAPI_n4_information_s *n4_info; + struct OpenAPI_n4_information_s *n4_info_ext1; + struct OpenAPI_n4_information_s *n4_info_ext2; + OpenAPI_list_t *dnai_list; + char *supported_features; + struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; + int ipv6_multi_homing_ind; +} OpenAPI_hsmf_updated_data_t; + +OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_list_t *dnai_list, + char *supported_features, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + int ipv6_multi_homing_ind + ); +void OpenAPI_hsmf_updated_data_free(OpenAPI_hsmf_updated_data_t *hsmf_updated_data); +OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf_updated_dataJSON); +cJSON *OpenAPI_hsmf_updated_data_convertToJSON(OpenAPI_hsmf_updated_data_t *hsmf_updated_data); +OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_copy(OpenAPI_hsmf_updated_data_t *dst, OpenAPI_hsmf_updated_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_hsmf_updated_data_H_ */ + diff --git a/lib/sbi/openapi/model/hss_auth_type.c b/lib/sbi/openapi/model/hss_auth_type.c index 901230a90..0d3fb8bbc 100644 --- a/lib/sbi/openapi/model/hss_auth_type.c +++ b/lib/sbi/openapi/model/hss_auth_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_copy(OpenAPI_hss_auth_type_t *dst, OpenAPI_hss_auth_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hss_auth_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hss_auth_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_hss_auth_type_free(dst); + dst = OpenAPI_hss_auth_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hss_auth_type.h b/lib/sbi/openapi/model/hss_auth_type.h index 1ef7a243e..0b1dcbffa 100644 --- a/lib/sbi/openapi/model/hss_auth_type.h +++ b/lib/sbi/openapi/model/hss_auth_type.h @@ -26,6 +26,7 @@ OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_create( void OpenAPI_hss_auth_type_free(OpenAPI_hss_auth_type_t *hss_auth_type); OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_parseFromJSON(cJSON *hss_auth_typeJSON); cJSON *OpenAPI_hss_auth_type_convertToJSON(OpenAPI_hss_auth_type_t *hss_auth_type); +OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_copy(OpenAPI_hss_auth_type_t *dst, OpenAPI_hss_auth_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/hss_authentication_info_request.c b/lib/sbi/openapi/model/hss_authentication_info_request.c index 445601666..a5dc9459a 100644 --- a/lib/sbi/openapi/model/hss_authentication_info_request.c +++ b/lib/sbi/openapi/model/hss_authentication_info_request.c @@ -170,3 +170,37 @@ end: return NULL; } +OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_request_copy(OpenAPI_hss_authentication_info_request_t *dst, OpenAPI_hss_authentication_info_request_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hss_authentication_info_request_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hss_authentication_info_request_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_hss_authentication_info_request_free(dst); + dst = OpenAPI_hss_authentication_info_request_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hss_authentication_info_request.h b/lib/sbi/openapi/model/hss_authentication_info_request.h index f62492efb..38562761e 100644 --- a/lib/sbi/openapi/model/hss_authentication_info_request.h +++ b/lib/sbi/openapi/model/hss_authentication_info_request.h @@ -39,6 +39,7 @@ OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_reque void OpenAPI_hss_authentication_info_request_free(OpenAPI_hss_authentication_info_request_t *hss_authentication_info_request); OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_request_parseFromJSON(cJSON *hss_authentication_info_requestJSON); cJSON *OpenAPI_hss_authentication_info_request_convertToJSON(OpenAPI_hss_authentication_info_request_t *hss_authentication_info_request); +OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_request_copy(OpenAPI_hss_authentication_info_request_t *dst, OpenAPI_hss_authentication_info_request_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/hss_authentication_info_result.c b/lib/sbi/openapi/model/hss_authentication_info_result.c index 92dfe4bc1..180d92d5b 100644 --- a/lib/sbi/openapi/model/hss_authentication_info_result.c +++ b/lib/sbi/openapi/model/hss_authentication_info_result.c @@ -98,3 +98,37 @@ end: return NULL; } +OpenAPI_hss_authentication_info_result_t *OpenAPI_hss_authentication_info_result_copy(OpenAPI_hss_authentication_info_result_t *dst, OpenAPI_hss_authentication_info_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hss_authentication_info_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hss_authentication_info_result_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_hss_authentication_info_result_free(dst); + dst = OpenAPI_hss_authentication_info_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hss_authentication_info_result.h b/lib/sbi/openapi/model/hss_authentication_info_result.h index 9e25a3d7d..1d83aa149 100644 --- a/lib/sbi/openapi/model/hss_authentication_info_result.h +++ b/lib/sbi/openapi/model/hss_authentication_info_result.h @@ -31,6 +31,7 @@ OpenAPI_hss_authentication_info_result_t *OpenAPI_hss_authentication_info_result void OpenAPI_hss_authentication_info_result_free(OpenAPI_hss_authentication_info_result_t *hss_authentication_info_result); OpenAPI_hss_authentication_info_result_t *OpenAPI_hss_authentication_info_result_parseFromJSON(cJSON *hss_authentication_info_resultJSON); cJSON *OpenAPI_hss_authentication_info_result_convertToJSON(OpenAPI_hss_authentication_info_result_t *hss_authentication_info_result); +OpenAPI_hss_authentication_info_result_t *OpenAPI_hss_authentication_info_result_copy(OpenAPI_hss_authentication_info_result_t *dst, OpenAPI_hss_authentication_info_result_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/hss_authentication_vectors.c b/lib/sbi/openapi/model/hss_authentication_vectors.c index b491e2919..18fbab559 100644 --- a/lib/sbi/openapi/model/hss_authentication_vectors.c +++ b/lib/sbi/openapi/model/hss_authentication_vectors.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_hss_authentication_vectors_t *OpenAPI_hss_authentication_vectors_copy(OpenAPI_hss_authentication_vectors_t *dst, OpenAPI_hss_authentication_vectors_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hss_authentication_vectors_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hss_authentication_vectors_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_hss_authentication_vectors_free(dst); + dst = OpenAPI_hss_authentication_vectors_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hss_authentication_vectors.h b/lib/sbi/openapi/model/hss_authentication_vectors.h index d28a357e7..7bc800b0c 100644 --- a/lib/sbi/openapi/model/hss_authentication_vectors.h +++ b/lib/sbi/openapi/model/hss_authentication_vectors.h @@ -26,6 +26,7 @@ OpenAPI_hss_authentication_vectors_t *OpenAPI_hss_authentication_vectors_create( void OpenAPI_hss_authentication_vectors_free(OpenAPI_hss_authentication_vectors_t *hss_authentication_vectors); OpenAPI_hss_authentication_vectors_t *OpenAPI_hss_authentication_vectors_parseFromJSON(cJSON *hss_authentication_vectorsJSON); cJSON *OpenAPI_hss_authentication_vectors_convertToJSON(OpenAPI_hss_authentication_vectors_t *hss_authentication_vectors); +OpenAPI_hss_authentication_vectors_t *OpenAPI_hss_authentication_vectors_copy(OpenAPI_hss_authentication_vectors_t *dst, OpenAPI_hss_authentication_vectors_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/hss_av_type.c b/lib/sbi/openapi/model/hss_av_type.c index a57f7d93a..24bca8162 100644 --- a/lib/sbi/openapi/model/hss_av_type.c +++ b/lib/sbi/openapi/model/hss_av_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_copy(OpenAPI_hss_av_type_t *dst, OpenAPI_hss_av_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hss_av_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hss_av_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_hss_av_type_free(dst); + dst = OpenAPI_hss_av_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hss_av_type.h b/lib/sbi/openapi/model/hss_av_type.h index ebd17eca3..1eb3af271 100644 --- a/lib/sbi/openapi/model/hss_av_type.h +++ b/lib/sbi/openapi/model/hss_av_type.h @@ -26,6 +26,7 @@ OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_create( void OpenAPI_hss_av_type_free(OpenAPI_hss_av_type_t *hss_av_type); OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_parseFromJSON(cJSON *hss_av_typeJSON); cJSON *OpenAPI_hss_av_type_convertToJSON(OpenAPI_hss_av_type_t *hss_av_type); +OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_copy(OpenAPI_hss_av_type_t *dst, OpenAPI_hss_av_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/hss_info.c b/lib/sbi/openapi/model/hss_info.c index 3aa52a50b..1c786a33e 100644 --- a/lib/sbi/openapi/model/hss_info.c +++ b/lib/sbi/openapi/model/hss_info.c @@ -119,3 +119,37 @@ end: return NULL; } +OpenAPI_hss_info_t *OpenAPI_hss_info_copy(OpenAPI_hss_info_t *dst, OpenAPI_hss_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hss_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_hss_info_free(dst); + dst = OpenAPI_hss_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hss_info.h b/lib/sbi/openapi/model/hss_info.h index 3160ef741..d681ef152 100644 --- a/lib/sbi/openapi/model/hss_info.h +++ b/lib/sbi/openapi/model/hss_info.h @@ -31,6 +31,7 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_create( void OpenAPI_hss_info_free(OpenAPI_hss_info_t *hss_info); OpenAPI_hss_info_t *OpenAPI_hss_info_parseFromJSON(cJSON *hss_infoJSON); cJSON *OpenAPI_hss_info_convertToJSON(OpenAPI_hss_info_t *hss_info); +OpenAPI_hss_info_t *OpenAPI_hss_info_copy(OpenAPI_hss_info_t *dst, OpenAPI_hss_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/id_translation_result.c b/lib/sbi/openapi/model/id_translation_result.c index eade38c08..5f1d3d514 100644 --- a/lib/sbi/openapi/model/id_translation_result.c +++ b/lib/sbi/openapi/model/id_translation_result.c @@ -114,3 +114,37 @@ end: return NULL; } +OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_copy(OpenAPI_id_translation_result_t *dst, OpenAPI_id_translation_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_id_translation_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_id_translation_result_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_id_translation_result_free(dst); + dst = OpenAPI_id_translation_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/id_translation_result.h b/lib/sbi/openapi/model/id_translation_result.h index 96312164e..9e5a68bbc 100644 --- a/lib/sbi/openapi/model/id_translation_result.h +++ b/lib/sbi/openapi/model/id_translation_result.h @@ -32,6 +32,7 @@ OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_create( void OpenAPI_id_translation_result_free(OpenAPI_id_translation_result_t *id_translation_result); OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_parseFromJSON(cJSON *id_translation_resultJSON); cJSON *OpenAPI_id_translation_result_convertToJSON(OpenAPI_id_translation_result_t *id_translation_result); +OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_copy(OpenAPI_id_translation_result_t *dst, OpenAPI_id_translation_result_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/identity_data.c b/lib/sbi/openapi/model/identity_data.c index d31f13248..182cea094 100644 --- a/lib/sbi/openapi/model/identity_data.c +++ b/lib/sbi/openapi/model/identity_data.c @@ -135,3 +135,37 @@ end: return NULL; } +OpenAPI_identity_data_t *OpenAPI_identity_data_copy(OpenAPI_identity_data_t *dst, OpenAPI_identity_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_identity_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_identity_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_identity_data_free(dst); + dst = OpenAPI_identity_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/identity_data.h b/lib/sbi/openapi/model/identity_data.h index 270c4a736..73db7d3f5 100644 --- a/lib/sbi/openapi/model/identity_data.h +++ b/lib/sbi/openapi/model/identity_data.h @@ -30,6 +30,7 @@ OpenAPI_identity_data_t *OpenAPI_identity_data_create( void OpenAPI_identity_data_free(OpenAPI_identity_data_t *identity_data); OpenAPI_identity_data_t *OpenAPI_identity_data_parseFromJSON(cJSON *identity_dataJSON); cJSON *OpenAPI_identity_data_convertToJSON(OpenAPI_identity_data_t *identity_data); +OpenAPI_identity_data_t *OpenAPI_identity_data_copy(OpenAPI_identity_data_t *dst, OpenAPI_identity_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/identity_range.c b/lib/sbi/openapi/model/identity_range.c index 99f5bdae2..2b4112941 100644 --- a/lib/sbi/openapi/model/identity_range.c +++ b/lib/sbi/openapi/model/identity_range.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_identity_range_t *OpenAPI_identity_range_copy(OpenAPI_identity_range_t *dst, OpenAPI_identity_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_identity_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_identity_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_identity_range_free(dst); + dst = OpenAPI_identity_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/identity_range.h b/lib/sbi/openapi/model/identity_range.h index 69585da59..8be3174ac 100644 --- a/lib/sbi/openapi/model/identity_range.h +++ b/lib/sbi/openapi/model/identity_range.h @@ -32,6 +32,7 @@ OpenAPI_identity_range_t *OpenAPI_identity_range_create( void OpenAPI_identity_range_free(OpenAPI_identity_range_t *identity_range); OpenAPI_identity_range_t *OpenAPI_identity_range_parseFromJSON(cJSON *identity_rangeJSON); cJSON *OpenAPI_identity_range_convertToJSON(OpenAPI_identity_range_t *identity_range); +OpenAPI_identity_range_t *OpenAPI_identity_range_copy(OpenAPI_identity_range_t *dst, OpenAPI_identity_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ims_vo_ps.c b/lib/sbi/openapi/model/ims_vo_ps.c index 6ae635158..4f42cc65c 100644 --- a/lib/sbi/openapi/model/ims_vo_ps.c +++ b/lib/sbi/openapi/model/ims_vo_ps.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_copy(OpenAPI_ims_vo_ps_t *dst, OpenAPI_ims_vo_ps_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ims_vo_ps_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ims_vo_ps_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ims_vo_ps_free(dst); + dst = OpenAPI_ims_vo_ps_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ims_vo_ps.h b/lib/sbi/openapi/model/ims_vo_ps.h index 857fb61bb..4b777a4ea 100644 --- a/lib/sbi/openapi/model/ims_vo_ps.h +++ b/lib/sbi/openapi/model/ims_vo_ps.h @@ -26,6 +26,7 @@ OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_create( void OpenAPI_ims_vo_ps_free(OpenAPI_ims_vo_ps_t *ims_vo_ps); OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_parseFromJSON(cJSON *ims_vo_psJSON); cJSON *OpenAPI_ims_vo_ps_convertToJSON(OpenAPI_ims_vo_ps_t *ims_vo_ps); +OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_copy(OpenAPI_ims_vo_ps_t *dst, OpenAPI_ims_vo_ps_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/imsi_range.c b/lib/sbi/openapi/model/imsi_range.c index 630a3c67f..51605d8e4 100644 --- a/lib/sbi/openapi/model/imsi_range.c +++ b/lib/sbi/openapi/model/imsi_range.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_imsi_range_t *OpenAPI_imsi_range_copy(OpenAPI_imsi_range_t *dst, OpenAPI_imsi_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_imsi_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_imsi_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_imsi_range_free(dst); + dst = OpenAPI_imsi_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/imsi_range.h b/lib/sbi/openapi/model/imsi_range.h index 504644141..8ef65a12c 100644 --- a/lib/sbi/openapi/model/imsi_range.h +++ b/lib/sbi/openapi/model/imsi_range.h @@ -32,6 +32,7 @@ OpenAPI_imsi_range_t *OpenAPI_imsi_range_create( void OpenAPI_imsi_range_free(OpenAPI_imsi_range_t *imsi_range); OpenAPI_imsi_range_t *OpenAPI_imsi_range_parseFromJSON(cJSON *imsi_rangeJSON); cJSON *OpenAPI_imsi_range_convertToJSON(OpenAPI_imsi_range_t *imsi_range); +OpenAPI_imsi_range_t *OpenAPI_imsi_range_copy(OpenAPI_imsi_range_t *dst, OpenAPI_imsi_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.c b/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.c new file mode 100644 index 000000000..7479a26af --- /dev/null +++ b/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.c @@ -0,0 +1,188 @@ + +#include +#include +#include +#include "indirect_data_forwarding_tunnel_info.h" + +OpenAPI_indirect_data_forwarding_tunnel_info_t *OpenAPI_indirect_data_forwarding_tunnel_info_create( + char *ipv4_addr, + char *ipv6_addr, + char *gtp_teid, + int drb_id, + int additional_tnl_nb + ) +{ + OpenAPI_indirect_data_forwarding_tunnel_info_t *indirect_data_forwarding_tunnel_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_indirect_data_forwarding_tunnel_info_t)); + if (!indirect_data_forwarding_tunnel_info_local_var) { + return NULL; + } + indirect_data_forwarding_tunnel_info_local_var->ipv4_addr = ipv4_addr; + indirect_data_forwarding_tunnel_info_local_var->ipv6_addr = ipv6_addr; + indirect_data_forwarding_tunnel_info_local_var->gtp_teid = gtp_teid; + indirect_data_forwarding_tunnel_info_local_var->drb_id = drb_id; + indirect_data_forwarding_tunnel_info_local_var->additional_tnl_nb = additional_tnl_nb; + + return indirect_data_forwarding_tunnel_info_local_var; +} + +void OpenAPI_indirect_data_forwarding_tunnel_info_free(OpenAPI_indirect_data_forwarding_tunnel_info_t *indirect_data_forwarding_tunnel_info) +{ + if (NULL == indirect_data_forwarding_tunnel_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(indirect_data_forwarding_tunnel_info->ipv4_addr); + ogs_free(indirect_data_forwarding_tunnel_info->ipv6_addr); + ogs_free(indirect_data_forwarding_tunnel_info->gtp_teid); + ogs_free(indirect_data_forwarding_tunnel_info); +} + +cJSON *OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON(OpenAPI_indirect_data_forwarding_tunnel_info_t *indirect_data_forwarding_tunnel_info) +{ + cJSON *item = NULL; + + if (indirect_data_forwarding_tunnel_info == NULL) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON() failed [IndirectDataForwardingTunnelInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (indirect_data_forwarding_tunnel_info->ipv4_addr) { + if (cJSON_AddStringToObject(item, "ipv4Addr", indirect_data_forwarding_tunnel_info->ipv4_addr) == NULL) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON() failed [ipv4_addr]"); + goto end; + } + } + + if (indirect_data_forwarding_tunnel_info->ipv6_addr) { + if (cJSON_AddStringToObject(item, "ipv6Addr", indirect_data_forwarding_tunnel_info->ipv6_addr) == NULL) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON() failed [ipv6_addr]"); + goto end; + } + } + + if (!indirect_data_forwarding_tunnel_info->gtp_teid) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON() failed [gtp_teid]"); + goto end; + } + if (cJSON_AddStringToObject(item, "gtpTeid", indirect_data_forwarding_tunnel_info->gtp_teid) == NULL) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON() failed [gtp_teid]"); + goto end; + } + + if (indirect_data_forwarding_tunnel_info->drb_id) { + if (cJSON_AddNumberToObject(item, "drbId", indirect_data_forwarding_tunnel_info->drb_id) == NULL) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON() failed [drb_id]"); + goto end; + } + } + + if (indirect_data_forwarding_tunnel_info->additional_tnl_nb) { + if (cJSON_AddNumberToObject(item, "additionalTnlNb", indirect_data_forwarding_tunnel_info->additional_tnl_nb) == NULL) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON() failed [additional_tnl_nb]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_indirect_data_forwarding_tunnel_info_t *OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON(cJSON *indirect_data_forwarding_tunnel_infoJSON) +{ + OpenAPI_indirect_data_forwarding_tunnel_info_t *indirect_data_forwarding_tunnel_info_local_var = NULL; + cJSON *ipv4_addr = cJSON_GetObjectItemCaseSensitive(indirect_data_forwarding_tunnel_infoJSON, "ipv4Addr"); + + if (ipv4_addr) { + if (!cJSON_IsString(ipv4_addr)) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON() failed [ipv4_addr]"); + goto end; + } + } + + cJSON *ipv6_addr = cJSON_GetObjectItemCaseSensitive(indirect_data_forwarding_tunnel_infoJSON, "ipv6Addr"); + + if (ipv6_addr) { + if (!cJSON_IsString(ipv6_addr)) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON() failed [ipv6_addr]"); + goto end; + } + } + + cJSON *gtp_teid = cJSON_GetObjectItemCaseSensitive(indirect_data_forwarding_tunnel_infoJSON, "gtpTeid"); + if (!gtp_teid) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON() failed [gtp_teid]"); + goto end; + } + + + if (!cJSON_IsString(gtp_teid)) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON() failed [gtp_teid]"); + goto end; + } + + cJSON *drb_id = cJSON_GetObjectItemCaseSensitive(indirect_data_forwarding_tunnel_infoJSON, "drbId"); + + if (drb_id) { + if (!cJSON_IsNumber(drb_id)) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON() failed [drb_id]"); + goto end; + } + } + + cJSON *additional_tnl_nb = cJSON_GetObjectItemCaseSensitive(indirect_data_forwarding_tunnel_infoJSON, "additionalTnlNb"); + + if (additional_tnl_nb) { + if (!cJSON_IsNumber(additional_tnl_nb)) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON() failed [additional_tnl_nb]"); + goto end; + } + } + + indirect_data_forwarding_tunnel_info_local_var = OpenAPI_indirect_data_forwarding_tunnel_info_create ( + ipv4_addr ? ogs_strdup(ipv4_addr->valuestring) : NULL, + ipv6_addr ? ogs_strdup(ipv6_addr->valuestring) : NULL, + ogs_strdup(gtp_teid->valuestring), + drb_id ? drb_id->valuedouble : 0, + additional_tnl_nb ? additional_tnl_nb->valuedouble : 0 + ); + + return indirect_data_forwarding_tunnel_info_local_var; +end: + return NULL; +} + +OpenAPI_indirect_data_forwarding_tunnel_info_t *OpenAPI_indirect_data_forwarding_tunnel_info_copy(OpenAPI_indirect_data_forwarding_tunnel_info_t *dst, OpenAPI_indirect_data_forwarding_tunnel_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_indirect_data_forwarding_tunnel_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_indirect_data_forwarding_tunnel_info_free(dst); + dst = OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.h b/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.h new file mode 100644 index 000000000..d76692732 --- /dev/null +++ b/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.h @@ -0,0 +1,46 @@ +/* + * indirect_data_forwarding_tunnel_info.h + * + * + */ + +#ifndef _OpenAPI_indirect_data_forwarding_tunnel_info_H_ +#define _OpenAPI_indirect_data_forwarding_tunnel_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_indirect_data_forwarding_tunnel_info_s OpenAPI_indirect_data_forwarding_tunnel_info_t; +typedef struct OpenAPI_indirect_data_forwarding_tunnel_info_s { + char *ipv4_addr; + char *ipv6_addr; + char *gtp_teid; + int drb_id; + int additional_tnl_nb; +} OpenAPI_indirect_data_forwarding_tunnel_info_t; + +OpenAPI_indirect_data_forwarding_tunnel_info_t *OpenAPI_indirect_data_forwarding_tunnel_info_create( + char *ipv4_addr, + char *ipv6_addr, + char *gtp_teid, + int drb_id, + int additional_tnl_nb + ); +void OpenAPI_indirect_data_forwarding_tunnel_info_free(OpenAPI_indirect_data_forwarding_tunnel_info_t *indirect_data_forwarding_tunnel_info); +OpenAPI_indirect_data_forwarding_tunnel_info_t *OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON(cJSON *indirect_data_forwarding_tunnel_infoJSON); +cJSON *OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON(OpenAPI_indirect_data_forwarding_tunnel_info_t *indirect_data_forwarding_tunnel_info); +OpenAPI_indirect_data_forwarding_tunnel_info_t *OpenAPI_indirect_data_forwarding_tunnel_info_copy(OpenAPI_indirect_data_forwarding_tunnel_info_t *dst, OpenAPI_indirect_data_forwarding_tunnel_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_indirect_data_forwarding_tunnel_info_H_ */ + diff --git a/lib/sbi/openapi/model/inline_object.c b/lib/sbi/openapi/model/inline_object.c new file mode 100644 index 000000000..678ff0ab0 --- /dev/null +++ b/lib/sbi/openapi/model/inline_object.c @@ -0,0 +1,585 @@ + +#include +#include +#include +#include "inline_object.h" + +OpenAPI_inline_object_t *OpenAPI_inline_object_create( + OpenAPI_ue_context_create_data_t *json_data, + OpenAPI_binary_t* binary_data_n2_information, + OpenAPI_binary_t* binary_data_n2_information_ext1, + OpenAPI_binary_t* binary_data_n2_information_ext2, + OpenAPI_binary_t* binary_data_n2_information_ext3, + OpenAPI_binary_t* binary_data_n2_information_ext4, + OpenAPI_binary_t* binary_data_n2_information_ext5, + OpenAPI_binary_t* binary_data_n2_information_ext6, + OpenAPI_binary_t* binary_data_n2_information_ext7, + OpenAPI_binary_t* binary_data_n2_information_ext8, + OpenAPI_binary_t* binary_data_n2_information_ext9, + OpenAPI_binary_t* binary_data_n2_information_ext10, + OpenAPI_binary_t* binary_data_n2_information_ext11, + OpenAPI_binary_t* binary_data_n2_information_ext12, + OpenAPI_binary_t* binary_data_n2_information_ext13, + OpenAPI_binary_t* binary_data_n2_information_ext14, + OpenAPI_binary_t* binary_data_n2_information_ext15, + OpenAPI_binary_t* binary_data_n2_information_ext16 + ) +{ + OpenAPI_inline_object_t *inline_object_local_var = OpenAPI_malloc(sizeof(OpenAPI_inline_object_t)); + if (!inline_object_local_var) { + return NULL; + } + inline_object_local_var->json_data = json_data; + inline_object_local_var->binary_data_n2_information = binary_data_n2_information; + inline_object_local_var->binary_data_n2_information_ext1 = binary_data_n2_information_ext1; + inline_object_local_var->binary_data_n2_information_ext2 = binary_data_n2_information_ext2; + inline_object_local_var->binary_data_n2_information_ext3 = binary_data_n2_information_ext3; + inline_object_local_var->binary_data_n2_information_ext4 = binary_data_n2_information_ext4; + inline_object_local_var->binary_data_n2_information_ext5 = binary_data_n2_information_ext5; + inline_object_local_var->binary_data_n2_information_ext6 = binary_data_n2_information_ext6; + inline_object_local_var->binary_data_n2_information_ext7 = binary_data_n2_information_ext7; + inline_object_local_var->binary_data_n2_information_ext8 = binary_data_n2_information_ext8; + inline_object_local_var->binary_data_n2_information_ext9 = binary_data_n2_information_ext9; + inline_object_local_var->binary_data_n2_information_ext10 = binary_data_n2_information_ext10; + inline_object_local_var->binary_data_n2_information_ext11 = binary_data_n2_information_ext11; + inline_object_local_var->binary_data_n2_information_ext12 = binary_data_n2_information_ext12; + inline_object_local_var->binary_data_n2_information_ext13 = binary_data_n2_information_ext13; + inline_object_local_var->binary_data_n2_information_ext14 = binary_data_n2_information_ext14; + inline_object_local_var->binary_data_n2_information_ext15 = binary_data_n2_information_ext15; + inline_object_local_var->binary_data_n2_information_ext16 = binary_data_n2_information_ext16; + + return inline_object_local_var; +} + +void OpenAPI_inline_object_free(OpenAPI_inline_object_t *inline_object) +{ + if (NULL == inline_object) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ue_context_create_data_free(inline_object->json_data); + ogs_free(inline_object->binary_data_n2_information->data); + ogs_free(inline_object->binary_data_n2_information_ext1->data); + ogs_free(inline_object->binary_data_n2_information_ext2->data); + ogs_free(inline_object->binary_data_n2_information_ext3->data); + ogs_free(inline_object->binary_data_n2_information_ext4->data); + ogs_free(inline_object->binary_data_n2_information_ext5->data); + ogs_free(inline_object->binary_data_n2_information_ext6->data); + ogs_free(inline_object->binary_data_n2_information_ext7->data); + ogs_free(inline_object->binary_data_n2_information_ext8->data); + ogs_free(inline_object->binary_data_n2_information_ext9->data); + ogs_free(inline_object->binary_data_n2_information_ext10->data); + ogs_free(inline_object->binary_data_n2_information_ext11->data); + ogs_free(inline_object->binary_data_n2_information_ext12->data); + ogs_free(inline_object->binary_data_n2_information_ext13->data); + ogs_free(inline_object->binary_data_n2_information_ext14->data); + ogs_free(inline_object->binary_data_n2_information_ext15->data); + ogs_free(inline_object->binary_data_n2_information_ext16->data); + ogs_free(inline_object); +} + +cJSON *OpenAPI_inline_object_convertToJSON(OpenAPI_inline_object_t *inline_object) +{ + cJSON *item = NULL; + + if (inline_object == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [inline_object]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (inline_object->json_data) { + cJSON *json_data_local_JSON = OpenAPI_ue_context_create_data_convertToJSON(inline_object->json_data); + if (json_data_local_JSON == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [json_data]"); + goto end; + } + cJSON_AddItemToObject(item, "jsonData", json_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [json_data]"); + goto end; + } + } + + if (inline_object->binary_data_n2_information) { + char* encoded_str_binary_data_n2_information = OpenAPI_base64encode(inline_object->binary_data_n2_information->data,inline_object->binary_data_n2_information->len); + if (cJSON_AddStringToObject(item, "binaryDataN2Information", encoded_str_binary_data_n2_information) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information); + } + + if (inline_object->binary_data_n2_information_ext1) { + char* encoded_str_binary_data_n2_information_ext1 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext1->data,inline_object->binary_data_n2_information_ext1->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt1", encoded_str_binary_data_n2_information_ext1) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext1]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext1); + } + + if (inline_object->binary_data_n2_information_ext2) { + char* encoded_str_binary_data_n2_information_ext2 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext2->data,inline_object->binary_data_n2_information_ext2->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt2", encoded_str_binary_data_n2_information_ext2) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext2); + } + + if (inline_object->binary_data_n2_information_ext3) { + char* encoded_str_binary_data_n2_information_ext3 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext3->data,inline_object->binary_data_n2_information_ext3->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt3", encoded_str_binary_data_n2_information_ext3) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext3]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext3); + } + + if (inline_object->binary_data_n2_information_ext4) { + char* encoded_str_binary_data_n2_information_ext4 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext4->data,inline_object->binary_data_n2_information_ext4->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt4", encoded_str_binary_data_n2_information_ext4) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext4]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext4); + } + + if (inline_object->binary_data_n2_information_ext5) { + char* encoded_str_binary_data_n2_information_ext5 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext5->data,inline_object->binary_data_n2_information_ext5->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt5", encoded_str_binary_data_n2_information_ext5) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext5]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext5); + } + + if (inline_object->binary_data_n2_information_ext6) { + char* encoded_str_binary_data_n2_information_ext6 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext6->data,inline_object->binary_data_n2_information_ext6->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt6", encoded_str_binary_data_n2_information_ext6) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext6]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext6); + } + + if (inline_object->binary_data_n2_information_ext7) { + char* encoded_str_binary_data_n2_information_ext7 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext7->data,inline_object->binary_data_n2_information_ext7->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt7", encoded_str_binary_data_n2_information_ext7) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext7]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext7); + } + + if (inline_object->binary_data_n2_information_ext8) { + char* encoded_str_binary_data_n2_information_ext8 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext8->data,inline_object->binary_data_n2_information_ext8->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt8", encoded_str_binary_data_n2_information_ext8) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext8]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext8); + } + + if (inline_object->binary_data_n2_information_ext9) { + char* encoded_str_binary_data_n2_information_ext9 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext9->data,inline_object->binary_data_n2_information_ext9->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt9", encoded_str_binary_data_n2_information_ext9) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext9]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext9); + } + + if (inline_object->binary_data_n2_information_ext10) { + char* encoded_str_binary_data_n2_information_ext10 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext10->data,inline_object->binary_data_n2_information_ext10->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt10", encoded_str_binary_data_n2_information_ext10) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext10]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext10); + } + + if (inline_object->binary_data_n2_information_ext11) { + char* encoded_str_binary_data_n2_information_ext11 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext11->data,inline_object->binary_data_n2_information_ext11->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt11", encoded_str_binary_data_n2_information_ext11) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext11]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext11); + } + + if (inline_object->binary_data_n2_information_ext12) { + char* encoded_str_binary_data_n2_information_ext12 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext12->data,inline_object->binary_data_n2_information_ext12->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt12", encoded_str_binary_data_n2_information_ext12) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext12]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext12); + } + + if (inline_object->binary_data_n2_information_ext13) { + char* encoded_str_binary_data_n2_information_ext13 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext13->data,inline_object->binary_data_n2_information_ext13->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt13", encoded_str_binary_data_n2_information_ext13) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext13]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext13); + } + + if (inline_object->binary_data_n2_information_ext14) { + char* encoded_str_binary_data_n2_information_ext14 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext14->data,inline_object->binary_data_n2_information_ext14->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt14", encoded_str_binary_data_n2_information_ext14) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext14]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext14); + } + + if (inline_object->binary_data_n2_information_ext15) { + char* encoded_str_binary_data_n2_information_ext15 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext15->data,inline_object->binary_data_n2_information_ext15->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt15", encoded_str_binary_data_n2_information_ext15) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext15]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext15); + } + + if (inline_object->binary_data_n2_information_ext16) { + char* encoded_str_binary_data_n2_information_ext16 = OpenAPI_base64encode(inline_object->binary_data_n2_information_ext16->data,inline_object->binary_data_n2_information_ext16->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt16", encoded_str_binary_data_n2_information_ext16) == NULL) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed [binary_data_n2_information_ext16]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext16); + } + +end: + return item; +} + +OpenAPI_inline_object_t *OpenAPI_inline_object_parseFromJSON(cJSON *inline_objectJSON) +{ + OpenAPI_inline_object_t *inline_object_local_var = NULL; + cJSON *json_data = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "jsonData"); + + OpenAPI_ue_context_create_data_t *json_data_local_nonprim = NULL; + if (json_data) { + json_data_local_nonprim = OpenAPI_ue_context_create_data_parseFromJSON(json_data); + } + + cJSON *binary_data_n2_information = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2Information"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information) { + if (!cJSON_IsString(binary_data_n2_information)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information]"); + goto end; + } + decoded_str_binary_data_n2_information->data = OpenAPI_base64decode(binary_data_n2_information->valuestring, strlen(binary_data_n2_information->valuestring), &decoded_str_binary_data_n2_information->len); + if (!decoded_str_binary_data_n2_information->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext1 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt1"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext1 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext1) { + if (!cJSON_IsString(binary_data_n2_information_ext1)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext1]"); + goto end; + } + decoded_str_binary_data_n2_information_ext1->data = OpenAPI_base64decode(binary_data_n2_information_ext1->valuestring, strlen(binary_data_n2_information_ext1->valuestring), &decoded_str_binary_data_n2_information_ext1->len); + if (!decoded_str_binary_data_n2_information_ext1->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext1]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext2 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt2"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext2 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext2) { + if (!cJSON_IsString(binary_data_n2_information_ext2)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + decoded_str_binary_data_n2_information_ext2->data = OpenAPI_base64decode(binary_data_n2_information_ext2->valuestring, strlen(binary_data_n2_information_ext2->valuestring), &decoded_str_binary_data_n2_information_ext2->len); + if (!decoded_str_binary_data_n2_information_ext2->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext3 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt3"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext3 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext3) { + if (!cJSON_IsString(binary_data_n2_information_ext3)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext3]"); + goto end; + } + decoded_str_binary_data_n2_information_ext3->data = OpenAPI_base64decode(binary_data_n2_information_ext3->valuestring, strlen(binary_data_n2_information_ext3->valuestring), &decoded_str_binary_data_n2_information_ext3->len); + if (!decoded_str_binary_data_n2_information_ext3->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext3]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext4 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt4"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext4 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext4) { + if (!cJSON_IsString(binary_data_n2_information_ext4)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext4]"); + goto end; + } + decoded_str_binary_data_n2_information_ext4->data = OpenAPI_base64decode(binary_data_n2_information_ext4->valuestring, strlen(binary_data_n2_information_ext4->valuestring), &decoded_str_binary_data_n2_information_ext4->len); + if (!decoded_str_binary_data_n2_information_ext4->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext4]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext5 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt5"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext5 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext5) { + if (!cJSON_IsString(binary_data_n2_information_ext5)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext5]"); + goto end; + } + decoded_str_binary_data_n2_information_ext5->data = OpenAPI_base64decode(binary_data_n2_information_ext5->valuestring, strlen(binary_data_n2_information_ext5->valuestring), &decoded_str_binary_data_n2_information_ext5->len); + if (!decoded_str_binary_data_n2_information_ext5->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext5]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext6 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt6"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext6 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext6) { + if (!cJSON_IsString(binary_data_n2_information_ext6)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext6]"); + goto end; + } + decoded_str_binary_data_n2_information_ext6->data = OpenAPI_base64decode(binary_data_n2_information_ext6->valuestring, strlen(binary_data_n2_information_ext6->valuestring), &decoded_str_binary_data_n2_information_ext6->len); + if (!decoded_str_binary_data_n2_information_ext6->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext6]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext7 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt7"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext7 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext7) { + if (!cJSON_IsString(binary_data_n2_information_ext7)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext7]"); + goto end; + } + decoded_str_binary_data_n2_information_ext7->data = OpenAPI_base64decode(binary_data_n2_information_ext7->valuestring, strlen(binary_data_n2_information_ext7->valuestring), &decoded_str_binary_data_n2_information_ext7->len); + if (!decoded_str_binary_data_n2_information_ext7->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext7]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext8 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt8"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext8 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext8) { + if (!cJSON_IsString(binary_data_n2_information_ext8)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext8]"); + goto end; + } + decoded_str_binary_data_n2_information_ext8->data = OpenAPI_base64decode(binary_data_n2_information_ext8->valuestring, strlen(binary_data_n2_information_ext8->valuestring), &decoded_str_binary_data_n2_information_ext8->len); + if (!decoded_str_binary_data_n2_information_ext8->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext8]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext9 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt9"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext9 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext9) { + if (!cJSON_IsString(binary_data_n2_information_ext9)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext9]"); + goto end; + } + decoded_str_binary_data_n2_information_ext9->data = OpenAPI_base64decode(binary_data_n2_information_ext9->valuestring, strlen(binary_data_n2_information_ext9->valuestring), &decoded_str_binary_data_n2_information_ext9->len); + if (!decoded_str_binary_data_n2_information_ext9->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext9]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext10 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt10"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext10 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext10) { + if (!cJSON_IsString(binary_data_n2_information_ext10)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext10]"); + goto end; + } + decoded_str_binary_data_n2_information_ext10->data = OpenAPI_base64decode(binary_data_n2_information_ext10->valuestring, strlen(binary_data_n2_information_ext10->valuestring), &decoded_str_binary_data_n2_information_ext10->len); + if (!decoded_str_binary_data_n2_information_ext10->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext10]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext11 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt11"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext11 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext11) { + if (!cJSON_IsString(binary_data_n2_information_ext11)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext11]"); + goto end; + } + decoded_str_binary_data_n2_information_ext11->data = OpenAPI_base64decode(binary_data_n2_information_ext11->valuestring, strlen(binary_data_n2_information_ext11->valuestring), &decoded_str_binary_data_n2_information_ext11->len); + if (!decoded_str_binary_data_n2_information_ext11->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext11]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext12 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt12"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext12 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext12) { + if (!cJSON_IsString(binary_data_n2_information_ext12)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext12]"); + goto end; + } + decoded_str_binary_data_n2_information_ext12->data = OpenAPI_base64decode(binary_data_n2_information_ext12->valuestring, strlen(binary_data_n2_information_ext12->valuestring), &decoded_str_binary_data_n2_information_ext12->len); + if (!decoded_str_binary_data_n2_information_ext12->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext12]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext13 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt13"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext13 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext13) { + if (!cJSON_IsString(binary_data_n2_information_ext13)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext13]"); + goto end; + } + decoded_str_binary_data_n2_information_ext13->data = OpenAPI_base64decode(binary_data_n2_information_ext13->valuestring, strlen(binary_data_n2_information_ext13->valuestring), &decoded_str_binary_data_n2_information_ext13->len); + if (!decoded_str_binary_data_n2_information_ext13->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext13]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext14 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt14"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext14 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext14) { + if (!cJSON_IsString(binary_data_n2_information_ext14)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext14]"); + goto end; + } + decoded_str_binary_data_n2_information_ext14->data = OpenAPI_base64decode(binary_data_n2_information_ext14->valuestring, strlen(binary_data_n2_information_ext14->valuestring), &decoded_str_binary_data_n2_information_ext14->len); + if (!decoded_str_binary_data_n2_information_ext14->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext14]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext15 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt15"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext15 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext15) { + if (!cJSON_IsString(binary_data_n2_information_ext15)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext15]"); + goto end; + } + decoded_str_binary_data_n2_information_ext15->data = OpenAPI_base64decode(binary_data_n2_information_ext15->valuestring, strlen(binary_data_n2_information_ext15->valuestring), &decoded_str_binary_data_n2_information_ext15->len); + if (!decoded_str_binary_data_n2_information_ext15->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext15]"); + goto end; + } + } + + cJSON *binary_data_n2_information_ext16 = cJSON_GetObjectItemCaseSensitive(inline_objectJSON, "binaryDataN2InformationExt16"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information_ext16 = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information_ext16) { + if (!cJSON_IsString(binary_data_n2_information_ext16)) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext16]"); + goto end; + } + decoded_str_binary_data_n2_information_ext16->data = OpenAPI_base64decode(binary_data_n2_information_ext16->valuestring, strlen(binary_data_n2_information_ext16->valuestring), &decoded_str_binary_data_n2_information_ext16->len); + if (!decoded_str_binary_data_n2_information_ext16->data) { + ogs_error("OpenAPI_inline_object_parseFromJSON() failed [binary_data_n2_information_ext16]"); + goto end; + } + } + + inline_object_local_var = OpenAPI_inline_object_create ( + json_data ? json_data_local_nonprim : NULL, + binary_data_n2_information ? decoded_str_binary_data_n2_information : NULL, + binary_data_n2_information_ext1 ? decoded_str_binary_data_n2_information_ext1 : NULL, + binary_data_n2_information_ext2 ? decoded_str_binary_data_n2_information_ext2 : NULL, + binary_data_n2_information_ext3 ? decoded_str_binary_data_n2_information_ext3 : NULL, + binary_data_n2_information_ext4 ? decoded_str_binary_data_n2_information_ext4 : NULL, + binary_data_n2_information_ext5 ? decoded_str_binary_data_n2_information_ext5 : NULL, + binary_data_n2_information_ext6 ? decoded_str_binary_data_n2_information_ext6 : NULL, + binary_data_n2_information_ext7 ? decoded_str_binary_data_n2_information_ext7 : NULL, + binary_data_n2_information_ext8 ? decoded_str_binary_data_n2_information_ext8 : NULL, + binary_data_n2_information_ext9 ? decoded_str_binary_data_n2_information_ext9 : NULL, + binary_data_n2_information_ext10 ? decoded_str_binary_data_n2_information_ext10 : NULL, + binary_data_n2_information_ext11 ? decoded_str_binary_data_n2_information_ext11 : NULL, + binary_data_n2_information_ext12 ? decoded_str_binary_data_n2_information_ext12 : NULL, + binary_data_n2_information_ext13 ? decoded_str_binary_data_n2_information_ext13 : NULL, + binary_data_n2_information_ext14 ? decoded_str_binary_data_n2_information_ext14 : NULL, + binary_data_n2_information_ext15 ? decoded_str_binary_data_n2_information_ext15 : NULL, + binary_data_n2_information_ext16 ? decoded_str_binary_data_n2_information_ext16 : NULL + ); + + return inline_object_local_var; +end: + return NULL; +} + +OpenAPI_inline_object_t *OpenAPI_inline_object_copy(OpenAPI_inline_object_t *dst, OpenAPI_inline_object_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_inline_object_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_inline_object_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_inline_object_free(dst); + dst = OpenAPI_inline_object_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/inline_object.h b/lib/sbi/openapi/model/inline_object.h new file mode 100644 index 000000000..817fc7627 --- /dev/null +++ b/lib/sbi/openapi/model/inline_object.h @@ -0,0 +1,73 @@ +/* + * inline_object.h + * + * + */ + +#ifndef _OpenAPI_inline_object_H_ +#define _OpenAPI_inline_object_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ue_context_create_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_inline_object_s OpenAPI_inline_object_t; +typedef struct OpenAPI_inline_object_s { + struct OpenAPI_ue_context_create_data_s *json_data; + OpenAPI_binary_t* binary_data_n2_information; + OpenAPI_binary_t* binary_data_n2_information_ext1; + OpenAPI_binary_t* binary_data_n2_information_ext2; + OpenAPI_binary_t* binary_data_n2_information_ext3; + OpenAPI_binary_t* binary_data_n2_information_ext4; + OpenAPI_binary_t* binary_data_n2_information_ext5; + OpenAPI_binary_t* binary_data_n2_information_ext6; + OpenAPI_binary_t* binary_data_n2_information_ext7; + OpenAPI_binary_t* binary_data_n2_information_ext8; + OpenAPI_binary_t* binary_data_n2_information_ext9; + OpenAPI_binary_t* binary_data_n2_information_ext10; + OpenAPI_binary_t* binary_data_n2_information_ext11; + OpenAPI_binary_t* binary_data_n2_information_ext12; + OpenAPI_binary_t* binary_data_n2_information_ext13; + OpenAPI_binary_t* binary_data_n2_information_ext14; + OpenAPI_binary_t* binary_data_n2_information_ext15; + OpenAPI_binary_t* binary_data_n2_information_ext16; +} OpenAPI_inline_object_t; + +OpenAPI_inline_object_t *OpenAPI_inline_object_create( + OpenAPI_ue_context_create_data_t *json_data, + OpenAPI_binary_t* binary_data_n2_information, + OpenAPI_binary_t* binary_data_n2_information_ext1, + OpenAPI_binary_t* binary_data_n2_information_ext2, + OpenAPI_binary_t* binary_data_n2_information_ext3, + OpenAPI_binary_t* binary_data_n2_information_ext4, + OpenAPI_binary_t* binary_data_n2_information_ext5, + OpenAPI_binary_t* binary_data_n2_information_ext6, + OpenAPI_binary_t* binary_data_n2_information_ext7, + OpenAPI_binary_t* binary_data_n2_information_ext8, + OpenAPI_binary_t* binary_data_n2_information_ext9, + OpenAPI_binary_t* binary_data_n2_information_ext10, + OpenAPI_binary_t* binary_data_n2_information_ext11, + OpenAPI_binary_t* binary_data_n2_information_ext12, + OpenAPI_binary_t* binary_data_n2_information_ext13, + OpenAPI_binary_t* binary_data_n2_information_ext14, + OpenAPI_binary_t* binary_data_n2_information_ext15, + OpenAPI_binary_t* binary_data_n2_information_ext16 + ); +void OpenAPI_inline_object_free(OpenAPI_inline_object_t *inline_object); +OpenAPI_inline_object_t *OpenAPI_inline_object_parseFromJSON(cJSON *inline_objectJSON); +cJSON *OpenAPI_inline_object_convertToJSON(OpenAPI_inline_object_t *inline_object); +OpenAPI_inline_object_t *OpenAPI_inline_object_copy(OpenAPI_inline_object_t *dst, OpenAPI_inline_object_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_inline_object_H_ */ + diff --git a/lib/sbi/openapi/model/inline_object_1.c b/lib/sbi/openapi/model/inline_object_1.c new file mode 100644 index 000000000..5dd8b9c08 --- /dev/null +++ b/lib/sbi/openapi/model/inline_object_1.c @@ -0,0 +1,137 @@ + +#include +#include +#include +#include "inline_object_1.h" + +OpenAPI_inline_object_1_t *OpenAPI_inline_object_1_create( + OpenAPI_n1_message_notification_t *json_data, + OpenAPI_binary_t* binary_data_n1_message + ) +{ + OpenAPI_inline_object_1_t *inline_object_1_local_var = OpenAPI_malloc(sizeof(OpenAPI_inline_object_1_t)); + if (!inline_object_1_local_var) { + return NULL; + } + inline_object_1_local_var->json_data = json_data; + inline_object_1_local_var->binary_data_n1_message = binary_data_n1_message; + + return inline_object_1_local_var; +} + +void OpenAPI_inline_object_1_free(OpenAPI_inline_object_1_t *inline_object_1) +{ + if (NULL == inline_object_1) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n1_message_notification_free(inline_object_1->json_data); + ogs_free(inline_object_1->binary_data_n1_message->data); + ogs_free(inline_object_1); +} + +cJSON *OpenAPI_inline_object_1_convertToJSON(OpenAPI_inline_object_1_t *inline_object_1) +{ + cJSON *item = NULL; + + if (inline_object_1 == NULL) { + ogs_error("OpenAPI_inline_object_1_convertToJSON() failed [inline_object_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (inline_object_1->json_data) { + cJSON *json_data_local_JSON = OpenAPI_n1_message_notification_convertToJSON(inline_object_1->json_data); + if (json_data_local_JSON == NULL) { + ogs_error("OpenAPI_inline_object_1_convertToJSON() failed [json_data]"); + goto end; + } + cJSON_AddItemToObject(item, "jsonData", json_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_inline_object_1_convertToJSON() failed [json_data]"); + goto end; + } + } + + if (inline_object_1->binary_data_n1_message) { + char* encoded_str_binary_data_n1_message = OpenAPI_base64encode(inline_object_1->binary_data_n1_message->data,inline_object_1->binary_data_n1_message->len); + if (cJSON_AddStringToObject(item, "binaryDataN1Message", encoded_str_binary_data_n1_message) == NULL) { + ogs_error("OpenAPI_inline_object_1_convertToJSON() failed [binary_data_n1_message]"); + goto end; + } + ogs_free(encoded_str_binary_data_n1_message); + } + +end: + return item; +} + +OpenAPI_inline_object_1_t *OpenAPI_inline_object_1_parseFromJSON(cJSON *inline_object_1JSON) +{ + OpenAPI_inline_object_1_t *inline_object_1_local_var = NULL; + cJSON *json_data = cJSON_GetObjectItemCaseSensitive(inline_object_1JSON, "jsonData"); + + OpenAPI_n1_message_notification_t *json_data_local_nonprim = NULL; + if (json_data) { + json_data_local_nonprim = OpenAPI_n1_message_notification_parseFromJSON(json_data); + } + + cJSON *binary_data_n1_message = cJSON_GetObjectItemCaseSensitive(inline_object_1JSON, "binaryDataN1Message"); + + OpenAPI_binary_t* decoded_str_binary_data_n1_message = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n1_message) { + if (!cJSON_IsString(binary_data_n1_message)) { + ogs_error("OpenAPI_inline_object_1_parseFromJSON() failed [binary_data_n1_message]"); + goto end; + } + decoded_str_binary_data_n1_message->data = OpenAPI_base64decode(binary_data_n1_message->valuestring, strlen(binary_data_n1_message->valuestring), &decoded_str_binary_data_n1_message->len); + if (!decoded_str_binary_data_n1_message->data) { + ogs_error("OpenAPI_inline_object_1_parseFromJSON() failed [binary_data_n1_message]"); + goto end; + } + } + + inline_object_1_local_var = OpenAPI_inline_object_1_create ( + json_data ? json_data_local_nonprim : NULL, + binary_data_n1_message ? decoded_str_binary_data_n1_message : NULL + ); + + return inline_object_1_local_var; +end: + return NULL; +} + +OpenAPI_inline_object_1_t *OpenAPI_inline_object_1_copy(OpenAPI_inline_object_1_t *dst, OpenAPI_inline_object_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_inline_object_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_inline_object_1_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_inline_object_1_free(dst); + dst = OpenAPI_inline_object_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/inline_object_1.h b/lib/sbi/openapi/model/inline_object_1.h new file mode 100644 index 000000000..03423c353 --- /dev/null +++ b/lib/sbi/openapi/model/inline_object_1.h @@ -0,0 +1,41 @@ +/* + * inline_object_1.h + * + * + */ + +#ifndef _OpenAPI_inline_object_1_H_ +#define _OpenAPI_inline_object_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n1_message_notification.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_inline_object_1_s OpenAPI_inline_object_1_t; +typedef struct OpenAPI_inline_object_1_s { + struct OpenAPI_n1_message_notification_s *json_data; + OpenAPI_binary_t* binary_data_n1_message; +} OpenAPI_inline_object_1_t; + +OpenAPI_inline_object_1_t *OpenAPI_inline_object_1_create( + OpenAPI_n1_message_notification_t *json_data, + OpenAPI_binary_t* binary_data_n1_message + ); +void OpenAPI_inline_object_1_free(OpenAPI_inline_object_1_t *inline_object_1); +OpenAPI_inline_object_1_t *OpenAPI_inline_object_1_parseFromJSON(cJSON *inline_object_1JSON); +cJSON *OpenAPI_inline_object_1_convertToJSON(OpenAPI_inline_object_1_t *inline_object_1); +OpenAPI_inline_object_1_t *OpenAPI_inline_object_1_copy(OpenAPI_inline_object_1_t *dst, OpenAPI_inline_object_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_inline_object_1_H_ */ + diff --git a/lib/sbi/openapi/model/inline_object_2.c b/lib/sbi/openapi/model/inline_object_2.c new file mode 100644 index 000000000..b27b97bc6 --- /dev/null +++ b/lib/sbi/openapi/model/inline_object_2.c @@ -0,0 +1,165 @@ + +#include +#include +#include +#include "inline_object_2.h" + +OpenAPI_inline_object_2_t *OpenAPI_inline_object_2_create( + OpenAPI_n2_information_notification_t *json_data, + OpenAPI_binary_t* binary_data_n1_message, + OpenAPI_binary_t* binary_data_n2_information + ) +{ + OpenAPI_inline_object_2_t *inline_object_2_local_var = OpenAPI_malloc(sizeof(OpenAPI_inline_object_2_t)); + if (!inline_object_2_local_var) { + return NULL; + } + inline_object_2_local_var->json_data = json_data; + inline_object_2_local_var->binary_data_n1_message = binary_data_n1_message; + inline_object_2_local_var->binary_data_n2_information = binary_data_n2_information; + + return inline_object_2_local_var; +} + +void OpenAPI_inline_object_2_free(OpenAPI_inline_object_2_t *inline_object_2) +{ + if (NULL == inline_object_2) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n2_information_notification_free(inline_object_2->json_data); + ogs_free(inline_object_2->binary_data_n1_message->data); + ogs_free(inline_object_2->binary_data_n2_information->data); + ogs_free(inline_object_2); +} + +cJSON *OpenAPI_inline_object_2_convertToJSON(OpenAPI_inline_object_2_t *inline_object_2) +{ + cJSON *item = NULL; + + if (inline_object_2 == NULL) { + ogs_error("OpenAPI_inline_object_2_convertToJSON() failed [inline_object_2]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (inline_object_2->json_data) { + cJSON *json_data_local_JSON = OpenAPI_n2_information_notification_convertToJSON(inline_object_2->json_data); + if (json_data_local_JSON == NULL) { + ogs_error("OpenAPI_inline_object_2_convertToJSON() failed [json_data]"); + goto end; + } + cJSON_AddItemToObject(item, "jsonData", json_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_inline_object_2_convertToJSON() failed [json_data]"); + goto end; + } + } + + if (inline_object_2->binary_data_n1_message) { + char* encoded_str_binary_data_n1_message = OpenAPI_base64encode(inline_object_2->binary_data_n1_message->data,inline_object_2->binary_data_n1_message->len); + if (cJSON_AddStringToObject(item, "binaryDataN1Message", encoded_str_binary_data_n1_message) == NULL) { + ogs_error("OpenAPI_inline_object_2_convertToJSON() failed [binary_data_n1_message]"); + goto end; + } + ogs_free(encoded_str_binary_data_n1_message); + } + + if (inline_object_2->binary_data_n2_information) { + char* encoded_str_binary_data_n2_information = OpenAPI_base64encode(inline_object_2->binary_data_n2_information->data,inline_object_2->binary_data_n2_information->len); + if (cJSON_AddStringToObject(item, "binaryDataN2Information", encoded_str_binary_data_n2_information) == NULL) { + ogs_error("OpenAPI_inline_object_2_convertToJSON() failed [binary_data_n2_information]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information); + } + +end: + return item; +} + +OpenAPI_inline_object_2_t *OpenAPI_inline_object_2_parseFromJSON(cJSON *inline_object_2JSON) +{ + OpenAPI_inline_object_2_t *inline_object_2_local_var = NULL; + cJSON *json_data = cJSON_GetObjectItemCaseSensitive(inline_object_2JSON, "jsonData"); + + OpenAPI_n2_information_notification_t *json_data_local_nonprim = NULL; + if (json_data) { + json_data_local_nonprim = OpenAPI_n2_information_notification_parseFromJSON(json_data); + } + + cJSON *binary_data_n1_message = cJSON_GetObjectItemCaseSensitive(inline_object_2JSON, "binaryDataN1Message"); + + OpenAPI_binary_t* decoded_str_binary_data_n1_message = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n1_message) { + if (!cJSON_IsString(binary_data_n1_message)) { + ogs_error("OpenAPI_inline_object_2_parseFromJSON() failed [binary_data_n1_message]"); + goto end; + } + decoded_str_binary_data_n1_message->data = OpenAPI_base64decode(binary_data_n1_message->valuestring, strlen(binary_data_n1_message->valuestring), &decoded_str_binary_data_n1_message->len); + if (!decoded_str_binary_data_n1_message->data) { + ogs_error("OpenAPI_inline_object_2_parseFromJSON() failed [binary_data_n1_message]"); + goto end; + } + } + + cJSON *binary_data_n2_information = cJSON_GetObjectItemCaseSensitive(inline_object_2JSON, "binaryDataN2Information"); + + OpenAPI_binary_t* decoded_str_binary_data_n2_information = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_data_n2_information) { + if (!cJSON_IsString(binary_data_n2_information)) { + ogs_error("OpenAPI_inline_object_2_parseFromJSON() failed [binary_data_n2_information]"); + goto end; + } + decoded_str_binary_data_n2_information->data = OpenAPI_base64decode(binary_data_n2_information->valuestring, strlen(binary_data_n2_information->valuestring), &decoded_str_binary_data_n2_information->len); + if (!decoded_str_binary_data_n2_information->data) { + ogs_error("OpenAPI_inline_object_2_parseFromJSON() failed [binary_data_n2_information]"); + goto end; + } + } + + inline_object_2_local_var = OpenAPI_inline_object_2_create ( + json_data ? json_data_local_nonprim : NULL, + binary_data_n1_message ? decoded_str_binary_data_n1_message : NULL, + binary_data_n2_information ? decoded_str_binary_data_n2_information : NULL + ); + + return inline_object_2_local_var; +end: + return NULL; +} + +OpenAPI_inline_object_2_t *OpenAPI_inline_object_2_copy(OpenAPI_inline_object_2_t *dst, OpenAPI_inline_object_2_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_inline_object_2_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_inline_object_2_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_inline_object_2_free(dst); + dst = OpenAPI_inline_object_2_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/inline_object_2.h b/lib/sbi/openapi/model/inline_object_2.h new file mode 100644 index 000000000..13a25522b --- /dev/null +++ b/lib/sbi/openapi/model/inline_object_2.h @@ -0,0 +1,43 @@ +/* + * inline_object_2.h + * + * + */ + +#ifndef _OpenAPI_inline_object_2_H_ +#define _OpenAPI_inline_object_2_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_information_notification.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_inline_object_2_s OpenAPI_inline_object_2_t; +typedef struct OpenAPI_inline_object_2_s { + struct OpenAPI_n2_information_notification_s *json_data; + OpenAPI_binary_t* binary_data_n1_message; + OpenAPI_binary_t* binary_data_n2_information; +} OpenAPI_inline_object_2_t; + +OpenAPI_inline_object_2_t *OpenAPI_inline_object_2_create( + OpenAPI_n2_information_notification_t *json_data, + OpenAPI_binary_t* binary_data_n1_message, + OpenAPI_binary_t* binary_data_n2_information + ); +void OpenAPI_inline_object_2_free(OpenAPI_inline_object_2_t *inline_object_2); +OpenAPI_inline_object_2_t *OpenAPI_inline_object_2_parseFromJSON(cJSON *inline_object_2JSON); +cJSON *OpenAPI_inline_object_2_convertToJSON(OpenAPI_inline_object_2_t *inline_object_2); +OpenAPI_inline_object_2_t *OpenAPI_inline_object_2_copy(OpenAPI_inline_object_2_t *dst, OpenAPI_inline_object_2_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_inline_object_2_H_ */ + diff --git a/lib/sbi/openapi/model/inline_object_3.c b/lib/sbi/openapi/model/inline_object_3.c new file mode 100644 index 000000000..2da5c6cfd --- /dev/null +++ b/lib/sbi/openapi/model/inline_object_3.c @@ -0,0 +1,137 @@ + +#include +#include +#include +#include "inline_object_3.h" + +OpenAPI_inline_object_3_t *OpenAPI_inline_object_3_create( + OpenAPI_transfer_mt_data_req_data_t *json_data, + OpenAPI_binary_t* binary_mt_data + ) +{ + OpenAPI_inline_object_3_t *inline_object_3_local_var = OpenAPI_malloc(sizeof(OpenAPI_inline_object_3_t)); + if (!inline_object_3_local_var) { + return NULL; + } + inline_object_3_local_var->json_data = json_data; + inline_object_3_local_var->binary_mt_data = binary_mt_data; + + return inline_object_3_local_var; +} + +void OpenAPI_inline_object_3_free(OpenAPI_inline_object_3_t *inline_object_3) +{ + if (NULL == inline_object_3) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_transfer_mt_data_req_data_free(inline_object_3->json_data); + ogs_free(inline_object_3->binary_mt_data->data); + ogs_free(inline_object_3); +} + +cJSON *OpenAPI_inline_object_3_convertToJSON(OpenAPI_inline_object_3_t *inline_object_3) +{ + cJSON *item = NULL; + + if (inline_object_3 == NULL) { + ogs_error("OpenAPI_inline_object_3_convertToJSON() failed [inline_object_3]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (inline_object_3->json_data) { + cJSON *json_data_local_JSON = OpenAPI_transfer_mt_data_req_data_convertToJSON(inline_object_3->json_data); + if (json_data_local_JSON == NULL) { + ogs_error("OpenAPI_inline_object_3_convertToJSON() failed [json_data]"); + goto end; + } + cJSON_AddItemToObject(item, "jsonData", json_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_inline_object_3_convertToJSON() failed [json_data]"); + goto end; + } + } + + if (inline_object_3->binary_mt_data) { + char* encoded_str_binary_mt_data = OpenAPI_base64encode(inline_object_3->binary_mt_data->data,inline_object_3->binary_mt_data->len); + if (cJSON_AddStringToObject(item, "binaryMtData", encoded_str_binary_mt_data) == NULL) { + ogs_error("OpenAPI_inline_object_3_convertToJSON() failed [binary_mt_data]"); + goto end; + } + ogs_free(encoded_str_binary_mt_data); + } + +end: + return item; +} + +OpenAPI_inline_object_3_t *OpenAPI_inline_object_3_parseFromJSON(cJSON *inline_object_3JSON) +{ + OpenAPI_inline_object_3_t *inline_object_3_local_var = NULL; + cJSON *json_data = cJSON_GetObjectItemCaseSensitive(inline_object_3JSON, "jsonData"); + + OpenAPI_transfer_mt_data_req_data_t *json_data_local_nonprim = NULL; + if (json_data) { + json_data_local_nonprim = OpenAPI_transfer_mt_data_req_data_parseFromJSON(json_data); + } + + cJSON *binary_mt_data = cJSON_GetObjectItemCaseSensitive(inline_object_3JSON, "binaryMtData"); + + OpenAPI_binary_t* decoded_str_binary_mt_data = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_mt_data) { + if (!cJSON_IsString(binary_mt_data)) { + ogs_error("OpenAPI_inline_object_3_parseFromJSON() failed [binary_mt_data]"); + goto end; + } + decoded_str_binary_mt_data->data = OpenAPI_base64decode(binary_mt_data->valuestring, strlen(binary_mt_data->valuestring), &decoded_str_binary_mt_data->len); + if (!decoded_str_binary_mt_data->data) { + ogs_error("OpenAPI_inline_object_3_parseFromJSON() failed [binary_mt_data]"); + goto end; + } + } + + inline_object_3_local_var = OpenAPI_inline_object_3_create ( + json_data ? json_data_local_nonprim : NULL, + binary_mt_data ? decoded_str_binary_mt_data : NULL + ); + + return inline_object_3_local_var; +end: + return NULL; +} + +OpenAPI_inline_object_3_t *OpenAPI_inline_object_3_copy(OpenAPI_inline_object_3_t *dst, OpenAPI_inline_object_3_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_inline_object_3_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_inline_object_3_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_inline_object_3_free(dst); + dst = OpenAPI_inline_object_3_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/inline_object_3.h b/lib/sbi/openapi/model/inline_object_3.h new file mode 100644 index 000000000..c28b54a2a --- /dev/null +++ b/lib/sbi/openapi/model/inline_object_3.h @@ -0,0 +1,41 @@ +/* + * inline_object_3.h + * + * + */ + +#ifndef _OpenAPI_inline_object_3_H_ +#define _OpenAPI_inline_object_3_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "transfer_mt_data_req_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_inline_object_3_s OpenAPI_inline_object_3_t; +typedef struct OpenAPI_inline_object_3_s { + struct OpenAPI_transfer_mt_data_req_data_s *json_data; + OpenAPI_binary_t* binary_mt_data; +} OpenAPI_inline_object_3_t; + +OpenAPI_inline_object_3_t *OpenAPI_inline_object_3_create( + OpenAPI_transfer_mt_data_req_data_t *json_data, + OpenAPI_binary_t* binary_mt_data + ); +void OpenAPI_inline_object_3_free(OpenAPI_inline_object_3_t *inline_object_3); +OpenAPI_inline_object_3_t *OpenAPI_inline_object_3_parseFromJSON(cJSON *inline_object_3JSON); +cJSON *OpenAPI_inline_object_3_convertToJSON(OpenAPI_inline_object_3_t *inline_object_3); +OpenAPI_inline_object_3_t *OpenAPI_inline_object_3_copy(OpenAPI_inline_object_3_t *dst, OpenAPI_inline_object_3_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_inline_object_3_H_ */ + diff --git a/lib/sbi/openapi/model/inline_object_4.c b/lib/sbi/openapi/model/inline_object_4.c new file mode 100644 index 000000000..2b6c1eb01 --- /dev/null +++ b/lib/sbi/openapi/model/inline_object_4.c @@ -0,0 +1,137 @@ + +#include +#include +#include +#include "inline_object_4.h" + +OpenAPI_inline_object_4_t *OpenAPI_inline_object_4_create( + OpenAPI_transfer_mo_data_req_data_t *json_data, + OpenAPI_binary_t* binary_mo_data + ) +{ + OpenAPI_inline_object_4_t *inline_object_4_local_var = OpenAPI_malloc(sizeof(OpenAPI_inline_object_4_t)); + if (!inline_object_4_local_var) { + return NULL; + } + inline_object_4_local_var->json_data = json_data; + inline_object_4_local_var->binary_mo_data = binary_mo_data; + + return inline_object_4_local_var; +} + +void OpenAPI_inline_object_4_free(OpenAPI_inline_object_4_t *inline_object_4) +{ + if (NULL == inline_object_4) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_transfer_mo_data_req_data_free(inline_object_4->json_data); + ogs_free(inline_object_4->binary_mo_data->data); + ogs_free(inline_object_4); +} + +cJSON *OpenAPI_inline_object_4_convertToJSON(OpenAPI_inline_object_4_t *inline_object_4) +{ + cJSON *item = NULL; + + if (inline_object_4 == NULL) { + ogs_error("OpenAPI_inline_object_4_convertToJSON() failed [inline_object_4]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (inline_object_4->json_data) { + cJSON *json_data_local_JSON = OpenAPI_transfer_mo_data_req_data_convertToJSON(inline_object_4->json_data); + if (json_data_local_JSON == NULL) { + ogs_error("OpenAPI_inline_object_4_convertToJSON() failed [json_data]"); + goto end; + } + cJSON_AddItemToObject(item, "jsonData", json_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_inline_object_4_convertToJSON() failed [json_data]"); + goto end; + } + } + + if (inline_object_4->binary_mo_data) { + char* encoded_str_binary_mo_data = OpenAPI_base64encode(inline_object_4->binary_mo_data->data,inline_object_4->binary_mo_data->len); + if (cJSON_AddStringToObject(item, "binaryMoData", encoded_str_binary_mo_data) == NULL) { + ogs_error("OpenAPI_inline_object_4_convertToJSON() failed [binary_mo_data]"); + goto end; + } + ogs_free(encoded_str_binary_mo_data); + } + +end: + return item; +} + +OpenAPI_inline_object_4_t *OpenAPI_inline_object_4_parseFromJSON(cJSON *inline_object_4JSON) +{ + OpenAPI_inline_object_4_t *inline_object_4_local_var = NULL; + cJSON *json_data = cJSON_GetObjectItemCaseSensitive(inline_object_4JSON, "jsonData"); + + OpenAPI_transfer_mo_data_req_data_t *json_data_local_nonprim = NULL; + if (json_data) { + json_data_local_nonprim = OpenAPI_transfer_mo_data_req_data_parseFromJSON(json_data); + } + + cJSON *binary_mo_data = cJSON_GetObjectItemCaseSensitive(inline_object_4JSON, "binaryMoData"); + + OpenAPI_binary_t* decoded_str_binary_mo_data = OpenAPI_malloc(sizeof(OpenAPI_binary_t)); + if (binary_mo_data) { + if (!cJSON_IsString(binary_mo_data)) { + ogs_error("OpenAPI_inline_object_4_parseFromJSON() failed [binary_mo_data]"); + goto end; + } + decoded_str_binary_mo_data->data = OpenAPI_base64decode(binary_mo_data->valuestring, strlen(binary_mo_data->valuestring), &decoded_str_binary_mo_data->len); + if (!decoded_str_binary_mo_data->data) { + ogs_error("OpenAPI_inline_object_4_parseFromJSON() failed [binary_mo_data]"); + goto end; + } + } + + inline_object_4_local_var = OpenAPI_inline_object_4_create ( + json_data ? json_data_local_nonprim : NULL, + binary_mo_data ? decoded_str_binary_mo_data : NULL + ); + + return inline_object_4_local_var; +end: + return NULL; +} + +OpenAPI_inline_object_4_t *OpenAPI_inline_object_4_copy(OpenAPI_inline_object_4_t *dst, OpenAPI_inline_object_4_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_inline_object_4_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_inline_object_4_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_inline_object_4_free(dst); + dst = OpenAPI_inline_object_4_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/inline_object_4.h b/lib/sbi/openapi/model/inline_object_4.h new file mode 100644 index 000000000..762f8cf2e --- /dev/null +++ b/lib/sbi/openapi/model/inline_object_4.h @@ -0,0 +1,41 @@ +/* + * inline_object_4.h + * + * + */ + +#ifndef _OpenAPI_inline_object_4_H_ +#define _OpenAPI_inline_object_4_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "transfer_mo_data_req_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_inline_object_4_s OpenAPI_inline_object_4_t; +typedef struct OpenAPI_inline_object_4_s { + struct OpenAPI_transfer_mo_data_req_data_s *json_data; + OpenAPI_binary_t* binary_mo_data; +} OpenAPI_inline_object_4_t; + +OpenAPI_inline_object_4_t *OpenAPI_inline_object_4_create( + OpenAPI_transfer_mo_data_req_data_t *json_data, + OpenAPI_binary_t* binary_mo_data + ); +void OpenAPI_inline_object_4_free(OpenAPI_inline_object_4_t *inline_object_4); +OpenAPI_inline_object_4_t *OpenAPI_inline_object_4_parseFromJSON(cJSON *inline_object_4JSON); +cJSON *OpenAPI_inline_object_4_convertToJSON(OpenAPI_inline_object_4_t *inline_object_4); +OpenAPI_inline_object_4_t *OpenAPI_inline_object_4_copy(OpenAPI_inline_object_4_t *dst, OpenAPI_inline_object_4_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_inline_object_4_H_ */ + diff --git a/lib/sbi/openapi/model/inline_response_200.c b/lib/sbi/openapi/model/inline_response_200.c index 8a6427497..87b8b07d8 100644 --- a/lib/sbi/openapi/model/inline_response_200.c +++ b/lib/sbi/openapi/model/inline_response_200.c @@ -102,3 +102,37 @@ end: return NULL; } +OpenAPI_inline_response_200_t *OpenAPI_inline_response_200_copy(OpenAPI_inline_response_200_t *dst, OpenAPI_inline_response_200_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_inline_response_200_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_inline_response_200_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_inline_response_200_free(dst); + dst = OpenAPI_inline_response_200_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/inline_response_200.h b/lib/sbi/openapi/model/inline_response_200.h index d42eb902a..f6edc29f2 100644 --- a/lib/sbi/openapi/model/inline_response_200.h +++ b/lib/sbi/openapi/model/inline_response_200.h @@ -29,6 +29,7 @@ OpenAPI_inline_response_200_t *OpenAPI_inline_response_200_create( void OpenAPI_inline_response_200_free(OpenAPI_inline_response_200_t *inline_response_200); OpenAPI_inline_response_200_t *OpenAPI_inline_response_200_parseFromJSON(cJSON *inline_response_200JSON); cJSON *OpenAPI_inline_response_200_convertToJSON(OpenAPI_inline_response_200_t *inline_response_200); +OpenAPI_inline_response_200_t *OpenAPI_inline_response_200_copy(OpenAPI_inline_response_200_t *dst, OpenAPI_inline_response_200_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/integrity_algorithm.c b/lib/sbi/openapi/model/integrity_algorithm.c new file mode 100644 index 000000000..cf132cc91 --- /dev/null +++ b/lib/sbi/openapi/model/integrity_algorithm.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "integrity_algorithm.h" + +char* OpenAPI_integrity_algorithm_ToString(OpenAPI_integrity_algorithm_e integrity_algorithm) +{ + const char *integrity_algorithmArray[] = { "NULL", "NIA0", "NIA1", "NIA2", "NIA3" }; + size_t sizeofArray = sizeof(integrity_algorithmArray) / sizeof(integrity_algorithmArray[0]); + if (integrity_algorithm < sizeofArray) + return (char *)integrity_algorithmArray[integrity_algorithm]; + else + return (char *)"Unknown"; +} + +OpenAPI_integrity_algorithm_e OpenAPI_integrity_algorithm_FromString(char* integrity_algorithm) +{ + int stringToReturn = 0; + const char *integrity_algorithmArray[] = { "NULL", "NIA0", "NIA1", "NIA2", "NIA3" }; + size_t sizeofArray = sizeof(integrity_algorithmArray) / sizeof(integrity_algorithmArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(integrity_algorithm, integrity_algorithmArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/integrity_algorithm.h b/lib/sbi/openapi/model/integrity_algorithm.h new file mode 100644 index 000000000..105eb342c --- /dev/null +++ b/lib/sbi/openapi/model/integrity_algorithm.h @@ -0,0 +1,31 @@ +/* + * integrity_algorithm.h + * + * + */ + +#ifndef _OpenAPI_integrity_algorithm_H_ +#define _OpenAPI_integrity_algorithm_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_integrity_algorithm_NULL = 0, OpenAPI_integrity_algorithm_NIA0, OpenAPI_integrity_algorithm_NIA1, OpenAPI_integrity_algorithm_NIA2, OpenAPI_integrity_algorithm_NIA3 } OpenAPI_integrity_algorithm_e; + +char* OpenAPI_integrity_algorithm_ToString(OpenAPI_integrity_algorithm_e integrity_algorithm); + +OpenAPI_integrity_algorithm_e OpenAPI_integrity_algorithm_FromString(char* integrity_algorithm); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_integrity_algorithm_H_ */ + diff --git a/lib/sbi/openapi/model/interface_upf_info_item.c b/lib/sbi/openapi/model/interface_upf_info_item.c index dba1c16c5..73f9d186d 100644 --- a/lib/sbi/openapi/model/interface_upf_info_item.c +++ b/lib/sbi/openapi/model/interface_upf_info_item.c @@ -204,3 +204,37 @@ end: return NULL; } +OpenAPI_interface_upf_info_item_t *OpenAPI_interface_upf_info_item_copy(OpenAPI_interface_upf_info_item_t *dst, OpenAPI_interface_upf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_interface_upf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_interface_upf_info_item_free(dst); + dst = OpenAPI_interface_upf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/interface_upf_info_item.h b/lib/sbi/openapi/model/interface_upf_info_item.h index cde685afb..567db76ae 100644 --- a/lib/sbi/openapi/model/interface_upf_info_item.h +++ b/lib/sbi/openapi/model/interface_upf_info_item.h @@ -37,6 +37,7 @@ OpenAPI_interface_upf_info_item_t *OpenAPI_interface_upf_info_item_create( void OpenAPI_interface_upf_info_item_free(OpenAPI_interface_upf_info_item_t *interface_upf_info_item); OpenAPI_interface_upf_info_item_t *OpenAPI_interface_upf_info_item_parseFromJSON(cJSON *interface_upf_info_itemJSON); cJSON *OpenAPI_interface_upf_info_item_convertToJSON(OpenAPI_interface_upf_info_item_t *interface_upf_info_item); +OpenAPI_interface_upf_info_item_t *OpenAPI_interface_upf_info_item_copy(OpenAPI_interface_upf_info_item_t *dst, OpenAPI_interface_upf_info_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/internal_group_id_range.c b/lib/sbi/openapi/model/internal_group_id_range.c index fc342fe47..5e397a13d 100644 --- a/lib/sbi/openapi/model/internal_group_id_range.c +++ b/lib/sbi/openapi/model/internal_group_id_range.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_internal_group_id_range_t *OpenAPI_internal_group_id_range_copy(OpenAPI_internal_group_id_range_t *dst, OpenAPI_internal_group_id_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_internal_group_id_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_internal_group_id_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_internal_group_id_range_free(dst); + dst = OpenAPI_internal_group_id_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/internal_group_id_range.h b/lib/sbi/openapi/model/internal_group_id_range.h index f4839e679..6f20b662f 100644 --- a/lib/sbi/openapi/model/internal_group_id_range.h +++ b/lib/sbi/openapi/model/internal_group_id_range.h @@ -32,6 +32,7 @@ OpenAPI_internal_group_id_range_t *OpenAPI_internal_group_id_range_create( void OpenAPI_internal_group_id_range_free(OpenAPI_internal_group_id_range_t *internal_group_id_range); OpenAPI_internal_group_id_range_t *OpenAPI_internal_group_id_range_parseFromJSON(cJSON *internal_group_id_rangeJSON); cJSON *OpenAPI_internal_group_id_range_convertToJSON(OpenAPI_internal_group_id_range_t *internal_group_id_range); +OpenAPI_internal_group_id_range_t *OpenAPI_internal_group_id_range_copy(OpenAPI_internal_group_id_range_t *dst, OpenAPI_internal_group_id_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/invalid_param.c b/lib/sbi/openapi/model/invalid_param.c index 8b0b37d5d..33232b1a7 100644 --- a/lib/sbi/openapi/model/invalid_param.c +++ b/lib/sbi/openapi/model/invalid_param.c @@ -94,3 +94,37 @@ end: return NULL; } +OpenAPI_invalid_param_t *OpenAPI_invalid_param_copy(OpenAPI_invalid_param_t *dst, OpenAPI_invalid_param_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_invalid_param_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_invalid_param_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_invalid_param_free(dst); + dst = OpenAPI_invalid_param_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/invalid_param.h b/lib/sbi/openapi/model/invalid_param.h index 74c94e0c4..2fc3ea628 100644 --- a/lib/sbi/openapi/model/invalid_param.h +++ b/lib/sbi/openapi/model/invalid_param.h @@ -30,6 +30,7 @@ OpenAPI_invalid_param_t *OpenAPI_invalid_param_create( void OpenAPI_invalid_param_free(OpenAPI_invalid_param_t *invalid_param); OpenAPI_invalid_param_t *OpenAPI_invalid_param_parseFromJSON(cJSON *invalid_paramJSON); cJSON *OpenAPI_invalid_param_convertToJSON(OpenAPI_invalid_param_t *invalid_param); +OpenAPI_invalid_param_t *OpenAPI_invalid_param_copy(OpenAPI_invalid_param_t *dst, OpenAPI_invalid_param_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ip_address.c b/lib/sbi/openapi/model/ip_address.c index 52843c362..9f746ad24 100644 --- a/lib/sbi/openapi/model/ip_address.c +++ b/lib/sbi/openapi/model/ip_address.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_ip_address_t *OpenAPI_ip_address_copy(OpenAPI_ip_address_t *dst, OpenAPI_ip_address_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_address_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_address_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ip_address_free(dst); + dst = OpenAPI_ip_address_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_address.h b/lib/sbi/openapi/model/ip_address.h index 510d314bd..e84802f19 100644 --- a/lib/sbi/openapi/model/ip_address.h +++ b/lib/sbi/openapi/model/ip_address.h @@ -32,6 +32,7 @@ OpenAPI_ip_address_t *OpenAPI_ip_address_create( void OpenAPI_ip_address_free(OpenAPI_ip_address_t *ip_address); OpenAPI_ip_address_t *OpenAPI_ip_address_parseFromJSON(cJSON *ip_addressJSON); cJSON *OpenAPI_ip_address_convertToJSON(OpenAPI_ip_address_t *ip_address); +OpenAPI_ip_address_t *OpenAPI_ip_address_copy(OpenAPI_ip_address_t *dst, OpenAPI_ip_address_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ip_end_point.c b/lib/sbi/openapi/model/ip_end_point.c index ddb0b12bd..2aef494cd 100644 --- a/lib/sbi/openapi/model/ip_end_point.c +++ b/lib/sbi/openapi/model/ip_end_point.c @@ -132,3 +132,37 @@ end: return NULL; } +OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_copy(OpenAPI_ip_end_point_t *dst, OpenAPI_ip_end_point_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_end_point_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_end_point_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ip_end_point_free(dst); + dst = OpenAPI_ip_end_point_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_end_point.h b/lib/sbi/openapi/model/ip_end_point.h index c02681478..ad1beea60 100644 --- a/lib/sbi/openapi/model/ip_end_point.h +++ b/lib/sbi/openapi/model/ip_end_point.h @@ -35,6 +35,7 @@ OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_create( void OpenAPI_ip_end_point_free(OpenAPI_ip_end_point_t *ip_end_point); OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_parseFromJSON(cJSON *ip_end_pointJSON); cJSON *OpenAPI_ip_end_point_convertToJSON(OpenAPI_ip_end_point_t *ip_end_point); +OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_copy(OpenAPI_ip_end_point_t *dst, OpenAPI_ip_end_point_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/iptv_config_data.c b/lib/sbi/openapi/model/iptv_config_data.c index 7bbb42212..0538abcf4 100644 --- a/lib/sbi/openapi/model/iptv_config_data.c +++ b/lib/sbi/openapi/model/iptv_config_data.c @@ -241,3 +241,37 @@ end: return NULL; } +OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_copy(OpenAPI_iptv_config_data_t *dst, OpenAPI_iptv_config_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_iptv_config_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_iptv_config_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_iptv_config_data_free(dst); + dst = OpenAPI_iptv_config_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/iptv_config_data.h b/lib/sbi/openapi/model/iptv_config_data.h index 15f827a68..866faf377 100644 --- a/lib/sbi/openapi/model/iptv_config_data.h +++ b/lib/sbi/openapi/model/iptv_config_data.h @@ -42,6 +42,7 @@ OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_create( void OpenAPI_iptv_config_data_free(OpenAPI_iptv_config_data_t *iptv_config_data); OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_parseFromJSON(cJSON *iptv_config_dataJSON); cJSON *OpenAPI_iptv_config_data_convertToJSON(OpenAPI_iptv_config_data_t *iptv_config_data); +OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_copy(OpenAPI_iptv_config_data_t *dst, OpenAPI_iptv_config_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/iptv_config_data_patch.c b/lib/sbi/openapi/model/iptv_config_data_patch.c index 6ece43ba4..d5f0c3a08 100644 --- a/lib/sbi/openapi/model/iptv_config_data_patch.c +++ b/lib/sbi/openapi/model/iptv_config_data_patch.c @@ -102,3 +102,37 @@ end: return NULL; } +OpenAPI_iptv_config_data_patch_t *OpenAPI_iptv_config_data_patch_copy(OpenAPI_iptv_config_data_patch_t *dst, OpenAPI_iptv_config_data_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_iptv_config_data_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_iptv_config_data_patch_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_iptv_config_data_patch_free(dst); + dst = OpenAPI_iptv_config_data_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/iptv_config_data_patch.h b/lib/sbi/openapi/model/iptv_config_data_patch.h index 776c6e89f..c6d79240e 100644 --- a/lib/sbi/openapi/model/iptv_config_data_patch.h +++ b/lib/sbi/openapi/model/iptv_config_data_patch.h @@ -29,6 +29,7 @@ OpenAPI_iptv_config_data_patch_t *OpenAPI_iptv_config_data_patch_create( void OpenAPI_iptv_config_data_patch_free(OpenAPI_iptv_config_data_patch_t *iptv_config_data_patch); OpenAPI_iptv_config_data_patch_t *OpenAPI_iptv_config_data_patch_parseFromJSON(cJSON *iptv_config_data_patchJSON); cJSON *OpenAPI_iptv_config_data_patch_convertToJSON(OpenAPI_iptv_config_data_patch_t *iptv_config_data_patch); +OpenAPI_iptv_config_data_patch_t *OpenAPI_iptv_config_data_patch_copy(OpenAPI_iptv_config_data_patch_t *dst, OpenAPI_iptv_config_data_patch_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ipv4_address_range.c b/lib/sbi/openapi/model/ipv4_address_range.c index 7a953003e..3462f8d17 100644 --- a/lib/sbi/openapi/model/ipv4_address_range.c +++ b/lib/sbi/openapi/model/ipv4_address_range.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_ipv4_address_range_t *OpenAPI_ipv4_address_range_copy(OpenAPI_ipv4_address_range_t *dst, OpenAPI_ipv4_address_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ipv4_address_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ipv4_address_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ipv4_address_range_free(dst); + dst = OpenAPI_ipv4_address_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ipv4_address_range.h b/lib/sbi/openapi/model/ipv4_address_range.h index eb2ae1482..d4d0ee699 100644 --- a/lib/sbi/openapi/model/ipv4_address_range.h +++ b/lib/sbi/openapi/model/ipv4_address_range.h @@ -30,6 +30,7 @@ OpenAPI_ipv4_address_range_t *OpenAPI_ipv4_address_range_create( void OpenAPI_ipv4_address_range_free(OpenAPI_ipv4_address_range_t *ipv4_address_range); OpenAPI_ipv4_address_range_t *OpenAPI_ipv4_address_range_parseFromJSON(cJSON *ipv4_address_rangeJSON); cJSON *OpenAPI_ipv4_address_range_convertToJSON(OpenAPI_ipv4_address_range_t *ipv4_address_range); +OpenAPI_ipv4_address_range_t *OpenAPI_ipv4_address_range_copy(OpenAPI_ipv4_address_range_t *dst, OpenAPI_ipv4_address_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ipv6_prefix_range.c b/lib/sbi/openapi/model/ipv6_prefix_range.c index ef0a8fe65..a2ce337b0 100644 --- a/lib/sbi/openapi/model/ipv6_prefix_range.c +++ b/lib/sbi/openapi/model/ipv6_prefix_range.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_ipv6_prefix_range_t *OpenAPI_ipv6_prefix_range_copy(OpenAPI_ipv6_prefix_range_t *dst, OpenAPI_ipv6_prefix_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ipv6_prefix_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ipv6_prefix_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ipv6_prefix_range_free(dst); + dst = OpenAPI_ipv6_prefix_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ipv6_prefix_range.h b/lib/sbi/openapi/model/ipv6_prefix_range.h index fc774a5c0..e4ef20b84 100644 --- a/lib/sbi/openapi/model/ipv6_prefix_range.h +++ b/lib/sbi/openapi/model/ipv6_prefix_range.h @@ -30,6 +30,7 @@ OpenAPI_ipv6_prefix_range_t *OpenAPI_ipv6_prefix_range_create( void OpenAPI_ipv6_prefix_range_free(OpenAPI_ipv6_prefix_range_t *ipv6_prefix_range); OpenAPI_ipv6_prefix_range_t *OpenAPI_ipv6_prefix_range_parseFromJSON(cJSON *ipv6_prefix_rangeJSON); cJSON *OpenAPI_ipv6_prefix_range_convertToJSON(OpenAPI_ipv6_prefix_range_t *ipv6_prefix_range); +OpenAPI_ipv6_prefix_range_t *OpenAPI_ipv6_prefix_range_copy(OpenAPI_ipv6_prefix_range_t *dst, OpenAPI_ipv6_prefix_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/key_amf.c b/lib/sbi/openapi/model/key_amf.c new file mode 100644 index 000000000..2e1676922 --- /dev/null +++ b/lib/sbi/openapi/model/key_amf.c @@ -0,0 +1,136 @@ + +#include +#include +#include +#include "key_amf.h" + +OpenAPI_key_amf_t *OpenAPI_key_amf_create( + OpenAPI_key_amf_type_e key_type, + char *key_val + ) +{ + OpenAPI_key_amf_t *key_amf_local_var = OpenAPI_malloc(sizeof(OpenAPI_key_amf_t)); + if (!key_amf_local_var) { + return NULL; + } + key_amf_local_var->key_type = key_type; + key_amf_local_var->key_val = key_val; + + return key_amf_local_var; +} + +void OpenAPI_key_amf_free(OpenAPI_key_amf_t *key_amf) +{ + if (NULL == key_amf) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(key_amf->key_val); + ogs_free(key_amf); +} + +cJSON *OpenAPI_key_amf_convertToJSON(OpenAPI_key_amf_t *key_amf) +{ + cJSON *item = NULL; + + if (key_amf == NULL) { + ogs_error("OpenAPI_key_amf_convertToJSON() failed [KeyAmf]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!key_amf->key_type) { + ogs_error("OpenAPI_key_amf_convertToJSON() failed [key_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "keyType", OpenAPI_key_amf_type_ToString(key_amf->key_type)) == NULL) { + ogs_error("OpenAPI_key_amf_convertToJSON() failed [key_type]"); + goto end; + } + + if (!key_amf->key_val) { + ogs_error("OpenAPI_key_amf_convertToJSON() failed [key_val]"); + goto end; + } + if (cJSON_AddStringToObject(item, "keyVal", key_amf->key_val) == NULL) { + ogs_error("OpenAPI_key_amf_convertToJSON() failed [key_val]"); + goto end; + } + +end: + return item; +} + +OpenAPI_key_amf_t *OpenAPI_key_amf_parseFromJSON(cJSON *key_amfJSON) +{ + OpenAPI_key_amf_t *key_amf_local_var = NULL; + cJSON *key_type = cJSON_GetObjectItemCaseSensitive(key_amfJSON, "keyType"); + if (!key_type) { + ogs_error("OpenAPI_key_amf_parseFromJSON() failed [key_type]"); + goto end; + } + + OpenAPI_key_amf_type_e key_typeVariable; + + if (!cJSON_IsString(key_type)) { + ogs_error("OpenAPI_key_amf_parseFromJSON() failed [key_type]"); + goto end; + } + key_typeVariable = OpenAPI_key_amf_type_FromString(key_type->valuestring); + + cJSON *key_val = cJSON_GetObjectItemCaseSensitive(key_amfJSON, "keyVal"); + if (!key_val) { + ogs_error("OpenAPI_key_amf_parseFromJSON() failed [key_val]"); + goto end; + } + + + if (!cJSON_IsString(key_val)) { + ogs_error("OpenAPI_key_amf_parseFromJSON() failed [key_val]"); + goto end; + } + + key_amf_local_var = OpenAPI_key_amf_create ( + key_typeVariable, + ogs_strdup(key_val->valuestring) + ); + + return key_amf_local_var; +end: + return NULL; +} + +OpenAPI_key_amf_t *OpenAPI_key_amf_copy(OpenAPI_key_amf_t *dst, OpenAPI_key_amf_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_key_amf_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_key_amf_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_key_amf_free(dst); + dst = OpenAPI_key_amf_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/key_amf.h b/lib/sbi/openapi/model/key_amf.h new file mode 100644 index 000000000..abec90160 --- /dev/null +++ b/lib/sbi/openapi/model/key_amf.h @@ -0,0 +1,41 @@ +/* + * key_amf.h + * + * + */ + +#ifndef _OpenAPI_key_amf_H_ +#define _OpenAPI_key_amf_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "key_amf_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_key_amf_s OpenAPI_key_amf_t; +typedef struct OpenAPI_key_amf_s { + OpenAPI_key_amf_type_e key_type; + char *key_val; +} OpenAPI_key_amf_t; + +OpenAPI_key_amf_t *OpenAPI_key_amf_create( + OpenAPI_key_amf_type_e key_type, + char *key_val + ); +void OpenAPI_key_amf_free(OpenAPI_key_amf_t *key_amf); +OpenAPI_key_amf_t *OpenAPI_key_amf_parseFromJSON(cJSON *key_amfJSON); +cJSON *OpenAPI_key_amf_convertToJSON(OpenAPI_key_amf_t *key_amf); +OpenAPI_key_amf_t *OpenAPI_key_amf_copy(OpenAPI_key_amf_t *dst, OpenAPI_key_amf_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_key_amf_H_ */ + diff --git a/lib/sbi/openapi/model/key_amf_type.c b/lib/sbi/openapi/model/key_amf_type.c new file mode 100644 index 000000000..2aa42c674 --- /dev/null +++ b/lib/sbi/openapi/model/key_amf_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "key_amf_type.h" + +char* OpenAPI_key_amf_type_ToString(OpenAPI_key_amf_type_e key_amf_type) +{ + const char *key_amf_typeArray[] = { "NULL", "KAMF", "KPRIMEAMF" }; + size_t sizeofArray = sizeof(key_amf_typeArray) / sizeof(key_amf_typeArray[0]); + if (key_amf_type < sizeofArray) + return (char *)key_amf_typeArray[key_amf_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_key_amf_type_e OpenAPI_key_amf_type_FromString(char* key_amf_type) +{ + int stringToReturn = 0; + const char *key_amf_typeArray[] = { "NULL", "KAMF", "KPRIMEAMF" }; + size_t sizeofArray = sizeof(key_amf_typeArray) / sizeof(key_amf_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(key_amf_type, key_amf_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/key_amf_type.h b/lib/sbi/openapi/model/key_amf_type.h new file mode 100644 index 000000000..009f3ec73 --- /dev/null +++ b/lib/sbi/openapi/model/key_amf_type.h @@ -0,0 +1,31 @@ +/* + * key_amf_type.h + * + * + */ + +#ifndef _OpenAPI_key_amf_type_H_ +#define _OpenAPI_key_amf_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_key_amf_type_NULL = 0, OpenAPI_key_amf_type_KAMF, OpenAPI_key_amf_type_KPRIMEAMF } OpenAPI_key_amf_type_e; + +char* OpenAPI_key_amf_type_ToString(OpenAPI_key_amf_type_e key_amf_type); + +OpenAPI_key_amf_type_e OpenAPI_key_amf_type_FromString(char* key_amf_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_key_amf_type_H_ */ + diff --git a/lib/sbi/openapi/model/ladn_info.c b/lib/sbi/openapi/model/ladn_info.c new file mode 100644 index 000000000..5587aa91c --- /dev/null +++ b/lib/sbi/openapi/model/ladn_info.c @@ -0,0 +1,134 @@ + +#include +#include +#include +#include "ladn_info.h" + +OpenAPI_ladn_info_t *OpenAPI_ladn_info_create( + char *ladn, + OpenAPI_presence_state_t *presence + ) +{ + OpenAPI_ladn_info_t *ladn_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_ladn_info_t)); + if (!ladn_info_local_var) { + return NULL; + } + ladn_info_local_var->ladn = ladn; + ladn_info_local_var->presence = presence; + + return ladn_info_local_var; +} + +void OpenAPI_ladn_info_free(OpenAPI_ladn_info_t *ladn_info) +{ + if (NULL == ladn_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ladn_info->ladn); + OpenAPI_presence_state_free(ladn_info->presence); + ogs_free(ladn_info); +} + +cJSON *OpenAPI_ladn_info_convertToJSON(OpenAPI_ladn_info_t *ladn_info) +{ + cJSON *item = NULL; + + if (ladn_info == NULL) { + ogs_error("OpenAPI_ladn_info_convertToJSON() failed [LadnInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ladn_info->ladn) { + ogs_error("OpenAPI_ladn_info_convertToJSON() failed [ladn]"); + goto end; + } + if (cJSON_AddStringToObject(item, "ladn", ladn_info->ladn) == NULL) { + ogs_error("OpenAPI_ladn_info_convertToJSON() failed [ladn]"); + goto end; + } + + if (ladn_info->presence) { + cJSON *presence_local_JSON = OpenAPI_presence_state_convertToJSON(ladn_info->presence); + if (presence_local_JSON == NULL) { + ogs_error("OpenAPI_ladn_info_convertToJSON() failed [presence]"); + goto end; + } + cJSON_AddItemToObject(item, "presence", presence_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ladn_info_convertToJSON() failed [presence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ladn_info_t *OpenAPI_ladn_info_parseFromJSON(cJSON *ladn_infoJSON) +{ + OpenAPI_ladn_info_t *ladn_info_local_var = NULL; + cJSON *ladn = cJSON_GetObjectItemCaseSensitive(ladn_infoJSON, "ladn"); + if (!ladn) { + ogs_error("OpenAPI_ladn_info_parseFromJSON() failed [ladn]"); + goto end; + } + + + if (!cJSON_IsString(ladn)) { + ogs_error("OpenAPI_ladn_info_parseFromJSON() failed [ladn]"); + goto end; + } + + cJSON *presence = cJSON_GetObjectItemCaseSensitive(ladn_infoJSON, "presence"); + + OpenAPI_presence_state_t *presence_local_nonprim = NULL; + if (presence) { + presence_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence); + } + + ladn_info_local_var = OpenAPI_ladn_info_create ( + ogs_strdup(ladn->valuestring), + presence ? presence_local_nonprim : NULL + ); + + return ladn_info_local_var; +end: + return NULL; +} + +OpenAPI_ladn_info_t *OpenAPI_ladn_info_copy(OpenAPI_ladn_info_t *dst, OpenAPI_ladn_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ladn_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ladn_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_ladn_info_free(dst); + dst = OpenAPI_ladn_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ladn_info.h b/lib/sbi/openapi/model/ladn_info.h new file mode 100644 index 000000000..3bfd44929 --- /dev/null +++ b/lib/sbi/openapi/model/ladn_info.h @@ -0,0 +1,41 @@ +/* + * ladn_info.h + * + * + */ + +#ifndef _OpenAPI_ladn_info_H_ +#define _OpenAPI_ladn_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "presence_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ladn_info_s OpenAPI_ladn_info_t; +typedef struct OpenAPI_ladn_info_s { + char *ladn; + struct OpenAPI_presence_state_s *presence; +} OpenAPI_ladn_info_t; + +OpenAPI_ladn_info_t *OpenAPI_ladn_info_create( + char *ladn, + OpenAPI_presence_state_t *presence + ); +void OpenAPI_ladn_info_free(OpenAPI_ladn_info_t *ladn_info); +OpenAPI_ladn_info_t *OpenAPI_ladn_info_parseFromJSON(cJSON *ladn_infoJSON); +cJSON *OpenAPI_ladn_info_convertToJSON(OpenAPI_ladn_info_t *ladn_info); +OpenAPI_ladn_info_t *OpenAPI_ladn_info_copy(OpenAPI_ladn_info_t *dst, OpenAPI_ladn_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ladn_info_H_ */ + diff --git a/lib/sbi/openapi/model/lcs_client_external.c b/lib/sbi/openapi/model/lcs_client_external.c index 3f6f61e47..8c2b8c034 100644 --- a/lib/sbi/openapi/model/lcs_client_external.c +++ b/lib/sbi/openapi/model/lcs_client_external.c @@ -144,3 +144,37 @@ end: return NULL; } +OpenAPI_lcs_client_external_t *OpenAPI_lcs_client_external_copy(OpenAPI_lcs_client_external_t *dst, OpenAPI_lcs_client_external_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lcs_client_external_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lcs_client_external_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_lcs_client_external_free(dst); + dst = OpenAPI_lcs_client_external_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lcs_client_external.h b/lib/sbi/openapi/model/lcs_client_external.h index 72507ff45..af24cf0cd 100644 --- a/lib/sbi/openapi/model/lcs_client_external.h +++ b/lib/sbi/openapi/model/lcs_client_external.h @@ -35,6 +35,7 @@ OpenAPI_lcs_client_external_t *OpenAPI_lcs_client_external_create( void OpenAPI_lcs_client_external_free(OpenAPI_lcs_client_external_t *lcs_client_external); OpenAPI_lcs_client_external_t *OpenAPI_lcs_client_external_parseFromJSON(cJSON *lcs_client_externalJSON); cJSON *OpenAPI_lcs_client_external_convertToJSON(OpenAPI_lcs_client_external_t *lcs_client_external); +OpenAPI_lcs_client_external_t *OpenAPI_lcs_client_external_copy(OpenAPI_lcs_client_external_t *dst, OpenAPI_lcs_client_external_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/lcs_client_group_external.c b/lib/sbi/openapi/model/lcs_client_group_external.c index 4027d0a03..889d5a5d6 100644 --- a/lib/sbi/openapi/model/lcs_client_group_external.c +++ b/lib/sbi/openapi/model/lcs_client_group_external.c @@ -164,3 +164,37 @@ end: return NULL; } +OpenAPI_lcs_client_group_external_t *OpenAPI_lcs_client_group_external_copy(OpenAPI_lcs_client_group_external_t *dst, OpenAPI_lcs_client_group_external_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lcs_client_group_external_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lcs_client_group_external_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_lcs_client_group_external_free(dst); + dst = OpenAPI_lcs_client_group_external_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lcs_client_group_external.h b/lib/sbi/openapi/model/lcs_client_group_external.h index 61d947c15..96ec0d794 100644 --- a/lib/sbi/openapi/model/lcs_client_group_external.h +++ b/lib/sbi/openapi/model/lcs_client_group_external.h @@ -37,6 +37,7 @@ OpenAPI_lcs_client_group_external_t *OpenAPI_lcs_client_group_external_create( void OpenAPI_lcs_client_group_external_free(OpenAPI_lcs_client_group_external_t *lcs_client_group_external); OpenAPI_lcs_client_group_external_t *OpenAPI_lcs_client_group_external_parseFromJSON(cJSON *lcs_client_group_externalJSON); cJSON *OpenAPI_lcs_client_group_external_convertToJSON(OpenAPI_lcs_client_group_external_t *lcs_client_group_external); +OpenAPI_lcs_client_group_external_t *OpenAPI_lcs_client_group_external_copy(OpenAPI_lcs_client_group_external_t *dst, OpenAPI_lcs_client_group_external_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/lcs_client_non_external.c b/lib/sbi/openapi/model/lcs_client_non_external.c index d62bedcca..9a86fda5f 100644 --- a/lib/sbi/openapi/model/lcs_client_non_external.c +++ b/lib/sbi/openapi/model/lcs_client_non_external.c @@ -190,3 +190,37 @@ end: return NULL; } +OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_copy(OpenAPI_lcs_client_non_external_t *dst, OpenAPI_lcs_client_non_external_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lcs_client_non_external_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_lcs_client_non_external_free(dst); + dst = OpenAPI_lcs_client_non_external_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lcs_client_non_external.h b/lib/sbi/openapi/model/lcs_client_non_external.h index fc17ae8b4..0d2d23428 100644 --- a/lib/sbi/openapi/model/lcs_client_non_external.h +++ b/lib/sbi/openapi/model/lcs_client_non_external.h @@ -40,6 +40,7 @@ OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_create( void OpenAPI_lcs_client_non_external_free(OpenAPI_lcs_client_non_external_t *lcs_client_non_external); OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_parseFromJSON(cJSON *lcs_client_non_externalJSON); cJSON *OpenAPI_lcs_client_non_external_convertToJSON(OpenAPI_lcs_client_non_external_t *lcs_client_non_external); +OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_copy(OpenAPI_lcs_client_non_external_t *dst, OpenAPI_lcs_client_non_external_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/lcs_mo_data.c b/lib/sbi/openapi/model/lcs_mo_data.c index b584efe36..81d4ab05b 100644 --- a/lib/sbi/openapi/model/lcs_mo_data.c +++ b/lib/sbi/openapi/model/lcs_mo_data.c @@ -95,3 +95,37 @@ end: return NULL; } +OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_copy(OpenAPI_lcs_mo_data_t *dst, OpenAPI_lcs_mo_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lcs_mo_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lcs_mo_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_lcs_mo_data_free(dst); + dst = OpenAPI_lcs_mo_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lcs_mo_data.h b/lib/sbi/openapi/model/lcs_mo_data.h index ce286b6ae..b4c020b5a 100644 --- a/lib/sbi/openapi/model/lcs_mo_data.h +++ b/lib/sbi/openapi/model/lcs_mo_data.h @@ -29,6 +29,7 @@ OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_create( void OpenAPI_lcs_mo_data_free(OpenAPI_lcs_mo_data_t *lcs_mo_data); OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_parseFromJSON(cJSON *lcs_mo_dataJSON); cJSON *OpenAPI_lcs_mo_data_convertToJSON(OpenAPI_lcs_mo_data_t *lcs_mo_data); +OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_copy(OpenAPI_lcs_mo_data_t *dst, OpenAPI_lcs_mo_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/lcs_privacy.c b/lib/sbi/openapi/model/lcs_privacy.c index 661ee802a..5e1414f4c 100644 --- a/lib/sbi/openapi/model/lcs_privacy.c +++ b/lib/sbi/openapi/model/lcs_privacy.c @@ -112,3 +112,37 @@ end: return NULL; } +OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_copy(OpenAPI_lcs_privacy_t *dst, OpenAPI_lcs_privacy_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lcs_privacy_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lcs_privacy_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_lcs_privacy_free(dst); + dst = OpenAPI_lcs_privacy_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lcs_privacy.h b/lib/sbi/openapi/model/lcs_privacy.h index 9ae370925..c4c6198ab 100644 --- a/lib/sbi/openapi/model/lcs_privacy.h +++ b/lib/sbi/openapi/model/lcs_privacy.h @@ -33,6 +33,7 @@ OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_create( void OpenAPI_lcs_privacy_free(OpenAPI_lcs_privacy_t *lcs_privacy); OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_parseFromJSON(cJSON *lcs_privacyJSON); cJSON *OpenAPI_lcs_privacy_convertToJSON(OpenAPI_lcs_privacy_t *lcs_privacy); +OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_copy(OpenAPI_lcs_privacy_t *dst, OpenAPI_lcs_privacy_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/lcs_privacy_data.c b/lib/sbi/openapi/model/lcs_privacy_data.c index a5df55c57..b706075db 100644 --- a/lib/sbi/openapi/model/lcs_privacy_data.c +++ b/lib/sbi/openapi/model/lcs_privacy_data.c @@ -173,3 +173,37 @@ end: return NULL; } +OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_copy(OpenAPI_lcs_privacy_data_t *dst, OpenAPI_lcs_privacy_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lcs_privacy_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lcs_privacy_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_lcs_privacy_data_free(dst); + dst = OpenAPI_lcs_privacy_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lcs_privacy_data.h b/lib/sbi/openapi/model/lcs_privacy_data.h index 5b9c678b3..7b4f8fbeb 100644 --- a/lib/sbi/openapi/model/lcs_privacy_data.h +++ b/lib/sbi/openapi/model/lcs_privacy_data.h @@ -35,6 +35,7 @@ OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_create( void OpenAPI_lcs_privacy_data_free(OpenAPI_lcs_privacy_data_t *lcs_privacy_data); OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_parseFromJSON(cJSON *lcs_privacy_dataJSON); cJSON *OpenAPI_lcs_privacy_data_convertToJSON(OpenAPI_lcs_privacy_data_t *lcs_privacy_data); +OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_copy(OpenAPI_lcs_privacy_data_t *dst, OpenAPI_lcs_privacy_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/limit_id_to_monitoring_key.c b/lib/sbi/openapi/model/limit_id_to_monitoring_key.c index c36b578c2..8a7797961 100644 --- a/lib/sbi/openapi/model/limit_id_to_monitoring_key.c +++ b/lib/sbi/openapi/model/limit_id_to_monitoring_key.c @@ -117,3 +117,37 @@ end: return NULL; } +OpenAPI_limit_id_to_monitoring_key_t *OpenAPI_limit_id_to_monitoring_key_copy(OpenAPI_limit_id_to_monitoring_key_t *dst, OpenAPI_limit_id_to_monitoring_key_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_limit_id_to_monitoring_key_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_limit_id_to_monitoring_key_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_limit_id_to_monitoring_key_free(dst); + dst = OpenAPI_limit_id_to_monitoring_key_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/limit_id_to_monitoring_key.h b/lib/sbi/openapi/model/limit_id_to_monitoring_key.h index 09057a989..5db549585 100644 --- a/lib/sbi/openapi/model/limit_id_to_monitoring_key.h +++ b/lib/sbi/openapi/model/limit_id_to_monitoring_key.h @@ -30,6 +30,7 @@ OpenAPI_limit_id_to_monitoring_key_t *OpenAPI_limit_id_to_monitoring_key_create( void OpenAPI_limit_id_to_monitoring_key_free(OpenAPI_limit_id_to_monitoring_key_t *limit_id_to_monitoring_key); OpenAPI_limit_id_to_monitoring_key_t *OpenAPI_limit_id_to_monitoring_key_parseFromJSON(cJSON *limit_id_to_monitoring_keyJSON); cJSON *OpenAPI_limit_id_to_monitoring_key_convertToJSON(OpenAPI_limit_id_to_monitoring_key_t *limit_id_to_monitoring_key); +OpenAPI_limit_id_to_monitoring_key_t *OpenAPI_limit_id_to_monitoring_key_copy(OpenAPI_limit_id_to_monitoring_key_t *dst, OpenAPI_limit_id_to_monitoring_key_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/link.c b/lib/sbi/openapi/model/link.c index c60ad9813..f27b0f8a7 100644 --- a/lib/sbi/openapi/model/link.c +++ b/lib/sbi/openapi/model/link.c @@ -69,3 +69,37 @@ end: return NULL; } +OpenAPI_link_t *OpenAPI_link_copy(OpenAPI_link_t *dst, OpenAPI_link_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_link_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_link_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_link_free(dst); + dst = OpenAPI_link_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/link.h b/lib/sbi/openapi/model/link.h index a7e59b37b..61f868951 100644 --- a/lib/sbi/openapi/model/link.h +++ b/lib/sbi/openapi/model/link.h @@ -28,6 +28,7 @@ OpenAPI_link_t *OpenAPI_link_create( void OpenAPI_link_free(OpenAPI_link_t *link); OpenAPI_link_t *OpenAPI_link_parseFromJSON(cJSON *linkJSON); cJSON *OpenAPI_link_convertToJSON(OpenAPI_link_t *link); +OpenAPI_link_t *OpenAPI_link_copy(OpenAPI_link_t *dst, OpenAPI_link_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/links_value_schema.c b/lib/sbi/openapi/model/links_value_schema.c index 926433476..0c0d9457d 100644 --- a/lib/sbi/openapi/model/links_value_schema.c +++ b/lib/sbi/openapi/model/links_value_schema.c @@ -69,3 +69,37 @@ end: return NULL; } +OpenAPI_links_value_schema_t *OpenAPI_links_value_schema_copy(OpenAPI_links_value_schema_t *dst, OpenAPI_links_value_schema_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_links_value_schema_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_links_value_schema_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_links_value_schema_free(dst); + dst = OpenAPI_links_value_schema_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/links_value_schema.h b/lib/sbi/openapi/model/links_value_schema.h index 522fec49b..149d119c4 100644 --- a/lib/sbi/openapi/model/links_value_schema.h +++ b/lib/sbi/openapi/model/links_value_schema.h @@ -29,6 +29,7 @@ OpenAPI_links_value_schema_t *OpenAPI_links_value_schema_create( void OpenAPI_links_value_schema_free(OpenAPI_links_value_schema_t *links_value_schema); OpenAPI_links_value_schema_t *OpenAPI_links_value_schema_parseFromJSON(cJSON *links_value_schemaJSON); cJSON *OpenAPI_links_value_schema_convertToJSON(OpenAPI_links_value_schema_t *links_value_schema); +OpenAPI_links_value_schema_t *OpenAPI_links_value_schema_copy(OpenAPI_links_value_schema_t *dst, OpenAPI_links_value_schema_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/lmf_info.c b/lib/sbi/openapi/model/lmf_info.c index 0da10a5c8..2562e3986 100644 --- a/lib/sbi/openapi/model/lmf_info.c +++ b/lib/sbi/openapi/model/lmf_info.c @@ -41,9 +41,6 @@ void OpenAPI_lmf_info_free(OpenAPI_lmf_info_t *lmf_info) OpenAPI_an_node_type_free(node->data); } OpenAPI_list_free(lmf_info->serving_an_node_types); - OpenAPI_list_for_each(lmf_info->serving_rat_types, node) { - OpenAPI_rat_type_free(node->data); - } OpenAPI_list_free(lmf_info->serving_rat_types); ogs_free(lmf_info); } @@ -121,21 +118,16 @@ cJSON *OpenAPI_lmf_info_convertToJSON(OpenAPI_lmf_info_t *lmf_info) } if (lmf_info->serving_rat_types) { - cJSON *serving_rat_typesList = cJSON_AddArrayToObject(item, "servingRatTypes"); - if (serving_rat_typesList == NULL) { + cJSON *serving_rat_types = cJSON_AddArrayToObject(item, "servingRatTypes"); + if (serving_rat_types == NULL) { ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_rat_types]"); goto end; } - OpenAPI_lnode_t *serving_rat_types_node; - if (lmf_info->serving_rat_types) { - OpenAPI_list_for_each(lmf_info->serving_rat_types, serving_rat_types_node) { - cJSON *itemLocal = OpenAPI_rat_type_convertToJSON(serving_rat_types_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_rat_types]"); - goto end; - } - cJSON_AddItemToArray(serving_rat_typesList, itemLocal); + OpenAPI_list_for_each(lmf_info->serving_rat_types, serving_rat_types_node) { + if (cJSON_AddStringToObject(serving_rat_types, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)serving_rat_types_node->data)) == NULL) { + ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_rat_types]"); + goto end; } } } @@ -237,13 +229,12 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_parseFromJSON(cJSON *lmf_infoJSON) serving_rat_typesList = OpenAPI_list_create(); cJSON_ArrayForEach(serving_rat_types_local_nonprimitive, serving_rat_types ) { - if (!cJSON_IsObject(serving_rat_types_local_nonprimitive)) { + if (!cJSON_IsString(serving_rat_types_local_nonprimitive)) { ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_rat_types]"); goto end; } - OpenAPI_rat_type_t *serving_rat_typesItem = OpenAPI_rat_type_parseFromJSON(serving_rat_types_local_nonprimitive); - OpenAPI_list_add(serving_rat_typesList, serving_rat_typesItem); + OpenAPI_list_add(serving_rat_typesList, (void *)OpenAPI_rat_type_FromString(serving_rat_types_local_nonprimitive->valuestring)); } } @@ -260,3 +251,37 @@ end: return NULL; } +OpenAPI_lmf_info_t *OpenAPI_lmf_info_copy(OpenAPI_lmf_info_t *dst, OpenAPI_lmf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lmf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lmf_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_lmf_info_free(dst); + dst = OpenAPI_lmf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lmf_info.h b/lib/sbi/openapi/model/lmf_info.h index 13d979c55..3ac04a98c 100644 --- a/lib/sbi/openapi/model/lmf_info.h +++ b/lib/sbi/openapi/model/lmf_info.h @@ -40,6 +40,7 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_create( void OpenAPI_lmf_info_free(OpenAPI_lmf_info_t *lmf_info); OpenAPI_lmf_info_t *OpenAPI_lmf_info_parseFromJSON(cJSON *lmf_infoJSON); cJSON *OpenAPI_lmf_info_convertToJSON(OpenAPI_lmf_info_t *lmf_info); +OpenAPI_lmf_info_t *OpenAPI_lmf_info_copy(OpenAPI_lmf_info_t *dst, OpenAPI_lmf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/location_accuracy.c b/lib/sbi/openapi/model/location_accuracy.c index f012744d6..5c58641a1 100644 --- a/lib/sbi/openapi/model/location_accuracy.c +++ b/lib/sbi/openapi/model/location_accuracy.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_location_accuracy_t *OpenAPI_location_accuracy_copy(OpenAPI_location_accuracy_t *dst, OpenAPI_location_accuracy_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_location_accuracy_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_location_accuracy_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_location_accuracy_free(dst); + dst = OpenAPI_location_accuracy_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/location_accuracy.h b/lib/sbi/openapi/model/location_accuracy.h index 2cf9fb91f..c95ed16e5 100644 --- a/lib/sbi/openapi/model/location_accuracy.h +++ b/lib/sbi/openapi/model/location_accuracy.h @@ -26,6 +26,7 @@ OpenAPI_location_accuracy_t *OpenAPI_location_accuracy_create( void OpenAPI_location_accuracy_free(OpenAPI_location_accuracy_t *location_accuracy); OpenAPI_location_accuracy_t *OpenAPI_location_accuracy_parseFromJSON(cJSON *location_accuracyJSON); cJSON *OpenAPI_location_accuracy_convertToJSON(OpenAPI_location_accuracy_t *location_accuracy); +OpenAPI_location_accuracy_t *OpenAPI_location_accuracy_copy(OpenAPI_location_accuracy_t *dst, OpenAPI_location_accuracy_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/location_area.c b/lib/sbi/openapi/model/location_area.c index 96aa0930f..c388fe210 100644 --- a/lib/sbi/openapi/model/location_area.c +++ b/lib/sbi/openapi/model/location_area.c @@ -173,3 +173,37 @@ end: return NULL; } +OpenAPI_location_area_t *OpenAPI_location_area_copy(OpenAPI_location_area_t *dst, OpenAPI_location_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_location_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_location_area_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_location_area_free(dst); + dst = OpenAPI_location_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/location_area.h b/lib/sbi/openapi/model/location_area.h index 51b9f6157..3b37604ab 100644 --- a/lib/sbi/openapi/model/location_area.h +++ b/lib/sbi/openapi/model/location_area.h @@ -35,6 +35,7 @@ OpenAPI_location_area_t *OpenAPI_location_area_create( void OpenAPI_location_area_free(OpenAPI_location_area_t *location_area); OpenAPI_location_area_t *OpenAPI_location_area_parseFromJSON(cJSON *location_areaJSON); cJSON *OpenAPI_location_area_convertToJSON(OpenAPI_location_area_t *location_area); +OpenAPI_location_area_t *OpenAPI_location_area_copy(OpenAPI_location_area_t *dst, OpenAPI_location_area_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/location_filter.c b/lib/sbi/openapi/model/location_filter.c new file mode 100644 index 000000000..f41749d64 --- /dev/null +++ b/lib/sbi/openapi/model/location_filter.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "location_filter.h" + +OpenAPI_location_filter_t *OpenAPI_location_filter_create( + ) +{ + OpenAPI_location_filter_t *location_filter_local_var = OpenAPI_malloc(sizeof(OpenAPI_location_filter_t)); + if (!location_filter_local_var) { + return NULL; + } + + return location_filter_local_var; +} + +void OpenAPI_location_filter_free(OpenAPI_location_filter_t *location_filter) +{ + if (NULL == location_filter) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(location_filter); +} + +cJSON *OpenAPI_location_filter_convertToJSON(OpenAPI_location_filter_t *location_filter) +{ + cJSON *item = NULL; + + if (location_filter == NULL) { + ogs_error("OpenAPI_location_filter_convertToJSON() failed [LocationFilter]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_location_filter_t *OpenAPI_location_filter_parseFromJSON(cJSON *location_filterJSON) +{ + OpenAPI_location_filter_t *location_filter_local_var = NULL; + location_filter_local_var = OpenAPI_location_filter_create ( + ); + + return location_filter_local_var; +end: + return NULL; +} + +OpenAPI_location_filter_t *OpenAPI_location_filter_copy(OpenAPI_location_filter_t *dst, OpenAPI_location_filter_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_location_filter_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_location_filter_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_location_filter_free(dst); + dst = OpenAPI_location_filter_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/location_filter.h b/lib/sbi/openapi/model/location_filter.h new file mode 100644 index 000000000..edbb04c64 --- /dev/null +++ b/lib/sbi/openapi/model/location_filter.h @@ -0,0 +1,36 @@ +/* + * location_filter.h + * + * + */ + +#ifndef _OpenAPI_location_filter_H_ +#define _OpenAPI_location_filter_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_location_filter_s OpenAPI_location_filter_t; +typedef struct OpenAPI_location_filter_s { +} OpenAPI_location_filter_t; + +OpenAPI_location_filter_t *OpenAPI_location_filter_create( + ); +void OpenAPI_location_filter_free(OpenAPI_location_filter_t *location_filter); +OpenAPI_location_filter_t *OpenAPI_location_filter_parseFromJSON(cJSON *location_filterJSON); +cJSON *OpenAPI_location_filter_convertToJSON(OpenAPI_location_filter_t *location_filter); +OpenAPI_location_filter_t *OpenAPI_location_filter_copy(OpenAPI_location_filter_t *dst, OpenAPI_location_filter_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_location_filter_H_ */ + diff --git a/lib/sbi/openapi/model/location_info.c b/lib/sbi/openapi/model/location_info.c index d3b2797cb..8f8ea2283 100644 --- a/lib/sbi/openapi/model/location_info.c +++ b/lib/sbi/openapi/model/location_info.c @@ -164,3 +164,37 @@ end: return NULL; } +OpenAPI_location_info_t *OpenAPI_location_info_copy(OpenAPI_location_info_t *dst, OpenAPI_location_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_location_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_location_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_location_info_free(dst); + dst = OpenAPI_location_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/location_info.h b/lib/sbi/openapi/model/location_info.h index 5ec6776c3..de418766b 100644 --- a/lib/sbi/openapi/model/location_info.h +++ b/lib/sbi/openapi/model/location_info.h @@ -35,6 +35,7 @@ OpenAPI_location_info_t *OpenAPI_location_info_create( void OpenAPI_location_info_free(OpenAPI_location_info_t *location_info); OpenAPI_location_info_t *OpenAPI_location_info_parseFromJSON(cJSON *location_infoJSON); cJSON *OpenAPI_location_info_convertToJSON(OpenAPI_location_info_t *location_info); +OpenAPI_location_info_t *OpenAPI_location_info_copy(OpenAPI_location_info_t *dst, OpenAPI_location_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/location_reporting_configuration.c b/lib/sbi/openapi/model/location_reporting_configuration.c index a10195a13..352fbb397 100644 --- a/lib/sbi/openapi/model/location_reporting_configuration.c +++ b/lib/sbi/openapi/model/location_reporting_configuration.c @@ -49,7 +49,7 @@ cJSON *OpenAPI_location_reporting_configuration_convertToJSON(OpenAPI_location_r goto end; } - if (location_reporting_configuration->one_time >= 0) { + if (location_reporting_configuration->one_time) { if (cJSON_AddBoolToObject(item, "oneTime", location_reporting_configuration->one_time) == NULL) { ogs_error("OpenAPI_location_reporting_configuration_convertToJSON() failed [one_time]"); goto end; @@ -136,3 +136,37 @@ end: return NULL; } +OpenAPI_location_reporting_configuration_t *OpenAPI_location_reporting_configuration_copy(OpenAPI_location_reporting_configuration_t *dst, OpenAPI_location_reporting_configuration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_location_reporting_configuration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_location_reporting_configuration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_location_reporting_configuration_free(dst); + dst = OpenAPI_location_reporting_configuration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/location_reporting_configuration.h b/lib/sbi/openapi/model/location_reporting_configuration.h index 97cbaf959..e65d06157 100644 --- a/lib/sbi/openapi/model/location_reporting_configuration.h +++ b/lib/sbi/openapi/model/location_reporting_configuration.h @@ -35,6 +35,7 @@ OpenAPI_location_reporting_configuration_t *OpenAPI_location_reporting_configura void OpenAPI_location_reporting_configuration_free(OpenAPI_location_reporting_configuration_t *location_reporting_configuration); OpenAPI_location_reporting_configuration_t *OpenAPI_location_reporting_configuration_parseFromJSON(cJSON *location_reporting_configurationJSON); cJSON *OpenAPI_location_reporting_configuration_convertToJSON(OpenAPI_location_reporting_configuration_t *location_reporting_configuration); +OpenAPI_location_reporting_configuration_t *OpenAPI_location_reporting_configuration_copy(OpenAPI_location_reporting_configuration_t *dst, OpenAPI_location_reporting_configuration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/lpi.c b/lib/sbi/openapi/model/lpi.c index 5d7589ebe..f3617428f 100644 --- a/lib/sbi/openapi/model/lpi.c +++ b/lib/sbi/openapi/model/lpi.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_lpi_t *OpenAPI_lpi_copy(OpenAPI_lpi_t *dst, OpenAPI_lpi_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lpi_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lpi_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_lpi_free(dst); + dst = OpenAPI_lpi_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lpi.h b/lib/sbi/openapi/model/lpi.h index 17239adc2..4935f968d 100644 --- a/lib/sbi/openapi/model/lpi.h +++ b/lib/sbi/openapi/model/lpi.h @@ -32,6 +32,7 @@ OpenAPI_lpi_t *OpenAPI_lpi_create( void OpenAPI_lpi_free(OpenAPI_lpi_t *lpi); OpenAPI_lpi_t *OpenAPI_lpi_parseFromJSON(cJSON *lpiJSON); cJSON *OpenAPI_lpi_convertToJSON(OpenAPI_lpi_t *lpi); +OpenAPI_lpi_t *OpenAPI_lpi_copy(OpenAPI_lpi_t *dst, OpenAPI_lpi_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/lte_v2x_auth.c b/lib/sbi/openapi/model/lte_v2x_auth.c index 4aa6efacb..5f7ab7361 100644 --- a/lib/sbi/openapi/model/lte_v2x_auth.c +++ b/lib/sbi/openapi/model/lte_v2x_auth.c @@ -97,3 +97,37 @@ end: return NULL; } +OpenAPI_lte_v2x_auth_t *OpenAPI_lte_v2x_auth_copy(OpenAPI_lte_v2x_auth_t *dst, OpenAPI_lte_v2x_auth_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lte_v2x_auth_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lte_v2x_auth_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_lte_v2x_auth_free(dst); + dst = OpenAPI_lte_v2x_auth_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lte_v2x_auth.h b/lib/sbi/openapi/model/lte_v2x_auth.h index a770e6788..657703157 100644 --- a/lib/sbi/openapi/model/lte_v2x_auth.h +++ b/lib/sbi/openapi/model/lte_v2x_auth.h @@ -31,6 +31,7 @@ OpenAPI_lte_v2x_auth_t *OpenAPI_lte_v2x_auth_create( void OpenAPI_lte_v2x_auth_free(OpenAPI_lte_v2x_auth_t *lte_v2x_auth); OpenAPI_lte_v2x_auth_t *OpenAPI_lte_v2x_auth_parseFromJSON(cJSON *lte_v2x_authJSON); cJSON *OpenAPI_lte_v2x_auth_convertToJSON(OpenAPI_lte_v2x_auth_t *lte_v2x_auth); +OpenAPI_lte_v2x_auth_t *OpenAPI_lte_v2x_auth_copy(OpenAPI_lte_v2x_auth_t *dst, OpenAPI_lte_v2x_auth_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ma_release_indication.c b/lib/sbi/openapi/model/ma_release_indication.c new file mode 100644 index 000000000..50033cb68 --- /dev/null +++ b/lib/sbi/openapi/model/ma_release_indication.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "ma_release_indication.h" + +OpenAPI_ma_release_indication_t *OpenAPI_ma_release_indication_create( + ) +{ + OpenAPI_ma_release_indication_t *ma_release_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_ma_release_indication_t)); + if (!ma_release_indication_local_var) { + return NULL; + } + + return ma_release_indication_local_var; +} + +void OpenAPI_ma_release_indication_free(OpenAPI_ma_release_indication_t *ma_release_indication) +{ + if (NULL == ma_release_indication) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ma_release_indication); +} + +cJSON *OpenAPI_ma_release_indication_convertToJSON(OpenAPI_ma_release_indication_t *ma_release_indication) +{ + cJSON *item = NULL; + + if (ma_release_indication == NULL) { + ogs_error("OpenAPI_ma_release_indication_convertToJSON() failed [MaReleaseIndication]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_ma_release_indication_t *OpenAPI_ma_release_indication_parseFromJSON(cJSON *ma_release_indicationJSON) +{ + OpenAPI_ma_release_indication_t *ma_release_indication_local_var = NULL; + ma_release_indication_local_var = OpenAPI_ma_release_indication_create ( + ); + + return ma_release_indication_local_var; +end: + return NULL; +} + +OpenAPI_ma_release_indication_t *OpenAPI_ma_release_indication_copy(OpenAPI_ma_release_indication_t *dst, OpenAPI_ma_release_indication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ma_release_indication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ma_release_indication_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ma_release_indication_free(dst); + dst = OpenAPI_ma_release_indication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ma_release_indication.h b/lib/sbi/openapi/model/ma_release_indication.h new file mode 100644 index 000000000..0e6c3407d --- /dev/null +++ b/lib/sbi/openapi/model/ma_release_indication.h @@ -0,0 +1,36 @@ +/* + * ma_release_indication.h + * + * Possible values are - REL_MAPDU_OVER_3GPP - REL_MAPDU_OVER_N3GPP + */ + +#ifndef _OpenAPI_ma_release_indication_H_ +#define _OpenAPI_ma_release_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ma_release_indication_s OpenAPI_ma_release_indication_t; +typedef struct OpenAPI_ma_release_indication_s { +} OpenAPI_ma_release_indication_t; + +OpenAPI_ma_release_indication_t *OpenAPI_ma_release_indication_create( + ); +void OpenAPI_ma_release_indication_free(OpenAPI_ma_release_indication_t *ma_release_indication); +OpenAPI_ma_release_indication_t *OpenAPI_ma_release_indication_parseFromJSON(cJSON *ma_release_indicationJSON); +cJSON *OpenAPI_ma_release_indication_convertToJSON(OpenAPI_ma_release_indication_t *ma_release_indication); +OpenAPI_ma_release_indication_t *OpenAPI_ma_release_indication_copy(OpenAPI_ma_release_indication_t *dst, OpenAPI_ma_release_indication_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ma_release_indication_H_ */ + diff --git a/lib/sbi/openapi/model/max_integrity_protected_data_rate.c b/lib/sbi/openapi/model/max_integrity_protected_data_rate.c new file mode 100644 index 000000000..687498fe6 --- /dev/null +++ b/lib/sbi/openapi/model/max_integrity_protected_data_rate.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "max_integrity_protected_data_rate.h" + +OpenAPI_max_integrity_protected_data_rate_t *OpenAPI_max_integrity_protected_data_rate_create( + ) +{ + OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate_local_var = OpenAPI_malloc(sizeof(OpenAPI_max_integrity_protected_data_rate_t)); + if (!max_integrity_protected_data_rate_local_var) { + return NULL; + } + + return max_integrity_protected_data_rate_local_var; +} + +void OpenAPI_max_integrity_protected_data_rate_free(OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate) +{ + if (NULL == max_integrity_protected_data_rate) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(max_integrity_protected_data_rate); +} + +cJSON *OpenAPI_max_integrity_protected_data_rate_convertToJSON(OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate) +{ + cJSON *item = NULL; + + if (max_integrity_protected_data_rate == NULL) { + ogs_error("OpenAPI_max_integrity_protected_data_rate_convertToJSON() failed [MaxIntegrityProtectedDataRate]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_max_integrity_protected_data_rate_t *OpenAPI_max_integrity_protected_data_rate_parseFromJSON(cJSON *max_integrity_protected_data_rateJSON) +{ + OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate_local_var = NULL; + max_integrity_protected_data_rate_local_var = OpenAPI_max_integrity_protected_data_rate_create ( + ); + + return max_integrity_protected_data_rate_local_var; +end: + return NULL; +} + +OpenAPI_max_integrity_protected_data_rate_t *OpenAPI_max_integrity_protected_data_rate_copy(OpenAPI_max_integrity_protected_data_rate_t *dst, OpenAPI_max_integrity_protected_data_rate_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_max_integrity_protected_data_rate_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_max_integrity_protected_data_rate_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_max_integrity_protected_data_rate_free(dst); + dst = OpenAPI_max_integrity_protected_data_rate_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/max_integrity_protected_data_rate.h b/lib/sbi/openapi/model/max_integrity_protected_data_rate.h new file mode 100644 index 000000000..ea25235f7 --- /dev/null +++ b/lib/sbi/openapi/model/max_integrity_protected_data_rate.h @@ -0,0 +1,36 @@ +/* + * max_integrity_protected_data_rate.h + * + * Possible values are - 64_KBPS - MAX_UE_RATE + */ + +#ifndef _OpenAPI_max_integrity_protected_data_rate_H_ +#define _OpenAPI_max_integrity_protected_data_rate_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_max_integrity_protected_data_rate_s OpenAPI_max_integrity_protected_data_rate_t; +typedef struct OpenAPI_max_integrity_protected_data_rate_s { +} OpenAPI_max_integrity_protected_data_rate_t; + +OpenAPI_max_integrity_protected_data_rate_t *OpenAPI_max_integrity_protected_data_rate_create( + ); +void OpenAPI_max_integrity_protected_data_rate_free(OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate); +OpenAPI_max_integrity_protected_data_rate_t *OpenAPI_max_integrity_protected_data_rate_parseFromJSON(cJSON *max_integrity_protected_data_rateJSON); +cJSON *OpenAPI_max_integrity_protected_data_rate_convertToJSON(OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate); +OpenAPI_max_integrity_protected_data_rate_t *OpenAPI_max_integrity_protected_data_rate_copy(OpenAPI_max_integrity_protected_data_rate_t *dst, OpenAPI_max_integrity_protected_data_rate_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_max_integrity_protected_data_rate_H_ */ + diff --git a/lib/sbi/openapi/model/maximum_latency.c b/lib/sbi/openapi/model/maximum_latency.c index a0053a82b..6ba39d834 100644 --- a/lib/sbi/openapi/model/maximum_latency.c +++ b/lib/sbi/openapi/model/maximum_latency.c @@ -137,3 +137,37 @@ end: return NULL; } +OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_copy(OpenAPI_maximum_latency_t *dst, OpenAPI_maximum_latency_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_maximum_latency_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_maximum_latency_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_maximum_latency_free(dst); + dst = OpenAPI_maximum_latency_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/maximum_latency.h b/lib/sbi/openapi/model/maximum_latency.h index 79495376d..54c8a7efe 100644 --- a/lib/sbi/openapi/model/maximum_latency.h +++ b/lib/sbi/openapi/model/maximum_latency.h @@ -35,6 +35,7 @@ OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_create( void OpenAPI_maximum_latency_free(OpenAPI_maximum_latency_t *maximum_latency); OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_parseFromJSON(cJSON *maximum_latencyJSON); cJSON *OpenAPI_maximum_latency_convertToJSON(OpenAPI_maximum_latency_t *maximum_latency); +OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_copy(OpenAPI_maximum_latency_t *dst, OpenAPI_maximum_latency_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/maximum_response_time.c b/lib/sbi/openapi/model/maximum_response_time.c index 70cca1d23..1203fc2c9 100644 --- a/lib/sbi/openapi/model/maximum_response_time.c +++ b/lib/sbi/openapi/model/maximum_response_time.c @@ -137,3 +137,37 @@ end: return NULL; } +OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_copy(OpenAPI_maximum_response_time_t *dst, OpenAPI_maximum_response_time_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_maximum_response_time_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_maximum_response_time_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_maximum_response_time_free(dst); + dst = OpenAPI_maximum_response_time_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/maximum_response_time.h b/lib/sbi/openapi/model/maximum_response_time.h index f1446d239..86e858b63 100644 --- a/lib/sbi/openapi/model/maximum_response_time.h +++ b/lib/sbi/openapi/model/maximum_response_time.h @@ -35,6 +35,7 @@ OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_create( void OpenAPI_maximum_response_time_free(OpenAPI_maximum_response_time_t *maximum_response_time); OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_parseFromJSON(cJSON *maximum_response_timeJSON); cJSON *OpenAPI_maximum_response_time_convertToJSON(OpenAPI_maximum_response_time_t *maximum_response_time); +OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_copy(OpenAPI_maximum_response_time_t *dst, OpenAPI_maximum_response_time_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/mm_context.c b/lib/sbi/openapi/model/mm_context.c new file mode 100644 index 000000000..8933252b0 --- /dev/null +++ b/lib/sbi/openapi/model/mm_context.c @@ -0,0 +1,436 @@ + +#include +#include +#include +#include "mm_context.h" + +OpenAPI_mm_context_t *OpenAPI_mm_context_create( + OpenAPI_access_type_e access_type, + OpenAPI_nas_security_mode_t *nas_security_mode, + int nas_downlink_count, + int nas_uplink_count, + char ue_security_capability, + char s1_ue_network_capability, + OpenAPI_list_t *allowed_nssai, + OpenAPI_list_t *nssai_mapping_list, + OpenAPI_list_t *ns_instance_list, + OpenAPI_expected_ue_behavior_t *expected_u_ebehavior, + char plmn_assi_ue_radio_cap_id, + char man_assi_ue_radio_cap_id, + char *ucmf_dic_entry_id + ) +{ + OpenAPI_mm_context_t *mm_context_local_var = OpenAPI_malloc(sizeof(OpenAPI_mm_context_t)); + if (!mm_context_local_var) { + return NULL; + } + mm_context_local_var->access_type = access_type; + mm_context_local_var->nas_security_mode = nas_security_mode; + mm_context_local_var->nas_downlink_count = nas_downlink_count; + mm_context_local_var->nas_uplink_count = nas_uplink_count; + mm_context_local_var->ue_security_capability = ue_security_capability; + mm_context_local_var->s1_ue_network_capability = s1_ue_network_capability; + mm_context_local_var->allowed_nssai = allowed_nssai; + mm_context_local_var->nssai_mapping_list = nssai_mapping_list; + mm_context_local_var->ns_instance_list = ns_instance_list; + mm_context_local_var->expected_u_ebehavior = expected_u_ebehavior; + mm_context_local_var->plmn_assi_ue_radio_cap_id = plmn_assi_ue_radio_cap_id; + mm_context_local_var->man_assi_ue_radio_cap_id = man_assi_ue_radio_cap_id; + mm_context_local_var->ucmf_dic_entry_id = ucmf_dic_entry_id; + + return mm_context_local_var; +} + +void OpenAPI_mm_context_free(OpenAPI_mm_context_t *mm_context) +{ + if (NULL == mm_context) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_nas_security_mode_free(mm_context->nas_security_mode); + OpenAPI_list_for_each(mm_context->allowed_nssai, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(mm_context->allowed_nssai); + OpenAPI_list_for_each(mm_context->nssai_mapping_list, node) { + OpenAPI_nssai_mapping_free(node->data); + } + OpenAPI_list_free(mm_context->nssai_mapping_list); + OpenAPI_list_for_each(mm_context->ns_instance_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mm_context->ns_instance_list); + OpenAPI_expected_ue_behavior_free(mm_context->expected_u_ebehavior); + ogs_free(mm_context->ucmf_dic_entry_id); + ogs_free(mm_context); +} + +cJSON *OpenAPI_mm_context_convertToJSON(OpenAPI_mm_context_t *mm_context) +{ + cJSON *item = NULL; + + if (mm_context == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [MmContext]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!mm_context->access_type) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [access_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(mm_context->access_type)) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [access_type]"); + goto end; + } + + if (mm_context->nas_security_mode) { + cJSON *nas_security_mode_local_JSON = OpenAPI_nas_security_mode_convertToJSON(mm_context->nas_security_mode); + if (nas_security_mode_local_JSON == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [nas_security_mode]"); + goto end; + } + cJSON_AddItemToObject(item, "nasSecurityMode", nas_security_mode_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [nas_security_mode]"); + goto end; + } + } + + if (mm_context->nas_downlink_count) { + if (cJSON_AddNumberToObject(item, "nasDownlinkCount", mm_context->nas_downlink_count) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [nas_downlink_count]"); + goto end; + } + } + + if (mm_context->nas_uplink_count) { + if (cJSON_AddNumberToObject(item, "nasUplinkCount", mm_context->nas_uplink_count) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [nas_uplink_count]"); + goto end; + } + } + + if (mm_context->ue_security_capability) { + if (cJSON_AddNumberToObject(item, "ueSecurityCapability", mm_context->ue_security_capability) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [ue_security_capability]"); + goto end; + } + } + + if (mm_context->s1_ue_network_capability) { + if (cJSON_AddNumberToObject(item, "s1UeNetworkCapability", mm_context->s1_ue_network_capability) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [s1_ue_network_capability]"); + goto end; + } + } + + if (mm_context->allowed_nssai) { + cJSON *allowed_nssaiList = cJSON_AddArrayToObject(item, "allowedNssai"); + if (allowed_nssaiList == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [allowed_nssai]"); + goto end; + } + + OpenAPI_lnode_t *allowed_nssai_node; + if (mm_context->allowed_nssai) { + OpenAPI_list_for_each(mm_context->allowed_nssai, allowed_nssai_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(allowed_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [allowed_nssai]"); + goto end; + } + cJSON_AddItemToArray(allowed_nssaiList, itemLocal); + } + } + } + + if (mm_context->nssai_mapping_list) { + cJSON *nssai_mapping_listList = cJSON_AddArrayToObject(item, "nssaiMappingList"); + if (nssai_mapping_listList == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [nssai_mapping_list]"); + goto end; + } + + OpenAPI_lnode_t *nssai_mapping_list_node; + if (mm_context->nssai_mapping_list) { + OpenAPI_list_for_each(mm_context->nssai_mapping_list, nssai_mapping_list_node) { + cJSON *itemLocal = OpenAPI_nssai_mapping_convertToJSON(nssai_mapping_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [nssai_mapping_list]"); + goto end; + } + cJSON_AddItemToArray(nssai_mapping_listList, itemLocal); + } + } + } + + if (mm_context->ns_instance_list) { + cJSON *ns_instance_list = cJSON_AddArrayToObject(item, "nsInstanceList"); + if (ns_instance_list == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [ns_instance_list]"); + goto end; + } + + OpenAPI_lnode_t *ns_instance_list_node; + OpenAPI_list_for_each(mm_context->ns_instance_list, ns_instance_list_node) { + if (cJSON_AddStringToObject(ns_instance_list, "", (char*)ns_instance_list_node->data) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [ns_instance_list]"); + goto end; + } + } + } + + if (mm_context->expected_u_ebehavior) { + cJSON *expected_u_ebehavior_local_JSON = OpenAPI_expected_ue_behavior_convertToJSON(mm_context->expected_u_ebehavior); + if (expected_u_ebehavior_local_JSON == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [expected_u_ebehavior]"); + goto end; + } + cJSON_AddItemToObject(item, "expectedUEbehavior", expected_u_ebehavior_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [expected_u_ebehavior]"); + goto end; + } + } + + if (mm_context->plmn_assi_ue_radio_cap_id) { + if (cJSON_AddNumberToObject(item, "plmnAssiUeRadioCapId", mm_context->plmn_assi_ue_radio_cap_id) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [plmn_assi_ue_radio_cap_id]"); + goto end; + } + } + + if (mm_context->man_assi_ue_radio_cap_id) { + if (cJSON_AddNumberToObject(item, "manAssiUeRadioCapId", mm_context->man_assi_ue_radio_cap_id) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [man_assi_ue_radio_cap_id]"); + goto end; + } + } + + if (mm_context->ucmf_dic_entry_id) { + if (cJSON_AddStringToObject(item, "ucmfDicEntryId", mm_context->ucmf_dic_entry_id) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [ucmf_dic_entry_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_mm_context_t *OpenAPI_mm_context_parseFromJSON(cJSON *mm_contextJSON) +{ + OpenAPI_mm_context_t *mm_context_local_var = NULL; + cJSON *access_type = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "accessType"); + if (!access_type) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [access_type]"); + goto end; + } + + OpenAPI_access_type_e access_typeVariable; + + if (!cJSON_IsString(access_type)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [access_type]"); + goto end; + } + access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring); + + cJSON *nas_security_mode = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nasSecurityMode"); + + OpenAPI_nas_security_mode_t *nas_security_mode_local_nonprim = NULL; + if (nas_security_mode) { + nas_security_mode_local_nonprim = OpenAPI_nas_security_mode_parseFromJSON(nas_security_mode); + } + + cJSON *nas_downlink_count = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nasDownlinkCount"); + + if (nas_downlink_count) { + if (!cJSON_IsNumber(nas_downlink_count)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nas_downlink_count]"); + goto end; + } + } + + cJSON *nas_uplink_count = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nasUplinkCount"); + + if (nas_uplink_count) { + if (!cJSON_IsNumber(nas_uplink_count)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nas_uplink_count]"); + goto end; + } + } + + cJSON *ue_security_capability = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "ueSecurityCapability"); + + if (ue_security_capability) { + if (!cJSON_IsNumber(ue_security_capability)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [ue_security_capability]"); + goto end; + } + } + + cJSON *s1_ue_network_capability = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "s1UeNetworkCapability"); + + if (s1_ue_network_capability) { + if (!cJSON_IsNumber(s1_ue_network_capability)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [s1_ue_network_capability]"); + goto end; + } + } + + cJSON *allowed_nssai = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "allowedNssai"); + + OpenAPI_list_t *allowed_nssaiList; + if (allowed_nssai) { + cJSON *allowed_nssai_local_nonprimitive; + if (!cJSON_IsArray(allowed_nssai)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [allowed_nssai]"); + goto end; + } + + allowed_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_nssai_local_nonprimitive, allowed_nssai ) { + if (!cJSON_IsObject(allowed_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [allowed_nssai]"); + goto end; + } + OpenAPI_snssai_t *allowed_nssaiItem = OpenAPI_snssai_parseFromJSON(allowed_nssai_local_nonprimitive); + + OpenAPI_list_add(allowed_nssaiList, allowed_nssaiItem); + } + } + + cJSON *nssai_mapping_list = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nssaiMappingList"); + + OpenAPI_list_t *nssai_mapping_listList; + if (nssai_mapping_list) { + cJSON *nssai_mapping_list_local_nonprimitive; + if (!cJSON_IsArray(nssai_mapping_list)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nssai_mapping_list]"); + goto end; + } + + nssai_mapping_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nssai_mapping_list_local_nonprimitive, nssai_mapping_list ) { + if (!cJSON_IsObject(nssai_mapping_list_local_nonprimitive)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nssai_mapping_list]"); + goto end; + } + OpenAPI_nssai_mapping_t *nssai_mapping_listItem = OpenAPI_nssai_mapping_parseFromJSON(nssai_mapping_list_local_nonprimitive); + + OpenAPI_list_add(nssai_mapping_listList, nssai_mapping_listItem); + } + } + + cJSON *ns_instance_list = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nsInstanceList"); + + OpenAPI_list_t *ns_instance_listList; + if (ns_instance_list) { + cJSON *ns_instance_list_local; + if (!cJSON_IsArray(ns_instance_list)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [ns_instance_list]"); + goto end; + } + ns_instance_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ns_instance_list_local, ns_instance_list) { + if (!cJSON_IsString(ns_instance_list_local)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [ns_instance_list]"); + goto end; + } + OpenAPI_list_add(ns_instance_listList, ogs_strdup(ns_instance_list_local->valuestring)); + } + } + + cJSON *expected_u_ebehavior = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "expectedUEbehavior"); + + OpenAPI_expected_ue_behavior_t *expected_u_ebehavior_local_nonprim = NULL; + if (expected_u_ebehavior) { + expected_u_ebehavior_local_nonprim = OpenAPI_expected_ue_behavior_parseFromJSON(expected_u_ebehavior); + } + + cJSON *plmn_assi_ue_radio_cap_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "plmnAssiUeRadioCapId"); + + if (plmn_assi_ue_radio_cap_id) { + if (!cJSON_IsNumber(plmn_assi_ue_radio_cap_id)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [plmn_assi_ue_radio_cap_id]"); + goto end; + } + } + + cJSON *man_assi_ue_radio_cap_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "manAssiUeRadioCapId"); + + if (man_assi_ue_radio_cap_id) { + if (!cJSON_IsNumber(man_assi_ue_radio_cap_id)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [man_assi_ue_radio_cap_id]"); + goto end; + } + } + + cJSON *ucmf_dic_entry_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "ucmfDicEntryId"); + + if (ucmf_dic_entry_id) { + if (!cJSON_IsString(ucmf_dic_entry_id)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [ucmf_dic_entry_id]"); + goto end; + } + } + + mm_context_local_var = OpenAPI_mm_context_create ( + access_typeVariable, + nas_security_mode ? nas_security_mode_local_nonprim : NULL, + nas_downlink_count ? nas_downlink_count->valuedouble : 0, + nas_uplink_count ? nas_uplink_count->valuedouble : 0, + ue_security_capability ? ue_security_capability->valueint : 0, + s1_ue_network_capability ? s1_ue_network_capability->valueint : 0, + allowed_nssai ? allowed_nssaiList : NULL, + nssai_mapping_list ? nssai_mapping_listList : NULL, + ns_instance_list ? ns_instance_listList : NULL, + expected_u_ebehavior ? expected_u_ebehavior_local_nonprim : NULL, + plmn_assi_ue_radio_cap_id ? plmn_assi_ue_radio_cap_id->valueint : 0, + man_assi_ue_radio_cap_id ? man_assi_ue_radio_cap_id->valueint : 0, + ucmf_dic_entry_id ? ogs_strdup(ucmf_dic_entry_id->valuestring) : NULL + ); + + return mm_context_local_var; +end: + return NULL; +} + +OpenAPI_mm_context_t *OpenAPI_mm_context_copy(OpenAPI_mm_context_t *dst, OpenAPI_mm_context_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mm_context_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_mm_context_free(dst); + dst = OpenAPI_mm_context_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mm_context.h b/lib/sbi/openapi/model/mm_context.h new file mode 100644 index 000000000..652db91db --- /dev/null +++ b/lib/sbi/openapi/model/mm_context.h @@ -0,0 +1,67 @@ +/* + * mm_context.h + * + * + */ + +#ifndef _OpenAPI_mm_context_H_ +#define _OpenAPI_mm_context_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "expected_ue_behavior.h" +#include "nas_security_mode.h" +#include "nssai_mapping.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mm_context_s OpenAPI_mm_context_t; +typedef struct OpenAPI_mm_context_s { + OpenAPI_access_type_e access_type; + struct OpenAPI_nas_security_mode_s *nas_security_mode; + int nas_downlink_count; + int nas_uplink_count; + char ue_security_capability; + char s1_ue_network_capability; + OpenAPI_list_t *allowed_nssai; + OpenAPI_list_t *nssai_mapping_list; + OpenAPI_list_t *ns_instance_list; + struct OpenAPI_expected_ue_behavior_s *expected_u_ebehavior; + char plmn_assi_ue_radio_cap_id; + char man_assi_ue_radio_cap_id; + char *ucmf_dic_entry_id; +} OpenAPI_mm_context_t; + +OpenAPI_mm_context_t *OpenAPI_mm_context_create( + OpenAPI_access_type_e access_type, + OpenAPI_nas_security_mode_t *nas_security_mode, + int nas_downlink_count, + int nas_uplink_count, + char ue_security_capability, + char s1_ue_network_capability, + OpenAPI_list_t *allowed_nssai, + OpenAPI_list_t *nssai_mapping_list, + OpenAPI_list_t *ns_instance_list, + OpenAPI_expected_ue_behavior_t *expected_u_ebehavior, + char plmn_assi_ue_radio_cap_id, + char man_assi_ue_radio_cap_id, + char *ucmf_dic_entry_id + ); +void OpenAPI_mm_context_free(OpenAPI_mm_context_t *mm_context); +OpenAPI_mm_context_t *OpenAPI_mm_context_parseFromJSON(cJSON *mm_contextJSON); +cJSON *OpenAPI_mm_context_convertToJSON(OpenAPI_mm_context_t *mm_context); +OpenAPI_mm_context_t *OpenAPI_mm_context_copy(OpenAPI_mm_context_t *dst, OpenAPI_mm_context_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mm_context_H_ */ + diff --git a/lib/sbi/openapi/model/mme_capabilities.c b/lib/sbi/openapi/model/mme_capabilities.c new file mode 100644 index 000000000..2b36c0730 --- /dev/null +++ b/lib/sbi/openapi/model/mme_capabilities.c @@ -0,0 +1,123 @@ + +#include +#include +#include +#include "mme_capabilities.h" + +OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_create( + int non_ip_supported, + int ethernet_supported + ) +{ + OpenAPI_mme_capabilities_t *mme_capabilities_local_var = OpenAPI_malloc(sizeof(OpenAPI_mme_capabilities_t)); + if (!mme_capabilities_local_var) { + return NULL; + } + mme_capabilities_local_var->non_ip_supported = non_ip_supported; + mme_capabilities_local_var->ethernet_supported = ethernet_supported; + + return mme_capabilities_local_var; +} + +void OpenAPI_mme_capabilities_free(OpenAPI_mme_capabilities_t *mme_capabilities) +{ + if (NULL == mme_capabilities) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(mme_capabilities); +} + +cJSON *OpenAPI_mme_capabilities_convertToJSON(OpenAPI_mme_capabilities_t *mme_capabilities) +{ + cJSON *item = NULL; + + if (mme_capabilities == NULL) { + ogs_error("OpenAPI_mme_capabilities_convertToJSON() failed [MmeCapabilities]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mme_capabilities->non_ip_supported) { + if (cJSON_AddBoolToObject(item, "nonIpSupported", mme_capabilities->non_ip_supported) == NULL) { + ogs_error("OpenAPI_mme_capabilities_convertToJSON() failed [non_ip_supported]"); + goto end; + } + } + + if (mme_capabilities->ethernet_supported) { + if (cJSON_AddBoolToObject(item, "ethernetSupported", mme_capabilities->ethernet_supported) == NULL) { + ogs_error("OpenAPI_mme_capabilities_convertToJSON() failed [ethernet_supported]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_parseFromJSON(cJSON *mme_capabilitiesJSON) +{ + OpenAPI_mme_capabilities_t *mme_capabilities_local_var = NULL; + cJSON *non_ip_supported = cJSON_GetObjectItemCaseSensitive(mme_capabilitiesJSON, "nonIpSupported"); + + if (non_ip_supported) { + if (!cJSON_IsBool(non_ip_supported)) { + ogs_error("OpenAPI_mme_capabilities_parseFromJSON() failed [non_ip_supported]"); + goto end; + } + } + + cJSON *ethernet_supported = cJSON_GetObjectItemCaseSensitive(mme_capabilitiesJSON, "ethernetSupported"); + + if (ethernet_supported) { + if (!cJSON_IsBool(ethernet_supported)) { + ogs_error("OpenAPI_mme_capabilities_parseFromJSON() failed [ethernet_supported]"); + goto end; + } + } + + mme_capabilities_local_var = OpenAPI_mme_capabilities_create ( + non_ip_supported ? non_ip_supported->valueint : 0, + ethernet_supported ? ethernet_supported->valueint : 0 + ); + + return mme_capabilities_local_var; +end: + return NULL; +} + +OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_copy(OpenAPI_mme_capabilities_t *dst, OpenAPI_mme_capabilities_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mme_capabilities_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mme_capabilities_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_mme_capabilities_free(dst); + dst = OpenAPI_mme_capabilities_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mme_capabilities.h b/lib/sbi/openapi/model/mme_capabilities.h new file mode 100644 index 000000000..8e9e48151 --- /dev/null +++ b/lib/sbi/openapi/model/mme_capabilities.h @@ -0,0 +1,40 @@ +/* + * mme_capabilities.h + * + * + */ + +#ifndef _OpenAPI_mme_capabilities_H_ +#define _OpenAPI_mme_capabilities_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_mme_capabilities_s OpenAPI_mme_capabilities_t; +typedef struct OpenAPI_mme_capabilities_s { + int non_ip_supported; + int ethernet_supported; +} OpenAPI_mme_capabilities_t; + +OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_create( + int non_ip_supported, + int ethernet_supported + ); +void OpenAPI_mme_capabilities_free(OpenAPI_mme_capabilities_t *mme_capabilities); +OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_parseFromJSON(cJSON *mme_capabilitiesJSON); +cJSON *OpenAPI_mme_capabilities_convertToJSON(OpenAPI_mme_capabilities_t *mme_capabilities); +OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_copy(OpenAPI_mme_capabilities_t *dst, OpenAPI_mme_capabilities_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mme_capabilities_H_ */ + diff --git a/lib/sbi/openapi/model/mo_exception_data_flag.c b/lib/sbi/openapi/model/mo_exception_data_flag.c new file mode 100644 index 000000000..529461452 --- /dev/null +++ b/lib/sbi/openapi/model/mo_exception_data_flag.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "mo_exception_data_flag.h" + +OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_create( + ) +{ + OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag_local_var = OpenAPI_malloc(sizeof(OpenAPI_mo_exception_data_flag_t)); + if (!mo_exception_data_flag_local_var) { + return NULL; + } + + return mo_exception_data_flag_local_var; +} + +void OpenAPI_mo_exception_data_flag_free(OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag) +{ + if (NULL == mo_exception_data_flag) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(mo_exception_data_flag); +} + +cJSON *OpenAPI_mo_exception_data_flag_convertToJSON(OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag) +{ + cJSON *item = NULL; + + if (mo_exception_data_flag == NULL) { + ogs_error("OpenAPI_mo_exception_data_flag_convertToJSON() failed [MoExceptionDataFlag]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_parseFromJSON(cJSON *mo_exception_data_flagJSON) +{ + OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag_local_var = NULL; + mo_exception_data_flag_local_var = OpenAPI_mo_exception_data_flag_create ( + ); + + return mo_exception_data_flag_local_var; +end: + return NULL; +} + +OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_copy(OpenAPI_mo_exception_data_flag_t *dst, OpenAPI_mo_exception_data_flag_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mo_exception_data_flag_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mo_exception_data_flag_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_mo_exception_data_flag_free(dst); + dst = OpenAPI_mo_exception_data_flag_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mo_exception_data_flag.h b/lib/sbi/openapi/model/mo_exception_data_flag.h new file mode 100644 index 000000000..827eb05f8 --- /dev/null +++ b/lib/sbi/openapi/model/mo_exception_data_flag.h @@ -0,0 +1,36 @@ +/* + * mo_exception_data_flag.h + * + * Possible values are - \"START\": Indicates the start of MO Exception Data delivery. - \"STOP\": Indicates the stop of MO Exception Data delivery. + */ + +#ifndef _OpenAPI_mo_exception_data_flag_H_ +#define _OpenAPI_mo_exception_data_flag_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mo_exception_data_flag_s OpenAPI_mo_exception_data_flag_t; +typedef struct OpenAPI_mo_exception_data_flag_s { +} OpenAPI_mo_exception_data_flag_t; + +OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_create( + ); +void OpenAPI_mo_exception_data_flag_free(OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag); +OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_parseFromJSON(cJSON *mo_exception_data_flagJSON); +cJSON *OpenAPI_mo_exception_data_flag_convertToJSON(OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag); +OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_copy(OpenAPI_mo_exception_data_flag_t *dst, OpenAPI_mo_exception_data_flag_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mo_exception_data_flag_H_ */ + diff --git a/lib/sbi/openapi/model/mo_exp_data_counter.c b/lib/sbi/openapi/model/mo_exp_data_counter.c new file mode 100644 index 000000000..ea8e235cb --- /dev/null +++ b/lib/sbi/openapi/model/mo_exp_data_counter.c @@ -0,0 +1,129 @@ + +#include +#include +#include +#include "mo_exp_data_counter.h" + +OpenAPI_mo_exp_data_counter_t *OpenAPI_mo_exp_data_counter_create( + int counter, + char *time_stamp + ) +{ + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_var = OpenAPI_malloc(sizeof(OpenAPI_mo_exp_data_counter_t)); + if (!mo_exp_data_counter_local_var) { + return NULL; + } + mo_exp_data_counter_local_var->counter = counter; + mo_exp_data_counter_local_var->time_stamp = time_stamp; + + return mo_exp_data_counter_local_var; +} + +void OpenAPI_mo_exp_data_counter_free(OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter) +{ + if (NULL == mo_exp_data_counter) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(mo_exp_data_counter->time_stamp); + ogs_free(mo_exp_data_counter); +} + +cJSON *OpenAPI_mo_exp_data_counter_convertToJSON(OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter) +{ + cJSON *item = NULL; + + if (mo_exp_data_counter == NULL) { + ogs_error("OpenAPI_mo_exp_data_counter_convertToJSON() failed [MoExpDataCounter]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!mo_exp_data_counter->counter) { + ogs_error("OpenAPI_mo_exp_data_counter_convertToJSON() failed [counter]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "counter", mo_exp_data_counter->counter) == NULL) { + ogs_error("OpenAPI_mo_exp_data_counter_convertToJSON() failed [counter]"); + goto end; + } + + if (mo_exp_data_counter->time_stamp) { + if (cJSON_AddStringToObject(item, "timeStamp", mo_exp_data_counter->time_stamp) == NULL) { + ogs_error("OpenAPI_mo_exp_data_counter_convertToJSON() failed [time_stamp]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_mo_exp_data_counter_t *OpenAPI_mo_exp_data_counter_parseFromJSON(cJSON *mo_exp_data_counterJSON) +{ + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_var = NULL; + cJSON *counter = cJSON_GetObjectItemCaseSensitive(mo_exp_data_counterJSON, "counter"); + if (!counter) { + ogs_error("OpenAPI_mo_exp_data_counter_parseFromJSON() failed [counter]"); + goto end; + } + + + if (!cJSON_IsNumber(counter)) { + ogs_error("OpenAPI_mo_exp_data_counter_parseFromJSON() failed [counter]"); + goto end; + } + + cJSON *time_stamp = cJSON_GetObjectItemCaseSensitive(mo_exp_data_counterJSON, "timeStamp"); + + if (time_stamp) { + if (!cJSON_IsString(time_stamp)) { + ogs_error("OpenAPI_mo_exp_data_counter_parseFromJSON() failed [time_stamp]"); + goto end; + } + } + + mo_exp_data_counter_local_var = OpenAPI_mo_exp_data_counter_create ( + counter->valuedouble, + time_stamp ? ogs_strdup(time_stamp->valuestring) : NULL + ); + + return mo_exp_data_counter_local_var; +end: + return NULL; +} + +OpenAPI_mo_exp_data_counter_t *OpenAPI_mo_exp_data_counter_copy(OpenAPI_mo_exp_data_counter_t *dst, OpenAPI_mo_exp_data_counter_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mo_exp_data_counter_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mo_exp_data_counter_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_mo_exp_data_counter_free(dst); + dst = OpenAPI_mo_exp_data_counter_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mo_exp_data_counter.h b/lib/sbi/openapi/model/mo_exp_data_counter.h new file mode 100644 index 000000000..eb63d2dc4 --- /dev/null +++ b/lib/sbi/openapi/model/mo_exp_data_counter.h @@ -0,0 +1,40 @@ +/* + * mo_exp_data_counter.h + * + * + */ + +#ifndef _OpenAPI_mo_exp_data_counter_H_ +#define _OpenAPI_mo_exp_data_counter_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_mo_exp_data_counter_s OpenAPI_mo_exp_data_counter_t; +typedef struct OpenAPI_mo_exp_data_counter_s { + int counter; + char *time_stamp; +} OpenAPI_mo_exp_data_counter_t; + +OpenAPI_mo_exp_data_counter_t *OpenAPI_mo_exp_data_counter_create( + int counter, + char *time_stamp + ); +void OpenAPI_mo_exp_data_counter_free(OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter); +OpenAPI_mo_exp_data_counter_t *OpenAPI_mo_exp_data_counter_parseFromJSON(cJSON *mo_exp_data_counterJSON); +cJSON *OpenAPI_mo_exp_data_counter_convertToJSON(OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter); +OpenAPI_mo_exp_data_counter_t *OpenAPI_mo_exp_data_counter_copy(OpenAPI_mo_exp_data_counter_t *dst, OpenAPI_mo_exp_data_counter_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mo_exp_data_counter_H_ */ + diff --git a/lib/sbi/openapi/model/model_5_g_vn_group_configuration.c b/lib/sbi/openapi/model/model_5_g_vn_group_configuration.c index 13eb85571..fb9d1a62c 100644 --- a/lib/sbi/openapi/model/model_5_g_vn_group_configuration.c +++ b/lib/sbi/openapi/model/model_5_g_vn_group_configuration.c @@ -175,3 +175,37 @@ end: return NULL; } +OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configuration_copy(OpenAPI_model_5_g_vn_group_configuration_t *dst, OpenAPI_model_5_g_vn_group_configuration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_model_5_g_vn_group_configuration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_model_5_g_vn_group_configuration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_model_5_g_vn_group_configuration_free(dst); + dst = OpenAPI_model_5_g_vn_group_configuration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/model_5_g_vn_group_configuration.h b/lib/sbi/openapi/model/model_5_g_vn_group_configuration.h index d041ce87a..95db09f23 100644 --- a/lib/sbi/openapi/model/model_5_g_vn_group_configuration.h +++ b/lib/sbi/openapi/model/model_5_g_vn_group_configuration.h @@ -37,6 +37,7 @@ OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configura void OpenAPI_model_5_g_vn_group_configuration_free(OpenAPI_model_5_g_vn_group_configuration_t *model_5_g_vn_group_configuration); OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configuration_parseFromJSON(cJSON *model_5_g_vn_group_configurationJSON); cJSON *OpenAPI_model_5_g_vn_group_configuration_convertToJSON(OpenAPI_model_5_g_vn_group_configuration_t *model_5_g_vn_group_configuration); +OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configuration_copy(OpenAPI_model_5_g_vn_group_configuration_t *dst, OpenAPI_model_5_g_vn_group_configuration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/model_5_g_vn_group_data.c b/lib/sbi/openapi/model/model_5_g_vn_group_data.c index c06d8e4de..6cf5b1535 100644 --- a/lib/sbi/openapi/model/model_5_g_vn_group_data.c +++ b/lib/sbi/openapi/model/model_5_g_vn_group_data.c @@ -31,9 +31,6 @@ void OpenAPI_model_5_g_vn_group_data_free(OpenAPI_model_5_g_vn_group_data_t *mod OpenAPI_lnode_t *node; ogs_free(model_5_g_vn_group_data->dnn); OpenAPI_snssai_free(model_5_g_vn_group_data->s_nssai); - OpenAPI_list_for_each(model_5_g_vn_group_data->pdu_session_types, node) { - OpenAPI_pdu_session_type_free(node->data); - } OpenAPI_list_free(model_5_g_vn_group_data->pdu_session_types); OpenAPI_list_for_each(model_5_g_vn_group_data->app_descriptors, node) { OpenAPI_app_descriptor_free(node->data); @@ -77,21 +74,16 @@ cJSON *OpenAPI_model_5_g_vn_group_data_convertToJSON(OpenAPI_model_5_g_vn_group_ } if (model_5_g_vn_group_data->pdu_session_types) { - cJSON *pdu_session_typesList = cJSON_AddArrayToObject(item, "pduSessionTypes"); - if (pdu_session_typesList == NULL) { + cJSON *pdu_session_types = cJSON_AddArrayToObject(item, "pduSessionTypes"); + if (pdu_session_types == NULL) { ogs_error("OpenAPI_model_5_g_vn_group_data_convertToJSON() failed [pdu_session_types]"); goto end; } - OpenAPI_lnode_t *pdu_session_types_node; - if (model_5_g_vn_group_data->pdu_session_types) { - OpenAPI_list_for_each(model_5_g_vn_group_data->pdu_session_types, pdu_session_types_node) { - cJSON *itemLocal = OpenAPI_pdu_session_type_convertToJSON(pdu_session_types_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_model_5_g_vn_group_data_convertToJSON() failed [pdu_session_types]"); - goto end; - } - cJSON_AddItemToArray(pdu_session_typesList, itemLocal); + OpenAPI_list_for_each(model_5_g_vn_group_data->pdu_session_types, pdu_session_types_node) { + if (cJSON_AddStringToObject(pdu_session_types, "", OpenAPI_pdu_session_type_ToString((OpenAPI_pdu_session_type_e)pdu_session_types_node->data)) == NULL) { + ogs_error("OpenAPI_model_5_g_vn_group_data_convertToJSON() failed [pdu_session_types]"); + goto end; } } } @@ -158,13 +150,12 @@ OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_parseFromJSON pdu_session_typesList = OpenAPI_list_create(); cJSON_ArrayForEach(pdu_session_types_local_nonprimitive, pdu_session_types ) { - if (!cJSON_IsObject(pdu_session_types_local_nonprimitive)) { + if (!cJSON_IsString(pdu_session_types_local_nonprimitive)) { ogs_error("OpenAPI_model_5_g_vn_group_data_parseFromJSON() failed [pdu_session_types]"); goto end; } - OpenAPI_pdu_session_type_t *pdu_session_typesItem = OpenAPI_pdu_session_type_parseFromJSON(pdu_session_types_local_nonprimitive); - OpenAPI_list_add(pdu_session_typesList, pdu_session_typesItem); + OpenAPI_list_add(pdu_session_typesList, (void *)OpenAPI_pdu_session_type_FromString(pdu_session_types_local_nonprimitive->valuestring)); } } @@ -203,3 +194,37 @@ end: return NULL; } +OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_copy(OpenAPI_model_5_g_vn_group_data_t *dst, OpenAPI_model_5_g_vn_group_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_model_5_g_vn_group_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_model_5_g_vn_group_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_model_5_g_vn_group_data_free(dst); + dst = OpenAPI_model_5_g_vn_group_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/model_5_g_vn_group_data.h b/lib/sbi/openapi/model/model_5_g_vn_group_data.h index 2720e8a33..d6b4cc707 100644 --- a/lib/sbi/openapi/model/model_5_g_vn_group_data.h +++ b/lib/sbi/openapi/model/model_5_g_vn_group_data.h @@ -37,6 +37,7 @@ OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_create( void OpenAPI_model_5_g_vn_group_data_free(OpenAPI_model_5_g_vn_group_data_t *model_5_g_vn_group_data); OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_parseFromJSON(cJSON *model_5_g_vn_group_dataJSON); cJSON *OpenAPI_model_5_g_vn_group_data_convertToJSON(OpenAPI_model_5_g_vn_group_data_t *model_5_g_vn_group_data); +OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_copy(OpenAPI_model_5_g_vn_group_data_t *dst, OpenAPI_model_5_g_vn_group_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/modification_notification.c b/lib/sbi/openapi/model/modification_notification.c index e14e14f12..a11a74130 100644 --- a/lib/sbi/openapi/model/modification_notification.c +++ b/lib/sbi/openapi/model/modification_notification.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_modification_notification_t *OpenAPI_modification_notification_copy(OpenAPI_modification_notification_t *dst, OpenAPI_modification_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_modification_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_modification_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_modification_notification_free(dst); + dst = OpenAPI_modification_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/modification_notification.h b/lib/sbi/openapi/model/modification_notification.h index 65b16efd1..cddc4e852 100644 --- a/lib/sbi/openapi/model/modification_notification.h +++ b/lib/sbi/openapi/model/modification_notification.h @@ -29,6 +29,7 @@ OpenAPI_modification_notification_t *OpenAPI_modification_notification_create( void OpenAPI_modification_notification_free(OpenAPI_modification_notification_t *modification_notification); OpenAPI_modification_notification_t *OpenAPI_modification_notification_parseFromJSON(cJSON *modification_notificationJSON); cJSON *OpenAPI_modification_notification_convertToJSON(OpenAPI_modification_notification_t *modification_notification); +OpenAPI_modification_notification_t *OpenAPI_modification_notification_copy(OpenAPI_modification_notification_t *dst, OpenAPI_modification_notification_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/monitoring_configuration.c b/lib/sbi/openapi/model/monitoring_configuration.c index 55f24ae9f..d2d680eca 100644 --- a/lib/sbi/openapi/model/monitoring_configuration.c +++ b/lib/sbi/openapi/model/monitoring_configuration.c @@ -63,7 +63,7 @@ cJSON *OpenAPI_monitoring_configuration_convertToJSON(OpenAPI_monitoring_configu goto end; } - if (monitoring_configuration->immediate_flag >= 0) { + if (monitoring_configuration->immediate_flag) { if (cJSON_AddBoolToObject(item, "immediateFlag", monitoring_configuration->immediate_flag) == NULL) { ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [immediate_flag]"); goto end; @@ -169,3 +169,37 @@ end: return NULL; } +OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_copy(OpenAPI_monitoring_configuration_t *dst, OpenAPI_monitoring_configuration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_monitoring_configuration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_monitoring_configuration_free(dst); + dst = OpenAPI_monitoring_configuration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/monitoring_configuration.h b/lib/sbi/openapi/model/monitoring_configuration.h index caf3dc01f..83e297e9c 100644 --- a/lib/sbi/openapi/model/monitoring_configuration.h +++ b/lib/sbi/openapi/model/monitoring_configuration.h @@ -40,6 +40,7 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( void OpenAPI_monitoring_configuration_free(OpenAPI_monitoring_configuration_t *monitoring_configuration); OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_parseFromJSON(cJSON *monitoring_configurationJSON); cJSON *OpenAPI_monitoring_configuration_convertToJSON(OpenAPI_monitoring_configuration_t *monitoring_configuration); +OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_copy(OpenAPI_monitoring_configuration_t *dst, OpenAPI_monitoring_configuration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/multicast_access_control.c b/lib/sbi/openapi/model/multicast_access_control.c index 00f337f5a..ab17a2b24 100644 --- a/lib/sbi/openapi/model/multicast_access_control.c +++ b/lib/sbi/openapi/model/multicast_access_control.c @@ -158,3 +158,37 @@ end: return NULL; } +OpenAPI_multicast_access_control_t *OpenAPI_multicast_access_control_copy(OpenAPI_multicast_access_control_t *dst, OpenAPI_multicast_access_control_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_multicast_access_control_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_multicast_access_control_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_multicast_access_control_free(dst); + dst = OpenAPI_multicast_access_control_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/multicast_access_control.h b/lib/sbi/openapi/model/multicast_access_control.h index dceed62cd..54458038d 100644 --- a/lib/sbi/openapi/model/multicast_access_control.h +++ b/lib/sbi/openapi/model/multicast_access_control.h @@ -37,6 +37,7 @@ OpenAPI_multicast_access_control_t *OpenAPI_multicast_access_control_create( void OpenAPI_multicast_access_control_free(OpenAPI_multicast_access_control_t *multicast_access_control); OpenAPI_multicast_access_control_t *OpenAPI_multicast_access_control_parseFromJSON(cJSON *multicast_access_controlJSON); cJSON *OpenAPI_multicast_access_control_convertToJSON(OpenAPI_multicast_access_control_t *multicast_access_control); +OpenAPI_multicast_access_control_t *OpenAPI_multicast_access_control_copy(OpenAPI_multicast_access_control_t *dst, OpenAPI_multicast_access_control_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/n1_message_container.c b/lib/sbi/openapi/model/n1_message_container.c new file mode 100644 index 000000000..8f0fe6084 --- /dev/null +++ b/lib/sbi/openapi/model/n1_message_container.c @@ -0,0 +1,180 @@ + +#include +#include +#include +#include "n1_message_container.h" + +OpenAPI_n1_message_container_t *OpenAPI_n1_message_container_create( + OpenAPI_n1_message_class_e n1_message_class, + OpenAPI_ref_to_binary_data_t *n1_message_content, + char *nf_id, + char *service_instance_id + ) +{ + OpenAPI_n1_message_container_t *n1_message_container_local_var = OpenAPI_malloc(sizeof(OpenAPI_n1_message_container_t)); + if (!n1_message_container_local_var) { + return NULL; + } + n1_message_container_local_var->n1_message_class = n1_message_class; + n1_message_container_local_var->n1_message_content = n1_message_content; + n1_message_container_local_var->nf_id = nf_id; + n1_message_container_local_var->service_instance_id = service_instance_id; + + return n1_message_container_local_var; +} + +void OpenAPI_n1_message_container_free(OpenAPI_n1_message_container_t *n1_message_container) +{ + if (NULL == n1_message_container) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ref_to_binary_data_free(n1_message_container->n1_message_content); + ogs_free(n1_message_container->nf_id); + ogs_free(n1_message_container->service_instance_id); + ogs_free(n1_message_container); +} + +cJSON *OpenAPI_n1_message_container_convertToJSON(OpenAPI_n1_message_container_t *n1_message_container) +{ + cJSON *item = NULL; + + if (n1_message_container == NULL) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed [N1MessageContainer]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n1_message_container->n1_message_class) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed [n1_message_class]"); + goto end; + } + if (cJSON_AddStringToObject(item, "n1MessageClass", OpenAPI_n1_message_class_ToString(n1_message_container->n1_message_class)) == NULL) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed [n1_message_class]"); + goto end; + } + + if (!n1_message_container->n1_message_content) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed [n1_message_content]"); + goto end; + } + cJSON *n1_message_content_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(n1_message_container->n1_message_content); + if (n1_message_content_local_JSON == NULL) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed [n1_message_content]"); + goto end; + } + cJSON_AddItemToObject(item, "n1MessageContent", n1_message_content_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed [n1_message_content]"); + goto end; + } + + if (n1_message_container->nf_id) { + if (cJSON_AddStringToObject(item, "nfId", n1_message_container->nf_id) == NULL) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed [nf_id]"); + goto end; + } + } + + if (n1_message_container->service_instance_id) { + if (cJSON_AddStringToObject(item, "serviceInstanceId", n1_message_container->service_instance_id) == NULL) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed [service_instance_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n1_message_container_t *OpenAPI_n1_message_container_parseFromJSON(cJSON *n1_message_containerJSON) +{ + OpenAPI_n1_message_container_t *n1_message_container_local_var = NULL; + cJSON *n1_message_class = cJSON_GetObjectItemCaseSensitive(n1_message_containerJSON, "n1MessageClass"); + if (!n1_message_class) { + ogs_error("OpenAPI_n1_message_container_parseFromJSON() failed [n1_message_class]"); + goto end; + } + + OpenAPI_n1_message_class_e n1_message_classVariable; + + if (!cJSON_IsString(n1_message_class)) { + ogs_error("OpenAPI_n1_message_container_parseFromJSON() failed [n1_message_class]"); + goto end; + } + n1_message_classVariable = OpenAPI_n1_message_class_FromString(n1_message_class->valuestring); + + cJSON *n1_message_content = cJSON_GetObjectItemCaseSensitive(n1_message_containerJSON, "n1MessageContent"); + if (!n1_message_content) { + ogs_error("OpenAPI_n1_message_container_parseFromJSON() failed [n1_message_content]"); + goto end; + } + + OpenAPI_ref_to_binary_data_t *n1_message_content_local_nonprim = NULL; + + n1_message_content_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_message_content); + + cJSON *nf_id = cJSON_GetObjectItemCaseSensitive(n1_message_containerJSON, "nfId"); + + if (nf_id) { + if (!cJSON_IsString(nf_id)) { + ogs_error("OpenAPI_n1_message_container_parseFromJSON() failed [nf_id]"); + goto end; + } + } + + cJSON *service_instance_id = cJSON_GetObjectItemCaseSensitive(n1_message_containerJSON, "serviceInstanceId"); + + if (service_instance_id) { + if (!cJSON_IsString(service_instance_id)) { + ogs_error("OpenAPI_n1_message_container_parseFromJSON() failed [service_instance_id]"); + goto end; + } + } + + n1_message_container_local_var = OpenAPI_n1_message_container_create ( + n1_message_classVariable, + n1_message_content_local_nonprim, + nf_id ? ogs_strdup(nf_id->valuestring) : NULL, + service_instance_id ? ogs_strdup(service_instance_id->valuestring) : NULL + ); + + return n1_message_container_local_var; +end: + return NULL; +} + +OpenAPI_n1_message_container_t *OpenAPI_n1_message_container_copy(OpenAPI_n1_message_container_t *dst, OpenAPI_n1_message_container_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n1_message_container_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n1_message_container_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n1_message_container_free(dst); + dst = OpenAPI_n1_message_container_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n1_message_container.h b/lib/sbi/openapi/model/n1_message_container.h new file mode 100644 index 000000000..6ac6818c8 --- /dev/null +++ b/lib/sbi/openapi/model/n1_message_container.h @@ -0,0 +1,46 @@ +/* + * n1_message_container.h + * + * + */ + +#ifndef _OpenAPI_n1_message_container_H_ +#define _OpenAPI_n1_message_container_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n1_message_class.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n1_message_container_s OpenAPI_n1_message_container_t; +typedef struct OpenAPI_n1_message_container_s { + OpenAPI_n1_message_class_e n1_message_class; + struct OpenAPI_ref_to_binary_data_s *n1_message_content; + char *nf_id; + char *service_instance_id; +} OpenAPI_n1_message_container_t; + +OpenAPI_n1_message_container_t *OpenAPI_n1_message_container_create( + OpenAPI_n1_message_class_e n1_message_class, + OpenAPI_ref_to_binary_data_t *n1_message_content, + char *nf_id, + char *service_instance_id + ); +void OpenAPI_n1_message_container_free(OpenAPI_n1_message_container_t *n1_message_container); +OpenAPI_n1_message_container_t *OpenAPI_n1_message_container_parseFromJSON(cJSON *n1_message_containerJSON); +cJSON *OpenAPI_n1_message_container_convertToJSON(OpenAPI_n1_message_container_t *n1_message_container); +OpenAPI_n1_message_container_t *OpenAPI_n1_message_container_copy(OpenAPI_n1_message_container_t *dst, OpenAPI_n1_message_container_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_message_container_H_ */ + diff --git a/lib/sbi/openapi/model/n1_message_notification.c b/lib/sbi/openapi/model/n1_message_notification.c new file mode 100644 index 000000000..a721a098a --- /dev/null +++ b/lib/sbi/openapi/model/n1_message_notification.c @@ -0,0 +1,198 @@ + +#include +#include +#include +#include "n1_message_notification.h" + +OpenAPI_n1_message_notification_t *OpenAPI_n1_message_notification_create( + char *n1_notify_subscription_id, + OpenAPI_n1_message_container_t *n1_message_container, + char *lcs_correlation_id, + OpenAPI_registration_context_container_t *registration_ctxt_container, + char *new_lmf_identification + ) +{ + OpenAPI_n1_message_notification_t *n1_message_notification_local_var = OpenAPI_malloc(sizeof(OpenAPI_n1_message_notification_t)); + if (!n1_message_notification_local_var) { + return NULL; + } + n1_message_notification_local_var->n1_notify_subscription_id = n1_notify_subscription_id; + n1_message_notification_local_var->n1_message_container = n1_message_container; + n1_message_notification_local_var->lcs_correlation_id = lcs_correlation_id; + n1_message_notification_local_var->registration_ctxt_container = registration_ctxt_container; + n1_message_notification_local_var->new_lmf_identification = new_lmf_identification; + + return n1_message_notification_local_var; +} + +void OpenAPI_n1_message_notification_free(OpenAPI_n1_message_notification_t *n1_message_notification) +{ + if (NULL == n1_message_notification) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(n1_message_notification->n1_notify_subscription_id); + OpenAPI_n1_message_container_free(n1_message_notification->n1_message_container); + ogs_free(n1_message_notification->lcs_correlation_id); + OpenAPI_registration_context_container_free(n1_message_notification->registration_ctxt_container); + ogs_free(n1_message_notification->new_lmf_identification); + ogs_free(n1_message_notification); +} + +cJSON *OpenAPI_n1_message_notification_convertToJSON(OpenAPI_n1_message_notification_t *n1_message_notification) +{ + cJSON *item = NULL; + + if (n1_message_notification == NULL) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [N1MessageNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (n1_message_notification->n1_notify_subscription_id) { + if (cJSON_AddStringToObject(item, "n1NotifySubscriptionId", n1_message_notification->n1_notify_subscription_id) == NULL) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [n1_notify_subscription_id]"); + goto end; + } + } + + if (!n1_message_notification->n1_message_container) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [n1_message_container]"); + goto end; + } + cJSON *n1_message_container_local_JSON = OpenAPI_n1_message_container_convertToJSON(n1_message_notification->n1_message_container); + if (n1_message_container_local_JSON == NULL) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [n1_message_container]"); + goto end; + } + cJSON_AddItemToObject(item, "n1MessageContainer", n1_message_container_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [n1_message_container]"); + goto end; + } + + if (n1_message_notification->lcs_correlation_id) { + if (cJSON_AddStringToObject(item, "lcsCorrelationId", n1_message_notification->lcs_correlation_id) == NULL) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [lcs_correlation_id]"); + goto end; + } + } + + if (n1_message_notification->registration_ctxt_container) { + cJSON *registration_ctxt_container_local_JSON = OpenAPI_registration_context_container_convertToJSON(n1_message_notification->registration_ctxt_container); + if (registration_ctxt_container_local_JSON == NULL) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [registration_ctxt_container]"); + goto end; + } + cJSON_AddItemToObject(item, "registrationCtxtContainer", registration_ctxt_container_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [registration_ctxt_container]"); + goto end; + } + } + + if (n1_message_notification->new_lmf_identification) { + if (cJSON_AddStringToObject(item, "newLmfIdentification", n1_message_notification->new_lmf_identification) == NULL) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed [new_lmf_identification]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n1_message_notification_t *OpenAPI_n1_message_notification_parseFromJSON(cJSON *n1_message_notificationJSON) +{ + OpenAPI_n1_message_notification_t *n1_message_notification_local_var = NULL; + cJSON *n1_notify_subscription_id = cJSON_GetObjectItemCaseSensitive(n1_message_notificationJSON, "n1NotifySubscriptionId"); + + if (n1_notify_subscription_id) { + if (!cJSON_IsString(n1_notify_subscription_id)) { + ogs_error("OpenAPI_n1_message_notification_parseFromJSON() failed [n1_notify_subscription_id]"); + goto end; + } + } + + cJSON *n1_message_container = cJSON_GetObjectItemCaseSensitive(n1_message_notificationJSON, "n1MessageContainer"); + if (!n1_message_container) { + ogs_error("OpenAPI_n1_message_notification_parseFromJSON() failed [n1_message_container]"); + goto end; + } + + OpenAPI_n1_message_container_t *n1_message_container_local_nonprim = NULL; + + n1_message_container_local_nonprim = OpenAPI_n1_message_container_parseFromJSON(n1_message_container); + + cJSON *lcs_correlation_id = cJSON_GetObjectItemCaseSensitive(n1_message_notificationJSON, "lcsCorrelationId"); + + if (lcs_correlation_id) { + if (!cJSON_IsString(lcs_correlation_id)) { + ogs_error("OpenAPI_n1_message_notification_parseFromJSON() failed [lcs_correlation_id]"); + goto end; + } + } + + cJSON *registration_ctxt_container = cJSON_GetObjectItemCaseSensitive(n1_message_notificationJSON, "registrationCtxtContainer"); + + OpenAPI_registration_context_container_t *registration_ctxt_container_local_nonprim = NULL; + if (registration_ctxt_container) { + registration_ctxt_container_local_nonprim = OpenAPI_registration_context_container_parseFromJSON(registration_ctxt_container); + } + + cJSON *new_lmf_identification = cJSON_GetObjectItemCaseSensitive(n1_message_notificationJSON, "newLmfIdentification"); + + if (new_lmf_identification) { + if (!cJSON_IsString(new_lmf_identification)) { + ogs_error("OpenAPI_n1_message_notification_parseFromJSON() failed [new_lmf_identification]"); + goto end; + } + } + + n1_message_notification_local_var = OpenAPI_n1_message_notification_create ( + n1_notify_subscription_id ? ogs_strdup(n1_notify_subscription_id->valuestring) : NULL, + n1_message_container_local_nonprim, + lcs_correlation_id ? ogs_strdup(lcs_correlation_id->valuestring) : NULL, + registration_ctxt_container ? registration_ctxt_container_local_nonprim : NULL, + new_lmf_identification ? ogs_strdup(new_lmf_identification->valuestring) : NULL + ); + + return n1_message_notification_local_var; +end: + return NULL; +} + +OpenAPI_n1_message_notification_t *OpenAPI_n1_message_notification_copy(OpenAPI_n1_message_notification_t *dst, OpenAPI_n1_message_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n1_message_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n1_message_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n1_message_notification_free(dst); + dst = OpenAPI_n1_message_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n1_message_notification.h b/lib/sbi/openapi/model/n1_message_notification.h new file mode 100644 index 000000000..a08a8f765 --- /dev/null +++ b/lib/sbi/openapi/model/n1_message_notification.h @@ -0,0 +1,48 @@ +/* + * n1_message_notification.h + * + * + */ + +#ifndef _OpenAPI_n1_message_notification_H_ +#define _OpenAPI_n1_message_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n1_message_container.h" +#include "registration_context_container.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n1_message_notification_s OpenAPI_n1_message_notification_t; +typedef struct OpenAPI_n1_message_notification_s { + char *n1_notify_subscription_id; + struct OpenAPI_n1_message_container_s *n1_message_container; + char *lcs_correlation_id; + struct OpenAPI_registration_context_container_s *registration_ctxt_container; + char *new_lmf_identification; +} OpenAPI_n1_message_notification_t; + +OpenAPI_n1_message_notification_t *OpenAPI_n1_message_notification_create( + char *n1_notify_subscription_id, + OpenAPI_n1_message_container_t *n1_message_container, + char *lcs_correlation_id, + OpenAPI_registration_context_container_t *registration_ctxt_container, + char *new_lmf_identification + ); +void OpenAPI_n1_message_notification_free(OpenAPI_n1_message_notification_t *n1_message_notification); +OpenAPI_n1_message_notification_t *OpenAPI_n1_message_notification_parseFromJSON(cJSON *n1_message_notificationJSON); +cJSON *OpenAPI_n1_message_notification_convertToJSON(OpenAPI_n1_message_notification_t *n1_message_notification); +OpenAPI_n1_message_notification_t *OpenAPI_n1_message_notification_copy(OpenAPI_n1_message_notification_t *dst, OpenAPI_n1_message_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_message_notification_H_ */ + diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_cause.c b/lib/sbi/openapi/model/n1_n2_message_transfer_cause.c new file mode 100644 index 000000000..86d46494e --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_cause.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n1_n2_message_transfer_cause.h" + +char* OpenAPI_n1_n2_message_transfer_cause_ToString(OpenAPI_n1_n2_message_transfer_cause_e n1_n2_message_transfer_cause) +{ + const char *n1_n2_message_transfer_causeArray[] = { "NULL", "ATTEMPTING_TO_REACH_UE", "N1_N2_TRANSFER_INITIATED", "WAITING_FOR_ASYNCHRONOUS_TRANSFER", "UE_NOT_RESPONDING", "N1_MSG_NOT_TRANSFERRED", "UE_NOT_REACHABLE_FOR_SESSION", "TEMPORARY_REJECT_REGISTRATION_ONGOING", "TEMPORARY_REJECT_HANDOVER_ONGOING" }; + size_t sizeofArray = sizeof(n1_n2_message_transfer_causeArray) / sizeof(n1_n2_message_transfer_causeArray[0]); + if (n1_n2_message_transfer_cause < sizeofArray) + return (char *)n1_n2_message_transfer_causeArray[n1_n2_message_transfer_cause]; + else + return (char *)"Unknown"; +} + +OpenAPI_n1_n2_message_transfer_cause_e OpenAPI_n1_n2_message_transfer_cause_FromString(char* n1_n2_message_transfer_cause) +{ + int stringToReturn = 0; + const char *n1_n2_message_transfer_causeArray[] = { "NULL", "ATTEMPTING_TO_REACH_UE", "N1_N2_TRANSFER_INITIATED", "WAITING_FOR_ASYNCHRONOUS_TRANSFER", "UE_NOT_RESPONDING", "N1_MSG_NOT_TRANSFERRED", "UE_NOT_REACHABLE_FOR_SESSION", "TEMPORARY_REJECT_REGISTRATION_ONGOING", "TEMPORARY_REJECT_HANDOVER_ONGOING" }; + size_t sizeofArray = sizeof(n1_n2_message_transfer_causeArray) / sizeof(n1_n2_message_transfer_causeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n1_n2_message_transfer_cause, n1_n2_message_transfer_causeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_cause.h b/lib/sbi/openapi/model/n1_n2_message_transfer_cause.h new file mode 100644 index 000000000..4e86b2386 --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_cause.h @@ -0,0 +1,31 @@ +/* + * n1_n2_message_transfer_cause.h + * + * + */ + +#ifndef _OpenAPI_n1_n2_message_transfer_cause_H_ +#define _OpenAPI_n1_n2_message_transfer_cause_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_n1_n2_message_transfer_cause_NULL = 0, OpenAPI_n1_n2_message_transfer_cause_ATTEMPTING_TO_REACH_UE, OpenAPI_n1_n2_message_transfer_cause_N1_N2_TRANSFER_INITIATED, OpenAPI_n1_n2_message_transfer_cause_WAITING_FOR_ASYNCHRONOUS_TRANSFER, OpenAPI_n1_n2_message_transfer_cause_UE_NOT_RESPONDING, OpenAPI_n1_n2_message_transfer_cause_N1_MSG_NOT_TRANSFERRED, OpenAPI_n1_n2_message_transfer_cause_UE_NOT_REACHABLE_FOR_SESSION, OpenAPI_n1_n2_message_transfer_cause_TEMPORARY_REJECT_REGISTRATION_ONGOING, OpenAPI_n1_n2_message_transfer_cause_TEMPORARY_REJECT_HANDOVER_ONGOING } OpenAPI_n1_n2_message_transfer_cause_e; + +char* OpenAPI_n1_n2_message_transfer_cause_ToString(OpenAPI_n1_n2_message_transfer_cause_e n1_n2_message_transfer_cause); + +OpenAPI_n1_n2_message_transfer_cause_e OpenAPI_n1_n2_message_transfer_cause_FromString(char* n1_n2_message_transfer_cause); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_n2_message_transfer_cause_H_ */ + diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_error.c b/lib/sbi/openapi/model/n1_n2_message_transfer_error.c new file mode 100644 index 000000000..8724b7e11 --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_error.c @@ -0,0 +1,138 @@ + +#include +#include +#include +#include "n1_n2_message_transfer_error.h" + +OpenAPI_n1_n2_message_transfer_error_t *OpenAPI_n1_n2_message_transfer_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_n1_n2_msg_txfr_err_detail_t *err_info + ) +{ + OpenAPI_n1_n2_message_transfer_error_t *n1_n2_message_transfer_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_n1_n2_message_transfer_error_t)); + if (!n1_n2_message_transfer_error_local_var) { + return NULL; + } + n1_n2_message_transfer_error_local_var->error = error; + n1_n2_message_transfer_error_local_var->err_info = err_info; + + return n1_n2_message_transfer_error_local_var; +} + +void OpenAPI_n1_n2_message_transfer_error_free(OpenAPI_n1_n2_message_transfer_error_t *n1_n2_message_transfer_error) +{ + if (NULL == n1_n2_message_transfer_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(n1_n2_message_transfer_error->error); + OpenAPI_n1_n2_msg_txfr_err_detail_free(n1_n2_message_transfer_error->err_info); + ogs_free(n1_n2_message_transfer_error); +} + +cJSON *OpenAPI_n1_n2_message_transfer_error_convertToJSON(OpenAPI_n1_n2_message_transfer_error_t *n1_n2_message_transfer_error) +{ + cJSON *item = NULL; + + if (n1_n2_message_transfer_error == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_error_convertToJSON() failed [N1N2MessageTransferError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n1_n2_message_transfer_error->error) { + ogs_error("OpenAPI_n1_n2_message_transfer_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(n1_n2_message_transfer_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_error_convertToJSON() failed [error]"); + goto end; + } + + if (n1_n2_message_transfer_error->err_info) { + cJSON *err_info_local_JSON = OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON(n1_n2_message_transfer_error->err_info); + if (err_info_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_error_convertToJSON() failed [err_info]"); + goto end; + } + cJSON_AddItemToObject(item, "errInfo", err_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_error_convertToJSON() failed [err_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n1_n2_message_transfer_error_t *OpenAPI_n1_n2_message_transfer_error_parseFromJSON(cJSON *n1_n2_message_transfer_errorJSON) +{ + OpenAPI_n1_n2_message_transfer_error_t *n1_n2_message_transfer_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_n1_n2_message_transfer_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *err_info = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_errorJSON, "errInfo"); + + OpenAPI_n1_n2_msg_txfr_err_detail_t *err_info_local_nonprim = NULL; + if (err_info) { + err_info_local_nonprim = OpenAPI_n1_n2_msg_txfr_err_detail_parseFromJSON(err_info); + } + + n1_n2_message_transfer_error_local_var = OpenAPI_n1_n2_message_transfer_error_create ( + error_local_nonprim, + err_info ? err_info_local_nonprim : NULL + ); + + return n1_n2_message_transfer_error_local_var; +end: + return NULL; +} + +OpenAPI_n1_n2_message_transfer_error_t *OpenAPI_n1_n2_message_transfer_error_copy(OpenAPI_n1_n2_message_transfer_error_t *dst, OpenAPI_n1_n2_message_transfer_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n1_n2_message_transfer_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n1_n2_message_transfer_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n1_n2_message_transfer_error_free(dst); + dst = OpenAPI_n1_n2_message_transfer_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_error.h b/lib/sbi/openapi/model/n1_n2_message_transfer_error.h new file mode 100644 index 000000000..a6b178f9e --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_error.h @@ -0,0 +1,42 @@ +/* + * n1_n2_message_transfer_error.h + * + * + */ + +#ifndef _OpenAPI_n1_n2_message_transfer_error_H_ +#define _OpenAPI_n1_n2_message_transfer_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n1_n2_msg_txfr_err_detail.h" +#include "problem_details.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n1_n2_message_transfer_error_s OpenAPI_n1_n2_message_transfer_error_t; +typedef struct OpenAPI_n1_n2_message_transfer_error_s { + struct OpenAPI_problem_details_s *error; + struct OpenAPI_n1_n2_msg_txfr_err_detail_s *err_info; +} OpenAPI_n1_n2_message_transfer_error_t; + +OpenAPI_n1_n2_message_transfer_error_t *OpenAPI_n1_n2_message_transfer_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_n1_n2_msg_txfr_err_detail_t *err_info + ); +void OpenAPI_n1_n2_message_transfer_error_free(OpenAPI_n1_n2_message_transfer_error_t *n1_n2_message_transfer_error); +OpenAPI_n1_n2_message_transfer_error_t *OpenAPI_n1_n2_message_transfer_error_parseFromJSON(cJSON *n1_n2_message_transfer_errorJSON); +cJSON *OpenAPI_n1_n2_message_transfer_error_convertToJSON(OpenAPI_n1_n2_message_transfer_error_t *n1_n2_message_transfer_error); +OpenAPI_n1_n2_message_transfer_error_t *OpenAPI_n1_n2_message_transfer_error_copy(OpenAPI_n1_n2_message_transfer_error_t *dst, OpenAPI_n1_n2_message_transfer_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_n2_message_transfer_error_H_ */ + diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.c b/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.c new file mode 100644 index 000000000..f5c266589 --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.c @@ -0,0 +1,462 @@ + +#include +#include +#include +#include "n1_n2_message_transfer_req_data.h" + +OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_data_create( + OpenAPI_n1_message_container_t *n1_message_container, + OpenAPI_n2_info_container_t *n2_info_container, + OpenAPI_ref_to_binary_data_t *mt_data, + int skip_ind, + int last_msg_indication, + int pdu_session_id, + char *lcs_correlation_id, + int ppi, + OpenAPI_arp_t *arp, + int _5qi, + char *n1n2_failure_txf_notif_uri, + int smf_reallocation_ind, + OpenAPI_area_of_validity_t *area_of_validity, + char *supported_features, + OpenAPI_guami_t *old_guami, + int ma_accepted_ind, + int ext_buf_support, + OpenAPI_access_type_e target_access + ) +{ + OpenAPI_n1_n2_message_transfer_req_data_t *n1_n2_message_transfer_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_n1_n2_message_transfer_req_data_t)); + if (!n1_n2_message_transfer_req_data_local_var) { + return NULL; + } + n1_n2_message_transfer_req_data_local_var->n1_message_container = n1_message_container; + n1_n2_message_transfer_req_data_local_var->n2_info_container = n2_info_container; + n1_n2_message_transfer_req_data_local_var->mt_data = mt_data; + n1_n2_message_transfer_req_data_local_var->skip_ind = skip_ind; + n1_n2_message_transfer_req_data_local_var->last_msg_indication = last_msg_indication; + n1_n2_message_transfer_req_data_local_var->pdu_session_id = pdu_session_id; + n1_n2_message_transfer_req_data_local_var->lcs_correlation_id = lcs_correlation_id; + n1_n2_message_transfer_req_data_local_var->ppi = ppi; + n1_n2_message_transfer_req_data_local_var->arp = arp; + n1_n2_message_transfer_req_data_local_var->_5qi = _5qi; + n1_n2_message_transfer_req_data_local_var->n1n2_failure_txf_notif_uri = n1n2_failure_txf_notif_uri; + n1_n2_message_transfer_req_data_local_var->smf_reallocation_ind = smf_reallocation_ind; + n1_n2_message_transfer_req_data_local_var->area_of_validity = area_of_validity; + n1_n2_message_transfer_req_data_local_var->supported_features = supported_features; + n1_n2_message_transfer_req_data_local_var->old_guami = old_guami; + n1_n2_message_transfer_req_data_local_var->ma_accepted_ind = ma_accepted_ind; + n1_n2_message_transfer_req_data_local_var->ext_buf_support = ext_buf_support; + n1_n2_message_transfer_req_data_local_var->target_access = target_access; + + return n1_n2_message_transfer_req_data_local_var; +} + +void OpenAPI_n1_n2_message_transfer_req_data_free(OpenAPI_n1_n2_message_transfer_req_data_t *n1_n2_message_transfer_req_data) +{ + if (NULL == n1_n2_message_transfer_req_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n1_message_container_free(n1_n2_message_transfer_req_data->n1_message_container); + OpenAPI_n2_info_container_free(n1_n2_message_transfer_req_data->n2_info_container); + OpenAPI_ref_to_binary_data_free(n1_n2_message_transfer_req_data->mt_data); + ogs_free(n1_n2_message_transfer_req_data->lcs_correlation_id); + OpenAPI_arp_free(n1_n2_message_transfer_req_data->arp); + ogs_free(n1_n2_message_transfer_req_data->n1n2_failure_txf_notif_uri); + OpenAPI_area_of_validity_free(n1_n2_message_transfer_req_data->area_of_validity); + ogs_free(n1_n2_message_transfer_req_data->supported_features); + OpenAPI_guami_free(n1_n2_message_transfer_req_data->old_guami); + ogs_free(n1_n2_message_transfer_req_data); +} + +cJSON *OpenAPI_n1_n2_message_transfer_req_data_convertToJSON(OpenAPI_n1_n2_message_transfer_req_data_t *n1_n2_message_transfer_req_data) +{ + cJSON *item = NULL; + + if (n1_n2_message_transfer_req_data == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [N1N2MessageTransferReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (n1_n2_message_transfer_req_data->n1_message_container) { + cJSON *n1_message_container_local_JSON = OpenAPI_n1_message_container_convertToJSON(n1_n2_message_transfer_req_data->n1_message_container); + if (n1_message_container_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [n1_message_container]"); + goto end; + } + cJSON_AddItemToObject(item, "n1MessageContainer", n1_message_container_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [n1_message_container]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->n2_info_container) { + cJSON *n2_info_container_local_JSON = OpenAPI_n2_info_container_convertToJSON(n1_n2_message_transfer_req_data->n2_info_container); + if (n2_info_container_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [n2_info_container]"); + goto end; + } + cJSON_AddItemToObject(item, "n2InfoContainer", n2_info_container_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [n2_info_container]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->mt_data) { + cJSON *mt_data_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(n1_n2_message_transfer_req_data->mt_data); + if (mt_data_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [mt_data]"); + goto end; + } + cJSON_AddItemToObject(item, "mtData", mt_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [mt_data]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->skip_ind) { + if (cJSON_AddBoolToObject(item, "skipInd", n1_n2_message_transfer_req_data->skip_ind) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [skip_ind]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->last_msg_indication) { + if (cJSON_AddBoolToObject(item, "lastMsgIndication", n1_n2_message_transfer_req_data->last_msg_indication) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [last_msg_indication]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->pdu_session_id) { + if (cJSON_AddNumberToObject(item, "pduSessionId", n1_n2_message_transfer_req_data->pdu_session_id) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->lcs_correlation_id) { + if (cJSON_AddStringToObject(item, "lcsCorrelationId", n1_n2_message_transfer_req_data->lcs_correlation_id) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [lcs_correlation_id]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->ppi) { + if (cJSON_AddNumberToObject(item, "ppi", n1_n2_message_transfer_req_data->ppi) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [ppi]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->arp) { + cJSON *arp_local_JSON = OpenAPI_arp_convertToJSON(n1_n2_message_transfer_req_data->arp); + if (arp_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [arp]"); + goto end; + } + cJSON_AddItemToObject(item, "arp", arp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [arp]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->_5qi) { + if (cJSON_AddNumberToObject(item, "5qi", n1_n2_message_transfer_req_data->_5qi) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [_5qi]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->n1n2_failure_txf_notif_uri) { + if (cJSON_AddStringToObject(item, "n1n2FailureTxfNotifURI", n1_n2_message_transfer_req_data->n1n2_failure_txf_notif_uri) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [n1n2_failure_txf_notif_uri]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->smf_reallocation_ind) { + if (cJSON_AddBoolToObject(item, "smfReallocationInd", n1_n2_message_transfer_req_data->smf_reallocation_ind) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [smf_reallocation_ind]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->area_of_validity) { + cJSON *area_of_validity_local_JSON = OpenAPI_area_of_validity_convertToJSON(n1_n2_message_transfer_req_data->area_of_validity); + if (area_of_validity_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [area_of_validity]"); + goto end; + } + cJSON_AddItemToObject(item, "areaOfValidity", area_of_validity_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [area_of_validity]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", n1_n2_message_transfer_req_data->supported_features) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->old_guami) { + cJSON *old_guami_local_JSON = OpenAPI_guami_convertToJSON(n1_n2_message_transfer_req_data->old_guami); + if (old_guami_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [old_guami]"); + goto end; + } + cJSON_AddItemToObject(item, "oldGuami", old_guami_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [old_guami]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->ma_accepted_ind) { + if (cJSON_AddBoolToObject(item, "maAcceptedInd", n1_n2_message_transfer_req_data->ma_accepted_ind) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [ma_accepted_ind]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->ext_buf_support) { + if (cJSON_AddBoolToObject(item, "extBufSupport", n1_n2_message_transfer_req_data->ext_buf_support) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [ext_buf_support]"); + goto end; + } + } + + if (n1_n2_message_transfer_req_data->target_access) { + if (cJSON_AddStringToObject(item, "targetAccess", OpenAPI_access_type_ToString(n1_n2_message_transfer_req_data->target_access)) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [target_access]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON(cJSON *n1_n2_message_transfer_req_dataJSON) +{ + OpenAPI_n1_n2_message_transfer_req_data_t *n1_n2_message_transfer_req_data_local_var = NULL; + cJSON *n1_message_container = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "n1MessageContainer"); + + OpenAPI_n1_message_container_t *n1_message_container_local_nonprim = NULL; + if (n1_message_container) { + n1_message_container_local_nonprim = OpenAPI_n1_message_container_parseFromJSON(n1_message_container); + } + + cJSON *n2_info_container = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "n2InfoContainer"); + + OpenAPI_n2_info_container_t *n2_info_container_local_nonprim = NULL; + if (n2_info_container) { + n2_info_container_local_nonprim = OpenAPI_n2_info_container_parseFromJSON(n2_info_container); + } + + cJSON *mt_data = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "mtData"); + + OpenAPI_ref_to_binary_data_t *mt_data_local_nonprim = NULL; + if (mt_data) { + mt_data_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(mt_data); + } + + cJSON *skip_ind = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "skipInd"); + + if (skip_ind) { + if (!cJSON_IsBool(skip_ind)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [skip_ind]"); + goto end; + } + } + + cJSON *last_msg_indication = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "lastMsgIndication"); + + if (last_msg_indication) { + if (!cJSON_IsBool(last_msg_indication)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [last_msg_indication]"); + goto end; + } + } + + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "pduSessionId"); + + if (pdu_session_id) { + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + } + + cJSON *lcs_correlation_id = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "lcsCorrelationId"); + + if (lcs_correlation_id) { + if (!cJSON_IsString(lcs_correlation_id)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [lcs_correlation_id]"); + goto end; + } + } + + cJSON *ppi = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "ppi"); + + if (ppi) { + if (!cJSON_IsNumber(ppi)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [ppi]"); + goto end; + } + } + + cJSON *arp = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "arp"); + + OpenAPI_arp_t *arp_local_nonprim = NULL; + if (arp) { + arp_local_nonprim = OpenAPI_arp_parseFromJSON(arp); + } + + cJSON *_5qi = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "5qi"); + + if (_5qi) { + if (!cJSON_IsNumber(_5qi)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [_5qi]"); + goto end; + } + } + + cJSON *n1n2_failure_txf_notif_uri = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "n1n2FailureTxfNotifURI"); + + if (n1n2_failure_txf_notif_uri) { + if (!cJSON_IsString(n1n2_failure_txf_notif_uri)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [n1n2_failure_txf_notif_uri]"); + goto end; + } + } + + cJSON *smf_reallocation_ind = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "smfReallocationInd"); + + if (smf_reallocation_ind) { + if (!cJSON_IsBool(smf_reallocation_ind)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [smf_reallocation_ind]"); + goto end; + } + } + + cJSON *area_of_validity = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "areaOfValidity"); + + OpenAPI_area_of_validity_t *area_of_validity_local_nonprim = NULL; + if (area_of_validity) { + area_of_validity_local_nonprim = OpenAPI_area_of_validity_parseFromJSON(area_of_validity); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *old_guami = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "oldGuami"); + + OpenAPI_guami_t *old_guami_local_nonprim = NULL; + if (old_guami) { + old_guami_local_nonprim = OpenAPI_guami_parseFromJSON(old_guami); + } + + cJSON *ma_accepted_ind = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "maAcceptedInd"); + + if (ma_accepted_ind) { + if (!cJSON_IsBool(ma_accepted_ind)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [ma_accepted_ind]"); + goto end; + } + } + + cJSON *ext_buf_support = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "extBufSupport"); + + if (ext_buf_support) { + if (!cJSON_IsBool(ext_buf_support)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [ext_buf_support]"); + goto end; + } + } + + cJSON *target_access = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "targetAccess"); + + OpenAPI_access_type_e target_accessVariable; + if (target_access) { + if (!cJSON_IsString(target_access)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [target_access]"); + goto end; + } + target_accessVariable = OpenAPI_access_type_FromString(target_access->valuestring); + } + + n1_n2_message_transfer_req_data_local_var = OpenAPI_n1_n2_message_transfer_req_data_create ( + n1_message_container ? n1_message_container_local_nonprim : NULL, + n2_info_container ? n2_info_container_local_nonprim : NULL, + mt_data ? mt_data_local_nonprim : NULL, + skip_ind ? skip_ind->valueint : 0, + last_msg_indication ? last_msg_indication->valueint : 0, + pdu_session_id ? pdu_session_id->valuedouble : 0, + lcs_correlation_id ? ogs_strdup(lcs_correlation_id->valuestring) : NULL, + ppi ? ppi->valuedouble : 0, + arp ? arp_local_nonprim : NULL, + _5qi ? _5qi->valuedouble : 0, + n1n2_failure_txf_notif_uri ? ogs_strdup(n1n2_failure_txf_notif_uri->valuestring) : NULL, + smf_reallocation_ind ? smf_reallocation_ind->valueint : 0, + area_of_validity ? area_of_validity_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + old_guami ? old_guami_local_nonprim : NULL, + ma_accepted_ind ? ma_accepted_ind->valueint : 0, + ext_buf_support ? ext_buf_support->valueint : 0, + target_access ? target_accessVariable : 0 + ); + + return n1_n2_message_transfer_req_data_local_var; +end: + return NULL; +} + +OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_data_copy(OpenAPI_n1_n2_message_transfer_req_data_t *dst, OpenAPI_n1_n2_message_transfer_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n1_n2_message_transfer_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n1_n2_message_transfer_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_n1_n2_message_transfer_req_data_free(dst); + dst = OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.h b/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.h new file mode 100644 index 000000000..bb80dfb13 --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.h @@ -0,0 +1,79 @@ +/* + * n1_n2_message_transfer_req_data.h + * + * + */ + +#ifndef _OpenAPI_n1_n2_message_transfer_req_data_H_ +#define _OpenAPI_n1_n2_message_transfer_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "area_of_validity.h" +#include "arp.h" +#include "guami.h" +#include "n1_message_container.h" +#include "n2_info_container.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n1_n2_message_transfer_req_data_s OpenAPI_n1_n2_message_transfer_req_data_t; +typedef struct OpenAPI_n1_n2_message_transfer_req_data_s { + struct OpenAPI_n1_message_container_s *n1_message_container; + struct OpenAPI_n2_info_container_s *n2_info_container; + struct OpenAPI_ref_to_binary_data_s *mt_data; + int skip_ind; + int last_msg_indication; + int pdu_session_id; + char *lcs_correlation_id; + int ppi; + struct OpenAPI_arp_s *arp; + int _5qi; + char *n1n2_failure_txf_notif_uri; + int smf_reallocation_ind; + struct OpenAPI_area_of_validity_s *area_of_validity; + char *supported_features; + struct OpenAPI_guami_s *old_guami; + int ma_accepted_ind; + int ext_buf_support; + OpenAPI_access_type_e target_access; +} OpenAPI_n1_n2_message_transfer_req_data_t; + +OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_data_create( + OpenAPI_n1_message_container_t *n1_message_container, + OpenAPI_n2_info_container_t *n2_info_container, + OpenAPI_ref_to_binary_data_t *mt_data, + int skip_ind, + int last_msg_indication, + int pdu_session_id, + char *lcs_correlation_id, + int ppi, + OpenAPI_arp_t *arp, + int _5qi, + char *n1n2_failure_txf_notif_uri, + int smf_reallocation_ind, + OpenAPI_area_of_validity_t *area_of_validity, + char *supported_features, + OpenAPI_guami_t *old_guami, + int ma_accepted_ind, + int ext_buf_support, + OpenAPI_access_type_e target_access + ); +void OpenAPI_n1_n2_message_transfer_req_data_free(OpenAPI_n1_n2_message_transfer_req_data_t *n1_n2_message_transfer_req_data); +OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON(cJSON *n1_n2_message_transfer_req_dataJSON); +cJSON *OpenAPI_n1_n2_message_transfer_req_data_convertToJSON(OpenAPI_n1_n2_message_transfer_req_data_t *n1_n2_message_transfer_req_data); +OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_data_copy(OpenAPI_n1_n2_message_transfer_req_data_t *dst, OpenAPI_n1_n2_message_transfer_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_n2_message_transfer_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.c b/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.c new file mode 100644 index 000000000..ce03e7b7c --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.c @@ -0,0 +1,131 @@ + +#include +#include +#include +#include "n1_n2_message_transfer_rsp_data.h" + +OpenAPI_n1_n2_message_transfer_rsp_data_t *OpenAPI_n1_n2_message_transfer_rsp_data_create( + OpenAPI_n1_n2_message_transfer_cause_e cause, + char *supported_features + ) +{ + OpenAPI_n1_n2_message_transfer_rsp_data_t *n1_n2_message_transfer_rsp_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_n1_n2_message_transfer_rsp_data_t)); + if (!n1_n2_message_transfer_rsp_data_local_var) { + return NULL; + } + n1_n2_message_transfer_rsp_data_local_var->cause = cause; + n1_n2_message_transfer_rsp_data_local_var->supported_features = supported_features; + + return n1_n2_message_transfer_rsp_data_local_var; +} + +void OpenAPI_n1_n2_message_transfer_rsp_data_free(OpenAPI_n1_n2_message_transfer_rsp_data_t *n1_n2_message_transfer_rsp_data) +{ + if (NULL == n1_n2_message_transfer_rsp_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(n1_n2_message_transfer_rsp_data->supported_features); + ogs_free(n1_n2_message_transfer_rsp_data); +} + +cJSON *OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON(OpenAPI_n1_n2_message_transfer_rsp_data_t *n1_n2_message_transfer_rsp_data) +{ + cJSON *item = NULL; + + if (n1_n2_message_transfer_rsp_data == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON() failed [N1N2MessageTransferRspData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n1_n2_message_transfer_rsp_data->cause) { + ogs_error("OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON() failed [cause]"); + goto end; + } + if (cJSON_AddStringToObject(item, "cause", OpenAPI_n1_n2_message_transfer_cause_ToString(n1_n2_message_transfer_rsp_data->cause)) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON() failed [cause]"); + goto end; + } + + if (n1_n2_message_transfer_rsp_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", n1_n2_message_transfer_rsp_data->supported_features) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n1_n2_message_transfer_rsp_data_t *OpenAPI_n1_n2_message_transfer_rsp_data_parseFromJSON(cJSON *n1_n2_message_transfer_rsp_dataJSON) +{ + OpenAPI_n1_n2_message_transfer_rsp_data_t *n1_n2_message_transfer_rsp_data_local_var = NULL; + cJSON *cause = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_rsp_dataJSON, "cause"); + if (!cause) { + ogs_error("OpenAPI_n1_n2_message_transfer_rsp_data_parseFromJSON() failed [cause]"); + goto end; + } + + OpenAPI_n1_n2_message_transfer_cause_e causeVariable; + + if (!cJSON_IsString(cause)) { + ogs_error("OpenAPI_n1_n2_message_transfer_rsp_data_parseFromJSON() failed [cause]"); + goto end; + } + causeVariable = OpenAPI_n1_n2_message_transfer_cause_FromString(cause->valuestring); + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_rsp_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_n1_n2_message_transfer_rsp_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + n1_n2_message_transfer_rsp_data_local_var = OpenAPI_n1_n2_message_transfer_rsp_data_create ( + causeVariable, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return n1_n2_message_transfer_rsp_data_local_var; +end: + return NULL; +} + +OpenAPI_n1_n2_message_transfer_rsp_data_t *OpenAPI_n1_n2_message_transfer_rsp_data_copy(OpenAPI_n1_n2_message_transfer_rsp_data_t *dst, OpenAPI_n1_n2_message_transfer_rsp_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n1_n2_message_transfer_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_n1_n2_message_transfer_rsp_data_free(dst); + dst = OpenAPI_n1_n2_message_transfer_rsp_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.h b/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.h new file mode 100644 index 000000000..52b212cf4 --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.h @@ -0,0 +1,41 @@ +/* + * n1_n2_message_transfer_rsp_data.h + * + * + */ + +#ifndef _OpenAPI_n1_n2_message_transfer_rsp_data_H_ +#define _OpenAPI_n1_n2_message_transfer_rsp_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n1_n2_message_transfer_cause.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n1_n2_message_transfer_rsp_data_s OpenAPI_n1_n2_message_transfer_rsp_data_t; +typedef struct OpenAPI_n1_n2_message_transfer_rsp_data_s { + OpenAPI_n1_n2_message_transfer_cause_e cause; + char *supported_features; +} OpenAPI_n1_n2_message_transfer_rsp_data_t; + +OpenAPI_n1_n2_message_transfer_rsp_data_t *OpenAPI_n1_n2_message_transfer_rsp_data_create( + OpenAPI_n1_n2_message_transfer_cause_e cause, + char *supported_features + ); +void OpenAPI_n1_n2_message_transfer_rsp_data_free(OpenAPI_n1_n2_message_transfer_rsp_data_t *n1_n2_message_transfer_rsp_data); +OpenAPI_n1_n2_message_transfer_rsp_data_t *OpenAPI_n1_n2_message_transfer_rsp_data_parseFromJSON(cJSON *n1_n2_message_transfer_rsp_dataJSON); +cJSON *OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON(OpenAPI_n1_n2_message_transfer_rsp_data_t *n1_n2_message_transfer_rsp_data); +OpenAPI_n1_n2_message_transfer_rsp_data_t *OpenAPI_n1_n2_message_transfer_rsp_data_copy(OpenAPI_n1_n2_message_transfer_rsp_data_t *dst, OpenAPI_n1_n2_message_transfer_rsp_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_n2_message_transfer_rsp_data_H_ */ + diff --git a/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.c b/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.c new file mode 100644 index 000000000..b5763726b --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.c @@ -0,0 +1,147 @@ + +#include +#include +#include +#include "n1_n2_msg_txfr_err_detail.h" + +OpenAPI_n1_n2_msg_txfr_err_detail_t *OpenAPI_n1_n2_msg_txfr_err_detail_create( + int retry_after, + OpenAPI_arp_t *highest_prio_arp, + int max_waiting_time + ) +{ + OpenAPI_n1_n2_msg_txfr_err_detail_t *n1_n2_msg_txfr_err_detail_local_var = OpenAPI_malloc(sizeof(OpenAPI_n1_n2_msg_txfr_err_detail_t)); + if (!n1_n2_msg_txfr_err_detail_local_var) { + return NULL; + } + n1_n2_msg_txfr_err_detail_local_var->retry_after = retry_after; + n1_n2_msg_txfr_err_detail_local_var->highest_prio_arp = highest_prio_arp; + n1_n2_msg_txfr_err_detail_local_var->max_waiting_time = max_waiting_time; + + return n1_n2_msg_txfr_err_detail_local_var; +} + +void OpenAPI_n1_n2_msg_txfr_err_detail_free(OpenAPI_n1_n2_msg_txfr_err_detail_t *n1_n2_msg_txfr_err_detail) +{ + if (NULL == n1_n2_msg_txfr_err_detail) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_arp_free(n1_n2_msg_txfr_err_detail->highest_prio_arp); + ogs_free(n1_n2_msg_txfr_err_detail); +} + +cJSON *OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON(OpenAPI_n1_n2_msg_txfr_err_detail_t *n1_n2_msg_txfr_err_detail) +{ + cJSON *item = NULL; + + if (n1_n2_msg_txfr_err_detail == NULL) { + ogs_error("OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON() failed [N1N2MsgTxfrErrDetail]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (n1_n2_msg_txfr_err_detail->retry_after) { + if (cJSON_AddNumberToObject(item, "retryAfter", n1_n2_msg_txfr_err_detail->retry_after) == NULL) { + ogs_error("OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON() failed [retry_after]"); + goto end; + } + } + + if (n1_n2_msg_txfr_err_detail->highest_prio_arp) { + cJSON *highest_prio_arp_local_JSON = OpenAPI_arp_convertToJSON(n1_n2_msg_txfr_err_detail->highest_prio_arp); + if (highest_prio_arp_local_JSON == NULL) { + ogs_error("OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON() failed [highest_prio_arp]"); + goto end; + } + cJSON_AddItemToObject(item, "highestPrioArp", highest_prio_arp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON() failed [highest_prio_arp]"); + goto end; + } + } + + if (n1_n2_msg_txfr_err_detail->max_waiting_time) { + if (cJSON_AddNumberToObject(item, "maxWaitingTime", n1_n2_msg_txfr_err_detail->max_waiting_time) == NULL) { + ogs_error("OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON() failed [max_waiting_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n1_n2_msg_txfr_err_detail_t *OpenAPI_n1_n2_msg_txfr_err_detail_parseFromJSON(cJSON *n1_n2_msg_txfr_err_detailJSON) +{ + OpenAPI_n1_n2_msg_txfr_err_detail_t *n1_n2_msg_txfr_err_detail_local_var = NULL; + cJSON *retry_after = cJSON_GetObjectItemCaseSensitive(n1_n2_msg_txfr_err_detailJSON, "retryAfter"); + + if (retry_after) { + if (!cJSON_IsNumber(retry_after)) { + ogs_error("OpenAPI_n1_n2_msg_txfr_err_detail_parseFromJSON() failed [retry_after]"); + goto end; + } + } + + cJSON *highest_prio_arp = cJSON_GetObjectItemCaseSensitive(n1_n2_msg_txfr_err_detailJSON, "highestPrioArp"); + + OpenAPI_arp_t *highest_prio_arp_local_nonprim = NULL; + if (highest_prio_arp) { + highest_prio_arp_local_nonprim = OpenAPI_arp_parseFromJSON(highest_prio_arp); + } + + cJSON *max_waiting_time = cJSON_GetObjectItemCaseSensitive(n1_n2_msg_txfr_err_detailJSON, "maxWaitingTime"); + + if (max_waiting_time) { + if (!cJSON_IsNumber(max_waiting_time)) { + ogs_error("OpenAPI_n1_n2_msg_txfr_err_detail_parseFromJSON() failed [max_waiting_time]"); + goto end; + } + } + + n1_n2_msg_txfr_err_detail_local_var = OpenAPI_n1_n2_msg_txfr_err_detail_create ( + retry_after ? retry_after->valuedouble : 0, + highest_prio_arp ? highest_prio_arp_local_nonprim : NULL, + max_waiting_time ? max_waiting_time->valuedouble : 0 + ); + + return n1_n2_msg_txfr_err_detail_local_var; +end: + return NULL; +} + +OpenAPI_n1_n2_msg_txfr_err_detail_t *OpenAPI_n1_n2_msg_txfr_err_detail_copy(OpenAPI_n1_n2_msg_txfr_err_detail_t *dst, OpenAPI_n1_n2_msg_txfr_err_detail_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n1_n2_msg_txfr_err_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_n1_n2_msg_txfr_err_detail_free(dst); + dst = OpenAPI_n1_n2_msg_txfr_err_detail_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.h b/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.h new file mode 100644 index 000000000..02b094e60 --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.h @@ -0,0 +1,43 @@ +/* + * n1_n2_msg_txfr_err_detail.h + * + * + */ + +#ifndef _OpenAPI_n1_n2_msg_txfr_err_detail_H_ +#define _OpenAPI_n1_n2_msg_txfr_err_detail_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "arp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n1_n2_msg_txfr_err_detail_s OpenAPI_n1_n2_msg_txfr_err_detail_t; +typedef struct OpenAPI_n1_n2_msg_txfr_err_detail_s { + int retry_after; + struct OpenAPI_arp_s *highest_prio_arp; + int max_waiting_time; +} OpenAPI_n1_n2_msg_txfr_err_detail_t; + +OpenAPI_n1_n2_msg_txfr_err_detail_t *OpenAPI_n1_n2_msg_txfr_err_detail_create( + int retry_after, + OpenAPI_arp_t *highest_prio_arp, + int max_waiting_time + ); +void OpenAPI_n1_n2_msg_txfr_err_detail_free(OpenAPI_n1_n2_msg_txfr_err_detail_t *n1_n2_msg_txfr_err_detail); +OpenAPI_n1_n2_msg_txfr_err_detail_t *OpenAPI_n1_n2_msg_txfr_err_detail_parseFromJSON(cJSON *n1_n2_msg_txfr_err_detailJSON); +cJSON *OpenAPI_n1_n2_msg_txfr_err_detail_convertToJSON(OpenAPI_n1_n2_msg_txfr_err_detail_t *n1_n2_msg_txfr_err_detail); +OpenAPI_n1_n2_msg_txfr_err_detail_t *OpenAPI_n1_n2_msg_txfr_err_detail_copy(OpenAPI_n1_n2_msg_txfr_err_detail_t *dst, OpenAPI_n1_n2_msg_txfr_err_detail_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_n2_msg_txfr_err_detail_H_ */ + diff --git a/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.c b/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.c new file mode 100644 index 000000000..e0bae38df --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.c @@ -0,0 +1,136 @@ + +#include +#include +#include +#include "n1_n2_msg_txfr_failure_notification.h" + +OpenAPI_n1_n2_msg_txfr_failure_notification_t *OpenAPI_n1_n2_msg_txfr_failure_notification_create( + OpenAPI_n1_n2_message_transfer_cause_e cause, + char *n1n2_msg_data_uri + ) +{ + OpenAPI_n1_n2_msg_txfr_failure_notification_t *n1_n2_msg_txfr_failure_notification_local_var = OpenAPI_malloc(sizeof(OpenAPI_n1_n2_msg_txfr_failure_notification_t)); + if (!n1_n2_msg_txfr_failure_notification_local_var) { + return NULL; + } + n1_n2_msg_txfr_failure_notification_local_var->cause = cause; + n1_n2_msg_txfr_failure_notification_local_var->n1n2_msg_data_uri = n1n2_msg_data_uri; + + return n1_n2_msg_txfr_failure_notification_local_var; +} + +void OpenAPI_n1_n2_msg_txfr_failure_notification_free(OpenAPI_n1_n2_msg_txfr_failure_notification_t *n1_n2_msg_txfr_failure_notification) +{ + if (NULL == n1_n2_msg_txfr_failure_notification) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(n1_n2_msg_txfr_failure_notification->n1n2_msg_data_uri); + ogs_free(n1_n2_msg_txfr_failure_notification); +} + +cJSON *OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON(OpenAPI_n1_n2_msg_txfr_failure_notification_t *n1_n2_msg_txfr_failure_notification) +{ + cJSON *item = NULL; + + if (n1_n2_msg_txfr_failure_notification == NULL) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON() failed [N1N2MsgTxfrFailureNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n1_n2_msg_txfr_failure_notification->cause) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON() failed [cause]"); + goto end; + } + if (cJSON_AddStringToObject(item, "cause", OpenAPI_n1_n2_message_transfer_cause_ToString(n1_n2_msg_txfr_failure_notification->cause)) == NULL) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON() failed [cause]"); + goto end; + } + + if (!n1_n2_msg_txfr_failure_notification->n1n2_msg_data_uri) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON() failed [n1n2_msg_data_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "n1n2MsgDataUri", n1_n2_msg_txfr_failure_notification->n1n2_msg_data_uri) == NULL) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON() failed [n1n2_msg_data_uri]"); + goto end; + } + +end: + return item; +} + +OpenAPI_n1_n2_msg_txfr_failure_notification_t *OpenAPI_n1_n2_msg_txfr_failure_notification_parseFromJSON(cJSON *n1_n2_msg_txfr_failure_notificationJSON) +{ + OpenAPI_n1_n2_msg_txfr_failure_notification_t *n1_n2_msg_txfr_failure_notification_local_var = NULL; + cJSON *cause = cJSON_GetObjectItemCaseSensitive(n1_n2_msg_txfr_failure_notificationJSON, "cause"); + if (!cause) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_parseFromJSON() failed [cause]"); + goto end; + } + + OpenAPI_n1_n2_message_transfer_cause_e causeVariable; + + if (!cJSON_IsString(cause)) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_parseFromJSON() failed [cause]"); + goto end; + } + causeVariable = OpenAPI_n1_n2_message_transfer_cause_FromString(cause->valuestring); + + cJSON *n1n2_msg_data_uri = cJSON_GetObjectItemCaseSensitive(n1_n2_msg_txfr_failure_notificationJSON, "n1n2MsgDataUri"); + if (!n1n2_msg_data_uri) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_parseFromJSON() failed [n1n2_msg_data_uri]"); + goto end; + } + + + if (!cJSON_IsString(n1n2_msg_data_uri)) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_parseFromJSON() failed [n1n2_msg_data_uri]"); + goto end; + } + + n1_n2_msg_txfr_failure_notification_local_var = OpenAPI_n1_n2_msg_txfr_failure_notification_create ( + causeVariable, + ogs_strdup(n1n2_msg_data_uri->valuestring) + ); + + return n1_n2_msg_txfr_failure_notification_local_var; +end: + return NULL; +} + +OpenAPI_n1_n2_msg_txfr_failure_notification_t *OpenAPI_n1_n2_msg_txfr_failure_notification_copy(OpenAPI_n1_n2_msg_txfr_failure_notification_t *dst, OpenAPI_n1_n2_msg_txfr_failure_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n1_n2_msg_txfr_failure_notification_free(dst); + dst = OpenAPI_n1_n2_msg_txfr_failure_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.h b/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.h new file mode 100644 index 000000000..0e50cd741 --- /dev/null +++ b/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.h @@ -0,0 +1,41 @@ +/* + * n1_n2_msg_txfr_failure_notification.h + * + * + */ + +#ifndef _OpenAPI_n1_n2_msg_txfr_failure_notification_H_ +#define _OpenAPI_n1_n2_msg_txfr_failure_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n1_n2_message_transfer_cause.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n1_n2_msg_txfr_failure_notification_s OpenAPI_n1_n2_msg_txfr_failure_notification_t; +typedef struct OpenAPI_n1_n2_msg_txfr_failure_notification_s { + OpenAPI_n1_n2_message_transfer_cause_e cause; + char *n1n2_msg_data_uri; +} OpenAPI_n1_n2_msg_txfr_failure_notification_t; + +OpenAPI_n1_n2_msg_txfr_failure_notification_t *OpenAPI_n1_n2_msg_txfr_failure_notification_create( + OpenAPI_n1_n2_message_transfer_cause_e cause, + char *n1n2_msg_data_uri + ); +void OpenAPI_n1_n2_msg_txfr_failure_notification_free(OpenAPI_n1_n2_msg_txfr_failure_notification_t *n1_n2_msg_txfr_failure_notification); +OpenAPI_n1_n2_msg_txfr_failure_notification_t *OpenAPI_n1_n2_msg_txfr_failure_notification_parseFromJSON(cJSON *n1_n2_msg_txfr_failure_notificationJSON); +cJSON *OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON(OpenAPI_n1_n2_msg_txfr_failure_notification_t *n1_n2_msg_txfr_failure_notification); +OpenAPI_n1_n2_msg_txfr_failure_notification_t *OpenAPI_n1_n2_msg_txfr_failure_notification_copy(OpenAPI_n1_n2_msg_txfr_failure_notification_t *dst, OpenAPI_n1_n2_msg_txfr_failure_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_n2_msg_txfr_failure_notification_H_ */ + diff --git a/lib/sbi/openapi/model/n2_info_container.c b/lib/sbi/openapi/model/n2_info_container.c new file mode 100644 index 000000000..305766ae2 --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_container.c @@ -0,0 +1,207 @@ + +#include +#include +#include +#include "n2_info_container.h" + +OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_create( + OpenAPI_n2_information_class_e n2_information_class, + OpenAPI_n2_sm_information_t *sm_info, + OpenAPI_n2_ran_information_t *ran_info, + OpenAPI_nrppa_information_t *nrppa_info, + OpenAPI_pws_information_t *pws_info + ) +{ + OpenAPI_n2_info_container_t *n2_info_container_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_info_container_t)); + if (!n2_info_container_local_var) { + return NULL; + } + n2_info_container_local_var->n2_information_class = n2_information_class; + n2_info_container_local_var->sm_info = sm_info; + n2_info_container_local_var->ran_info = ran_info; + n2_info_container_local_var->nrppa_info = nrppa_info; + n2_info_container_local_var->pws_info = pws_info; + + return n2_info_container_local_var; +} + +void OpenAPI_n2_info_container_free(OpenAPI_n2_info_container_t *n2_info_container) +{ + if (NULL == n2_info_container) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n2_sm_information_free(n2_info_container->sm_info); + OpenAPI_n2_ran_information_free(n2_info_container->ran_info); + OpenAPI_nrppa_information_free(n2_info_container->nrppa_info); + OpenAPI_pws_information_free(n2_info_container->pws_info); + ogs_free(n2_info_container); +} + +cJSON *OpenAPI_n2_info_container_convertToJSON(OpenAPI_n2_info_container_t *n2_info_container) +{ + cJSON *item = NULL; + + if (n2_info_container == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [N2InfoContainer]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n2_info_container->n2_information_class) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [n2_information_class]"); + goto end; + } + if (cJSON_AddStringToObject(item, "n2InformationClass", OpenAPI_n2_information_class_ToString(n2_info_container->n2_information_class)) == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [n2_information_class]"); + goto end; + } + + if (n2_info_container->sm_info) { + cJSON *sm_info_local_JSON = OpenAPI_n2_sm_information_convertToJSON(n2_info_container->sm_info); + if (sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "smInfo", sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [sm_info]"); + goto end; + } + } + + if (n2_info_container->ran_info) { + cJSON *ran_info_local_JSON = OpenAPI_n2_ran_information_convertToJSON(n2_info_container->ran_info); + if (ran_info_local_JSON == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [ran_info]"); + goto end; + } + cJSON_AddItemToObject(item, "ranInfo", ran_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [ran_info]"); + goto end; + } + } + + if (n2_info_container->nrppa_info) { + cJSON *nrppa_info_local_JSON = OpenAPI_nrppa_information_convertToJSON(n2_info_container->nrppa_info); + if (nrppa_info_local_JSON == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [nrppa_info]"); + goto end; + } + cJSON_AddItemToObject(item, "nrppaInfo", nrppa_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [nrppa_info]"); + goto end; + } + } + + if (n2_info_container->pws_info) { + cJSON *pws_info_local_JSON = OpenAPI_pws_information_convertToJSON(n2_info_container->pws_info); + if (pws_info_local_JSON == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [pws_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pwsInfo", pws_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [pws_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_parseFromJSON(cJSON *n2_info_containerJSON) +{ + OpenAPI_n2_info_container_t *n2_info_container_local_var = NULL; + cJSON *n2_information_class = cJSON_GetObjectItemCaseSensitive(n2_info_containerJSON, "n2InformationClass"); + if (!n2_information_class) { + ogs_error("OpenAPI_n2_info_container_parseFromJSON() failed [n2_information_class]"); + goto end; + } + + OpenAPI_n2_information_class_e n2_information_classVariable; + + if (!cJSON_IsString(n2_information_class)) { + ogs_error("OpenAPI_n2_info_container_parseFromJSON() failed [n2_information_class]"); + goto end; + } + n2_information_classVariable = OpenAPI_n2_information_class_FromString(n2_information_class->valuestring); + + cJSON *sm_info = cJSON_GetObjectItemCaseSensitive(n2_info_containerJSON, "smInfo"); + + OpenAPI_n2_sm_information_t *sm_info_local_nonprim = NULL; + if (sm_info) { + sm_info_local_nonprim = OpenAPI_n2_sm_information_parseFromJSON(sm_info); + } + + cJSON *ran_info = cJSON_GetObjectItemCaseSensitive(n2_info_containerJSON, "ranInfo"); + + OpenAPI_n2_ran_information_t *ran_info_local_nonprim = NULL; + if (ran_info) { + ran_info_local_nonprim = OpenAPI_n2_ran_information_parseFromJSON(ran_info); + } + + cJSON *nrppa_info = cJSON_GetObjectItemCaseSensitive(n2_info_containerJSON, "nrppaInfo"); + + OpenAPI_nrppa_information_t *nrppa_info_local_nonprim = NULL; + if (nrppa_info) { + nrppa_info_local_nonprim = OpenAPI_nrppa_information_parseFromJSON(nrppa_info); + } + + cJSON *pws_info = cJSON_GetObjectItemCaseSensitive(n2_info_containerJSON, "pwsInfo"); + + OpenAPI_pws_information_t *pws_info_local_nonprim = NULL; + if (pws_info) { + pws_info_local_nonprim = OpenAPI_pws_information_parseFromJSON(pws_info); + } + + n2_info_container_local_var = OpenAPI_n2_info_container_create ( + n2_information_classVariable, + sm_info ? sm_info_local_nonprim : NULL, + ran_info ? ran_info_local_nonprim : NULL, + nrppa_info ? nrppa_info_local_nonprim : NULL, + pws_info ? pws_info_local_nonprim : NULL + ); + + return n2_info_container_local_var; +end: + return NULL; +} + +OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_copy(OpenAPI_n2_info_container_t *dst, OpenAPI_n2_info_container_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_info_container_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n2_info_container_free(dst); + dst = OpenAPI_n2_info_container_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_info_container.h b/lib/sbi/openapi/model/n2_info_container.h new file mode 100644 index 000000000..a7cf8d0bf --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_container.h @@ -0,0 +1,51 @@ +/* + * n2_info_container.h + * + * + */ + +#ifndef _OpenAPI_n2_info_container_H_ +#define _OpenAPI_n2_info_container_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_information_class.h" +#include "n2_ran_information.h" +#include "n2_sm_information.h" +#include "nrppa_information.h" +#include "pws_information.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_info_container_s OpenAPI_n2_info_container_t; +typedef struct OpenAPI_n2_info_container_s { + OpenAPI_n2_information_class_e n2_information_class; + struct OpenAPI_n2_sm_information_s *sm_info; + struct OpenAPI_n2_ran_information_s *ran_info; + struct OpenAPI_nrppa_information_s *nrppa_info; + struct OpenAPI_pws_information_s *pws_info; +} OpenAPI_n2_info_container_t; + +OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_create( + OpenAPI_n2_information_class_e n2_information_class, + OpenAPI_n2_sm_information_t *sm_info, + OpenAPI_n2_ran_information_t *ran_info, + OpenAPI_nrppa_information_t *nrppa_info, + OpenAPI_pws_information_t *pws_info + ); +void OpenAPI_n2_info_container_free(OpenAPI_n2_info_container_t *n2_info_container); +OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_parseFromJSON(cJSON *n2_info_containerJSON); +cJSON *OpenAPI_n2_info_container_convertToJSON(OpenAPI_n2_info_container_t *n2_info_container); +OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_copy(OpenAPI_n2_info_container_t *dst, OpenAPI_n2_info_container_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_info_container_H_ */ + diff --git a/lib/sbi/openapi/model/n2_info_content.c b/lib/sbi/openapi/model/n2_info_content.c new file mode 100644 index 000000000..dcab2810c --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_content.c @@ -0,0 +1,154 @@ + +#include +#include +#include +#include "n2_info_content.h" + +OpenAPI_n2_info_content_t *OpenAPI_n2_info_content_create( + int ngap_message_type, + OpenAPI_ngap_ie_type_e ngap_ie_type, + OpenAPI_ref_to_binary_data_t *ngap_data + ) +{ + OpenAPI_n2_info_content_t *n2_info_content_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_info_content_t)); + if (!n2_info_content_local_var) { + return NULL; + } + n2_info_content_local_var->ngap_message_type = ngap_message_type; + n2_info_content_local_var->ngap_ie_type = ngap_ie_type; + n2_info_content_local_var->ngap_data = ngap_data; + + return n2_info_content_local_var; +} + +void OpenAPI_n2_info_content_free(OpenAPI_n2_info_content_t *n2_info_content) +{ + if (NULL == n2_info_content) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ref_to_binary_data_free(n2_info_content->ngap_data); + ogs_free(n2_info_content); +} + +cJSON *OpenAPI_n2_info_content_convertToJSON(OpenAPI_n2_info_content_t *n2_info_content) +{ + cJSON *item = NULL; + + if (n2_info_content == NULL) { + ogs_error("OpenAPI_n2_info_content_convertToJSON() failed [N2InfoContent]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (n2_info_content->ngap_message_type) { + if (cJSON_AddNumberToObject(item, "ngapMessageType", n2_info_content->ngap_message_type) == NULL) { + ogs_error("OpenAPI_n2_info_content_convertToJSON() failed [ngap_message_type]"); + goto end; + } + } + + if (n2_info_content->ngap_ie_type) { + if (cJSON_AddStringToObject(item, "ngapIeType", OpenAPI_ngap_ie_type_ToString(n2_info_content->ngap_ie_type)) == NULL) { + ogs_error("OpenAPI_n2_info_content_convertToJSON() failed [ngap_ie_type]"); + goto end; + } + } + + if (!n2_info_content->ngap_data) { + ogs_error("OpenAPI_n2_info_content_convertToJSON() failed [ngap_data]"); + goto end; + } + cJSON *ngap_data_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(n2_info_content->ngap_data); + if (ngap_data_local_JSON == NULL) { + ogs_error("OpenAPI_n2_info_content_convertToJSON() failed [ngap_data]"); + goto end; + } + cJSON_AddItemToObject(item, "ngapData", ngap_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_info_content_convertToJSON() failed [ngap_data]"); + goto end; + } + +end: + return item; +} + +OpenAPI_n2_info_content_t *OpenAPI_n2_info_content_parseFromJSON(cJSON *n2_info_contentJSON) +{ + OpenAPI_n2_info_content_t *n2_info_content_local_var = NULL; + cJSON *ngap_message_type = cJSON_GetObjectItemCaseSensitive(n2_info_contentJSON, "ngapMessageType"); + + if (ngap_message_type) { + if (!cJSON_IsNumber(ngap_message_type)) { + ogs_error("OpenAPI_n2_info_content_parseFromJSON() failed [ngap_message_type]"); + goto end; + } + } + + cJSON *ngap_ie_type = cJSON_GetObjectItemCaseSensitive(n2_info_contentJSON, "ngapIeType"); + + OpenAPI_ngap_ie_type_e ngap_ie_typeVariable; + if (ngap_ie_type) { + if (!cJSON_IsString(ngap_ie_type)) { + ogs_error("OpenAPI_n2_info_content_parseFromJSON() failed [ngap_ie_type]"); + goto end; + } + ngap_ie_typeVariable = OpenAPI_ngap_ie_type_FromString(ngap_ie_type->valuestring); + } + + cJSON *ngap_data = cJSON_GetObjectItemCaseSensitive(n2_info_contentJSON, "ngapData"); + if (!ngap_data) { + ogs_error("OpenAPI_n2_info_content_parseFromJSON() failed [ngap_data]"); + goto end; + } + + OpenAPI_ref_to_binary_data_t *ngap_data_local_nonprim = NULL; + + ngap_data_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(ngap_data); + + n2_info_content_local_var = OpenAPI_n2_info_content_create ( + ngap_message_type ? ngap_message_type->valuedouble : 0, + ngap_ie_type ? ngap_ie_typeVariable : 0, + ngap_data_local_nonprim + ); + + return n2_info_content_local_var; +end: + return NULL; +} + +OpenAPI_n2_info_content_t *OpenAPI_n2_info_content_copy(OpenAPI_n2_info_content_t *dst, OpenAPI_n2_info_content_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_info_content_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_info_content_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n2_info_content_free(dst); + dst = OpenAPI_n2_info_content_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_info_content.h b/lib/sbi/openapi/model/n2_info_content.h new file mode 100644 index 000000000..98a6c4279 --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_content.h @@ -0,0 +1,44 @@ +/* + * n2_info_content.h + * + * + */ + +#ifndef _OpenAPI_n2_info_content_H_ +#define _OpenAPI_n2_info_content_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ngap_ie_type.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_info_content_s OpenAPI_n2_info_content_t; +typedef struct OpenAPI_n2_info_content_s { + int ngap_message_type; + OpenAPI_ngap_ie_type_e ngap_ie_type; + struct OpenAPI_ref_to_binary_data_s *ngap_data; +} OpenAPI_n2_info_content_t; + +OpenAPI_n2_info_content_t *OpenAPI_n2_info_content_create( + int ngap_message_type, + OpenAPI_ngap_ie_type_e ngap_ie_type, + OpenAPI_ref_to_binary_data_t *ngap_data + ); +void OpenAPI_n2_info_content_free(OpenAPI_n2_info_content_t *n2_info_content); +OpenAPI_n2_info_content_t *OpenAPI_n2_info_content_parseFromJSON(cJSON *n2_info_contentJSON); +cJSON *OpenAPI_n2_info_content_convertToJSON(OpenAPI_n2_info_content_t *n2_info_content); +OpenAPI_n2_info_content_t *OpenAPI_n2_info_content_copy(OpenAPI_n2_info_content_t *dst, OpenAPI_n2_info_content_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_info_content_H_ */ + diff --git a/lib/sbi/openapi/model/n2_info_notification_rsp_data.c b/lib/sbi/openapi/model/n2_info_notification_rsp_data.c new file mode 100644 index 000000000..1f089c3b2 --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_notification_rsp_data.c @@ -0,0 +1,109 @@ + +#include +#include +#include +#include "n2_info_notification_rsp_data.h" + +OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_create( + OpenAPI_n2_info_content_t *n2_info_content + ) +{ + OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_info_notification_rsp_data_t)); + if (!n2_info_notification_rsp_data_local_var) { + return NULL; + } + n2_info_notification_rsp_data_local_var->n2_info_content = n2_info_content; + + return n2_info_notification_rsp_data_local_var; +} + +void OpenAPI_n2_info_notification_rsp_data_free(OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data) +{ + if (NULL == n2_info_notification_rsp_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n2_info_content_free(n2_info_notification_rsp_data->n2_info_content); + ogs_free(n2_info_notification_rsp_data); +} + +cJSON *OpenAPI_n2_info_notification_rsp_data_convertToJSON(OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data) +{ + cJSON *item = NULL; + + if (n2_info_notification_rsp_data == NULL) { + ogs_error("OpenAPI_n2_info_notification_rsp_data_convertToJSON() failed [N2InfoNotificationRspData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (n2_info_notification_rsp_data->n2_info_content) { + cJSON *n2_info_content_local_JSON = OpenAPI_n2_info_content_convertToJSON(n2_info_notification_rsp_data->n2_info_content); + if (n2_info_content_local_JSON == NULL) { + ogs_error("OpenAPI_n2_info_notification_rsp_data_convertToJSON() failed [n2_info_content]"); + goto end; + } + cJSON_AddItemToObject(item, "n2InfoContent", n2_info_content_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_info_notification_rsp_data_convertToJSON() failed [n2_info_content]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_parseFromJSON(cJSON *n2_info_notification_rsp_dataJSON) +{ + OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data_local_var = NULL; + cJSON *n2_info_content = cJSON_GetObjectItemCaseSensitive(n2_info_notification_rsp_dataJSON, "n2InfoContent"); + + OpenAPI_n2_info_content_t *n2_info_content_local_nonprim = NULL; + if (n2_info_content) { + n2_info_content_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(n2_info_content); + } + + n2_info_notification_rsp_data_local_var = OpenAPI_n2_info_notification_rsp_data_create ( + n2_info_content ? n2_info_content_local_nonprim : NULL + ); + + return n2_info_notification_rsp_data_local_var; +end: + return NULL; +} + +OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_copy(OpenAPI_n2_info_notification_rsp_data_t *dst, OpenAPI_n2_info_notification_rsp_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_info_notification_rsp_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_info_notification_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_n2_info_notification_rsp_data_free(dst); + dst = OpenAPI_n2_info_notification_rsp_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_info_notification_rsp_data.h b/lib/sbi/openapi/model/n2_info_notification_rsp_data.h new file mode 100644 index 000000000..92da9f1a8 --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_notification_rsp_data.h @@ -0,0 +1,39 @@ +/* + * n2_info_notification_rsp_data.h + * + * + */ + +#ifndef _OpenAPI_n2_info_notification_rsp_data_H_ +#define _OpenAPI_n2_info_notification_rsp_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_info_notification_rsp_data_s OpenAPI_n2_info_notification_rsp_data_t; +typedef struct OpenAPI_n2_info_notification_rsp_data_s { + struct OpenAPI_n2_info_content_s *n2_info_content; +} OpenAPI_n2_info_notification_rsp_data_t; + +OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_create( + OpenAPI_n2_info_content_t *n2_info_content + ); +void OpenAPI_n2_info_notification_rsp_data_free(OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data); +OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_parseFromJSON(cJSON *n2_info_notification_rsp_dataJSON); +cJSON *OpenAPI_n2_info_notification_rsp_data_convertToJSON(OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data); +OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_copy(OpenAPI_n2_info_notification_rsp_data_t *dst, OpenAPI_n2_info_notification_rsp_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_info_notification_rsp_data_H_ */ + diff --git a/lib/sbi/openapi/model/n2_info_notify_reason.c b/lib/sbi/openapi/model/n2_info_notify_reason.c new file mode 100644 index 000000000..8b3c809f2 --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_notify_reason.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n2_info_notify_reason.h" + +char* OpenAPI_n2_info_notify_reason_ToString(OpenAPI_n2_info_notify_reason_e n2_info_notify_reason) +{ + const char *n2_info_notify_reasonArray[] = { "NULL", "HANDOVER_COMPLETED" }; + size_t sizeofArray = sizeof(n2_info_notify_reasonArray) / sizeof(n2_info_notify_reasonArray[0]); + if (n2_info_notify_reason < sizeofArray) + return (char *)n2_info_notify_reasonArray[n2_info_notify_reason]; + else + return (char *)"Unknown"; +} + +OpenAPI_n2_info_notify_reason_e OpenAPI_n2_info_notify_reason_FromString(char* n2_info_notify_reason) +{ + int stringToReturn = 0; + const char *n2_info_notify_reasonArray[] = { "NULL", "HANDOVER_COMPLETED" }; + size_t sizeofArray = sizeof(n2_info_notify_reasonArray) / sizeof(n2_info_notify_reasonArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n2_info_notify_reason, n2_info_notify_reasonArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n2_info_notify_reason.h b/lib/sbi/openapi/model/n2_info_notify_reason.h new file mode 100644 index 000000000..125eeb539 --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_notify_reason.h @@ -0,0 +1,31 @@ +/* + * n2_info_notify_reason.h + * + * + */ + +#ifndef _OpenAPI_n2_info_notify_reason_H_ +#define _OpenAPI_n2_info_notify_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_n2_info_notify_reason_NULL = 0, OpenAPI_n2_info_notify_reason_HANDOVER_COMPLETED } OpenAPI_n2_info_notify_reason_e; + +char* OpenAPI_n2_info_notify_reason_ToString(OpenAPI_n2_info_notify_reason_e n2_info_notify_reason); + +OpenAPI_n2_info_notify_reason_e OpenAPI_n2_info_notify_reason_FromString(char* n2_info_notify_reason); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_info_notify_reason_H_ */ + diff --git a/lib/sbi/openapi/model/n2_information_class.c b/lib/sbi/openapi/model/n2_information_class.c index 6a03f7170..1a59a4d10 100644 --- a/lib/sbi/openapi/model/n2_information_class.c +++ b/lib/sbi/openapi/model/n2_information_class.c @@ -4,48 +4,27 @@ #include #include "n2_information_class.h" -OpenAPI_n2_information_class_t *OpenAPI_n2_information_class_create( - ) +char* OpenAPI_n2_information_class_ToString(OpenAPI_n2_information_class_e n2_information_class) { - OpenAPI_n2_information_class_t *n2_information_class_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_information_class_t)); - if (!n2_information_class_local_var) { - return NULL; + const char *n2_information_classArray[] = { "NULL", "SM", "NRPPa", "PWS", "PWS_BCAL", "PWS_RF", "RAN" }; + size_t sizeofArray = sizeof(n2_information_classArray) / sizeof(n2_information_classArray[0]); + if (n2_information_class < sizeofArray) + return (char *)n2_information_classArray[n2_information_class]; + else + return (char *)"Unknown"; +} + +OpenAPI_n2_information_class_e OpenAPI_n2_information_class_FromString(char* n2_information_class) +{ + int stringToReturn = 0; + const char *n2_information_classArray[] = { "NULL", "SM", "NRPPa", "PWS", "PWS_BCAL", "PWS_RF", "RAN" }; + size_t sizeofArray = sizeof(n2_information_classArray) / sizeof(n2_information_classArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n2_information_class, n2_information_classArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - - return n2_information_class_local_var; -} - -void OpenAPI_n2_information_class_free(OpenAPI_n2_information_class_t *n2_information_class) -{ - if (NULL == n2_information_class) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(n2_information_class); -} - -cJSON *OpenAPI_n2_information_class_convertToJSON(OpenAPI_n2_information_class_t *n2_information_class) -{ - cJSON *item = NULL; - - if (n2_information_class == NULL) { - ogs_error("OpenAPI_n2_information_class_convertToJSON() failed [N2InformationClass]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_n2_information_class_t *OpenAPI_n2_information_class_parseFromJSON(cJSON *n2_information_classJSON) -{ - OpenAPI_n2_information_class_t *n2_information_class_local_var = NULL; - n2_information_class_local_var = OpenAPI_n2_information_class_create ( - ); - - return n2_information_class_local_var; -end: - return NULL; + return 0; } diff --git a/lib/sbi/openapi/model/n2_information_class.h b/lib/sbi/openapi/model/n2_information_class.h index 716e6fba9..63e3e08f0 100644 --- a/lib/sbi/openapi/model/n2_information_class.h +++ b/lib/sbi/openapi/model/n2_information_class.h @@ -17,15 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_n2_information_class_s OpenAPI_n2_information_class_t; -typedef struct OpenAPI_n2_information_class_s { -} OpenAPI_n2_information_class_t; +typedef enum { OpenAPI_n2_information_class_NULL = 0, OpenAPI_n2_information_class_SM, OpenAPI_n2_information_class_NRPPa, OpenAPI_n2_information_class_PWS, OpenAPI_n2_information_class_PWS_BCAL, OpenAPI_n2_information_class_PWS_RF, OpenAPI_n2_information_class_RAN } OpenAPI_n2_information_class_e; -OpenAPI_n2_information_class_t *OpenAPI_n2_information_class_create( - ); -void OpenAPI_n2_information_class_free(OpenAPI_n2_information_class_t *n2_information_class); -OpenAPI_n2_information_class_t *OpenAPI_n2_information_class_parseFromJSON(cJSON *n2_information_classJSON); -cJSON *OpenAPI_n2_information_class_convertToJSON(OpenAPI_n2_information_class_t *n2_information_class); +char* OpenAPI_n2_information_class_ToString(OpenAPI_n2_information_class_e n2_information_class); + +OpenAPI_n2_information_class_e OpenAPI_n2_information_class_FromString(char* n2_information_class); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/n2_information_notification.c b/lib/sbi/openapi/model/n2_information_notification.c new file mode 100644 index 000000000..252c444df --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_notification.c @@ -0,0 +1,352 @@ + +#include +#include +#include +#include "n2_information_notification.h" + +OpenAPI_n2_information_notification_t *OpenAPI_n2_information_notification_create( + char *n2_notify_subscription_id, + OpenAPI_n2_info_container_t *n2_info_container, + OpenAPI_list_t *to_release_session_list, + char *lcs_correlation_id, + OpenAPI_n2_info_notify_reason_e notify_reason, + OpenAPI_list_t *smf_change_info_list, + OpenAPI_global_ran_node_id_t *ran_node_id, + char *initial_amf_name, + char *an_n2_i_pv4_addr, + char *an_n2_i_pv6_addr + ) +{ + OpenAPI_n2_information_notification_t *n2_information_notification_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_information_notification_t)); + if (!n2_information_notification_local_var) { + return NULL; + } + n2_information_notification_local_var->n2_notify_subscription_id = n2_notify_subscription_id; + n2_information_notification_local_var->n2_info_container = n2_info_container; + n2_information_notification_local_var->to_release_session_list = to_release_session_list; + n2_information_notification_local_var->lcs_correlation_id = lcs_correlation_id; + n2_information_notification_local_var->notify_reason = notify_reason; + n2_information_notification_local_var->smf_change_info_list = smf_change_info_list; + n2_information_notification_local_var->ran_node_id = ran_node_id; + n2_information_notification_local_var->initial_amf_name = initial_amf_name; + n2_information_notification_local_var->an_n2_i_pv4_addr = an_n2_i_pv4_addr; + n2_information_notification_local_var->an_n2_i_pv6_addr = an_n2_i_pv6_addr; + + return n2_information_notification_local_var; +} + +void OpenAPI_n2_information_notification_free(OpenAPI_n2_information_notification_t *n2_information_notification) +{ + if (NULL == n2_information_notification) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(n2_information_notification->n2_notify_subscription_id); + OpenAPI_n2_info_container_free(n2_information_notification->n2_info_container); + OpenAPI_list_for_each(n2_information_notification->to_release_session_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(n2_information_notification->to_release_session_list); + ogs_free(n2_information_notification->lcs_correlation_id); + OpenAPI_list_for_each(n2_information_notification->smf_change_info_list, node) { + OpenAPI_smf_change_info_free(node->data); + } + OpenAPI_list_free(n2_information_notification->smf_change_info_list); + OpenAPI_global_ran_node_id_free(n2_information_notification->ran_node_id); + ogs_free(n2_information_notification->initial_amf_name); + ogs_free(n2_information_notification->an_n2_i_pv4_addr); + ogs_free(n2_information_notification->an_n2_i_pv6_addr); + ogs_free(n2_information_notification); +} + +cJSON *OpenAPI_n2_information_notification_convertToJSON(OpenAPI_n2_information_notification_t *n2_information_notification) +{ + cJSON *item = NULL; + + if (n2_information_notification == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [N2InformationNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n2_information_notification->n2_notify_subscription_id) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [n2_notify_subscription_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "n2NotifySubscriptionId", n2_information_notification->n2_notify_subscription_id) == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [n2_notify_subscription_id]"); + goto end; + } + + if (n2_information_notification->n2_info_container) { + cJSON *n2_info_container_local_JSON = OpenAPI_n2_info_container_convertToJSON(n2_information_notification->n2_info_container); + if (n2_info_container_local_JSON == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [n2_info_container]"); + goto end; + } + cJSON_AddItemToObject(item, "n2InfoContainer", n2_info_container_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [n2_info_container]"); + goto end; + } + } + + if (n2_information_notification->to_release_session_list) { + cJSON *to_release_session_list = cJSON_AddArrayToObject(item, "toReleaseSessionList"); + if (to_release_session_list == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [to_release_session_list]"); + goto end; + } + + OpenAPI_lnode_t *to_release_session_list_node; + OpenAPI_list_for_each(n2_information_notification->to_release_session_list, to_release_session_list_node) { + if (cJSON_AddNumberToObject(to_release_session_list, "", *(double *)to_release_session_list_node->data) == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [to_release_session_list]"); + goto end; + } + } + } + + if (n2_information_notification->lcs_correlation_id) { + if (cJSON_AddStringToObject(item, "lcsCorrelationId", n2_information_notification->lcs_correlation_id) == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [lcs_correlation_id]"); + goto end; + } + } + + if (n2_information_notification->notify_reason) { + if (cJSON_AddStringToObject(item, "notifyReason", OpenAPI_n2_info_notify_reason_ToString(n2_information_notification->notify_reason)) == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [notify_reason]"); + goto end; + } + } + + if (n2_information_notification->smf_change_info_list) { + cJSON *smf_change_info_listList = cJSON_AddArrayToObject(item, "smfChangeInfoList"); + if (smf_change_info_listList == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [smf_change_info_list]"); + goto end; + } + + OpenAPI_lnode_t *smf_change_info_list_node; + if (n2_information_notification->smf_change_info_list) { + OpenAPI_list_for_each(n2_information_notification->smf_change_info_list, smf_change_info_list_node) { + cJSON *itemLocal = OpenAPI_smf_change_info_convertToJSON(smf_change_info_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [smf_change_info_list]"); + goto end; + } + cJSON_AddItemToArray(smf_change_info_listList, itemLocal); + } + } + } + + if (n2_information_notification->ran_node_id) { + cJSON *ran_node_id_local_JSON = OpenAPI_global_ran_node_id_convertToJSON(n2_information_notification->ran_node_id); + if (ran_node_id_local_JSON == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [ran_node_id]"); + goto end; + } + cJSON_AddItemToObject(item, "ranNodeId", ran_node_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [ran_node_id]"); + goto end; + } + } + + if (n2_information_notification->initial_amf_name) { + if (cJSON_AddStringToObject(item, "initialAmfName", n2_information_notification->initial_amf_name) == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [initial_amf_name]"); + goto end; + } + } + + if (n2_information_notification->an_n2_i_pv4_addr) { + if (cJSON_AddStringToObject(item, "anN2IPv4Addr", n2_information_notification->an_n2_i_pv4_addr) == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [an_n2_i_pv4_addr]"); + goto end; + } + } + + if (n2_information_notification->an_n2_i_pv6_addr) { + if (cJSON_AddStringToObject(item, "anN2IPv6Addr", n2_information_notification->an_n2_i_pv6_addr) == NULL) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed [an_n2_i_pv6_addr]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n2_information_notification_t *OpenAPI_n2_information_notification_parseFromJSON(cJSON *n2_information_notificationJSON) +{ + OpenAPI_n2_information_notification_t *n2_information_notification_local_var = NULL; + cJSON *n2_notify_subscription_id = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "n2NotifySubscriptionId"); + if (!n2_notify_subscription_id) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [n2_notify_subscription_id]"); + goto end; + } + + + if (!cJSON_IsString(n2_notify_subscription_id)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [n2_notify_subscription_id]"); + goto end; + } + + cJSON *n2_info_container = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "n2InfoContainer"); + + OpenAPI_n2_info_container_t *n2_info_container_local_nonprim = NULL; + if (n2_info_container) { + n2_info_container_local_nonprim = OpenAPI_n2_info_container_parseFromJSON(n2_info_container); + } + + cJSON *to_release_session_list = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "toReleaseSessionList"); + + OpenAPI_list_t *to_release_session_listList; + if (to_release_session_list) { + cJSON *to_release_session_list_local; + if (!cJSON_IsArray(to_release_session_list)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [to_release_session_list]"); + goto end; + } + to_release_session_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(to_release_session_list_local, to_release_session_list) { + if (!cJSON_IsNumber(to_release_session_list_local)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [to_release_session_list]"); + goto end; + } + OpenAPI_list_add(to_release_session_listList, &to_release_session_list_local->valuedouble); + } + } + + cJSON *lcs_correlation_id = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "lcsCorrelationId"); + + if (lcs_correlation_id) { + if (!cJSON_IsString(lcs_correlation_id)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [lcs_correlation_id]"); + goto end; + } + } + + cJSON *notify_reason = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "notifyReason"); + + OpenAPI_n2_info_notify_reason_e notify_reasonVariable; + if (notify_reason) { + if (!cJSON_IsString(notify_reason)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [notify_reason]"); + goto end; + } + notify_reasonVariable = OpenAPI_n2_info_notify_reason_FromString(notify_reason->valuestring); + } + + cJSON *smf_change_info_list = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "smfChangeInfoList"); + + OpenAPI_list_t *smf_change_info_listList; + if (smf_change_info_list) { + cJSON *smf_change_info_list_local_nonprimitive; + if (!cJSON_IsArray(smf_change_info_list)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [smf_change_info_list]"); + goto end; + } + + smf_change_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(smf_change_info_list_local_nonprimitive, smf_change_info_list ) { + if (!cJSON_IsObject(smf_change_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [smf_change_info_list]"); + goto end; + } + OpenAPI_smf_change_info_t *smf_change_info_listItem = OpenAPI_smf_change_info_parseFromJSON(smf_change_info_list_local_nonprimitive); + + OpenAPI_list_add(smf_change_info_listList, smf_change_info_listItem); + } + } + + cJSON *ran_node_id = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "ranNodeId"); + + OpenAPI_global_ran_node_id_t *ran_node_id_local_nonprim = NULL; + if (ran_node_id) { + ran_node_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(ran_node_id); + } + + cJSON *initial_amf_name = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "initialAmfName"); + + if (initial_amf_name) { + if (!cJSON_IsString(initial_amf_name)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [initial_amf_name]"); + goto end; + } + } + + cJSON *an_n2_i_pv4_addr = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "anN2IPv4Addr"); + + if (an_n2_i_pv4_addr) { + if (!cJSON_IsString(an_n2_i_pv4_addr)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [an_n2_i_pv4_addr]"); + goto end; + } + } + + cJSON *an_n2_i_pv6_addr = cJSON_GetObjectItemCaseSensitive(n2_information_notificationJSON, "anN2IPv6Addr"); + + if (an_n2_i_pv6_addr) { + if (!cJSON_IsString(an_n2_i_pv6_addr)) { + ogs_error("OpenAPI_n2_information_notification_parseFromJSON() failed [an_n2_i_pv6_addr]"); + goto end; + } + } + + n2_information_notification_local_var = OpenAPI_n2_information_notification_create ( + ogs_strdup(n2_notify_subscription_id->valuestring), + n2_info_container ? n2_info_container_local_nonprim : NULL, + to_release_session_list ? to_release_session_listList : NULL, + lcs_correlation_id ? ogs_strdup(lcs_correlation_id->valuestring) : NULL, + notify_reason ? notify_reasonVariable : 0, + smf_change_info_list ? smf_change_info_listList : NULL, + ran_node_id ? ran_node_id_local_nonprim : NULL, + initial_amf_name ? ogs_strdup(initial_amf_name->valuestring) : NULL, + an_n2_i_pv4_addr ? ogs_strdup(an_n2_i_pv4_addr->valuestring) : NULL, + an_n2_i_pv6_addr ? ogs_strdup(an_n2_i_pv6_addr->valuestring) : NULL + ); + + return n2_information_notification_local_var; +end: + return NULL; +} + +OpenAPI_n2_information_notification_t *OpenAPI_n2_information_notification_copy(OpenAPI_n2_information_notification_t *dst, OpenAPI_n2_information_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_information_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_information_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n2_information_notification_free(dst); + dst = OpenAPI_n2_information_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_information_notification.h b/lib/sbi/openapi/model/n2_information_notification.h new file mode 100644 index 000000000..ada238ea2 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_notification.h @@ -0,0 +1,60 @@ +/* + * n2_information_notification.h + * + * + */ + +#ifndef _OpenAPI_n2_information_notification_H_ +#define _OpenAPI_n2_information_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "global_ran_node_id.h" +#include "n2_info_container.h" +#include "n2_info_notify_reason.h" +#include "smf_change_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_information_notification_s OpenAPI_n2_information_notification_t; +typedef struct OpenAPI_n2_information_notification_s { + char *n2_notify_subscription_id; + struct OpenAPI_n2_info_container_s *n2_info_container; + OpenAPI_list_t *to_release_session_list; + char *lcs_correlation_id; + OpenAPI_n2_info_notify_reason_e notify_reason; + OpenAPI_list_t *smf_change_info_list; + struct OpenAPI_global_ran_node_id_s *ran_node_id; + char *initial_amf_name; + char *an_n2_i_pv4_addr; + char *an_n2_i_pv6_addr; +} OpenAPI_n2_information_notification_t; + +OpenAPI_n2_information_notification_t *OpenAPI_n2_information_notification_create( + char *n2_notify_subscription_id, + OpenAPI_n2_info_container_t *n2_info_container, + OpenAPI_list_t *to_release_session_list, + char *lcs_correlation_id, + OpenAPI_n2_info_notify_reason_e notify_reason, + OpenAPI_list_t *smf_change_info_list, + OpenAPI_global_ran_node_id_t *ran_node_id, + char *initial_amf_name, + char *an_n2_i_pv4_addr, + char *an_n2_i_pv6_addr + ); +void OpenAPI_n2_information_notification_free(OpenAPI_n2_information_notification_t *n2_information_notification); +OpenAPI_n2_information_notification_t *OpenAPI_n2_information_notification_parseFromJSON(cJSON *n2_information_notificationJSON); +cJSON *OpenAPI_n2_information_notification_convertToJSON(OpenAPI_n2_information_notification_t *n2_information_notification); +OpenAPI_n2_information_notification_t *OpenAPI_n2_information_notification_copy(OpenAPI_n2_information_notification_t *dst, OpenAPI_n2_information_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_information_notification_H_ */ + diff --git a/lib/sbi/openapi/model/n2_information_transfer_error.c b/lib/sbi/openapi/model/n2_information_transfer_error.c new file mode 100644 index 000000000..d55bc6925 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_transfer_error.c @@ -0,0 +1,138 @@ + +#include +#include +#include +#include "n2_information_transfer_error.h" + +OpenAPI_n2_information_transfer_error_t *OpenAPI_n2_information_transfer_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_pws_error_data_t *pwd_error_info + ) +{ + OpenAPI_n2_information_transfer_error_t *n2_information_transfer_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_information_transfer_error_t)); + if (!n2_information_transfer_error_local_var) { + return NULL; + } + n2_information_transfer_error_local_var->error = error; + n2_information_transfer_error_local_var->pwd_error_info = pwd_error_info; + + return n2_information_transfer_error_local_var; +} + +void OpenAPI_n2_information_transfer_error_free(OpenAPI_n2_information_transfer_error_t *n2_information_transfer_error) +{ + if (NULL == n2_information_transfer_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(n2_information_transfer_error->error); + OpenAPI_pws_error_data_free(n2_information_transfer_error->pwd_error_info); + ogs_free(n2_information_transfer_error); +} + +cJSON *OpenAPI_n2_information_transfer_error_convertToJSON(OpenAPI_n2_information_transfer_error_t *n2_information_transfer_error) +{ + cJSON *item = NULL; + + if (n2_information_transfer_error == NULL) { + ogs_error("OpenAPI_n2_information_transfer_error_convertToJSON() failed [N2InformationTransferError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n2_information_transfer_error->error) { + ogs_error("OpenAPI_n2_information_transfer_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(n2_information_transfer_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_n2_information_transfer_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_information_transfer_error_convertToJSON() failed [error]"); + goto end; + } + + if (n2_information_transfer_error->pwd_error_info) { + cJSON *pwd_error_info_local_JSON = OpenAPI_pws_error_data_convertToJSON(n2_information_transfer_error->pwd_error_info); + if (pwd_error_info_local_JSON == NULL) { + ogs_error("OpenAPI_n2_information_transfer_error_convertToJSON() failed [pwd_error_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pwdErrorInfo", pwd_error_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_information_transfer_error_convertToJSON() failed [pwd_error_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n2_information_transfer_error_t *OpenAPI_n2_information_transfer_error_parseFromJSON(cJSON *n2_information_transfer_errorJSON) +{ + OpenAPI_n2_information_transfer_error_t *n2_information_transfer_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_n2_information_transfer_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *pwd_error_info = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_errorJSON, "pwdErrorInfo"); + + OpenAPI_pws_error_data_t *pwd_error_info_local_nonprim = NULL; + if (pwd_error_info) { + pwd_error_info_local_nonprim = OpenAPI_pws_error_data_parseFromJSON(pwd_error_info); + } + + n2_information_transfer_error_local_var = OpenAPI_n2_information_transfer_error_create ( + error_local_nonprim, + pwd_error_info ? pwd_error_info_local_nonprim : NULL + ); + + return n2_information_transfer_error_local_var; +end: + return NULL; +} + +OpenAPI_n2_information_transfer_error_t *OpenAPI_n2_information_transfer_error_copy(OpenAPI_n2_information_transfer_error_t *dst, OpenAPI_n2_information_transfer_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_information_transfer_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_information_transfer_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n2_information_transfer_error_free(dst); + dst = OpenAPI_n2_information_transfer_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_information_transfer_error.h b/lib/sbi/openapi/model/n2_information_transfer_error.h new file mode 100644 index 000000000..98279ac43 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_transfer_error.h @@ -0,0 +1,42 @@ +/* + * n2_information_transfer_error.h + * + * + */ + +#ifndef _OpenAPI_n2_information_transfer_error_H_ +#define _OpenAPI_n2_information_transfer_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "problem_details.h" +#include "pws_error_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_information_transfer_error_s OpenAPI_n2_information_transfer_error_t; +typedef struct OpenAPI_n2_information_transfer_error_s { + struct OpenAPI_problem_details_s *error; + struct OpenAPI_pws_error_data_s *pwd_error_info; +} OpenAPI_n2_information_transfer_error_t; + +OpenAPI_n2_information_transfer_error_t *OpenAPI_n2_information_transfer_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_pws_error_data_t *pwd_error_info + ); +void OpenAPI_n2_information_transfer_error_free(OpenAPI_n2_information_transfer_error_t *n2_information_transfer_error); +OpenAPI_n2_information_transfer_error_t *OpenAPI_n2_information_transfer_error_parseFromJSON(cJSON *n2_information_transfer_errorJSON); +cJSON *OpenAPI_n2_information_transfer_error_convertToJSON(OpenAPI_n2_information_transfer_error_t *n2_information_transfer_error); +OpenAPI_n2_information_transfer_error_t *OpenAPI_n2_information_transfer_error_copy(OpenAPI_n2_information_transfer_error_t *dst, OpenAPI_n2_information_transfer_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_information_transfer_error_H_ */ + diff --git a/lib/sbi/openapi/model/n2_information_transfer_req_data.c b/lib/sbi/openapi/model/n2_information_transfer_req_data.c new file mode 100644 index 000000000..13a93bbdb --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_transfer_req_data.c @@ -0,0 +1,255 @@ + +#include +#include +#include +#include "n2_information_transfer_req_data.h" + +OpenAPI_n2_information_transfer_req_data_t *OpenAPI_n2_information_transfer_req_data_create( + OpenAPI_list_t *tai_list, + OpenAPI_rat_selector_e rat_selector, + OpenAPI_list_t *global_ran_node_list, + OpenAPI_n2_info_container_t *n2_information, + char *supported_features + ) +{ + OpenAPI_n2_information_transfer_req_data_t *n2_information_transfer_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_information_transfer_req_data_t)); + if (!n2_information_transfer_req_data_local_var) { + return NULL; + } + n2_information_transfer_req_data_local_var->tai_list = tai_list; + n2_information_transfer_req_data_local_var->rat_selector = rat_selector; + n2_information_transfer_req_data_local_var->global_ran_node_list = global_ran_node_list; + n2_information_transfer_req_data_local_var->n2_information = n2_information; + n2_information_transfer_req_data_local_var->supported_features = supported_features; + + return n2_information_transfer_req_data_local_var; +} + +void OpenAPI_n2_information_transfer_req_data_free(OpenAPI_n2_information_transfer_req_data_t *n2_information_transfer_req_data) +{ + if (NULL == n2_information_transfer_req_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(n2_information_transfer_req_data->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(n2_information_transfer_req_data->tai_list); + OpenAPI_list_for_each(n2_information_transfer_req_data->global_ran_node_list, node) { + OpenAPI_global_ran_node_id_free(node->data); + } + OpenAPI_list_free(n2_information_transfer_req_data->global_ran_node_list); + OpenAPI_n2_info_container_free(n2_information_transfer_req_data->n2_information); + ogs_free(n2_information_transfer_req_data->supported_features); + ogs_free(n2_information_transfer_req_data); +} + +cJSON *OpenAPI_n2_information_transfer_req_data_convertToJSON(OpenAPI_n2_information_transfer_req_data_t *n2_information_transfer_req_data) +{ + cJSON *item = NULL; + + if (n2_information_transfer_req_data == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [N2InformationTransferReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (n2_information_transfer_req_data->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [tai_list]"); + goto end; + } + + OpenAPI_lnode_t *tai_list_node; + if (n2_information_transfer_req_data->tai_list) { + OpenAPI_list_for_each(n2_information_transfer_req_data->tai_list, tai_list_node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(tai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + } + + if (n2_information_transfer_req_data->rat_selector) { + if (cJSON_AddStringToObject(item, "ratSelector", OpenAPI_rat_selector_ToString(n2_information_transfer_req_data->rat_selector)) == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [rat_selector]"); + goto end; + } + } + + if (n2_information_transfer_req_data->global_ran_node_list) { + cJSON *global_ran_node_listList = cJSON_AddArrayToObject(item, "globalRanNodeList"); + if (global_ran_node_listList == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [global_ran_node_list]"); + goto end; + } + + OpenAPI_lnode_t *global_ran_node_list_node; + if (n2_information_transfer_req_data->global_ran_node_list) { + OpenAPI_list_for_each(n2_information_transfer_req_data->global_ran_node_list, global_ran_node_list_node) { + cJSON *itemLocal = OpenAPI_global_ran_node_id_convertToJSON(global_ran_node_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [global_ran_node_list]"); + goto end; + } + cJSON_AddItemToArray(global_ran_node_listList, itemLocal); + } + } + } + + if (!n2_information_transfer_req_data->n2_information) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [n2_information]"); + goto end; + } + cJSON *n2_information_local_JSON = OpenAPI_n2_info_container_convertToJSON(n2_information_transfer_req_data->n2_information); + if (n2_information_local_JSON == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [n2_information]"); + goto end; + } + cJSON_AddItemToObject(item, "n2Information", n2_information_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [n2_information]"); + goto end; + } + + if (n2_information_transfer_req_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", n2_information_transfer_req_data->supported_features) == NULL) { + ogs_error("OpenAPI_n2_information_transfer_req_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n2_information_transfer_req_data_t *OpenAPI_n2_information_transfer_req_data_parseFromJSON(cJSON *n2_information_transfer_req_dataJSON) +{ + OpenAPI_n2_information_transfer_req_data_t *n2_information_transfer_req_data_local_var = NULL; + cJSON *tai_list = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_req_dataJSON, "taiList"); + + OpenAPI_list_t *tai_listList; + if (tai_list) { + cJSON *tai_list_local_nonprimitive; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_n2_information_transfer_req_data_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local_nonprimitive, tai_list ) { + if (!cJSON_IsObject(tai_list_local_nonprimitive)) { + ogs_error("OpenAPI_n2_information_transfer_req_data_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local_nonprimitive); + + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + cJSON *rat_selector = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_req_dataJSON, "ratSelector"); + + OpenAPI_rat_selector_e rat_selectorVariable; + if (rat_selector) { + if (!cJSON_IsString(rat_selector)) { + ogs_error("OpenAPI_n2_information_transfer_req_data_parseFromJSON() failed [rat_selector]"); + goto end; + } + rat_selectorVariable = OpenAPI_rat_selector_FromString(rat_selector->valuestring); + } + + cJSON *global_ran_node_list = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_req_dataJSON, "globalRanNodeList"); + + OpenAPI_list_t *global_ran_node_listList; + if (global_ran_node_list) { + cJSON *global_ran_node_list_local_nonprimitive; + if (!cJSON_IsArray(global_ran_node_list)) { + ogs_error("OpenAPI_n2_information_transfer_req_data_parseFromJSON() failed [global_ran_node_list]"); + goto end; + } + + global_ran_node_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(global_ran_node_list_local_nonprimitive, global_ran_node_list ) { + if (!cJSON_IsObject(global_ran_node_list_local_nonprimitive)) { + ogs_error("OpenAPI_n2_information_transfer_req_data_parseFromJSON() failed [global_ran_node_list]"); + goto end; + } + OpenAPI_global_ran_node_id_t *global_ran_node_listItem = OpenAPI_global_ran_node_id_parseFromJSON(global_ran_node_list_local_nonprimitive); + + OpenAPI_list_add(global_ran_node_listList, global_ran_node_listItem); + } + } + + cJSON *n2_information = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_req_dataJSON, "n2Information"); + if (!n2_information) { + ogs_error("OpenAPI_n2_information_transfer_req_data_parseFromJSON() failed [n2_information]"); + goto end; + } + + OpenAPI_n2_info_container_t *n2_information_local_nonprim = NULL; + + n2_information_local_nonprim = OpenAPI_n2_info_container_parseFromJSON(n2_information); + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_req_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_n2_information_transfer_req_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + n2_information_transfer_req_data_local_var = OpenAPI_n2_information_transfer_req_data_create ( + tai_list ? tai_listList : NULL, + rat_selector ? rat_selectorVariable : 0, + global_ran_node_list ? global_ran_node_listList : NULL, + n2_information_local_nonprim, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return n2_information_transfer_req_data_local_var; +end: + return NULL; +} + +OpenAPI_n2_information_transfer_req_data_t *OpenAPI_n2_information_transfer_req_data_copy(OpenAPI_n2_information_transfer_req_data_t *dst, OpenAPI_n2_information_transfer_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_information_transfer_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_information_transfer_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_n2_information_transfer_req_data_free(dst); + dst = OpenAPI_n2_information_transfer_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_information_transfer_req_data.h b/lib/sbi/openapi/model/n2_information_transfer_req_data.h new file mode 100644 index 000000000..de87a5e39 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_transfer_req_data.h @@ -0,0 +1,50 @@ +/* + * n2_information_transfer_req_data.h + * + * + */ + +#ifndef _OpenAPI_n2_information_transfer_req_data_H_ +#define _OpenAPI_n2_information_transfer_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "global_ran_node_id.h" +#include "n2_info_container.h" +#include "rat_selector.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_information_transfer_req_data_s OpenAPI_n2_information_transfer_req_data_t; +typedef struct OpenAPI_n2_information_transfer_req_data_s { + OpenAPI_list_t *tai_list; + OpenAPI_rat_selector_e rat_selector; + OpenAPI_list_t *global_ran_node_list; + struct OpenAPI_n2_info_container_s *n2_information; + char *supported_features; +} OpenAPI_n2_information_transfer_req_data_t; + +OpenAPI_n2_information_transfer_req_data_t *OpenAPI_n2_information_transfer_req_data_create( + OpenAPI_list_t *tai_list, + OpenAPI_rat_selector_e rat_selector, + OpenAPI_list_t *global_ran_node_list, + OpenAPI_n2_info_container_t *n2_information, + char *supported_features + ); +void OpenAPI_n2_information_transfer_req_data_free(OpenAPI_n2_information_transfer_req_data_t *n2_information_transfer_req_data); +OpenAPI_n2_information_transfer_req_data_t *OpenAPI_n2_information_transfer_req_data_parseFromJSON(cJSON *n2_information_transfer_req_dataJSON); +cJSON *OpenAPI_n2_information_transfer_req_data_convertToJSON(OpenAPI_n2_information_transfer_req_data_t *n2_information_transfer_req_data); +OpenAPI_n2_information_transfer_req_data_t *OpenAPI_n2_information_transfer_req_data_copy(OpenAPI_n2_information_transfer_req_data_t *dst, OpenAPI_n2_information_transfer_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_information_transfer_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/n2_information_transfer_result.c b/lib/sbi/openapi/model/n2_information_transfer_result.c new file mode 100644 index 000000000..2b5789dd5 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_transfer_result.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n2_information_transfer_result.h" + +char* OpenAPI_n2_information_transfer_result_ToString(OpenAPI_n2_information_transfer_result_e n2_information_transfer_result) +{ + const char *n2_information_transfer_resultArray[] = { "NULL", "N2_INFO_TRANSFER_INITIATED" }; + size_t sizeofArray = sizeof(n2_information_transfer_resultArray) / sizeof(n2_information_transfer_resultArray[0]); + if (n2_information_transfer_result < sizeofArray) + return (char *)n2_information_transfer_resultArray[n2_information_transfer_result]; + else + return (char *)"Unknown"; +} + +OpenAPI_n2_information_transfer_result_e OpenAPI_n2_information_transfer_result_FromString(char* n2_information_transfer_result) +{ + int stringToReturn = 0; + const char *n2_information_transfer_resultArray[] = { "NULL", "N2_INFO_TRANSFER_INITIATED" }; + size_t sizeofArray = sizeof(n2_information_transfer_resultArray) / sizeof(n2_information_transfer_resultArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n2_information_transfer_result, n2_information_transfer_resultArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n2_information_transfer_result.h b/lib/sbi/openapi/model/n2_information_transfer_result.h new file mode 100644 index 000000000..2a59b3130 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_transfer_result.h @@ -0,0 +1,31 @@ +/* + * n2_information_transfer_result.h + * + * + */ + +#ifndef _OpenAPI_n2_information_transfer_result_H_ +#define _OpenAPI_n2_information_transfer_result_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_n2_information_transfer_result_NULL = 0, OpenAPI_n2_information_transfer_result_N2_INFO_TRANSFER_INITIATED } OpenAPI_n2_information_transfer_result_e; + +char* OpenAPI_n2_information_transfer_result_ToString(OpenAPI_n2_information_transfer_result_e n2_information_transfer_result); + +OpenAPI_n2_information_transfer_result_e OpenAPI_n2_information_transfer_result_FromString(char* n2_information_transfer_result); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_information_transfer_result_H_ */ + diff --git a/lib/sbi/openapi/model/n2_information_transfer_rsp_data.c b/lib/sbi/openapi/model/n2_information_transfer_rsp_data.c new file mode 100644 index 000000000..f59971041 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_transfer_rsp_data.c @@ -0,0 +1,155 @@ + +#include +#include +#include +#include "n2_information_transfer_rsp_data.h" + +OpenAPI_n2_information_transfer_rsp_data_t *OpenAPI_n2_information_transfer_rsp_data_create( + OpenAPI_n2_information_transfer_result_e result, + OpenAPI_pws_response_data_t *pws_rsp_data, + char *supported_features + ) +{ + OpenAPI_n2_information_transfer_rsp_data_t *n2_information_transfer_rsp_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_information_transfer_rsp_data_t)); + if (!n2_information_transfer_rsp_data_local_var) { + return NULL; + } + n2_information_transfer_rsp_data_local_var->result = result; + n2_information_transfer_rsp_data_local_var->pws_rsp_data = pws_rsp_data; + n2_information_transfer_rsp_data_local_var->supported_features = supported_features; + + return n2_information_transfer_rsp_data_local_var; +} + +void OpenAPI_n2_information_transfer_rsp_data_free(OpenAPI_n2_information_transfer_rsp_data_t *n2_information_transfer_rsp_data) +{ + if (NULL == n2_information_transfer_rsp_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_pws_response_data_free(n2_information_transfer_rsp_data->pws_rsp_data); + ogs_free(n2_information_transfer_rsp_data->supported_features); + ogs_free(n2_information_transfer_rsp_data); +} + +cJSON *OpenAPI_n2_information_transfer_rsp_data_convertToJSON(OpenAPI_n2_information_transfer_rsp_data_t *n2_information_transfer_rsp_data) +{ + cJSON *item = NULL; + + if (n2_information_transfer_rsp_data == NULL) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_convertToJSON() failed [N2InformationTransferRspData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n2_information_transfer_rsp_data->result) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_convertToJSON() failed [result]"); + goto end; + } + if (cJSON_AddStringToObject(item, "result", OpenAPI_n2_information_transfer_result_ToString(n2_information_transfer_rsp_data->result)) == NULL) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_convertToJSON() failed [result]"); + goto end; + } + + if (n2_information_transfer_rsp_data->pws_rsp_data) { + cJSON *pws_rsp_data_local_JSON = OpenAPI_pws_response_data_convertToJSON(n2_information_transfer_rsp_data->pws_rsp_data); + if (pws_rsp_data_local_JSON == NULL) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_convertToJSON() failed [pws_rsp_data]"); + goto end; + } + cJSON_AddItemToObject(item, "pwsRspData", pws_rsp_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_convertToJSON() failed [pws_rsp_data]"); + goto end; + } + } + + if (n2_information_transfer_rsp_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", n2_information_transfer_rsp_data->supported_features) == NULL) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n2_information_transfer_rsp_data_t *OpenAPI_n2_information_transfer_rsp_data_parseFromJSON(cJSON *n2_information_transfer_rsp_dataJSON) +{ + OpenAPI_n2_information_transfer_rsp_data_t *n2_information_transfer_rsp_data_local_var = NULL; + cJSON *result = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_rsp_dataJSON, "result"); + if (!result) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_parseFromJSON() failed [result]"); + goto end; + } + + OpenAPI_n2_information_transfer_result_e resultVariable; + + if (!cJSON_IsString(result)) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_parseFromJSON() failed [result]"); + goto end; + } + resultVariable = OpenAPI_n2_information_transfer_result_FromString(result->valuestring); + + cJSON *pws_rsp_data = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_rsp_dataJSON, "pwsRspData"); + + OpenAPI_pws_response_data_t *pws_rsp_data_local_nonprim = NULL; + if (pws_rsp_data) { + pws_rsp_data_local_nonprim = OpenAPI_pws_response_data_parseFromJSON(pws_rsp_data); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(n2_information_transfer_rsp_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_n2_information_transfer_rsp_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + n2_information_transfer_rsp_data_local_var = OpenAPI_n2_information_transfer_rsp_data_create ( + resultVariable, + pws_rsp_data ? pws_rsp_data_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return n2_information_transfer_rsp_data_local_var; +end: + return NULL; +} + +OpenAPI_n2_information_transfer_rsp_data_t *OpenAPI_n2_information_transfer_rsp_data_copy(OpenAPI_n2_information_transfer_rsp_data_t *dst, OpenAPI_n2_information_transfer_rsp_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_information_transfer_rsp_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_information_transfer_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_n2_information_transfer_rsp_data_free(dst); + dst = OpenAPI_n2_information_transfer_rsp_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_information_transfer_rsp_data.h b/lib/sbi/openapi/model/n2_information_transfer_rsp_data.h new file mode 100644 index 000000000..0fd0a3abf --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_transfer_rsp_data.h @@ -0,0 +1,44 @@ +/* + * n2_information_transfer_rsp_data.h + * + * + */ + +#ifndef _OpenAPI_n2_information_transfer_rsp_data_H_ +#define _OpenAPI_n2_information_transfer_rsp_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_information_transfer_result.h" +#include "pws_response_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_information_transfer_rsp_data_s OpenAPI_n2_information_transfer_rsp_data_t; +typedef struct OpenAPI_n2_information_transfer_rsp_data_s { + OpenAPI_n2_information_transfer_result_e result; + struct OpenAPI_pws_response_data_s *pws_rsp_data; + char *supported_features; +} OpenAPI_n2_information_transfer_rsp_data_t; + +OpenAPI_n2_information_transfer_rsp_data_t *OpenAPI_n2_information_transfer_rsp_data_create( + OpenAPI_n2_information_transfer_result_e result, + OpenAPI_pws_response_data_t *pws_rsp_data, + char *supported_features + ); +void OpenAPI_n2_information_transfer_rsp_data_free(OpenAPI_n2_information_transfer_rsp_data_t *n2_information_transfer_rsp_data); +OpenAPI_n2_information_transfer_rsp_data_t *OpenAPI_n2_information_transfer_rsp_data_parseFromJSON(cJSON *n2_information_transfer_rsp_dataJSON); +cJSON *OpenAPI_n2_information_transfer_rsp_data_convertToJSON(OpenAPI_n2_information_transfer_rsp_data_t *n2_information_transfer_rsp_data); +OpenAPI_n2_information_transfer_rsp_data_t *OpenAPI_n2_information_transfer_rsp_data_copy(OpenAPI_n2_information_transfer_rsp_data_t *dst, OpenAPI_n2_information_transfer_rsp_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_information_transfer_rsp_data_H_ */ + diff --git a/lib/sbi/openapi/model/n2_interface_amf_info.c b/lib/sbi/openapi/model/n2_interface_amf_info.c index 845d9108e..a4126f011 100644 --- a/lib/sbi/openapi/model/n2_interface_amf_info.c +++ b/lib/sbi/openapi/model/n2_interface_amf_info.c @@ -155,3 +155,37 @@ end: return NULL; } +OpenAPI_n2_interface_amf_info_t *OpenAPI_n2_interface_amf_info_copy(OpenAPI_n2_interface_amf_info_t *dst, OpenAPI_n2_interface_amf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_interface_amf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_interface_amf_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n2_interface_amf_info_free(dst); + dst = OpenAPI_n2_interface_amf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_interface_amf_info.h b/lib/sbi/openapi/model/n2_interface_amf_info.h index 0f7572051..135ca9cc1 100644 --- a/lib/sbi/openapi/model/n2_interface_amf_info.h +++ b/lib/sbi/openapi/model/n2_interface_amf_info.h @@ -32,6 +32,7 @@ OpenAPI_n2_interface_amf_info_t *OpenAPI_n2_interface_amf_info_create( void OpenAPI_n2_interface_amf_info_free(OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info); OpenAPI_n2_interface_amf_info_t *OpenAPI_n2_interface_amf_info_parseFromJSON(cJSON *n2_interface_amf_infoJSON); cJSON *OpenAPI_n2_interface_amf_info_convertToJSON(OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info); +OpenAPI_n2_interface_amf_info_t *OpenAPI_n2_interface_amf_info_copy(OpenAPI_n2_interface_amf_info_t *dst, OpenAPI_n2_interface_amf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/n2_ran_information.c b/lib/sbi/openapi/model/n2_ran_information.c new file mode 100644 index 000000000..14f9e28ed --- /dev/null +++ b/lib/sbi/openapi/model/n2_ran_information.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "n2_ran_information.h" + +OpenAPI_n2_ran_information_t *OpenAPI_n2_ran_information_create( + OpenAPI_n2_info_content_t *n2_info_content + ) +{ + OpenAPI_n2_ran_information_t *n2_ran_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_ran_information_t)); + if (!n2_ran_information_local_var) { + return NULL; + } + n2_ran_information_local_var->n2_info_content = n2_info_content; + + return n2_ran_information_local_var; +} + +void OpenAPI_n2_ran_information_free(OpenAPI_n2_ran_information_t *n2_ran_information) +{ + if (NULL == n2_ran_information) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n2_info_content_free(n2_ran_information->n2_info_content); + ogs_free(n2_ran_information); +} + +cJSON *OpenAPI_n2_ran_information_convertToJSON(OpenAPI_n2_ran_information_t *n2_ran_information) +{ + cJSON *item = NULL; + + if (n2_ran_information == NULL) { + ogs_error("OpenAPI_n2_ran_information_convertToJSON() failed [N2RanInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n2_ran_information->n2_info_content) { + ogs_error("OpenAPI_n2_ran_information_convertToJSON() failed [n2_info_content]"); + goto end; + } + cJSON *n2_info_content_local_JSON = OpenAPI_n2_info_content_convertToJSON(n2_ran_information->n2_info_content); + if (n2_info_content_local_JSON == NULL) { + ogs_error("OpenAPI_n2_ran_information_convertToJSON() failed [n2_info_content]"); + goto end; + } + cJSON_AddItemToObject(item, "n2InfoContent", n2_info_content_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_ran_information_convertToJSON() failed [n2_info_content]"); + goto end; + } + +end: + return item; +} + +OpenAPI_n2_ran_information_t *OpenAPI_n2_ran_information_parseFromJSON(cJSON *n2_ran_informationJSON) +{ + OpenAPI_n2_ran_information_t *n2_ran_information_local_var = NULL; + cJSON *n2_info_content = cJSON_GetObjectItemCaseSensitive(n2_ran_informationJSON, "n2InfoContent"); + if (!n2_info_content) { + ogs_error("OpenAPI_n2_ran_information_parseFromJSON() failed [n2_info_content]"); + goto end; + } + + OpenAPI_n2_info_content_t *n2_info_content_local_nonprim = NULL; + + n2_info_content_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(n2_info_content); + + n2_ran_information_local_var = OpenAPI_n2_ran_information_create ( + n2_info_content_local_nonprim + ); + + return n2_ran_information_local_var; +end: + return NULL; +} + +OpenAPI_n2_ran_information_t *OpenAPI_n2_ran_information_copy(OpenAPI_n2_ran_information_t *dst, OpenAPI_n2_ran_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_ran_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_ran_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n2_ran_information_free(dst); + dst = OpenAPI_n2_ran_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_ran_information.h b/lib/sbi/openapi/model/n2_ran_information.h new file mode 100644 index 000000000..5897dc57f --- /dev/null +++ b/lib/sbi/openapi/model/n2_ran_information.h @@ -0,0 +1,39 @@ +/* + * n2_ran_information.h + * + * + */ + +#ifndef _OpenAPI_n2_ran_information_H_ +#define _OpenAPI_n2_ran_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_ran_information_s OpenAPI_n2_ran_information_t; +typedef struct OpenAPI_n2_ran_information_s { + struct OpenAPI_n2_info_content_s *n2_info_content; +} OpenAPI_n2_ran_information_t; + +OpenAPI_n2_ran_information_t *OpenAPI_n2_ran_information_create( + OpenAPI_n2_info_content_t *n2_info_content + ); +void OpenAPI_n2_ran_information_free(OpenAPI_n2_ran_information_t *n2_ran_information); +OpenAPI_n2_ran_information_t *OpenAPI_n2_ran_information_parseFromJSON(cJSON *n2_ran_informationJSON); +cJSON *OpenAPI_n2_ran_information_convertToJSON(OpenAPI_n2_ran_information_t *n2_ran_information); +OpenAPI_n2_ran_information_t *OpenAPI_n2_ran_information_copy(OpenAPI_n2_ran_information_t *dst, OpenAPI_n2_ran_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_ran_information_H_ */ + diff --git a/lib/sbi/openapi/model/n2_sm_info_type.c b/lib/sbi/openapi/model/n2_sm_info_type.c new file mode 100644 index 000000000..0329a59fd --- /dev/null +++ b/lib/sbi/openapi/model/n2_sm_info_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n2_sm_info_type.h" + +char* OpenAPI_n2_sm_info_type_ToString(OpenAPI_n2_sm_info_type_e n2_sm_info_type) +{ + const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE" }; + size_t sizeofArray = sizeof(n2_sm_info_typeArray) / sizeof(n2_sm_info_typeArray[0]); + if (n2_sm_info_type < sizeofArray) + return (char *)n2_sm_info_typeArray[n2_sm_info_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_n2_sm_info_type_e OpenAPI_n2_sm_info_type_FromString(char* n2_sm_info_type) +{ + int stringToReturn = 0; + const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE" }; + size_t sizeofArray = sizeof(n2_sm_info_typeArray) / sizeof(n2_sm_info_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n2_sm_info_type, n2_sm_info_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n2_sm_info_type.h b/lib/sbi/openapi/model/n2_sm_info_type.h new file mode 100644 index 000000000..dcbf19272 --- /dev/null +++ b/lib/sbi/openapi/model/n2_sm_info_type.h @@ -0,0 +1,31 @@ +/* + * n2_sm_info_type.h + * + * + */ + +#ifndef _OpenAPI_n2_sm_info_type_H_ +#define _OpenAPI_n2_sm_info_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_n2_sm_info_type_NULL = 0, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_REQ, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_REL_CMD, OpenAPI_n2_sm_info_type_PDU_RES_REL_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_REQ, OpenAPI_n2_sm_info_type_PDU_RES_MOD_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_NTY, OpenAPI_n2_sm_info_type_PDU_RES_NTY_REL, OpenAPI_n2_sm_info_type_PDU_RES_MOD_IND, OpenAPI_n2_sm_info_type_PDU_RES_MOD_CFM, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ, OpenAPI_n2_sm_info_type_PATH_SWITCH_SETUP_FAIL, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_ACK, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQUIRED, OpenAPI_n2_sm_info_type_HANDOVER_CMD, OpenAPI_n2_sm_info_type_HANDOVER_PREP_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQ_ACK, OpenAPI_n2_sm_info_type_HANDOVER_RES_ALLOC_FAIL, OpenAPI_n2_sm_info_type_SECONDARY_RAT_USAGE } OpenAPI_n2_sm_info_type_e; + +char* OpenAPI_n2_sm_info_type_ToString(OpenAPI_n2_sm_info_type_e n2_sm_info_type); + +OpenAPI_n2_sm_info_type_e OpenAPI_n2_sm_info_type_FromString(char* n2_sm_info_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_sm_info_type_H_ */ + diff --git a/lib/sbi/openapi/model/n2_sm_information.c b/lib/sbi/openapi/model/n2_sm_information.c new file mode 100644 index 000000000..ecd3bc73c --- /dev/null +++ b/lib/sbi/openapi/model/n2_sm_information.c @@ -0,0 +1,200 @@ + +#include +#include +#include +#include "n2_sm_information.h" + +OpenAPI_n2_sm_information_t *OpenAPI_n2_sm_information_create( + int pdu_session_id, + OpenAPI_n2_info_content_t *n2_info_content, + OpenAPI_snssai_t *s_nssai, + OpenAPI_snssai_t *home_plmn_snssai, + int subject_to_ho + ) +{ + OpenAPI_n2_sm_information_t *n2_sm_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_sm_information_t)); + if (!n2_sm_information_local_var) { + return NULL; + } + n2_sm_information_local_var->pdu_session_id = pdu_session_id; + n2_sm_information_local_var->n2_info_content = n2_info_content; + n2_sm_information_local_var->s_nssai = s_nssai; + n2_sm_information_local_var->home_plmn_snssai = home_plmn_snssai; + n2_sm_information_local_var->subject_to_ho = subject_to_ho; + + return n2_sm_information_local_var; +} + +void OpenAPI_n2_sm_information_free(OpenAPI_n2_sm_information_t *n2_sm_information) +{ + if (NULL == n2_sm_information) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n2_info_content_free(n2_sm_information->n2_info_content); + OpenAPI_snssai_free(n2_sm_information->s_nssai); + OpenAPI_snssai_free(n2_sm_information->home_plmn_snssai); + ogs_free(n2_sm_information); +} + +cJSON *OpenAPI_n2_sm_information_convertToJSON(OpenAPI_n2_sm_information_t *n2_sm_information) +{ + cJSON *item = NULL; + + if (n2_sm_information == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [N2SmInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n2_sm_information->pdu_session_id) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [pdu_session_id]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "pduSessionId", n2_sm_information->pdu_session_id) == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [pdu_session_id]"); + goto end; + } + + if (n2_sm_information->n2_info_content) { + cJSON *n2_info_content_local_JSON = OpenAPI_n2_info_content_convertToJSON(n2_sm_information->n2_info_content); + if (n2_info_content_local_JSON == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [n2_info_content]"); + goto end; + } + cJSON_AddItemToObject(item, "n2InfoContent", n2_info_content_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [n2_info_content]"); + goto end; + } + } + + if (n2_sm_information->s_nssai) { + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(n2_sm_information->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [s_nssai]"); + goto end; + } + } + + if (n2_sm_information->home_plmn_snssai) { + cJSON *home_plmn_snssai_local_JSON = OpenAPI_snssai_convertToJSON(n2_sm_information->home_plmn_snssai); + if (home_plmn_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [home_plmn_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "homePlmnSnssai", home_plmn_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [home_plmn_snssai]"); + goto end; + } + } + + if (n2_sm_information->subject_to_ho) { + if (cJSON_AddBoolToObject(item, "subjectToHo", n2_sm_information->subject_to_ho) == NULL) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed [subject_to_ho]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n2_sm_information_t *OpenAPI_n2_sm_information_parseFromJSON(cJSON *n2_sm_informationJSON) +{ + OpenAPI_n2_sm_information_t *n2_sm_information_local_var = NULL; + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(n2_sm_informationJSON, "pduSessionId"); + if (!pdu_session_id) { + ogs_error("OpenAPI_n2_sm_information_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_n2_sm_information_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + cJSON *n2_info_content = cJSON_GetObjectItemCaseSensitive(n2_sm_informationJSON, "n2InfoContent"); + + OpenAPI_n2_info_content_t *n2_info_content_local_nonprim = NULL; + if (n2_info_content) { + n2_info_content_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(n2_info_content); + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(n2_sm_informationJSON, "sNssai"); + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + if (s_nssai) { + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + } + + cJSON *home_plmn_snssai = cJSON_GetObjectItemCaseSensitive(n2_sm_informationJSON, "homePlmnSnssai"); + + OpenAPI_snssai_t *home_plmn_snssai_local_nonprim = NULL; + if (home_plmn_snssai) { + home_plmn_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(home_plmn_snssai); + } + + cJSON *subject_to_ho = cJSON_GetObjectItemCaseSensitive(n2_sm_informationJSON, "subjectToHo"); + + if (subject_to_ho) { + if (!cJSON_IsBool(subject_to_ho)) { + ogs_error("OpenAPI_n2_sm_information_parseFromJSON() failed [subject_to_ho]"); + goto end; + } + } + + n2_sm_information_local_var = OpenAPI_n2_sm_information_create ( + pdu_session_id->valuedouble, + n2_info_content ? n2_info_content_local_nonprim : NULL, + s_nssai ? s_nssai_local_nonprim : NULL, + home_plmn_snssai ? home_plmn_snssai_local_nonprim : NULL, + subject_to_ho ? subject_to_ho->valueint : 0 + ); + + return n2_sm_information_local_var; +end: + return NULL; +} + +OpenAPI_n2_sm_information_t *OpenAPI_n2_sm_information_copy(OpenAPI_n2_sm_information_t *dst, OpenAPI_n2_sm_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_sm_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_sm_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n2_sm_information_free(dst); + dst = OpenAPI_n2_sm_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_sm_information.h b/lib/sbi/openapi/model/n2_sm_information.h new file mode 100644 index 000000000..ff5239dea --- /dev/null +++ b/lib/sbi/openapi/model/n2_sm_information.h @@ -0,0 +1,48 @@ +/* + * n2_sm_information.h + * + * + */ + +#ifndef _OpenAPI_n2_sm_information_H_ +#define _OpenAPI_n2_sm_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_sm_information_s OpenAPI_n2_sm_information_t; +typedef struct OpenAPI_n2_sm_information_s { + int pdu_session_id; + struct OpenAPI_n2_info_content_s *n2_info_content; + struct OpenAPI_snssai_s *s_nssai; + struct OpenAPI_snssai_s *home_plmn_snssai; + int subject_to_ho; +} OpenAPI_n2_sm_information_t; + +OpenAPI_n2_sm_information_t *OpenAPI_n2_sm_information_create( + int pdu_session_id, + OpenAPI_n2_info_content_t *n2_info_content, + OpenAPI_snssai_t *s_nssai, + OpenAPI_snssai_t *home_plmn_snssai, + int subject_to_ho + ); +void OpenAPI_n2_sm_information_free(OpenAPI_n2_sm_information_t *n2_sm_information); +OpenAPI_n2_sm_information_t *OpenAPI_n2_sm_information_parseFromJSON(cJSON *n2_sm_informationJSON); +cJSON *OpenAPI_n2_sm_information_convertToJSON(OpenAPI_n2_sm_information_t *n2_sm_information); +OpenAPI_n2_sm_information_t *OpenAPI_n2_sm_information_copy(OpenAPI_n2_sm_information_t *dst, OpenAPI_n2_sm_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_sm_information_H_ */ + diff --git a/lib/sbi/openapi/model/n3ga_location.c b/lib/sbi/openapi/model/n3ga_location.c index 97e5be9ce..a9f7927f9 100644 --- a/lib/sbi/openapi/model/n3ga_location.c +++ b/lib/sbi/openapi/model/n3ga_location.c @@ -254,3 +254,37 @@ end: return NULL; } +OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_copy(OpenAPI_n3ga_location_t *dst, OpenAPI_n3ga_location_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n3ga_location_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n3ga_location_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n3ga_location_free(dst); + dst = OpenAPI_n3ga_location_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n3ga_location.h b/lib/sbi/openapi/model/n3ga_location.h index 30eaea32e..fa0efc2ad 100644 --- a/lib/sbi/openapi/model/n3ga_location.h +++ b/lib/sbi/openapi/model/n3ga_location.h @@ -48,6 +48,7 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_create( void OpenAPI_n3ga_location_free(OpenAPI_n3ga_location_t *n3ga_location); OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_parseFromJSON(cJSON *n3ga_locationJSON); cJSON *OpenAPI_n3ga_location_convertToJSON(OpenAPI_n3ga_location_t *n3ga_location); +OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_copy(OpenAPI_n3ga_location_t *dst, OpenAPI_n3ga_location_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/n4_information.c b/lib/sbi/openapi/model/n4_information.c new file mode 100644 index 000000000..2ab19c061 --- /dev/null +++ b/lib/sbi/openapi/model/n4_information.c @@ -0,0 +1,167 @@ + +#include +#include +#include +#include "n4_information.h" + +OpenAPI_n4_information_t *OpenAPI_n4_information_create( + OpenAPI_n4_message_type_t *n4_message_type, + OpenAPI_ref_to_binary_data_t *n4_message_payload, + OpenAPI_dnai_information_t *n4_dnai_info + ) +{ + OpenAPI_n4_information_t *n4_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_n4_information_t)); + if (!n4_information_local_var) { + return NULL; + } + n4_information_local_var->n4_message_type = n4_message_type; + n4_information_local_var->n4_message_payload = n4_message_payload; + n4_information_local_var->n4_dnai_info = n4_dnai_info; + + return n4_information_local_var; +} + +void OpenAPI_n4_information_free(OpenAPI_n4_information_t *n4_information) +{ + if (NULL == n4_information) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n4_message_type_free(n4_information->n4_message_type); + OpenAPI_ref_to_binary_data_free(n4_information->n4_message_payload); + OpenAPI_dnai_information_free(n4_information->n4_dnai_info); + ogs_free(n4_information); +} + +cJSON *OpenAPI_n4_information_convertToJSON(OpenAPI_n4_information_t *n4_information) +{ + cJSON *item = NULL; + + if (n4_information == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [N4Information]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n4_information->n4_message_type) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n4_message_type]"); + goto end; + } + cJSON *n4_message_type_local_JSON = OpenAPI_n4_message_type_convertToJSON(n4_information->n4_message_type); + if (n4_message_type_local_JSON == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n4_message_type]"); + goto end; + } + cJSON_AddItemToObject(item, "n4MessageType", n4_message_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n4_message_type]"); + goto end; + } + + if (!n4_information->n4_message_payload) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n4_message_payload]"); + goto end; + } + cJSON *n4_message_payload_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(n4_information->n4_message_payload); + if (n4_message_payload_local_JSON == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n4_message_payload]"); + goto end; + } + cJSON_AddItemToObject(item, "n4MessagePayload", n4_message_payload_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n4_message_payload]"); + goto end; + } + + if (n4_information->n4_dnai_info) { + cJSON *n4_dnai_info_local_JSON = OpenAPI_dnai_information_convertToJSON(n4_information->n4_dnai_info); + if (n4_dnai_info_local_JSON == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n4_dnai_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n4DnaiInfo", n4_dnai_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n4_dnai_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n4_information_t *OpenAPI_n4_information_parseFromJSON(cJSON *n4_informationJSON) +{ + OpenAPI_n4_information_t *n4_information_local_var = NULL; + cJSON *n4_message_type = cJSON_GetObjectItemCaseSensitive(n4_informationJSON, "n4MessageType"); + if (!n4_message_type) { + ogs_error("OpenAPI_n4_information_parseFromJSON() failed [n4_message_type]"); + goto end; + } + + OpenAPI_n4_message_type_t *n4_message_type_local_nonprim = NULL; + + n4_message_type_local_nonprim = OpenAPI_n4_message_type_parseFromJSON(n4_message_type); + + cJSON *n4_message_payload = cJSON_GetObjectItemCaseSensitive(n4_informationJSON, "n4MessagePayload"); + if (!n4_message_payload) { + ogs_error("OpenAPI_n4_information_parseFromJSON() failed [n4_message_payload]"); + goto end; + } + + OpenAPI_ref_to_binary_data_t *n4_message_payload_local_nonprim = NULL; + + n4_message_payload_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n4_message_payload); + + cJSON *n4_dnai_info = cJSON_GetObjectItemCaseSensitive(n4_informationJSON, "n4DnaiInfo"); + + OpenAPI_dnai_information_t *n4_dnai_info_local_nonprim = NULL; + if (n4_dnai_info) { + n4_dnai_info_local_nonprim = OpenAPI_dnai_information_parseFromJSON(n4_dnai_info); + } + + n4_information_local_var = OpenAPI_n4_information_create ( + n4_message_type_local_nonprim, + n4_message_payload_local_nonprim, + n4_dnai_info ? n4_dnai_info_local_nonprim : NULL + ); + + return n4_information_local_var; +end: + return NULL; +} + +OpenAPI_n4_information_t *OpenAPI_n4_information_copy(OpenAPI_n4_information_t *dst, OpenAPI_n4_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n4_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n4_information_free(dst); + dst = OpenAPI_n4_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n4_information.h b/lib/sbi/openapi/model/n4_information.h new file mode 100644 index 000000000..64d8f9025 --- /dev/null +++ b/lib/sbi/openapi/model/n4_information.h @@ -0,0 +1,45 @@ +/* + * n4_information.h + * + * + */ + +#ifndef _OpenAPI_n4_information_H_ +#define _OpenAPI_n4_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dnai_information.h" +#include "n4_message_type.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n4_information_s OpenAPI_n4_information_t; +typedef struct OpenAPI_n4_information_s { + struct OpenAPI_n4_message_type_s *n4_message_type; + struct OpenAPI_ref_to_binary_data_s *n4_message_payload; + struct OpenAPI_dnai_information_s *n4_dnai_info; +} OpenAPI_n4_information_t; + +OpenAPI_n4_information_t *OpenAPI_n4_information_create( + OpenAPI_n4_message_type_t *n4_message_type, + OpenAPI_ref_to_binary_data_t *n4_message_payload, + OpenAPI_dnai_information_t *n4_dnai_info + ); +void OpenAPI_n4_information_free(OpenAPI_n4_information_t *n4_information); +OpenAPI_n4_information_t *OpenAPI_n4_information_parseFromJSON(cJSON *n4_informationJSON); +cJSON *OpenAPI_n4_information_convertToJSON(OpenAPI_n4_information_t *n4_information); +OpenAPI_n4_information_t *OpenAPI_n4_information_copy(OpenAPI_n4_information_t *dst, OpenAPI_n4_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n4_information_H_ */ + diff --git a/lib/sbi/openapi/model/n4_message_type.c b/lib/sbi/openapi/model/n4_message_type.c new file mode 100644 index 000000000..433214aa9 --- /dev/null +++ b/lib/sbi/openapi/model/n4_message_type.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "n4_message_type.h" + +OpenAPI_n4_message_type_t *OpenAPI_n4_message_type_create( + ) +{ + OpenAPI_n4_message_type_t *n4_message_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_n4_message_type_t)); + if (!n4_message_type_local_var) { + return NULL; + } + + return n4_message_type_local_var; +} + +void OpenAPI_n4_message_type_free(OpenAPI_n4_message_type_t *n4_message_type) +{ + if (NULL == n4_message_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(n4_message_type); +} + +cJSON *OpenAPI_n4_message_type_convertToJSON(OpenAPI_n4_message_type_t *n4_message_type) +{ + cJSON *item = NULL; + + if (n4_message_type == NULL) { + ogs_error("OpenAPI_n4_message_type_convertToJSON() failed [N4MessageType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_n4_message_type_t *OpenAPI_n4_message_type_parseFromJSON(cJSON *n4_message_typeJSON) +{ + OpenAPI_n4_message_type_t *n4_message_type_local_var = NULL; + n4_message_type_local_var = OpenAPI_n4_message_type_create ( + ); + + return n4_message_type_local_var; +end: + return NULL; +} + +OpenAPI_n4_message_type_t *OpenAPI_n4_message_type_copy(OpenAPI_n4_message_type_t *dst, OpenAPI_n4_message_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n4_message_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n4_message_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n4_message_type_free(dst); + dst = OpenAPI_n4_message_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n4_message_type.h b/lib/sbi/openapi/model/n4_message_type.h new file mode 100644 index 000000000..b2343e6bb --- /dev/null +++ b/lib/sbi/openapi/model/n4_message_type.h @@ -0,0 +1,36 @@ +/* + * n4_message_type.h + * + * Possible values are - PFCP_SES_EST_REQ - PFCP_SES_EST_RSP - PFCP_SES_MOD_REQ - PFCP_SES_MOD_RSP - PFCP_SES_DEL_REQ - PFCP_SES_DEL_RSP - PFCP_SES_REP_REQ - PFCP_SES_REP_RSP + */ + +#ifndef _OpenAPI_n4_message_type_H_ +#define _OpenAPI_n4_message_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 struct OpenAPI_n4_message_type_s OpenAPI_n4_message_type_t; +typedef struct OpenAPI_n4_message_type_s { +} OpenAPI_n4_message_type_t; + +OpenAPI_n4_message_type_t *OpenAPI_n4_message_type_create( + ); +void OpenAPI_n4_message_type_free(OpenAPI_n4_message_type_t *n4_message_type); +OpenAPI_n4_message_type_t *OpenAPI_n4_message_type_parseFromJSON(cJSON *n4_message_typeJSON); +cJSON *OpenAPI_n4_message_type_convertToJSON(OpenAPI_n4_message_type_t *n4_message_type); +OpenAPI_n4_message_type_t *OpenAPI_n4_message_type_copy(OpenAPI_n4_message_type_t *dst, OpenAPI_n4_message_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n4_message_type_H_ */ + diff --git a/lib/sbi/openapi/model/nas_security_mode.c b/lib/sbi/openapi/model/nas_security_mode.c new file mode 100644 index 000000000..798d336bb --- /dev/null +++ b/lib/sbi/openapi/model/nas_security_mode.c @@ -0,0 +1,137 @@ + +#include +#include +#include +#include "nas_security_mode.h" + +OpenAPI_nas_security_mode_t *OpenAPI_nas_security_mode_create( + OpenAPI_integrity_algorithm_e integrity_algorithm, + OpenAPI_ciphering_algorithm_e ciphering_algorithm + ) +{ + OpenAPI_nas_security_mode_t *nas_security_mode_local_var = OpenAPI_malloc(sizeof(OpenAPI_nas_security_mode_t)); + if (!nas_security_mode_local_var) { + return NULL; + } + nas_security_mode_local_var->integrity_algorithm = integrity_algorithm; + nas_security_mode_local_var->ciphering_algorithm = ciphering_algorithm; + + return nas_security_mode_local_var; +} + +void OpenAPI_nas_security_mode_free(OpenAPI_nas_security_mode_t *nas_security_mode) +{ + if (NULL == nas_security_mode) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nas_security_mode); +} + +cJSON *OpenAPI_nas_security_mode_convertToJSON(OpenAPI_nas_security_mode_t *nas_security_mode) +{ + cJSON *item = NULL; + + if (nas_security_mode == NULL) { + ogs_error("OpenAPI_nas_security_mode_convertToJSON() failed [NasSecurityMode]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nas_security_mode->integrity_algorithm) { + ogs_error("OpenAPI_nas_security_mode_convertToJSON() failed [integrity_algorithm]"); + goto end; + } + if (cJSON_AddStringToObject(item, "integrityAlgorithm", OpenAPI_integrity_algorithm_ToString(nas_security_mode->integrity_algorithm)) == NULL) { + ogs_error("OpenAPI_nas_security_mode_convertToJSON() failed [integrity_algorithm]"); + goto end; + } + + if (!nas_security_mode->ciphering_algorithm) { + ogs_error("OpenAPI_nas_security_mode_convertToJSON() failed [ciphering_algorithm]"); + goto end; + } + if (cJSON_AddStringToObject(item, "cipheringAlgorithm", OpenAPI_ciphering_algorithm_ToString(nas_security_mode->ciphering_algorithm)) == NULL) { + ogs_error("OpenAPI_nas_security_mode_convertToJSON() failed [ciphering_algorithm]"); + goto end; + } + +end: + return item; +} + +OpenAPI_nas_security_mode_t *OpenAPI_nas_security_mode_parseFromJSON(cJSON *nas_security_modeJSON) +{ + OpenAPI_nas_security_mode_t *nas_security_mode_local_var = NULL; + cJSON *integrity_algorithm = cJSON_GetObjectItemCaseSensitive(nas_security_modeJSON, "integrityAlgorithm"); + if (!integrity_algorithm) { + ogs_error("OpenAPI_nas_security_mode_parseFromJSON() failed [integrity_algorithm]"); + goto end; + } + + OpenAPI_integrity_algorithm_e integrity_algorithmVariable; + + if (!cJSON_IsString(integrity_algorithm)) { + ogs_error("OpenAPI_nas_security_mode_parseFromJSON() failed [integrity_algorithm]"); + goto end; + } + integrity_algorithmVariable = OpenAPI_integrity_algorithm_FromString(integrity_algorithm->valuestring); + + cJSON *ciphering_algorithm = cJSON_GetObjectItemCaseSensitive(nas_security_modeJSON, "cipheringAlgorithm"); + if (!ciphering_algorithm) { + ogs_error("OpenAPI_nas_security_mode_parseFromJSON() failed [ciphering_algorithm]"); + goto end; + } + + OpenAPI_ciphering_algorithm_e ciphering_algorithmVariable; + + if (!cJSON_IsString(ciphering_algorithm)) { + ogs_error("OpenAPI_nas_security_mode_parseFromJSON() failed [ciphering_algorithm]"); + goto end; + } + ciphering_algorithmVariable = OpenAPI_ciphering_algorithm_FromString(ciphering_algorithm->valuestring); + + nas_security_mode_local_var = OpenAPI_nas_security_mode_create ( + integrity_algorithmVariable, + ciphering_algorithmVariable + ); + + return nas_security_mode_local_var; +end: + return NULL; +} + +OpenAPI_nas_security_mode_t *OpenAPI_nas_security_mode_copy(OpenAPI_nas_security_mode_t *dst, OpenAPI_nas_security_mode_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nas_security_mode_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nas_security_mode_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nas_security_mode_free(dst); + dst = OpenAPI_nas_security_mode_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nas_security_mode.h b/lib/sbi/openapi/model/nas_security_mode.h new file mode 100644 index 000000000..3cdb86337 --- /dev/null +++ b/lib/sbi/openapi/model/nas_security_mode.h @@ -0,0 +1,42 @@ +/* + * nas_security_mode.h + * + * + */ + +#ifndef _OpenAPI_nas_security_mode_H_ +#define _OpenAPI_nas_security_mode_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ciphering_algorithm.h" +#include "integrity_algorithm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nas_security_mode_s OpenAPI_nas_security_mode_t; +typedef struct OpenAPI_nas_security_mode_s { + OpenAPI_integrity_algorithm_e integrity_algorithm; + OpenAPI_ciphering_algorithm_e ciphering_algorithm; +} OpenAPI_nas_security_mode_t; + +OpenAPI_nas_security_mode_t *OpenAPI_nas_security_mode_create( + OpenAPI_integrity_algorithm_e integrity_algorithm, + OpenAPI_ciphering_algorithm_e ciphering_algorithm + ); +void OpenAPI_nas_security_mode_free(OpenAPI_nas_security_mode_t *nas_security_mode); +OpenAPI_nas_security_mode_t *OpenAPI_nas_security_mode_parseFromJSON(cJSON *nas_security_modeJSON); +cJSON *OpenAPI_nas_security_mode_convertToJSON(OpenAPI_nas_security_mode_t *nas_security_mode); +OpenAPI_nas_security_mode_t *OpenAPI_nas_security_mode_copy(OpenAPI_nas_security_mode_t *dst, OpenAPI_nas_security_mode_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nas_security_mode_H_ */ + diff --git a/lib/sbi/openapi/model/ncgi.c b/lib/sbi/openapi/model/ncgi.c index 21cae53e0..90406daeb 100644 --- a/lib/sbi/openapi/model/ncgi.c +++ b/lib/sbi/openapi/model/ncgi.c @@ -123,3 +123,37 @@ end: return NULL; } +OpenAPI_ncgi_t *OpenAPI_ncgi_copy(OpenAPI_ncgi_t *dst, OpenAPI_ncgi_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ncgi_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ncgi_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ncgi_free(dst); + dst = OpenAPI_ncgi_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ncgi.h b/lib/sbi/openapi/model/ncgi.h index f06f74ee0..34448c67e 100644 --- a/lib/sbi/openapi/model/ncgi.h +++ b/lib/sbi/openapi/model/ncgi.h @@ -33,6 +33,7 @@ OpenAPI_ncgi_t *OpenAPI_ncgi_create( void OpenAPI_ncgi_free(OpenAPI_ncgi_t *ncgi); OpenAPI_ncgi_t *OpenAPI_ncgi_parseFromJSON(cJSON *ncgiJSON); cJSON *OpenAPI_ncgi_convertToJSON(OpenAPI_ncgi_t *ncgi); +OpenAPI_ncgi_t *OpenAPI_ncgi_copy(OpenAPI_ncgi_t *dst, OpenAPI_ncgi_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nef_info.c b/lib/sbi/openapi/model/nef_info.c index eeee21876..d2f8609ee 100644 --- a/lib/sbi/openapi/model/nef_info.c +++ b/lib/sbi/openapi/model/nef_info.c @@ -117,3 +117,37 @@ end: return NULL; } +OpenAPI_nef_info_t *OpenAPI_nef_info_copy(OpenAPI_nef_info_t *dst, OpenAPI_nef_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nef_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nef_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_nef_info_free(dst); + dst = OpenAPI_nef_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nef_info.h b/lib/sbi/openapi/model/nef_info.h index 08c687a87..da1bb61f4 100644 --- a/lib/sbi/openapi/model/nef_info.h +++ b/lib/sbi/openapi/model/nef_info.h @@ -34,6 +34,7 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_create( void OpenAPI_nef_info_free(OpenAPI_nef_info_t *nef_info); OpenAPI_nef_info_t *OpenAPI_nef_info_parseFromJSON(cJSON *nef_infoJSON); cJSON *OpenAPI_nef_info_convertToJSON(OpenAPI_nef_info_t *nef_info); +OpenAPI_nef_info_t *OpenAPI_nef_info_copy(OpenAPI_nef_info_t *dst, OpenAPI_nef_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/network_area_info.c b/lib/sbi/openapi/model/network_area_info.c index 09696b72b..becca5439 100644 --- a/lib/sbi/openapi/model/network_area_info.c +++ b/lib/sbi/openapi/model/network_area_info.c @@ -249,3 +249,37 @@ end: return NULL; } +OpenAPI_network_area_info_t *OpenAPI_network_area_info_copy(OpenAPI_network_area_info_t *dst, OpenAPI_network_area_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_network_area_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_network_area_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_network_area_info_free(dst); + dst = OpenAPI_network_area_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/network_area_info.h b/lib/sbi/openapi/model/network_area_info.h index 3c68afacc..c860dd78b 100644 --- a/lib/sbi/openapi/model/network_area_info.h +++ b/lib/sbi/openapi/model/network_area_info.h @@ -38,6 +38,7 @@ OpenAPI_network_area_info_t *OpenAPI_network_area_info_create( void OpenAPI_network_area_info_free(OpenAPI_network_area_info_t *network_area_info); OpenAPI_network_area_info_t *OpenAPI_network_area_info_parseFromJSON(cJSON *network_area_infoJSON); cJSON *OpenAPI_network_area_info_convertToJSON(OpenAPI_network_area_info_t *network_area_info); +OpenAPI_network_area_info_t *OpenAPI_network_area_info_copy(OpenAPI_network_area_info_t *dst, OpenAPI_network_area_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/network_area_info_2.c b/lib/sbi/openapi/model/network_area_info_2.c index d7b2e2aaf..cb744a91e 100644 --- a/lib/sbi/openapi/model/network_area_info_2.c +++ b/lib/sbi/openapi/model/network_area_info_2.c @@ -249,3 +249,37 @@ end: return NULL; } +OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_copy(OpenAPI_network_area_info_2_t *dst, OpenAPI_network_area_info_2_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_network_area_info_2_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_network_area_info_2_free(dst); + dst = OpenAPI_network_area_info_2_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/network_area_info_2.h b/lib/sbi/openapi/model/network_area_info_2.h index 210ccc3f5..1304ae0cd 100644 --- a/lib/sbi/openapi/model/network_area_info_2.h +++ b/lib/sbi/openapi/model/network_area_info_2.h @@ -38,6 +38,7 @@ OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_create( void OpenAPI_network_area_info_2_free(OpenAPI_network_area_info_2_t *network_area_info_2); OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_parseFromJSON(cJSON *network_area_info_2JSON); cJSON *OpenAPI_network_area_info_2_convertToJSON(OpenAPI_network_area_info_2_t *network_area_info_2); +OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_copy(OpenAPI_network_area_info_2_t *dst, OpenAPI_network_area_info_2_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/network_node_diameter_address.c b/lib/sbi/openapi/model/network_node_diameter_address.c index 5b1ed61df..ca43e4ffd 100644 --- a/lib/sbi/openapi/model/network_node_diameter_address.c +++ b/lib/sbi/openapi/model/network_node_diameter_address.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_network_node_diameter_address_t *OpenAPI_network_node_diameter_address_copy(OpenAPI_network_node_diameter_address_t *dst, OpenAPI_network_node_diameter_address_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_network_node_diameter_address_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_network_node_diameter_address_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_network_node_diameter_address_free(dst); + dst = OpenAPI_network_node_diameter_address_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/network_node_diameter_address.h b/lib/sbi/openapi/model/network_node_diameter_address.h index 444960e99..e80f35879 100644 --- a/lib/sbi/openapi/model/network_node_diameter_address.h +++ b/lib/sbi/openapi/model/network_node_diameter_address.h @@ -30,6 +30,7 @@ OpenAPI_network_node_diameter_address_t *OpenAPI_network_node_diameter_address_c void OpenAPI_network_node_diameter_address_free(OpenAPI_network_node_diameter_address_t *network_node_diameter_address); OpenAPI_network_node_diameter_address_t *OpenAPI_network_node_diameter_address_parseFromJSON(cJSON *network_node_diameter_addressJSON); cJSON *OpenAPI_network_node_diameter_address_convertToJSON(OpenAPI_network_node_diameter_address_t *network_node_diameter_address); +OpenAPI_network_node_diameter_address_t *OpenAPI_network_node_diameter_address_copy(OpenAPI_network_node_diameter_address_t *dst, OpenAPI_network_node_diameter_address_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/network_slice_cond.c b/lib/sbi/openapi/model/network_slice_cond.c index 2d9c65bee..ac68c5dfb 100644 --- a/lib/sbi/openapi/model/network_slice_cond.c +++ b/lib/sbi/openapi/model/network_slice_cond.c @@ -147,3 +147,37 @@ end: return NULL; } +OpenAPI_network_slice_cond_t *OpenAPI_network_slice_cond_copy(OpenAPI_network_slice_cond_t *dst, OpenAPI_network_slice_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_network_slice_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_network_slice_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_network_slice_cond_free(dst); + dst = OpenAPI_network_slice_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/network_slice_cond.h b/lib/sbi/openapi/model/network_slice_cond.h index 65eb465bc..c008ad0e7 100644 --- a/lib/sbi/openapi/model/network_slice_cond.h +++ b/lib/sbi/openapi/model/network_slice_cond.h @@ -31,6 +31,7 @@ OpenAPI_network_slice_cond_t *OpenAPI_network_slice_cond_create( void OpenAPI_network_slice_cond_free(OpenAPI_network_slice_cond_t *network_slice_cond); OpenAPI_network_slice_cond_t *OpenAPI_network_slice_cond_parseFromJSON(cJSON *network_slice_condJSON); cJSON *OpenAPI_network_slice_cond_convertToJSON(OpenAPI_network_slice_cond_t *network_slice_cond); +OpenAPI_network_slice_cond_t *OpenAPI_network_slice_cond_copy(OpenAPI_network_slice_cond_t *dst, OpenAPI_network_slice_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_group_cond.c b/lib/sbi/openapi/model/nf_group_cond.c index 9c7cc1b47..303f262b6 100644 --- a/lib/sbi/openapi/model/nf_group_cond.c +++ b/lib/sbi/openapi/model/nf_group_cond.c @@ -123,3 +123,37 @@ end: return NULL; } +OpenAPI_nf_group_cond_t *OpenAPI_nf_group_cond_copy(OpenAPI_nf_group_cond_t *dst, OpenAPI_nf_group_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_group_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_group_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_group_cond_free(dst); + dst = OpenAPI_nf_group_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_group_cond.h b/lib/sbi/openapi/model/nf_group_cond.h index 7fff76ce0..d1e6504d4 100644 --- a/lib/sbi/openapi/model/nf_group_cond.h +++ b/lib/sbi/openapi/model/nf_group_cond.h @@ -35,6 +35,7 @@ OpenAPI_nf_group_cond_t *OpenAPI_nf_group_cond_create( void OpenAPI_nf_group_cond_free(OpenAPI_nf_group_cond_t *nf_group_cond); OpenAPI_nf_group_cond_t *OpenAPI_nf_group_cond_parseFromJSON(cJSON *nf_group_condJSON); cJSON *OpenAPI_nf_group_cond_convertToJSON(OpenAPI_nf_group_cond_t *nf_group_cond); +OpenAPI_nf_group_cond_t *OpenAPI_nf_group_cond_copy(OpenAPI_nf_group_cond_t *dst, OpenAPI_nf_group_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_info.c b/lib/sbi/openapi/model/nf_info.c index e2d1e0a94..6e0e4d130 100644 --- a/lib/sbi/openapi/model/nf_info.c +++ b/lib/sbi/openapi/model/nf_info.c @@ -70,3 +70,37 @@ end: return NULL; } +OpenAPI_nf_info_t *OpenAPI_nf_info_copy(OpenAPI_nf_info_t *dst, OpenAPI_nf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_info_free(dst); + dst = OpenAPI_nf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_info.h b/lib/sbi/openapi/model/nf_info.h index 5675cddf0..0bbdb9565 100644 --- a/lib/sbi/openapi/model/nf_info.h +++ b/lib/sbi/openapi/model/nf_info.h @@ -29,6 +29,7 @@ OpenAPI_nf_info_t *OpenAPI_nf_info_create( void OpenAPI_nf_info_free(OpenAPI_nf_info_t *nf_info); OpenAPI_nf_info_t *OpenAPI_nf_info_parseFromJSON(cJSON *nf_infoJSON); cJSON *OpenAPI_nf_info_convertToJSON(OpenAPI_nf_info_t *nf_info); +OpenAPI_nf_info_t *OpenAPI_nf_info_copy(OpenAPI_nf_info_t *dst, OpenAPI_nf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_instance_id_cond.c b/lib/sbi/openapi/model/nf_instance_id_cond.c index f6a9ccc15..71410bd06 100644 --- a/lib/sbi/openapi/model/nf_instance_id_cond.c +++ b/lib/sbi/openapi/model/nf_instance_id_cond.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_nf_instance_id_cond_t *OpenAPI_nf_instance_id_cond_copy(OpenAPI_nf_instance_id_cond_t *dst, OpenAPI_nf_instance_id_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_instance_id_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_instance_id_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_instance_id_cond_free(dst); + dst = OpenAPI_nf_instance_id_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_instance_id_cond.h b/lib/sbi/openapi/model/nf_instance_id_cond.h index dac4f8cb4..e83cda0d8 100644 --- a/lib/sbi/openapi/model/nf_instance_id_cond.h +++ b/lib/sbi/openapi/model/nf_instance_id_cond.h @@ -28,6 +28,7 @@ OpenAPI_nf_instance_id_cond_t *OpenAPI_nf_instance_id_cond_create( void OpenAPI_nf_instance_id_cond_free(OpenAPI_nf_instance_id_cond_t *nf_instance_id_cond); OpenAPI_nf_instance_id_cond_t *OpenAPI_nf_instance_id_cond_parseFromJSON(cJSON *nf_instance_id_condJSON); cJSON *OpenAPI_nf_instance_id_cond_convertToJSON(OpenAPI_nf_instance_id_cond_t *nf_instance_id_cond); +OpenAPI_nf_instance_id_cond_t *OpenAPI_nf_instance_id_cond_copy(OpenAPI_nf_instance_id_cond_t *dst, OpenAPI_nf_instance_id_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_profile.c b/lib/sbi/openapi/model/nf_profile.c index 9d653af05..3b12c965f 100644 --- a/lib/sbi/openapi/model/nf_profile.c +++ b/lib/sbi/openapi/model/nf_profile.c @@ -1028,7 +1028,7 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->nf_service_persistence >= 0) { + if (nf_profile->nf_service_persistence) { if (cJSON_AddBoolToObject(item, "nfServicePersistence", nf_profile->nf_service_persistence) == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_service_persistence]"); goto end; @@ -1055,14 +1055,14 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->nf_profile_changes_support_ind >= 0) { + if (nf_profile->nf_profile_changes_support_ind) { if (cJSON_AddBoolToObject(item, "nfProfileChangesSupportInd", nf_profile->nf_profile_changes_support_ind) == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_profile_changes_support_ind]"); goto end; } } - if (nf_profile->nf_profile_changes_ind >= 0) { + if (nf_profile->nf_profile_changes_ind) { if (cJSON_AddBoolToObject(item, "nfProfileChangesInd", nf_profile->nf_profile_changes_ind) == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_profile_changes_ind]"); goto end; @@ -1147,14 +1147,14 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->lc_h_support_ind >= 0) { + if (nf_profile->lc_h_support_ind) { if (cJSON_AddBoolToObject(item, "lcHSupportInd", nf_profile->lc_h_support_ind) == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [lc_h_support_ind]"); goto end; } } - if (nf_profile->olc_h_support_ind >= 0) { + if (nf_profile->olc_h_support_ind) { if (cJSON_AddBoolToObject(item, "olcHSupportInd", nf_profile->olc_h_support_ind) == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [olc_h_support_ind]"); goto end; @@ -2150,3 +2150,37 @@ end: return NULL; } +OpenAPI_nf_profile_t *OpenAPI_nf_profile_copy(OpenAPI_nf_profile_t *dst, OpenAPI_nf_profile_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_profile_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_profile_free(dst); + dst = OpenAPI_nf_profile_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_profile.h b/lib/sbi/openapi/model/nf_profile.h index dd72e9653..008fa1b8b 100644 --- a/lib/sbi/openapi/model/nf_profile.h +++ b/lib/sbi/openapi/model/nf_profile.h @@ -176,6 +176,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile); OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON); cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile); +OpenAPI_nf_profile_t *OpenAPI_nf_profile_copy(OpenAPI_nf_profile_t *dst, OpenAPI_nf_profile_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_service.c b/lib/sbi/openapi/model/nf_service.c index 3af01d0bd..838c9fa84 100644 --- a/lib/sbi/openapi/model/nf_service.c +++ b/lib/sbi/openapi/model/nf_service.c @@ -490,7 +490,7 @@ cJSON *OpenAPI_nf_service_convertToJSON(OpenAPI_nf_service_t *nf_service) } } - if (nf_service->oauth2_required >= 0) { + if (nf_service->oauth2_required) { if (cJSON_AddBoolToObject(item, "oauth2Required", nf_service->oauth2_required) == NULL) { ogs_error("OpenAPI_nf_service_convertToJSON() failed [oauth2_required]"); goto end; @@ -964,3 +964,37 @@ end: return NULL; } +OpenAPI_nf_service_t *OpenAPI_nf_service_copy(OpenAPI_nf_service_t *dst, OpenAPI_nf_service_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_service_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_service_free(dst); + dst = OpenAPI_nf_service_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_service.h b/lib/sbi/openapi/model/nf_service.h index d60248fc3..d31bd0c66 100644 --- a/lib/sbi/openapi/model/nf_service.h +++ b/lib/sbi/openapi/model/nf_service.h @@ -94,6 +94,7 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_create( void OpenAPI_nf_service_free(OpenAPI_nf_service_t *nf_service); OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON); cJSON *OpenAPI_nf_service_convertToJSON(OpenAPI_nf_service_t *nf_service); +OpenAPI_nf_service_t *OpenAPI_nf_service_copy(OpenAPI_nf_service_t *dst, OpenAPI_nf_service_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_service_set_cond.c b/lib/sbi/openapi/model/nf_service_set_cond.c index 53873ac1b..4ff3c9748 100644 --- a/lib/sbi/openapi/model/nf_service_set_cond.c +++ b/lib/sbi/openapi/model/nf_service_set_cond.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_copy(OpenAPI_nf_service_set_cond_t *dst, OpenAPI_nf_service_set_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_service_set_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_service_set_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_service_set_cond_free(dst); + dst = OpenAPI_nf_service_set_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_service_set_cond.h b/lib/sbi/openapi/model/nf_service_set_cond.h index 102460d01..7dab96c72 100644 --- a/lib/sbi/openapi/model/nf_service_set_cond.h +++ b/lib/sbi/openapi/model/nf_service_set_cond.h @@ -28,6 +28,7 @@ OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_create( void OpenAPI_nf_service_set_cond_free(OpenAPI_nf_service_set_cond_t *nf_service_set_cond); OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_parseFromJSON(cJSON *nf_service_set_condJSON); cJSON *OpenAPI_nf_service_set_cond_convertToJSON(OpenAPI_nf_service_set_cond_t *nf_service_set_cond); +OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_copy(OpenAPI_nf_service_set_cond_t *dst, OpenAPI_nf_service_set_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_service_version.c b/lib/sbi/openapi/model/nf_service_version.c index 90f0f021b..bbc8faa81 100644 --- a/lib/sbi/openapi/model/nf_service_version.c +++ b/lib/sbi/openapi/model/nf_service_version.c @@ -119,3 +119,37 @@ end: return NULL; } +OpenAPI_nf_service_version_t *OpenAPI_nf_service_version_copy(OpenAPI_nf_service_version_t *dst, OpenAPI_nf_service_version_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_service_version_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_service_version_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_service_version_free(dst); + dst = OpenAPI_nf_service_version_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_service_version.h b/lib/sbi/openapi/model/nf_service_version.h index 3720db9b0..6353b872d 100644 --- a/lib/sbi/openapi/model/nf_service_version.h +++ b/lib/sbi/openapi/model/nf_service_version.h @@ -32,6 +32,7 @@ OpenAPI_nf_service_version_t *OpenAPI_nf_service_version_create( void OpenAPI_nf_service_version_free(OpenAPI_nf_service_version_t *nf_service_version); OpenAPI_nf_service_version_t *OpenAPI_nf_service_version_parseFromJSON(cJSON *nf_service_versionJSON); cJSON *OpenAPI_nf_service_version_convertToJSON(OpenAPI_nf_service_version_t *nf_service_version); +OpenAPI_nf_service_version_t *OpenAPI_nf_service_version_copy(OpenAPI_nf_service_version_t *dst, OpenAPI_nf_service_version_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_set_cond.c b/lib/sbi/openapi/model/nf_set_cond.c index c4276e640..f7bfd8e5a 100644 --- a/lib/sbi/openapi/model/nf_set_cond.c +++ b/lib/sbi/openapi/model/nf_set_cond.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_nf_set_cond_t *OpenAPI_nf_set_cond_copy(OpenAPI_nf_set_cond_t *dst, OpenAPI_nf_set_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_set_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_set_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_set_cond_free(dst); + dst = OpenAPI_nf_set_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_set_cond.h b/lib/sbi/openapi/model/nf_set_cond.h index 30b6e30fb..4c3ffdd44 100644 --- a/lib/sbi/openapi/model/nf_set_cond.h +++ b/lib/sbi/openapi/model/nf_set_cond.h @@ -28,6 +28,7 @@ OpenAPI_nf_set_cond_t *OpenAPI_nf_set_cond_create( void OpenAPI_nf_set_cond_free(OpenAPI_nf_set_cond_t *nf_set_cond); OpenAPI_nf_set_cond_t *OpenAPI_nf_set_cond_parseFromJSON(cJSON *nf_set_condJSON); cJSON *OpenAPI_nf_set_cond_convertToJSON(OpenAPI_nf_set_cond_t *nf_set_cond); +OpenAPI_nf_set_cond_t *OpenAPI_nf_set_cond_copy(OpenAPI_nf_set_cond_t *dst, OpenAPI_nf_set_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nf_type_cond.c b/lib/sbi/openapi/model/nf_type_cond.c index 6f1cb8cad..1cb2b9e8d 100644 --- a/lib/sbi/openapi/model/nf_type_cond.c +++ b/lib/sbi/openapi/model/nf_type_cond.c @@ -75,3 +75,37 @@ end: return NULL; } +OpenAPI_nf_type_cond_t *OpenAPI_nf_type_cond_copy(OpenAPI_nf_type_cond_t *dst, OpenAPI_nf_type_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_type_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_type_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nf_type_cond_free(dst); + dst = OpenAPI_nf_type_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_type_cond.h b/lib/sbi/openapi/model/nf_type_cond.h index 743b08311..a5d49938e 100644 --- a/lib/sbi/openapi/model/nf_type_cond.h +++ b/lib/sbi/openapi/model/nf_type_cond.h @@ -29,6 +29,7 @@ OpenAPI_nf_type_cond_t *OpenAPI_nf_type_cond_create( void OpenAPI_nf_type_cond_free(OpenAPI_nf_type_cond_t *nf_type_cond); OpenAPI_nf_type_cond_t *OpenAPI_nf_type_cond_parseFromJSON(cJSON *nf_type_condJSON); cJSON *OpenAPI_nf_type_cond_convertToJSON(OpenAPI_nf_type_cond_t *nf_type_cond); +OpenAPI_nf_type_cond_t *OpenAPI_nf_type_cond_copy(OpenAPI_nf_type_cond_t *dst, OpenAPI_nf_type_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ng_ap_cause.c b/lib/sbi/openapi/model/ng_ap_cause.c new file mode 100644 index 000000000..a981ce8b3 --- /dev/null +++ b/lib/sbi/openapi/model/ng_ap_cause.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "ng_ap_cause.h" + +OpenAPI_ng_ap_cause_t *OpenAPI_ng_ap_cause_create( + int group, + int value + ) +{ + OpenAPI_ng_ap_cause_t *ng_ap_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_ng_ap_cause_t)); + if (!ng_ap_cause_local_var) { + return NULL; + } + ng_ap_cause_local_var->group = group; + ng_ap_cause_local_var->value = value; + + return ng_ap_cause_local_var; +} + +void OpenAPI_ng_ap_cause_free(OpenAPI_ng_ap_cause_t *ng_ap_cause) +{ + if (NULL == ng_ap_cause) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ng_ap_cause); +} + +cJSON *OpenAPI_ng_ap_cause_convertToJSON(OpenAPI_ng_ap_cause_t *ng_ap_cause) +{ + cJSON *item = NULL; + + if (ng_ap_cause == NULL) { + ogs_error("OpenAPI_ng_ap_cause_convertToJSON() failed [NgApCause]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ng_ap_cause->group) { + ogs_error("OpenAPI_ng_ap_cause_convertToJSON() failed [group]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "group", ng_ap_cause->group) == NULL) { + ogs_error("OpenAPI_ng_ap_cause_convertToJSON() failed [group]"); + goto end; + } + + if (!ng_ap_cause->value) { + ogs_error("OpenAPI_ng_ap_cause_convertToJSON() failed [value]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "value", ng_ap_cause->value) == NULL) { + ogs_error("OpenAPI_ng_ap_cause_convertToJSON() failed [value]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ng_ap_cause_t *OpenAPI_ng_ap_cause_parseFromJSON(cJSON *ng_ap_causeJSON) +{ + OpenAPI_ng_ap_cause_t *ng_ap_cause_local_var = NULL; + cJSON *group = cJSON_GetObjectItemCaseSensitive(ng_ap_causeJSON, "group"); + if (!group) { + ogs_error("OpenAPI_ng_ap_cause_parseFromJSON() failed [group]"); + goto end; + } + + + if (!cJSON_IsNumber(group)) { + ogs_error("OpenAPI_ng_ap_cause_parseFromJSON() failed [group]"); + goto end; + } + + cJSON *value = cJSON_GetObjectItemCaseSensitive(ng_ap_causeJSON, "value"); + if (!value) { + ogs_error("OpenAPI_ng_ap_cause_parseFromJSON() failed [value]"); + goto end; + } + + + if (!cJSON_IsNumber(value)) { + ogs_error("OpenAPI_ng_ap_cause_parseFromJSON() failed [value]"); + goto end; + } + + ng_ap_cause_local_var = OpenAPI_ng_ap_cause_create ( + group->valuedouble, + value->valuedouble + ); + + return ng_ap_cause_local_var; +end: + return NULL; +} + +OpenAPI_ng_ap_cause_t *OpenAPI_ng_ap_cause_copy(OpenAPI_ng_ap_cause_t *dst, OpenAPI_ng_ap_cause_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ng_ap_cause_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ng_ap_cause_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ng_ap_cause_free(dst); + dst = OpenAPI_ng_ap_cause_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ng_ap_cause.h b/lib/sbi/openapi/model/ng_ap_cause.h new file mode 100644 index 000000000..303956fd4 --- /dev/null +++ b/lib/sbi/openapi/model/ng_ap_cause.h @@ -0,0 +1,40 @@ +/* + * ng_ap_cause.h + * + * + */ + +#ifndef _OpenAPI_ng_ap_cause_H_ +#define _OpenAPI_ng_ap_cause_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ng_ap_cause_s OpenAPI_ng_ap_cause_t; +typedef struct OpenAPI_ng_ap_cause_s { + int group; + int value; +} OpenAPI_ng_ap_cause_t; + +OpenAPI_ng_ap_cause_t *OpenAPI_ng_ap_cause_create( + int group, + int value + ); +void OpenAPI_ng_ap_cause_free(OpenAPI_ng_ap_cause_t *ng_ap_cause); +OpenAPI_ng_ap_cause_t *OpenAPI_ng_ap_cause_parseFromJSON(cJSON *ng_ap_causeJSON); +cJSON *OpenAPI_ng_ap_cause_convertToJSON(OpenAPI_ng_ap_cause_t *ng_ap_cause); +OpenAPI_ng_ap_cause_t *OpenAPI_ng_ap_cause_copy(OpenAPI_ng_ap_cause_t *dst, OpenAPI_ng_ap_cause_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ng_ap_cause_H_ */ + diff --git a/lib/sbi/openapi/model/ng_ksi.c b/lib/sbi/openapi/model/ng_ksi.c new file mode 100644 index 000000000..141f8d9b4 --- /dev/null +++ b/lib/sbi/openapi/model/ng_ksi.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "ng_ksi.h" + +OpenAPI_ng_ksi_t *OpenAPI_ng_ksi_create( + OpenAPI_sc_type_e tsc, + int ksi + ) +{ + OpenAPI_ng_ksi_t *ng_ksi_local_var = OpenAPI_malloc(sizeof(OpenAPI_ng_ksi_t)); + if (!ng_ksi_local_var) { + return NULL; + } + ng_ksi_local_var->tsc = tsc; + ng_ksi_local_var->ksi = ksi; + + return ng_ksi_local_var; +} + +void OpenAPI_ng_ksi_free(OpenAPI_ng_ksi_t *ng_ksi) +{ + if (NULL == ng_ksi) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ng_ksi); +} + +cJSON *OpenAPI_ng_ksi_convertToJSON(OpenAPI_ng_ksi_t *ng_ksi) +{ + cJSON *item = NULL; + + if (ng_ksi == NULL) { + ogs_error("OpenAPI_ng_ksi_convertToJSON() failed [NgKsi]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ng_ksi->tsc) { + ogs_error("OpenAPI_ng_ksi_convertToJSON() failed [tsc]"); + goto end; + } + if (cJSON_AddStringToObject(item, "tsc", OpenAPI_sc_type_ToString(ng_ksi->tsc)) == NULL) { + ogs_error("OpenAPI_ng_ksi_convertToJSON() failed [tsc]"); + goto end; + } + + if (!ng_ksi->ksi) { + ogs_error("OpenAPI_ng_ksi_convertToJSON() failed [ksi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "ksi", ng_ksi->ksi) == NULL) { + ogs_error("OpenAPI_ng_ksi_convertToJSON() failed [ksi]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ng_ksi_t *OpenAPI_ng_ksi_parseFromJSON(cJSON *ng_ksiJSON) +{ + OpenAPI_ng_ksi_t *ng_ksi_local_var = NULL; + cJSON *tsc = cJSON_GetObjectItemCaseSensitive(ng_ksiJSON, "tsc"); + if (!tsc) { + ogs_error("OpenAPI_ng_ksi_parseFromJSON() failed [tsc]"); + goto end; + } + + OpenAPI_sc_type_e tscVariable; + + if (!cJSON_IsString(tsc)) { + ogs_error("OpenAPI_ng_ksi_parseFromJSON() failed [tsc]"); + goto end; + } + tscVariable = OpenAPI_sc_type_FromString(tsc->valuestring); + + cJSON *ksi = cJSON_GetObjectItemCaseSensitive(ng_ksiJSON, "ksi"); + if (!ksi) { + ogs_error("OpenAPI_ng_ksi_parseFromJSON() failed [ksi]"); + goto end; + } + + + if (!cJSON_IsNumber(ksi)) { + ogs_error("OpenAPI_ng_ksi_parseFromJSON() failed [ksi]"); + goto end; + } + + ng_ksi_local_var = OpenAPI_ng_ksi_create ( + tscVariable, + ksi->valuedouble + ); + + return ng_ksi_local_var; +end: + return NULL; +} + +OpenAPI_ng_ksi_t *OpenAPI_ng_ksi_copy(OpenAPI_ng_ksi_t *dst, OpenAPI_ng_ksi_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ng_ksi_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ng_ksi_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ng_ksi_free(dst); + dst = OpenAPI_ng_ksi_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ng_ksi.h b/lib/sbi/openapi/model/ng_ksi.h new file mode 100644 index 000000000..625642dc8 --- /dev/null +++ b/lib/sbi/openapi/model/ng_ksi.h @@ -0,0 +1,41 @@ +/* + * ng_ksi.h + * + * + */ + +#ifndef _OpenAPI_ng_ksi_H_ +#define _OpenAPI_ng_ksi_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "sc_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ng_ksi_s OpenAPI_ng_ksi_t; +typedef struct OpenAPI_ng_ksi_s { + OpenAPI_sc_type_e tsc; + int ksi; +} OpenAPI_ng_ksi_t; + +OpenAPI_ng_ksi_t *OpenAPI_ng_ksi_create( + OpenAPI_sc_type_e tsc, + int ksi + ); +void OpenAPI_ng_ksi_free(OpenAPI_ng_ksi_t *ng_ksi); +OpenAPI_ng_ksi_t *OpenAPI_ng_ksi_parseFromJSON(cJSON *ng_ksiJSON); +cJSON *OpenAPI_ng_ksi_convertToJSON(OpenAPI_ng_ksi_t *ng_ksi); +OpenAPI_ng_ksi_t *OpenAPI_ng_ksi_copy(OpenAPI_ng_ksi_t *dst, OpenAPI_ng_ksi_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ng_ksi_H_ */ + diff --git a/lib/sbi/openapi/model/ng_ran_target_id.c b/lib/sbi/openapi/model/ng_ran_target_id.c new file mode 100644 index 000000000..06a0e32eb --- /dev/null +++ b/lib/sbi/openapi/model/ng_ran_target_id.c @@ -0,0 +1,143 @@ + +#include +#include +#include +#include "ng_ran_target_id.h" + +OpenAPI_ng_ran_target_id_t *OpenAPI_ng_ran_target_id_create( + OpenAPI_global_ran_node_id_t *ran_node_id, + OpenAPI_tai_t *tai + ) +{ + OpenAPI_ng_ran_target_id_t *ng_ran_target_id_local_var = OpenAPI_malloc(sizeof(OpenAPI_ng_ran_target_id_t)); + if (!ng_ran_target_id_local_var) { + return NULL; + } + ng_ran_target_id_local_var->ran_node_id = ran_node_id; + ng_ran_target_id_local_var->tai = tai; + + return ng_ran_target_id_local_var; +} + +void OpenAPI_ng_ran_target_id_free(OpenAPI_ng_ran_target_id_t *ng_ran_target_id) +{ + if (NULL == ng_ran_target_id) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_global_ran_node_id_free(ng_ran_target_id->ran_node_id); + OpenAPI_tai_free(ng_ran_target_id->tai); + ogs_free(ng_ran_target_id); +} + +cJSON *OpenAPI_ng_ran_target_id_convertToJSON(OpenAPI_ng_ran_target_id_t *ng_ran_target_id) +{ + cJSON *item = NULL; + + if (ng_ran_target_id == NULL) { + ogs_error("OpenAPI_ng_ran_target_id_convertToJSON() failed [NgRanTargetId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ng_ran_target_id->ran_node_id) { + ogs_error("OpenAPI_ng_ran_target_id_convertToJSON() failed [ran_node_id]"); + goto end; + } + cJSON *ran_node_id_local_JSON = OpenAPI_global_ran_node_id_convertToJSON(ng_ran_target_id->ran_node_id); + if (ran_node_id_local_JSON == NULL) { + ogs_error("OpenAPI_ng_ran_target_id_convertToJSON() failed [ran_node_id]"); + goto end; + } + cJSON_AddItemToObject(item, "ranNodeId", ran_node_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ng_ran_target_id_convertToJSON() failed [ran_node_id]"); + goto end; + } + + if (!ng_ran_target_id->tai) { + ogs_error("OpenAPI_ng_ran_target_id_convertToJSON() failed [tai]"); + goto end; + } + cJSON *tai_local_JSON = OpenAPI_tai_convertToJSON(ng_ran_target_id->tai); + if (tai_local_JSON == NULL) { + ogs_error("OpenAPI_ng_ran_target_id_convertToJSON() failed [tai]"); + goto end; + } + cJSON_AddItemToObject(item, "tai", tai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ng_ran_target_id_convertToJSON() failed [tai]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ng_ran_target_id_t *OpenAPI_ng_ran_target_id_parseFromJSON(cJSON *ng_ran_target_idJSON) +{ + OpenAPI_ng_ran_target_id_t *ng_ran_target_id_local_var = NULL; + cJSON *ran_node_id = cJSON_GetObjectItemCaseSensitive(ng_ran_target_idJSON, "ranNodeId"); + if (!ran_node_id) { + ogs_error("OpenAPI_ng_ran_target_id_parseFromJSON() failed [ran_node_id]"); + goto end; + } + + OpenAPI_global_ran_node_id_t *ran_node_id_local_nonprim = NULL; + + ran_node_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(ran_node_id); + + cJSON *tai = cJSON_GetObjectItemCaseSensitive(ng_ran_target_idJSON, "tai"); + if (!tai) { + ogs_error("OpenAPI_ng_ran_target_id_parseFromJSON() failed [tai]"); + goto end; + } + + OpenAPI_tai_t *tai_local_nonprim = NULL; + + tai_local_nonprim = OpenAPI_tai_parseFromJSON(tai); + + ng_ran_target_id_local_var = OpenAPI_ng_ran_target_id_create ( + ran_node_id_local_nonprim, + tai_local_nonprim + ); + + return ng_ran_target_id_local_var; +end: + return NULL; +} + +OpenAPI_ng_ran_target_id_t *OpenAPI_ng_ran_target_id_copy(OpenAPI_ng_ran_target_id_t *dst, OpenAPI_ng_ran_target_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ng_ran_target_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ng_ran_target_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ng_ran_target_id_free(dst); + dst = OpenAPI_ng_ran_target_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ng_ran_target_id.h b/lib/sbi/openapi/model/ng_ran_target_id.h new file mode 100644 index 000000000..b457c1c0b --- /dev/null +++ b/lib/sbi/openapi/model/ng_ran_target_id.h @@ -0,0 +1,42 @@ +/* + * ng_ran_target_id.h + * + * + */ + +#ifndef _OpenAPI_ng_ran_target_id_H_ +#define _OpenAPI_ng_ran_target_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "global_ran_node_id.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ng_ran_target_id_s OpenAPI_ng_ran_target_id_t; +typedef struct OpenAPI_ng_ran_target_id_s { + struct OpenAPI_global_ran_node_id_s *ran_node_id; + struct OpenAPI_tai_s *tai; +} OpenAPI_ng_ran_target_id_t; + +OpenAPI_ng_ran_target_id_t *OpenAPI_ng_ran_target_id_create( + OpenAPI_global_ran_node_id_t *ran_node_id, + OpenAPI_tai_t *tai + ); +void OpenAPI_ng_ran_target_id_free(OpenAPI_ng_ran_target_id_t *ng_ran_target_id); +OpenAPI_ng_ran_target_id_t *OpenAPI_ng_ran_target_id_parseFromJSON(cJSON *ng_ran_target_idJSON); +cJSON *OpenAPI_ng_ran_target_id_convertToJSON(OpenAPI_ng_ran_target_id_t *ng_ran_target_id); +OpenAPI_ng_ran_target_id_t *OpenAPI_ng_ran_target_id_copy(OpenAPI_ng_ran_target_id_t *dst, OpenAPI_ng_ran_target_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ng_ran_target_id_H_ */ + diff --git a/lib/sbi/openapi/model/ngap_ie_type.c b/lib/sbi/openapi/model/ngap_ie_type.c new file mode 100644 index 000000000..a284dabd7 --- /dev/null +++ b/lib/sbi/openapi/model/ngap_ie_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ngap_ie_type.h" + +char* OpenAPI_ngap_ie_type_ToString(OpenAPI_ngap_ie_type_e ngap_ie_type) +{ + const char *ngap_ie_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_REL_CMD", "PDU_RES_MOD_REQ", "HANDOVER_CMD", "HANDOVER_REQUIRED", "HANDOVER_PREP_FAIL", "SRC_TO_TAR_CONTAINER", "TAR_TO_SRC_CONTAINER", "RAN_STATUS_TRANS_CONTAINER", "SON_CONFIG_TRANSFER", "NRPPA_PDU", "UE_RADIO_CAPABILITY", "RIM_INFO_TRANSFER", "SECONDARY_RAT_USAGE" }; + size_t sizeofArray = sizeof(ngap_ie_typeArray) / sizeof(ngap_ie_typeArray[0]); + if (ngap_ie_type < sizeofArray) + return (char *)ngap_ie_typeArray[ngap_ie_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_ngap_ie_type_e OpenAPI_ngap_ie_type_FromString(char* ngap_ie_type) +{ + int stringToReturn = 0; + const char *ngap_ie_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_REL_CMD", "PDU_RES_MOD_REQ", "HANDOVER_CMD", "HANDOVER_REQUIRED", "HANDOVER_PREP_FAIL", "SRC_TO_TAR_CONTAINER", "TAR_TO_SRC_CONTAINER", "RAN_STATUS_TRANS_CONTAINER", "SON_CONFIG_TRANSFER", "NRPPA_PDU", "UE_RADIO_CAPABILITY", "RIM_INFO_TRANSFER", "SECONDARY_RAT_USAGE" }; + size_t sizeofArray = sizeof(ngap_ie_typeArray) / sizeof(ngap_ie_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ngap_ie_type, ngap_ie_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ngap_ie_type.h b/lib/sbi/openapi/model/ngap_ie_type.h new file mode 100644 index 000000000..365d6cd09 --- /dev/null +++ b/lib/sbi/openapi/model/ngap_ie_type.h @@ -0,0 +1,31 @@ +/* + * ngap_ie_type.h + * + * + */ + +#ifndef _OpenAPI_ngap_ie_type_H_ +#define _OpenAPI_ngap_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_ngap_ie_type_NULL = 0, OpenAPI_ngap_ie_type_PDU_RES_SETUP_REQ, OpenAPI_ngap_ie_type_PDU_RES_REL_CMD, OpenAPI_ngap_ie_type_PDU_RES_MOD_REQ, OpenAPI_ngap_ie_type_HANDOVER_CMD, OpenAPI_ngap_ie_type_HANDOVER_REQUIRED, OpenAPI_ngap_ie_type_HANDOVER_PREP_FAIL, OpenAPI_ngap_ie_type_SRC_TO_TAR_CONTAINER, OpenAPI_ngap_ie_type_TAR_TO_SRC_CONTAINER, OpenAPI_ngap_ie_type_RAN_STATUS_TRANS_CONTAINER, OpenAPI_ngap_ie_type_SON_CONFIG_TRANSFER, OpenAPI_ngap_ie_type_NRPPA_PDU, OpenAPI_ngap_ie_type_UE_RADIO_CAPABILITY, OpenAPI_ngap_ie_type_RIM_INFO_TRANSFER, OpenAPI_ngap_ie_type_SECONDARY_RAT_USAGE } OpenAPI_ngap_ie_type_e; + +char* OpenAPI_ngap_ie_type_ToString(OpenAPI_ngap_ie_type_e ngap_ie_type); + +OpenAPI_ngap_ie_type_e OpenAPI_ngap_ie_type_FromString(char* ngap_ie_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ngap_ie_type_H_ */ + diff --git a/lib/sbi/openapi/model/nidd_information.c b/lib/sbi/openapi/model/nidd_information.c index 6f6b217c9..dfc3e7db5 100644 --- a/lib/sbi/openapi/model/nidd_information.c +++ b/lib/sbi/openapi/model/nidd_information.c @@ -114,3 +114,37 @@ end: return NULL; } +OpenAPI_nidd_information_t *OpenAPI_nidd_information_copy(OpenAPI_nidd_information_t *dst, OpenAPI_nidd_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nidd_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nidd_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nidd_information_free(dst); + dst = OpenAPI_nidd_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nidd_information.h b/lib/sbi/openapi/model/nidd_information.h index 9bb0825d5..f41a5e5cb 100644 --- a/lib/sbi/openapi/model/nidd_information.h +++ b/lib/sbi/openapi/model/nidd_information.h @@ -32,6 +32,7 @@ OpenAPI_nidd_information_t *OpenAPI_nidd_information_create( void OpenAPI_nidd_information_free(OpenAPI_nidd_information_t *nidd_information); OpenAPI_nidd_information_t *OpenAPI_nidd_information_parseFromJSON(cJSON *nidd_informationJSON); cJSON *OpenAPI_nidd_information_convertToJSON(OpenAPI_nidd_information_t *nidd_information); +OpenAPI_nidd_information_t *OpenAPI_nidd_information_copy(OpenAPI_nidd_information_t *dst, OpenAPI_nidd_information_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/non_dynamic5_qi.c b/lib/sbi/openapi/model/non_dynamic5_qi.c new file mode 100644 index 000000000..45105c9e3 --- /dev/null +++ b/lib/sbi/openapi/model/non_dynamic5_qi.c @@ -0,0 +1,161 @@ + +#include +#include +#include +#include "non_dynamic5_qi.h" + +OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_create( + int priority_level, + int aver_window, + int max_data_burst_vol, + int ext_max_data_burst_vol + ) +{ + OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi_local_var = OpenAPI_malloc(sizeof(OpenAPI_non_dynamic5_qi_t)); + if (!non_dynamic5_qi_local_var) { + return NULL; + } + non_dynamic5_qi_local_var->priority_level = priority_level; + non_dynamic5_qi_local_var->aver_window = aver_window; + non_dynamic5_qi_local_var->max_data_burst_vol = max_data_burst_vol; + non_dynamic5_qi_local_var->ext_max_data_burst_vol = ext_max_data_burst_vol; + + return non_dynamic5_qi_local_var; +} + +void OpenAPI_non_dynamic5_qi_free(OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi) +{ + if (NULL == non_dynamic5_qi) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(non_dynamic5_qi); +} + +cJSON *OpenAPI_non_dynamic5_qi_convertToJSON(OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi) +{ + cJSON *item = NULL; + + if (non_dynamic5_qi == NULL) { + ogs_error("OpenAPI_non_dynamic5_qi_convertToJSON() failed [NonDynamic5Qi]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (non_dynamic5_qi->priority_level) { + if (cJSON_AddNumberToObject(item, "priorityLevel", non_dynamic5_qi->priority_level) == NULL) { + ogs_error("OpenAPI_non_dynamic5_qi_convertToJSON() failed [priority_level]"); + goto end; + } + } + + if (non_dynamic5_qi->aver_window) { + if (cJSON_AddNumberToObject(item, "averWindow", non_dynamic5_qi->aver_window) == NULL) { + ogs_error("OpenAPI_non_dynamic5_qi_convertToJSON() failed [aver_window]"); + goto end; + } + } + + if (non_dynamic5_qi->max_data_burst_vol) { + if (cJSON_AddNumberToObject(item, "maxDataBurstVol", non_dynamic5_qi->max_data_burst_vol) == NULL) { + ogs_error("OpenAPI_non_dynamic5_qi_convertToJSON() failed [max_data_burst_vol]"); + goto end; + } + } + + if (non_dynamic5_qi->ext_max_data_burst_vol) { + if (cJSON_AddNumberToObject(item, "extMaxDataBurstVol", non_dynamic5_qi->ext_max_data_burst_vol) == NULL) { + ogs_error("OpenAPI_non_dynamic5_qi_convertToJSON() failed [ext_max_data_burst_vol]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_parseFromJSON(cJSON *non_dynamic5_qiJSON) +{ + OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi_local_var = NULL; + cJSON *priority_level = cJSON_GetObjectItemCaseSensitive(non_dynamic5_qiJSON, "priorityLevel"); + + if (priority_level) { + if (!cJSON_IsNumber(priority_level)) { + ogs_error("OpenAPI_non_dynamic5_qi_parseFromJSON() failed [priority_level]"); + goto end; + } + } + + cJSON *aver_window = cJSON_GetObjectItemCaseSensitive(non_dynamic5_qiJSON, "averWindow"); + + if (aver_window) { + if (!cJSON_IsNumber(aver_window)) { + ogs_error("OpenAPI_non_dynamic5_qi_parseFromJSON() failed [aver_window]"); + goto end; + } + } + + cJSON *max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(non_dynamic5_qiJSON, "maxDataBurstVol"); + + if (max_data_burst_vol) { + if (!cJSON_IsNumber(max_data_burst_vol)) { + ogs_error("OpenAPI_non_dynamic5_qi_parseFromJSON() failed [max_data_burst_vol]"); + goto end; + } + } + + cJSON *ext_max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(non_dynamic5_qiJSON, "extMaxDataBurstVol"); + + if (ext_max_data_burst_vol) { + if (!cJSON_IsNumber(ext_max_data_burst_vol)) { + ogs_error("OpenAPI_non_dynamic5_qi_parseFromJSON() failed [ext_max_data_burst_vol]"); + goto end; + } + } + + non_dynamic5_qi_local_var = OpenAPI_non_dynamic5_qi_create ( + priority_level ? priority_level->valuedouble : 0, + aver_window ? aver_window->valuedouble : 0, + max_data_burst_vol ? max_data_burst_vol->valuedouble : 0, + ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0 + ); + + return non_dynamic5_qi_local_var; +end: + return NULL; +} + +OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_copy(OpenAPI_non_dynamic5_qi_t *dst, OpenAPI_non_dynamic5_qi_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_non_dynamic5_qi_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_non_dynamic5_qi_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_non_dynamic5_qi_free(dst); + dst = OpenAPI_non_dynamic5_qi_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/non_dynamic5_qi.h b/lib/sbi/openapi/model/non_dynamic5_qi.h new file mode 100644 index 000000000..bf176bd56 --- /dev/null +++ b/lib/sbi/openapi/model/non_dynamic5_qi.h @@ -0,0 +1,44 @@ +/* + * non_dynamic5_qi.h + * + * + */ + +#ifndef _OpenAPI_non_dynamic5_qi_H_ +#define _OpenAPI_non_dynamic5_qi_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_non_dynamic5_qi_s OpenAPI_non_dynamic5_qi_t; +typedef struct OpenAPI_non_dynamic5_qi_s { + int priority_level; + int aver_window; + int max_data_burst_vol; + int ext_max_data_burst_vol; +} OpenAPI_non_dynamic5_qi_t; + +OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_create( + int priority_level, + int aver_window, + int max_data_burst_vol, + int ext_max_data_burst_vol + ); +void OpenAPI_non_dynamic5_qi_free(OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi); +OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_parseFromJSON(cJSON *non_dynamic5_qiJSON); +cJSON *OpenAPI_non_dynamic5_qi_convertToJSON(OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi); +OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_copy(OpenAPI_non_dynamic5_qi_t *dst, OpenAPI_non_dynamic5_qi_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_non_dynamic5_qi_H_ */ + diff --git a/lib/sbi/openapi/model/non_external_unrelated_class.c b/lib/sbi/openapi/model/non_external_unrelated_class.c index 4a23144bf..de9c620bc 100644 --- a/lib/sbi/openapi/model/non_external_unrelated_class.c +++ b/lib/sbi/openapi/model/non_external_unrelated_class.c @@ -149,3 +149,37 @@ end: return NULL; } +OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_copy(OpenAPI_non_external_unrelated_class_t *dst, OpenAPI_non_external_unrelated_class_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_non_external_unrelated_class_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_non_external_unrelated_class_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_non_external_unrelated_class_free(dst); + dst = OpenAPI_non_external_unrelated_class_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/non_external_unrelated_class.h b/lib/sbi/openapi/model/non_external_unrelated_class.h index 603a80dc5..08f09c451 100644 --- a/lib/sbi/openapi/model/non_external_unrelated_class.h +++ b/lib/sbi/openapi/model/non_external_unrelated_class.h @@ -32,6 +32,7 @@ OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_cre void OpenAPI_non_external_unrelated_class_free(OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class); OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_parseFromJSON(cJSON *non_external_unrelated_classJSON); cJSON *OpenAPI_non_external_unrelated_class_convertToJSON(OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class); +OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_copy(OpenAPI_non_external_unrelated_class_t *dst, OpenAPI_non_external_unrelated_class_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.c b/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.c new file mode 100644 index 000000000..8d352d19d --- /dev/null +++ b/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.c @@ -0,0 +1,267 @@ + +#include +#include +#include +#include "non_ue_n2_info_subscription_create_data.h" + +OpenAPI_non_ue_n2_info_subscription_create_data_t *OpenAPI_non_ue_n2_info_subscription_create_data_create( + OpenAPI_list_t *global_ran_node_list, + OpenAPI_list_t *an_type_list, + OpenAPI_n2_information_class_e n2_information_class, + char *n2_notify_callback_uri, + char *nf_id, + char *supported_features + ) +{ + OpenAPI_non_ue_n2_info_subscription_create_data_t *non_ue_n2_info_subscription_create_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_non_ue_n2_info_subscription_create_data_t)); + if (!non_ue_n2_info_subscription_create_data_local_var) { + return NULL; + } + non_ue_n2_info_subscription_create_data_local_var->global_ran_node_list = global_ran_node_list; + non_ue_n2_info_subscription_create_data_local_var->an_type_list = an_type_list; + non_ue_n2_info_subscription_create_data_local_var->n2_information_class = n2_information_class; + non_ue_n2_info_subscription_create_data_local_var->n2_notify_callback_uri = n2_notify_callback_uri; + non_ue_n2_info_subscription_create_data_local_var->nf_id = nf_id; + non_ue_n2_info_subscription_create_data_local_var->supported_features = supported_features; + + return non_ue_n2_info_subscription_create_data_local_var; +} + +void OpenAPI_non_ue_n2_info_subscription_create_data_free(OpenAPI_non_ue_n2_info_subscription_create_data_t *non_ue_n2_info_subscription_create_data) +{ + if (NULL == non_ue_n2_info_subscription_create_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(non_ue_n2_info_subscription_create_data->global_ran_node_list, node) { + OpenAPI_global_ran_node_id_free(node->data); + } + OpenAPI_list_free(non_ue_n2_info_subscription_create_data->global_ran_node_list); + OpenAPI_list_free(non_ue_n2_info_subscription_create_data->an_type_list); + ogs_free(non_ue_n2_info_subscription_create_data->n2_notify_callback_uri); + ogs_free(non_ue_n2_info_subscription_create_data->nf_id); + ogs_free(non_ue_n2_info_subscription_create_data->supported_features); + ogs_free(non_ue_n2_info_subscription_create_data); +} + +cJSON *OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON(OpenAPI_non_ue_n2_info_subscription_create_data_t *non_ue_n2_info_subscription_create_data) +{ + cJSON *item = NULL; + + if (non_ue_n2_info_subscription_create_data == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [NonUeN2InfoSubscriptionCreateData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (non_ue_n2_info_subscription_create_data->global_ran_node_list) { + cJSON *global_ran_node_listList = cJSON_AddArrayToObject(item, "globalRanNodeList"); + if (global_ran_node_listList == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [global_ran_node_list]"); + goto end; + } + + OpenAPI_lnode_t *global_ran_node_list_node; + if (non_ue_n2_info_subscription_create_data->global_ran_node_list) { + OpenAPI_list_for_each(non_ue_n2_info_subscription_create_data->global_ran_node_list, global_ran_node_list_node) { + cJSON *itemLocal = OpenAPI_global_ran_node_id_convertToJSON(global_ran_node_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [global_ran_node_list]"); + goto end; + } + cJSON_AddItemToArray(global_ran_node_listList, itemLocal); + } + } + } + + if (non_ue_n2_info_subscription_create_data->an_type_list) { + cJSON *an_type_list = cJSON_AddArrayToObject(item, "anTypeList"); + if (an_type_list == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [an_type_list]"); + goto end; + } + OpenAPI_lnode_t *an_type_list_node; + OpenAPI_list_for_each(non_ue_n2_info_subscription_create_data->an_type_list, an_type_list_node) { + if (cJSON_AddStringToObject(an_type_list, "", OpenAPI_access_type_ToString((OpenAPI_access_type_e)an_type_list_node->data)) == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [an_type_list]"); + goto end; + } + } + } + + if (!non_ue_n2_info_subscription_create_data->n2_information_class) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [n2_information_class]"); + goto end; + } + if (cJSON_AddStringToObject(item, "n2InformationClass", OpenAPI_n2_information_class_ToString(non_ue_n2_info_subscription_create_data->n2_information_class)) == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [n2_information_class]"); + goto end; + } + + if (!non_ue_n2_info_subscription_create_data->n2_notify_callback_uri) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [n2_notify_callback_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "n2NotifyCallbackUri", non_ue_n2_info_subscription_create_data->n2_notify_callback_uri) == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [n2_notify_callback_uri]"); + goto end; + } + + if (non_ue_n2_info_subscription_create_data->nf_id) { + if (cJSON_AddStringToObject(item, "nfId", non_ue_n2_info_subscription_create_data->nf_id) == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [nf_id]"); + goto end; + } + } + + if (non_ue_n2_info_subscription_create_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", non_ue_n2_info_subscription_create_data->supported_features) == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_non_ue_n2_info_subscription_create_data_t *OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON(cJSON *non_ue_n2_info_subscription_create_dataJSON) +{ + OpenAPI_non_ue_n2_info_subscription_create_data_t *non_ue_n2_info_subscription_create_data_local_var = NULL; + cJSON *global_ran_node_list = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_create_dataJSON, "globalRanNodeList"); + + OpenAPI_list_t *global_ran_node_listList; + if (global_ran_node_list) { + cJSON *global_ran_node_list_local_nonprimitive; + if (!cJSON_IsArray(global_ran_node_list)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [global_ran_node_list]"); + goto end; + } + + global_ran_node_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(global_ran_node_list_local_nonprimitive, global_ran_node_list ) { + if (!cJSON_IsObject(global_ran_node_list_local_nonprimitive)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [global_ran_node_list]"); + goto end; + } + OpenAPI_global_ran_node_id_t *global_ran_node_listItem = OpenAPI_global_ran_node_id_parseFromJSON(global_ran_node_list_local_nonprimitive); + + OpenAPI_list_add(global_ran_node_listList, global_ran_node_listItem); + } + } + + cJSON *an_type_list = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_create_dataJSON, "anTypeList"); + + OpenAPI_list_t *an_type_listList; + if (an_type_list) { + cJSON *an_type_list_local_nonprimitive; + if (!cJSON_IsArray(an_type_list)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [an_type_list]"); + goto end; + } + + an_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(an_type_list_local_nonprimitive, an_type_list ) { + if (!cJSON_IsString(an_type_list_local_nonprimitive)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [an_type_list]"); + goto end; + } + + OpenAPI_list_add(an_type_listList, (void *)OpenAPI_access_type_FromString(an_type_list_local_nonprimitive->valuestring)); + } + } + + cJSON *n2_information_class = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_create_dataJSON, "n2InformationClass"); + if (!n2_information_class) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [n2_information_class]"); + goto end; + } + + OpenAPI_n2_information_class_e n2_information_classVariable; + + if (!cJSON_IsString(n2_information_class)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [n2_information_class]"); + goto end; + } + n2_information_classVariable = OpenAPI_n2_information_class_FromString(n2_information_class->valuestring); + + cJSON *n2_notify_callback_uri = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_create_dataJSON, "n2NotifyCallbackUri"); + if (!n2_notify_callback_uri) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [n2_notify_callback_uri]"); + goto end; + } + + + if (!cJSON_IsString(n2_notify_callback_uri)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [n2_notify_callback_uri]"); + goto end; + } + + cJSON *nf_id = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_create_dataJSON, "nfId"); + + if (nf_id) { + if (!cJSON_IsString(nf_id)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [nf_id]"); + goto end; + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_create_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + non_ue_n2_info_subscription_create_data_local_var = OpenAPI_non_ue_n2_info_subscription_create_data_create ( + global_ran_node_list ? global_ran_node_listList : NULL, + an_type_list ? an_type_listList : NULL, + n2_information_classVariable, + ogs_strdup(n2_notify_callback_uri->valuestring), + nf_id ? ogs_strdup(nf_id->valuestring) : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return non_ue_n2_info_subscription_create_data_local_var; +end: + return NULL; +} + +OpenAPI_non_ue_n2_info_subscription_create_data_t *OpenAPI_non_ue_n2_info_subscription_create_data_copy(OpenAPI_non_ue_n2_info_subscription_create_data_t *dst, OpenAPI_non_ue_n2_info_subscription_create_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_create_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_non_ue_n2_info_subscription_create_data_free(dst); + dst = OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.h b/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.h new file mode 100644 index 000000000..2a616c860 --- /dev/null +++ b/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.h @@ -0,0 +1,51 @@ +/* + * non_ue_n2_info_subscription_create_data.h + * + * + */ + +#ifndef _OpenAPI_non_ue_n2_info_subscription_create_data_H_ +#define _OpenAPI_non_ue_n2_info_subscription_create_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "global_ran_node_id.h" +#include "n2_information_class.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_non_ue_n2_info_subscription_create_data_s OpenAPI_non_ue_n2_info_subscription_create_data_t; +typedef struct OpenAPI_non_ue_n2_info_subscription_create_data_s { + OpenAPI_list_t *global_ran_node_list; + OpenAPI_list_t *an_type_list; + OpenAPI_n2_information_class_e n2_information_class; + char *n2_notify_callback_uri; + char *nf_id; + char *supported_features; +} OpenAPI_non_ue_n2_info_subscription_create_data_t; + +OpenAPI_non_ue_n2_info_subscription_create_data_t *OpenAPI_non_ue_n2_info_subscription_create_data_create( + OpenAPI_list_t *global_ran_node_list, + OpenAPI_list_t *an_type_list, + OpenAPI_n2_information_class_e n2_information_class, + char *n2_notify_callback_uri, + char *nf_id, + char *supported_features + ); +void OpenAPI_non_ue_n2_info_subscription_create_data_free(OpenAPI_non_ue_n2_info_subscription_create_data_t *non_ue_n2_info_subscription_create_data); +OpenAPI_non_ue_n2_info_subscription_create_data_t *OpenAPI_non_ue_n2_info_subscription_create_data_parseFromJSON(cJSON *non_ue_n2_info_subscription_create_dataJSON); +cJSON *OpenAPI_non_ue_n2_info_subscription_create_data_convertToJSON(OpenAPI_non_ue_n2_info_subscription_create_data_t *non_ue_n2_info_subscription_create_data); +OpenAPI_non_ue_n2_info_subscription_create_data_t *OpenAPI_non_ue_n2_info_subscription_create_data_copy(OpenAPI_non_ue_n2_info_subscription_create_data_t *dst, OpenAPI_non_ue_n2_info_subscription_create_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_non_ue_n2_info_subscription_create_data_H_ */ + diff --git a/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.c b/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.c new file mode 100644 index 000000000..1269b4ade --- /dev/null +++ b/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.c @@ -0,0 +1,151 @@ + +#include +#include +#include +#include "non_ue_n2_info_subscription_created_data.h" + +OpenAPI_non_ue_n2_info_subscription_created_data_t *OpenAPI_non_ue_n2_info_subscription_created_data_create( + char *n2_notify_subscription_id, + char *supported_features, + OpenAPI_n2_information_class_e n2_information_class + ) +{ + OpenAPI_non_ue_n2_info_subscription_created_data_t *non_ue_n2_info_subscription_created_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_non_ue_n2_info_subscription_created_data_t)); + if (!non_ue_n2_info_subscription_created_data_local_var) { + return NULL; + } + non_ue_n2_info_subscription_created_data_local_var->n2_notify_subscription_id = n2_notify_subscription_id; + non_ue_n2_info_subscription_created_data_local_var->supported_features = supported_features; + non_ue_n2_info_subscription_created_data_local_var->n2_information_class = n2_information_class; + + return non_ue_n2_info_subscription_created_data_local_var; +} + +void OpenAPI_non_ue_n2_info_subscription_created_data_free(OpenAPI_non_ue_n2_info_subscription_created_data_t *non_ue_n2_info_subscription_created_data) +{ + if (NULL == non_ue_n2_info_subscription_created_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(non_ue_n2_info_subscription_created_data->n2_notify_subscription_id); + ogs_free(non_ue_n2_info_subscription_created_data->supported_features); + ogs_free(non_ue_n2_info_subscription_created_data); +} + +cJSON *OpenAPI_non_ue_n2_info_subscription_created_data_convertToJSON(OpenAPI_non_ue_n2_info_subscription_created_data_t *non_ue_n2_info_subscription_created_data) +{ + cJSON *item = NULL; + + if (non_ue_n2_info_subscription_created_data == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_convertToJSON() failed [NonUeN2InfoSubscriptionCreatedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!non_ue_n2_info_subscription_created_data->n2_notify_subscription_id) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_convertToJSON() failed [n2_notify_subscription_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "n2NotifySubscriptionId", non_ue_n2_info_subscription_created_data->n2_notify_subscription_id) == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_convertToJSON() failed [n2_notify_subscription_id]"); + goto end; + } + + if (non_ue_n2_info_subscription_created_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", non_ue_n2_info_subscription_created_data->supported_features) == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (non_ue_n2_info_subscription_created_data->n2_information_class) { + if (cJSON_AddStringToObject(item, "n2InformationClass", OpenAPI_n2_information_class_ToString(non_ue_n2_info_subscription_created_data->n2_information_class)) == NULL) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_convertToJSON() failed [n2_information_class]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_non_ue_n2_info_subscription_created_data_t *OpenAPI_non_ue_n2_info_subscription_created_data_parseFromJSON(cJSON *non_ue_n2_info_subscription_created_dataJSON) +{ + OpenAPI_non_ue_n2_info_subscription_created_data_t *non_ue_n2_info_subscription_created_data_local_var = NULL; + cJSON *n2_notify_subscription_id = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_created_dataJSON, "n2NotifySubscriptionId"); + if (!n2_notify_subscription_id) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_parseFromJSON() failed [n2_notify_subscription_id]"); + goto end; + } + + + if (!cJSON_IsString(n2_notify_subscription_id)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_parseFromJSON() failed [n2_notify_subscription_id]"); + goto end; + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_created_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *n2_information_class = cJSON_GetObjectItemCaseSensitive(non_ue_n2_info_subscription_created_dataJSON, "n2InformationClass"); + + OpenAPI_n2_information_class_e n2_information_classVariable; + if (n2_information_class) { + if (!cJSON_IsString(n2_information_class)) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_data_parseFromJSON() failed [n2_information_class]"); + goto end; + } + n2_information_classVariable = OpenAPI_n2_information_class_FromString(n2_information_class->valuestring); + } + + non_ue_n2_info_subscription_created_data_local_var = OpenAPI_non_ue_n2_info_subscription_created_data_create ( + ogs_strdup(n2_notify_subscription_id->valuestring), + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + n2_information_class ? n2_information_classVariable : 0 + ); + + return non_ue_n2_info_subscription_created_data_local_var; +end: + return NULL; +} + +OpenAPI_non_ue_n2_info_subscription_created_data_t *OpenAPI_non_ue_n2_info_subscription_created_data_copy(OpenAPI_non_ue_n2_info_subscription_created_data_t *dst, OpenAPI_non_ue_n2_info_subscription_created_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_non_ue_n2_info_subscription_created_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_non_ue_n2_info_subscription_created_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_non_ue_n2_info_subscription_created_data_free(dst); + dst = OpenAPI_non_ue_n2_info_subscription_created_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.h b/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.h new file mode 100644 index 000000000..14492918e --- /dev/null +++ b/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.h @@ -0,0 +1,43 @@ +/* + * non_ue_n2_info_subscription_created_data.h + * + * + */ + +#ifndef _OpenAPI_non_ue_n2_info_subscription_created_data_H_ +#define _OpenAPI_non_ue_n2_info_subscription_created_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_information_class.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_non_ue_n2_info_subscription_created_data_s OpenAPI_non_ue_n2_info_subscription_created_data_t; +typedef struct OpenAPI_non_ue_n2_info_subscription_created_data_s { + char *n2_notify_subscription_id; + char *supported_features; + OpenAPI_n2_information_class_e n2_information_class; +} OpenAPI_non_ue_n2_info_subscription_created_data_t; + +OpenAPI_non_ue_n2_info_subscription_created_data_t *OpenAPI_non_ue_n2_info_subscription_created_data_create( + char *n2_notify_subscription_id, + char *supported_features, + OpenAPI_n2_information_class_e n2_information_class + ); +void OpenAPI_non_ue_n2_info_subscription_created_data_free(OpenAPI_non_ue_n2_info_subscription_created_data_t *non_ue_n2_info_subscription_created_data); +OpenAPI_non_ue_n2_info_subscription_created_data_t *OpenAPI_non_ue_n2_info_subscription_created_data_parseFromJSON(cJSON *non_ue_n2_info_subscription_created_dataJSON); +cJSON *OpenAPI_non_ue_n2_info_subscription_created_data_convertToJSON(OpenAPI_non_ue_n2_info_subscription_created_data_t *non_ue_n2_info_subscription_created_data); +OpenAPI_non_ue_n2_info_subscription_created_data_t *OpenAPI_non_ue_n2_info_subscription_created_data_copy(OpenAPI_non_ue_n2_info_subscription_created_data_t *dst, OpenAPI_non_ue_n2_info_subscription_created_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_non_ue_n2_info_subscription_created_data_H_ */ + diff --git a/lib/sbi/openapi/model/notif_condition.c b/lib/sbi/openapi/model/notif_condition.c index 26daf1076..8fc71e9ef 100644 --- a/lib/sbi/openapi/model/notif_condition.c +++ b/lib/sbi/openapi/model/notif_condition.c @@ -135,3 +135,37 @@ end: return NULL; } +OpenAPI_notif_condition_t *OpenAPI_notif_condition_copy(OpenAPI_notif_condition_t *dst, OpenAPI_notif_condition_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notif_condition_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notif_condition_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_notif_condition_free(dst); + dst = OpenAPI_notif_condition_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notif_condition.h b/lib/sbi/openapi/model/notif_condition.h index 2dd57404c..2b748920a 100644 --- a/lib/sbi/openapi/model/notif_condition.h +++ b/lib/sbi/openapi/model/notif_condition.h @@ -30,6 +30,7 @@ OpenAPI_notif_condition_t *OpenAPI_notif_condition_create( void OpenAPI_notif_condition_free(OpenAPI_notif_condition_t *notif_condition); OpenAPI_notif_condition_t *OpenAPI_notif_condition_parseFromJSON(cJSON *notif_conditionJSON); cJSON *OpenAPI_notif_condition_convertToJSON(OpenAPI_notif_condition_t *notif_condition); +OpenAPI_notif_condition_t *OpenAPI_notif_condition_copy(OpenAPI_notif_condition_t *dst, OpenAPI_notif_condition_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/notification_cause.c b/lib/sbi/openapi/model/notification_cause.c new file mode 100644 index 000000000..d1e236375 --- /dev/null +++ b/lib/sbi/openapi/model/notification_cause.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "notification_cause.h" + +OpenAPI_notification_cause_t *OpenAPI_notification_cause_create( + ) +{ + OpenAPI_notification_cause_t *notification_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_notification_cause_t)); + if (!notification_cause_local_var) { + return NULL; + } + + return notification_cause_local_var; +} + +void OpenAPI_notification_cause_free(OpenAPI_notification_cause_t *notification_cause) +{ + if (NULL == notification_cause) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(notification_cause); +} + +cJSON *OpenAPI_notification_cause_convertToJSON(OpenAPI_notification_cause_t *notification_cause) +{ + cJSON *item = NULL; + + if (notification_cause == NULL) { + ogs_error("OpenAPI_notification_cause_convertToJSON() failed [NotificationCause]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_notification_cause_t *OpenAPI_notification_cause_parseFromJSON(cJSON *notification_causeJSON) +{ + OpenAPI_notification_cause_t *notification_cause_local_var = NULL; + notification_cause_local_var = OpenAPI_notification_cause_create ( + ); + + return notification_cause_local_var; +end: + return NULL; +} + +OpenAPI_notification_cause_t *OpenAPI_notification_cause_copy(OpenAPI_notification_cause_t *dst, OpenAPI_notification_cause_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notification_cause_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notification_cause_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_notification_cause_free(dst); + dst = OpenAPI_notification_cause_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notification_cause.h b/lib/sbi/openapi/model/notification_cause.h new file mode 100644 index 000000000..8ea42cba5 --- /dev/null +++ b/lib/sbi/openapi/model/notification_cause.h @@ -0,0 +1,36 @@ +/* + * notification_cause.h + * + * Possible values are - QOS_FULFILLED - QOS_NOT_FULFILLED - UP_SEC_FULFILLED - UP_SEC_NOT_FULFILLED + */ + +#ifndef _OpenAPI_notification_cause_H_ +#define _OpenAPI_notification_cause_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_notification_cause_s OpenAPI_notification_cause_t; +typedef struct OpenAPI_notification_cause_s { +} OpenAPI_notification_cause_t; + +OpenAPI_notification_cause_t *OpenAPI_notification_cause_create( + ); +void OpenAPI_notification_cause_free(OpenAPI_notification_cause_t *notification_cause); +OpenAPI_notification_cause_t *OpenAPI_notification_cause_parseFromJSON(cJSON *notification_causeJSON); +cJSON *OpenAPI_notification_cause_convertToJSON(OpenAPI_notification_cause_t *notification_cause); +OpenAPI_notification_cause_t *OpenAPI_notification_cause_copy(OpenAPI_notification_cause_t *dst, OpenAPI_notification_cause_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_cause_H_ */ + diff --git a/lib/sbi/openapi/model/notification_control.c b/lib/sbi/openapi/model/notification_control.c new file mode 100644 index 000000000..0381a1841 --- /dev/null +++ b/lib/sbi/openapi/model/notification_control.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "notification_control.h" + +OpenAPI_notification_control_t *OpenAPI_notification_control_create( + ) +{ + OpenAPI_notification_control_t *notification_control_local_var = OpenAPI_malloc(sizeof(OpenAPI_notification_control_t)); + if (!notification_control_local_var) { + return NULL; + } + + return notification_control_local_var; +} + +void OpenAPI_notification_control_free(OpenAPI_notification_control_t *notification_control) +{ + if (NULL == notification_control) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(notification_control); +} + +cJSON *OpenAPI_notification_control_convertToJSON(OpenAPI_notification_control_t *notification_control) +{ + cJSON *item = NULL; + + if (notification_control == NULL) { + ogs_error("OpenAPI_notification_control_convertToJSON() failed [NotificationControl]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_notification_control_t *OpenAPI_notification_control_parseFromJSON(cJSON *notification_controlJSON) +{ + OpenAPI_notification_control_t *notification_control_local_var = NULL; + notification_control_local_var = OpenAPI_notification_control_create ( + ); + + return notification_control_local_var; +end: + return NULL; +} + +OpenAPI_notification_control_t *OpenAPI_notification_control_copy(OpenAPI_notification_control_t *dst, OpenAPI_notification_control_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notification_control_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notification_control_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_notification_control_free(dst); + dst = OpenAPI_notification_control_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notification_control.h b/lib/sbi/openapi/model/notification_control.h new file mode 100644 index 000000000..9cca2ab26 --- /dev/null +++ b/lib/sbi/openapi/model/notification_control.h @@ -0,0 +1,36 @@ +/* + * notification_control.h + * + * + */ + +#ifndef _OpenAPI_notification_control_H_ +#define _OpenAPI_notification_control_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_notification_control_s OpenAPI_notification_control_t; +typedef struct OpenAPI_notification_control_s { +} OpenAPI_notification_control_t; + +OpenAPI_notification_control_t *OpenAPI_notification_control_create( + ); +void OpenAPI_notification_control_free(OpenAPI_notification_control_t *notification_control); +OpenAPI_notification_control_t *OpenAPI_notification_control_parseFromJSON(cJSON *notification_controlJSON); +cJSON *OpenAPI_notification_control_convertToJSON(OpenAPI_notification_control_t *notification_control); +OpenAPI_notification_control_t *OpenAPI_notification_control_copy(OpenAPI_notification_control_t *dst, OpenAPI_notification_control_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_control_H_ */ + diff --git a/lib/sbi/openapi/model/notification_data.c b/lib/sbi/openapi/model/notification_data.c index f5637ee61..e8fef30c1 100644 --- a/lib/sbi/openapi/model/notification_data.c +++ b/lib/sbi/openapi/model/notification_data.c @@ -174,3 +174,37 @@ end: return NULL; } +OpenAPI_notification_data_t *OpenAPI_notification_data_copy(OpenAPI_notification_data_t *dst, OpenAPI_notification_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notification_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notification_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_notification_data_free(dst); + dst = OpenAPI_notification_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notification_data.h b/lib/sbi/openapi/model/notification_data.h index e8a4b7b64..13d40c18e 100644 --- a/lib/sbi/openapi/model/notification_data.h +++ b/lib/sbi/openapi/model/notification_data.h @@ -37,6 +37,7 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_create( void OpenAPI_notification_data_free(OpenAPI_notification_data_t *notification_data); OpenAPI_notification_data_t *OpenAPI_notification_data_parseFromJSON(cJSON *notification_dataJSON); cJSON *OpenAPI_notification_data_convertToJSON(OpenAPI_notification_data_t *notification_data); +OpenAPI_notification_data_t *OpenAPI_notification_data_copy(OpenAPI_notification_data_t *dst, OpenAPI_notification_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/notification_item.c b/lib/sbi/openapi/model/notification_item.c index b6445cf73..8cb7cd42d 100644 --- a/lib/sbi/openapi/model/notification_item.c +++ b/lib/sbi/openapi/model/notification_item.c @@ -129,3 +129,37 @@ end: return NULL; } +OpenAPI_notification_item_t *OpenAPI_notification_item_copy(OpenAPI_notification_item_t *dst, OpenAPI_notification_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notification_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notification_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_notification_item_free(dst); + dst = OpenAPI_notification_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notification_item.h b/lib/sbi/openapi/model/notification_item.h index 704656efa..d5caba469 100644 --- a/lib/sbi/openapi/model/notification_item.h +++ b/lib/sbi/openapi/model/notification_item.h @@ -31,6 +31,7 @@ OpenAPI_notification_item_t *OpenAPI_notification_item_create( void OpenAPI_notification_item_free(OpenAPI_notification_item_t *notification_item); OpenAPI_notification_item_t *OpenAPI_notification_item_parseFromJSON(cJSON *notification_itemJSON); cJSON *OpenAPI_notification_item_convertToJSON(OpenAPI_notification_item_t *notification_item); +OpenAPI_notification_item_t *OpenAPI_notification_item_copy(OpenAPI_notification_item_t *dst, OpenAPI_notification_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/notify_item.c b/lib/sbi/openapi/model/notify_item.c index 0c6f6aa17..0ad0c6061 100644 --- a/lib/sbi/openapi/model/notify_item.c +++ b/lib/sbi/openapi/model/notify_item.c @@ -129,3 +129,37 @@ end: return NULL; } +OpenAPI_notify_item_t *OpenAPI_notify_item_copy(OpenAPI_notify_item_t *dst, OpenAPI_notify_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notify_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notify_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_notify_item_free(dst); + dst = OpenAPI_notify_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notify_item.h b/lib/sbi/openapi/model/notify_item.h index cffdf7c25..d1b8fcc43 100644 --- a/lib/sbi/openapi/model/notify_item.h +++ b/lib/sbi/openapi/model/notify_item.h @@ -31,6 +31,7 @@ OpenAPI_notify_item_t *OpenAPI_notify_item_create( void OpenAPI_notify_item_free(OpenAPI_notify_item_t *notify_item); OpenAPI_notify_item_t *OpenAPI_notify_item_parseFromJSON(cJSON *notify_itemJSON); cJSON *OpenAPI_notify_item_convertToJSON(OpenAPI_notify_item_t *notify_item); +OpenAPI_notify_item_t *OpenAPI_notify_item_copy(OpenAPI_notify_item_t *dst, OpenAPI_notify_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nr_location.c b/lib/sbi/openapi/model/nr_location.c index 6b75fb3cd..86e63d420 100644 --- a/lib/sbi/openapi/model/nr_location.c +++ b/lib/sbi/openapi/model/nr_location.c @@ -210,3 +210,37 @@ end: return NULL; } +OpenAPI_nr_location_t *OpenAPI_nr_location_copy(OpenAPI_nr_location_t *dst, OpenAPI_nr_location_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nr_location_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nr_location_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nr_location_free(dst); + dst = OpenAPI_nr_location_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nr_location.h b/lib/sbi/openapi/model/nr_location.h index 7745b79f9..d60aebbc1 100644 --- a/lib/sbi/openapi/model/nr_location.h +++ b/lib/sbi/openapi/model/nr_location.h @@ -43,6 +43,7 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_create( void OpenAPI_nr_location_free(OpenAPI_nr_location_t *nr_location); OpenAPI_nr_location_t *OpenAPI_nr_location_parseFromJSON(cJSON *nr_locationJSON); cJSON *OpenAPI_nr_location_convertToJSON(OpenAPI_nr_location_t *nr_location); +OpenAPI_nr_location_t *OpenAPI_nr_location_copy(OpenAPI_nr_location_t *dst, OpenAPI_nr_location_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nr_v2x_auth.c b/lib/sbi/openapi/model/nr_v2x_auth.c index 0bcee7a0f..fded67537 100644 --- a/lib/sbi/openapi/model/nr_v2x_auth.c +++ b/lib/sbi/openapi/model/nr_v2x_auth.c @@ -97,3 +97,37 @@ end: return NULL; } +OpenAPI_nr_v2x_auth_t *OpenAPI_nr_v2x_auth_copy(OpenAPI_nr_v2x_auth_t *dst, OpenAPI_nr_v2x_auth_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nr_v2x_auth_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nr_v2x_auth_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nr_v2x_auth_free(dst); + dst = OpenAPI_nr_v2x_auth_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nr_v2x_auth.h b/lib/sbi/openapi/model/nr_v2x_auth.h index 46ee9def8..d13e7c31b 100644 --- a/lib/sbi/openapi/model/nr_v2x_auth.h +++ b/lib/sbi/openapi/model/nr_v2x_auth.h @@ -31,6 +31,7 @@ OpenAPI_nr_v2x_auth_t *OpenAPI_nr_v2x_auth_create( void OpenAPI_nr_v2x_auth_free(OpenAPI_nr_v2x_auth_t *nr_v2x_auth); OpenAPI_nr_v2x_auth_t *OpenAPI_nr_v2x_auth_parseFromJSON(cJSON *nr_v2x_authJSON); cJSON *OpenAPI_nr_v2x_auth_convertToJSON(OpenAPI_nr_v2x_auth_t *nr_v2x_auth); +OpenAPI_nr_v2x_auth_t *OpenAPI_nr_v2x_auth_copy(OpenAPI_nr_v2x_auth_t *dst, OpenAPI_nr_v2x_auth_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nrf_info.c b/lib/sbi/openapi/model/nrf_info.c index a8d8cc570..5a268dba4 100644 --- a/lib/sbi/openapi/model/nrf_info.c +++ b/lib/sbi/openapi/model/nrf_info.c @@ -897,3 +897,37 @@ end: return NULL; } +OpenAPI_nrf_info_t *OpenAPI_nrf_info_copy(OpenAPI_nrf_info_t *dst, OpenAPI_nrf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_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_nrf_info_free(dst); + dst = OpenAPI_nrf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info.h b/lib/sbi/openapi/model/nrf_info.h index 18a9488f2..576332a5c 100644 --- a/lib/sbi/openapi/model/nrf_info.h +++ b/lib/sbi/openapi/model/nrf_info.h @@ -74,6 +74,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info); OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON); cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info); +OpenAPI_nrf_info_t *OpenAPI_nrf_info_copy(OpenAPI_nrf_info_t *dst, OpenAPI_nrf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nrppa_information.c b/lib/sbi/openapi/model/nrppa_information.c new file mode 100644 index 000000000..1c7e51bca --- /dev/null +++ b/lib/sbi/openapi/model/nrppa_information.c @@ -0,0 +1,159 @@ + +#include +#include +#include +#include "nrppa_information.h" + +OpenAPI_nrppa_information_t *OpenAPI_nrppa_information_create( + char *nf_id, + OpenAPI_n2_info_content_t *nrppa_pdu, + char *service_instance_id + ) +{ + OpenAPI_nrppa_information_t *nrppa_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_nrppa_information_t)); + if (!nrppa_information_local_var) { + return NULL; + } + nrppa_information_local_var->nf_id = nf_id; + nrppa_information_local_var->nrppa_pdu = nrppa_pdu; + nrppa_information_local_var->service_instance_id = service_instance_id; + + return nrppa_information_local_var; +} + +void OpenAPI_nrppa_information_free(OpenAPI_nrppa_information_t *nrppa_information) +{ + if (NULL == nrppa_information) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nrppa_information->nf_id); + OpenAPI_n2_info_content_free(nrppa_information->nrppa_pdu); + ogs_free(nrppa_information->service_instance_id); + ogs_free(nrppa_information); +} + +cJSON *OpenAPI_nrppa_information_convertToJSON(OpenAPI_nrppa_information_t *nrppa_information) +{ + cJSON *item = NULL; + + if (nrppa_information == NULL) { + ogs_error("OpenAPI_nrppa_information_convertToJSON() failed [NrppaInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nrppa_information->nf_id) { + ogs_error("OpenAPI_nrppa_information_convertToJSON() failed [nf_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfId", nrppa_information->nf_id) == NULL) { + ogs_error("OpenAPI_nrppa_information_convertToJSON() failed [nf_id]"); + goto end; + } + + if (!nrppa_information->nrppa_pdu) { + ogs_error("OpenAPI_nrppa_information_convertToJSON() failed [nrppa_pdu]"); + goto end; + } + cJSON *nrppa_pdu_local_JSON = OpenAPI_n2_info_content_convertToJSON(nrppa_information->nrppa_pdu); + if (nrppa_pdu_local_JSON == NULL) { + ogs_error("OpenAPI_nrppa_information_convertToJSON() failed [nrppa_pdu]"); + goto end; + } + cJSON_AddItemToObject(item, "nrppaPdu", nrppa_pdu_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrppa_information_convertToJSON() failed [nrppa_pdu]"); + goto end; + } + + if (nrppa_information->service_instance_id) { + if (cJSON_AddStringToObject(item, "serviceInstanceId", nrppa_information->service_instance_id) == NULL) { + ogs_error("OpenAPI_nrppa_information_convertToJSON() failed [service_instance_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nrppa_information_t *OpenAPI_nrppa_information_parseFromJSON(cJSON *nrppa_informationJSON) +{ + OpenAPI_nrppa_information_t *nrppa_information_local_var = NULL; + cJSON *nf_id = cJSON_GetObjectItemCaseSensitive(nrppa_informationJSON, "nfId"); + if (!nf_id) { + ogs_error("OpenAPI_nrppa_information_parseFromJSON() failed [nf_id]"); + goto end; + } + + + if (!cJSON_IsString(nf_id)) { + ogs_error("OpenAPI_nrppa_information_parseFromJSON() failed [nf_id]"); + goto end; + } + + cJSON *nrppa_pdu = cJSON_GetObjectItemCaseSensitive(nrppa_informationJSON, "nrppaPdu"); + if (!nrppa_pdu) { + ogs_error("OpenAPI_nrppa_information_parseFromJSON() failed [nrppa_pdu]"); + goto end; + } + + OpenAPI_n2_info_content_t *nrppa_pdu_local_nonprim = NULL; + + nrppa_pdu_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(nrppa_pdu); + + cJSON *service_instance_id = cJSON_GetObjectItemCaseSensitive(nrppa_informationJSON, "serviceInstanceId"); + + if (service_instance_id) { + if (!cJSON_IsString(service_instance_id)) { + ogs_error("OpenAPI_nrppa_information_parseFromJSON() failed [service_instance_id]"); + goto end; + } + } + + nrppa_information_local_var = OpenAPI_nrppa_information_create ( + ogs_strdup(nf_id->valuestring), + nrppa_pdu_local_nonprim, + service_instance_id ? ogs_strdup(service_instance_id->valuestring) : NULL + ); + + return nrppa_information_local_var; +end: + return NULL; +} + +OpenAPI_nrppa_information_t *OpenAPI_nrppa_information_copy(OpenAPI_nrppa_information_t *dst, OpenAPI_nrppa_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrppa_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrppa_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nrppa_information_free(dst); + dst = OpenAPI_nrppa_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrppa_information.h b/lib/sbi/openapi/model/nrppa_information.h new file mode 100644 index 000000000..59f714fdc --- /dev/null +++ b/lib/sbi/openapi/model/nrppa_information.h @@ -0,0 +1,43 @@ +/* + * nrppa_information.h + * + * + */ + +#ifndef _OpenAPI_nrppa_information_H_ +#define _OpenAPI_nrppa_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrppa_information_s OpenAPI_nrppa_information_t; +typedef struct OpenAPI_nrppa_information_s { + char *nf_id; + struct OpenAPI_n2_info_content_s *nrppa_pdu; + char *service_instance_id; +} OpenAPI_nrppa_information_t; + +OpenAPI_nrppa_information_t *OpenAPI_nrppa_information_create( + char *nf_id, + OpenAPI_n2_info_content_t *nrppa_pdu, + char *service_instance_id + ); +void OpenAPI_nrppa_information_free(OpenAPI_nrppa_information_t *nrppa_information); +OpenAPI_nrppa_information_t *OpenAPI_nrppa_information_parseFromJSON(cJSON *nrppa_informationJSON); +cJSON *OpenAPI_nrppa_information_convertToJSON(OpenAPI_nrppa_information_t *nrppa_information); +OpenAPI_nrppa_information_t *OpenAPI_nrppa_information_copy(OpenAPI_nrppa_information_t *dst, OpenAPI_nrppa_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrppa_information_H_ */ + diff --git a/lib/sbi/openapi/model/nsi_information.c b/lib/sbi/openapi/model/nsi_information.c new file mode 100644 index 000000000..c5b692f09 --- /dev/null +++ b/lib/sbi/openapi/model/nsi_information.c @@ -0,0 +1,170 @@ + +#include +#include +#include +#include "nsi_information.h" + +OpenAPI_nsi_information_t *OpenAPI_nsi_information_create( + char *nrf_id, + char *nsi_id, + char *nrf_nf_mgt_uri, + char *nrf_access_token_uri + ) +{ + OpenAPI_nsi_information_t *nsi_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_nsi_information_t)); + if (!nsi_information_local_var) { + return NULL; + } + nsi_information_local_var->nrf_id = nrf_id; + nsi_information_local_var->nsi_id = nsi_id; + nsi_information_local_var->nrf_nf_mgt_uri = nrf_nf_mgt_uri; + nsi_information_local_var->nrf_access_token_uri = nrf_access_token_uri; + + return nsi_information_local_var; +} + +void OpenAPI_nsi_information_free(OpenAPI_nsi_information_t *nsi_information) +{ + if (NULL == nsi_information) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nsi_information->nrf_id); + ogs_free(nsi_information->nsi_id); + ogs_free(nsi_information->nrf_nf_mgt_uri); + ogs_free(nsi_information->nrf_access_token_uri); + ogs_free(nsi_information); +} + +cJSON *OpenAPI_nsi_information_convertToJSON(OpenAPI_nsi_information_t *nsi_information) +{ + cJSON *item = NULL; + + if (nsi_information == NULL) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed [NsiInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nsi_information->nrf_id) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed [nrf_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nrfId", nsi_information->nrf_id) == NULL) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed [nrf_id]"); + goto end; + } + + if (nsi_information->nsi_id) { + if (cJSON_AddStringToObject(item, "nsiId", nsi_information->nsi_id) == NULL) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed [nsi_id]"); + goto end; + } + } + + if (nsi_information->nrf_nf_mgt_uri) { + if (cJSON_AddStringToObject(item, "nrfNfMgtUri", nsi_information->nrf_nf_mgt_uri) == NULL) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed [nrf_nf_mgt_uri]"); + goto end; + } + } + + if (nsi_information->nrf_access_token_uri) { + if (cJSON_AddStringToObject(item, "nrfAccessTokenUri", nsi_information->nrf_access_token_uri) == NULL) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed [nrf_access_token_uri]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nsi_information_t *OpenAPI_nsi_information_parseFromJSON(cJSON *nsi_informationJSON) +{ + OpenAPI_nsi_information_t *nsi_information_local_var = NULL; + cJSON *nrf_id = cJSON_GetObjectItemCaseSensitive(nsi_informationJSON, "nrfId"); + if (!nrf_id) { + ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nrf_id]"); + goto end; + } + + + if (!cJSON_IsString(nrf_id)) { + ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nrf_id]"); + goto end; + } + + cJSON *nsi_id = cJSON_GetObjectItemCaseSensitive(nsi_informationJSON, "nsiId"); + + if (nsi_id) { + if (!cJSON_IsString(nsi_id)) { + ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nsi_id]"); + goto end; + } + } + + cJSON *nrf_nf_mgt_uri = cJSON_GetObjectItemCaseSensitive(nsi_informationJSON, "nrfNfMgtUri"); + + if (nrf_nf_mgt_uri) { + if (!cJSON_IsString(nrf_nf_mgt_uri)) { + ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nrf_nf_mgt_uri]"); + goto end; + } + } + + cJSON *nrf_access_token_uri = cJSON_GetObjectItemCaseSensitive(nsi_informationJSON, "nrfAccessTokenUri"); + + if (nrf_access_token_uri) { + if (!cJSON_IsString(nrf_access_token_uri)) { + ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nrf_access_token_uri]"); + goto end; + } + } + + nsi_information_local_var = OpenAPI_nsi_information_create ( + ogs_strdup(nrf_id->valuestring), + nsi_id ? ogs_strdup(nsi_id->valuestring) : NULL, + nrf_nf_mgt_uri ? ogs_strdup(nrf_nf_mgt_uri->valuestring) : NULL, + nrf_access_token_uri ? ogs_strdup(nrf_access_token_uri->valuestring) : NULL + ); + + return nsi_information_local_var; +end: + return NULL; +} + +OpenAPI_nsi_information_t *OpenAPI_nsi_information_copy(OpenAPI_nsi_information_t *dst, OpenAPI_nsi_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nsi_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nsi_information_free(dst); + dst = OpenAPI_nsi_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nsi_information.h b/lib/sbi/openapi/model/nsi_information.h new file mode 100644 index 000000000..24f78b5c9 --- /dev/null +++ b/lib/sbi/openapi/model/nsi_information.h @@ -0,0 +1,44 @@ +/* + * nsi_information.h + * + * + */ + +#ifndef _OpenAPI_nsi_information_H_ +#define _OpenAPI_nsi_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nsi_information_s OpenAPI_nsi_information_t; +typedef struct OpenAPI_nsi_information_s { + char *nrf_id; + char *nsi_id; + char *nrf_nf_mgt_uri; + char *nrf_access_token_uri; +} OpenAPI_nsi_information_t; + +OpenAPI_nsi_information_t *OpenAPI_nsi_information_create( + char *nrf_id, + char *nsi_id, + char *nrf_nf_mgt_uri, + char *nrf_access_token_uri + ); +void OpenAPI_nsi_information_free(OpenAPI_nsi_information_t *nsi_information); +OpenAPI_nsi_information_t *OpenAPI_nsi_information_parseFromJSON(cJSON *nsi_informationJSON); +cJSON *OpenAPI_nsi_information_convertToJSON(OpenAPI_nsi_information_t *nsi_information); +OpenAPI_nsi_information_t *OpenAPI_nsi_information_copy(OpenAPI_nsi_information_t *dst, OpenAPI_nsi_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nsi_information_H_ */ + diff --git a/lib/sbi/openapi/model/nssai.c b/lib/sbi/openapi/model/nssai.c index 9dbd8b748..eff3a0889 100644 --- a/lib/sbi/openapi/model/nssai.c +++ b/lib/sbi/openapi/model/nssai.c @@ -247,3 +247,37 @@ end: return NULL; } +OpenAPI_nssai_t *OpenAPI_nssai_copy(OpenAPI_nssai_t *dst, OpenAPI_nssai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nssai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nssai_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nssai_free(dst); + dst = OpenAPI_nssai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nssai.h b/lib/sbi/openapi/model/nssai.h index 663354da3..376190a4e 100644 --- a/lib/sbi/openapi/model/nssai.h +++ b/lib/sbi/openapi/model/nssai.h @@ -38,6 +38,7 @@ OpenAPI_nssai_t *OpenAPI_nssai_create( void OpenAPI_nssai_free(OpenAPI_nssai_t *nssai); OpenAPI_nssai_t *OpenAPI_nssai_parseFromJSON(cJSON *nssaiJSON); cJSON *OpenAPI_nssai_convertToJSON(OpenAPI_nssai_t *nssai); +OpenAPI_nssai_t *OpenAPI_nssai_copy(OpenAPI_nssai_t *dst, OpenAPI_nssai_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nssai_ack_data.c b/lib/sbi/openapi/model/nssai_ack_data.c index 181930a46..e8609ed82 100644 --- a/lib/sbi/openapi/model/nssai_ack_data.c +++ b/lib/sbi/openapi/model/nssai_ack_data.c @@ -100,3 +100,37 @@ end: return NULL; } +OpenAPI_nssai_ack_data_t *OpenAPI_nssai_ack_data_copy(OpenAPI_nssai_ack_data_t *dst, OpenAPI_nssai_ack_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nssai_ack_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nssai_ack_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_nssai_ack_data_free(dst); + dst = OpenAPI_nssai_ack_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nssai_ack_data.h b/lib/sbi/openapi/model/nssai_ack_data.h index d07b6b4de..83b748c64 100644 --- a/lib/sbi/openapi/model/nssai_ack_data.h +++ b/lib/sbi/openapi/model/nssai_ack_data.h @@ -31,6 +31,7 @@ OpenAPI_nssai_ack_data_t *OpenAPI_nssai_ack_data_create( void OpenAPI_nssai_ack_data_free(OpenAPI_nssai_ack_data_t *nssai_ack_data); OpenAPI_nssai_ack_data_t *OpenAPI_nssai_ack_data_parseFromJSON(cJSON *nssai_ack_dataJSON); cJSON *OpenAPI_nssai_ack_data_convertToJSON(OpenAPI_nssai_ack_data_t *nssai_ack_data); +OpenAPI_nssai_ack_data_t *OpenAPI_nssai_ack_data_copy(OpenAPI_nssai_ack_data_t *dst, OpenAPI_nssai_ack_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nssai_mapping.c b/lib/sbi/openapi/model/nssai_mapping.c new file mode 100644 index 000000000..014d371d5 --- /dev/null +++ b/lib/sbi/openapi/model/nssai_mapping.c @@ -0,0 +1,143 @@ + +#include +#include +#include +#include "nssai_mapping.h" + +OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_create( + OpenAPI_snssai_t *mapped_snssai, + OpenAPI_snssai_t *h_snssai + ) +{ + OpenAPI_nssai_mapping_t *nssai_mapping_local_var = OpenAPI_malloc(sizeof(OpenAPI_nssai_mapping_t)); + if (!nssai_mapping_local_var) { + return NULL; + } + nssai_mapping_local_var->mapped_snssai = mapped_snssai; + nssai_mapping_local_var->h_snssai = h_snssai; + + return nssai_mapping_local_var; +} + +void OpenAPI_nssai_mapping_free(OpenAPI_nssai_mapping_t *nssai_mapping) +{ + if (NULL == nssai_mapping) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_snssai_free(nssai_mapping->mapped_snssai); + OpenAPI_snssai_free(nssai_mapping->h_snssai); + ogs_free(nssai_mapping); +} + +cJSON *OpenAPI_nssai_mapping_convertToJSON(OpenAPI_nssai_mapping_t *nssai_mapping) +{ + cJSON *item = NULL; + + if (nssai_mapping == NULL) { + ogs_error("OpenAPI_nssai_mapping_convertToJSON() failed [NssaiMapping]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nssai_mapping->mapped_snssai) { + ogs_error("OpenAPI_nssai_mapping_convertToJSON() failed [mapped_snssai]"); + goto end; + } + cJSON *mapped_snssai_local_JSON = OpenAPI_snssai_convertToJSON(nssai_mapping->mapped_snssai); + if (mapped_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_nssai_mapping_convertToJSON() failed [mapped_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "mappedSnssai", mapped_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nssai_mapping_convertToJSON() failed [mapped_snssai]"); + goto end; + } + + if (!nssai_mapping->h_snssai) { + ogs_error("OpenAPI_nssai_mapping_convertToJSON() failed [h_snssai]"); + goto end; + } + cJSON *h_snssai_local_JSON = OpenAPI_snssai_convertToJSON(nssai_mapping->h_snssai); + if (h_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_nssai_mapping_convertToJSON() failed [h_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "hSnssai", h_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nssai_mapping_convertToJSON() failed [h_snssai]"); + goto end; + } + +end: + return item; +} + +OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_parseFromJSON(cJSON *nssai_mappingJSON) +{ + OpenAPI_nssai_mapping_t *nssai_mapping_local_var = NULL; + cJSON *mapped_snssai = cJSON_GetObjectItemCaseSensitive(nssai_mappingJSON, "mappedSnssai"); + if (!mapped_snssai) { + ogs_error("OpenAPI_nssai_mapping_parseFromJSON() failed [mapped_snssai]"); + goto end; + } + + OpenAPI_snssai_t *mapped_snssai_local_nonprim = NULL; + + mapped_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(mapped_snssai); + + cJSON *h_snssai = cJSON_GetObjectItemCaseSensitive(nssai_mappingJSON, "hSnssai"); + if (!h_snssai) { + ogs_error("OpenAPI_nssai_mapping_parseFromJSON() failed [h_snssai]"); + goto end; + } + + OpenAPI_snssai_t *h_snssai_local_nonprim = NULL; + + h_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(h_snssai); + + nssai_mapping_local_var = OpenAPI_nssai_mapping_create ( + mapped_snssai_local_nonprim, + h_snssai_local_nonprim + ); + + return nssai_mapping_local_var; +end: + return NULL; +} + +OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_copy(OpenAPI_nssai_mapping_t *dst, OpenAPI_nssai_mapping_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nssai_mapping_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nssai_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_nssai_mapping_free(dst); + dst = OpenAPI_nssai_mapping_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nssai_mapping.h b/lib/sbi/openapi/model/nssai_mapping.h new file mode 100644 index 000000000..e81785551 --- /dev/null +++ b/lib/sbi/openapi/model/nssai_mapping.h @@ -0,0 +1,41 @@ +/* + * nssai_mapping.h + * + * + */ + +#ifndef _OpenAPI_nssai_mapping_H_ +#define _OpenAPI_nssai_mapping_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nssai_mapping_s OpenAPI_nssai_mapping_t; +typedef struct OpenAPI_nssai_mapping_s { + struct OpenAPI_snssai_s *mapped_snssai; + struct OpenAPI_snssai_s *h_snssai; +} OpenAPI_nssai_mapping_t; + +OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_create( + OpenAPI_snssai_t *mapped_snssai, + OpenAPI_snssai_t *h_snssai + ); +void OpenAPI_nssai_mapping_free(OpenAPI_nssai_mapping_t *nssai_mapping); +OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_parseFromJSON(cJSON *nssai_mappingJSON); +cJSON *OpenAPI_nssai_mapping_convertToJSON(OpenAPI_nssai_mapping_t *nssai_mapping); +OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_copy(OpenAPI_nssai_mapping_t *dst, OpenAPI_nssai_mapping_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nssai_mapping_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_event.c b/lib/sbi/openapi/model/nwdaf_event.c index c4413ee03..98df8552b 100644 --- a/lib/sbi/openapi/model/nwdaf_event.c +++ b/lib/sbi/openapi/model/nwdaf_event.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_nwdaf_event_t *OpenAPI_nwdaf_event_copy(OpenAPI_nwdaf_event_t *dst, OpenAPI_nwdaf_event_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_event_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_event_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nwdaf_event_free(dst); + dst = OpenAPI_nwdaf_event_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_event.h b/lib/sbi/openapi/model/nwdaf_event.h index be9d694dd..dc5492ea8 100644 --- a/lib/sbi/openapi/model/nwdaf_event.h +++ b/lib/sbi/openapi/model/nwdaf_event.h @@ -26,6 +26,7 @@ OpenAPI_nwdaf_event_t *OpenAPI_nwdaf_event_create( void OpenAPI_nwdaf_event_free(OpenAPI_nwdaf_event_t *nwdaf_event); OpenAPI_nwdaf_event_t *OpenAPI_nwdaf_event_parseFromJSON(cJSON *nwdaf_eventJSON); cJSON *OpenAPI_nwdaf_event_convertToJSON(OpenAPI_nwdaf_event_t *nwdaf_event); +OpenAPI_nwdaf_event_t *OpenAPI_nwdaf_event_copy(OpenAPI_nwdaf_event_t *dst, OpenAPI_nwdaf_event_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/nwdaf_info.c b/lib/sbi/openapi/model/nwdaf_info.c index ae416f21c..c76ef60f6 100644 --- a/lib/sbi/openapi/model/nwdaf_info.c +++ b/lib/sbi/openapi/model/nwdaf_info.c @@ -249,3 +249,37 @@ end: return NULL; } +OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_copy(OpenAPI_nwdaf_info_t *dst, OpenAPI_nwdaf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_nwdaf_info_free(dst); + dst = OpenAPI_nwdaf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_info.h b/lib/sbi/openapi/model/nwdaf_info.h index 31c68831e..1d33ffba7 100644 --- a/lib/sbi/openapi/model/nwdaf_info.h +++ b/lib/sbi/openapi/model/nwdaf_info.h @@ -38,6 +38,7 @@ OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_create( void OpenAPI_nwdaf_info_free(OpenAPI_nwdaf_info_t *nwdaf_info); OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_parseFromJSON(cJSON *nwdaf_infoJSON); cJSON *OpenAPI_nwdaf_info_convertToJSON(OpenAPI_nwdaf_info_t *nwdaf_info); +OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_copy(OpenAPI_nwdaf_info_t *dst, OpenAPI_nwdaf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/odb_data.c b/lib/sbi/openapi/model/odb_data.c index 5b38a0423..e15aade8f 100644 --- a/lib/sbi/openapi/model/odb_data.c +++ b/lib/sbi/openapi/model/odb_data.c @@ -73,3 +73,37 @@ end: return NULL; } +OpenAPI_odb_data_t *OpenAPI_odb_data_copy(OpenAPI_odb_data_t *dst, OpenAPI_odb_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_odb_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_odb_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_odb_data_free(dst); + dst = OpenAPI_odb_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/odb_data.h b/lib/sbi/openapi/model/odb_data.h index 687994ca6..ef08acfd9 100644 --- a/lib/sbi/openapi/model/odb_data.h +++ b/lib/sbi/openapi/model/odb_data.h @@ -29,6 +29,7 @@ OpenAPI_odb_data_t *OpenAPI_odb_data_create( void OpenAPI_odb_data_free(OpenAPI_odb_data_t *odb_data); OpenAPI_odb_data_t *OpenAPI_odb_data_parseFromJSON(cJSON *odb_dataJSON); cJSON *OpenAPI_odb_data_convertToJSON(OpenAPI_odb_data_t *odb_data); +OpenAPI_odb_data_t *OpenAPI_odb_data_copy(OpenAPI_odb_data_t *dst, OpenAPI_odb_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/odb_packet_services.c b/lib/sbi/openapi/model/odb_packet_services.c index 6137eeb0b..dc17a9258 100644 --- a/lib/sbi/openapi/model/odb_packet_services.c +++ b/lib/sbi/openapi/model/odb_packet_services.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_copy(OpenAPI_odb_packet_services_t *dst, OpenAPI_odb_packet_services_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_odb_packet_services_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_odb_packet_services_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_odb_packet_services_free(dst); + dst = OpenAPI_odb_packet_services_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/odb_packet_services.h b/lib/sbi/openapi/model/odb_packet_services.h index e8b7a7497..12a19e431 100644 --- a/lib/sbi/openapi/model/odb_packet_services.h +++ b/lib/sbi/openapi/model/odb_packet_services.h @@ -27,6 +27,7 @@ OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_create( void OpenAPI_odb_packet_services_free(OpenAPI_odb_packet_services_t *odb_packet_services); OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_parseFromJSON(cJSON *odb_packet_servicesJSON); cJSON *OpenAPI_odb_packet_services_convertToJSON(OpenAPI_odb_packet_services_t *odb_packet_services); +OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_copy(OpenAPI_odb_packet_services_t *dst, OpenAPI_odb_packet_services_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/operator_managed.c b/lib/sbi/openapi/model/operator_managed.c index 5d24cdd10..8b161e77c 100644 --- a/lib/sbi/openapi/model/operator_managed.c +++ b/lib/sbi/openapi/model/operator_managed.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_operator_managed_t *OpenAPI_operator_managed_copy(OpenAPI_operator_managed_t *dst, OpenAPI_operator_managed_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_operator_managed_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_operator_managed_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_operator_managed_free(dst); + dst = OpenAPI_operator_managed_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/operator_managed.h b/lib/sbi/openapi/model/operator_managed.h index 2ee686c78..256d21640 100644 --- a/lib/sbi/openapi/model/operator_managed.h +++ b/lib/sbi/openapi/model/operator_managed.h @@ -26,6 +26,7 @@ OpenAPI_operator_managed_t *OpenAPI_operator_managed_create( void OpenAPI_operator_managed_free(OpenAPI_operator_managed_t *operator_managed); OpenAPI_operator_managed_t *OpenAPI_operator_managed_parseFromJSON(cJSON *operator_managedJSON); cJSON *OpenAPI_operator_managed_convertToJSON(OpenAPI_operator_managed_t *operator_managed); +OpenAPI_operator_managed_t *OpenAPI_operator_managed_copy(OpenAPI_operator_managed_t *dst, OpenAPI_operator_managed_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/operator_specific_data_container.c b/lib/sbi/openapi/model/operator_specific_data_container.c index a47847384..74076b4b6 100644 --- a/lib/sbi/openapi/model/operator_specific_data_container.c +++ b/lib/sbi/openapi/model/operator_specific_data_container.c @@ -163,3 +163,37 @@ end: return NULL; } +OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_container_copy(OpenAPI_operator_specific_data_container_t *dst, OpenAPI_operator_specific_data_container_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_operator_specific_data_container_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_operator_specific_data_container_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_operator_specific_data_container_free(dst); + dst = OpenAPI_operator_specific_data_container_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/operator_specific_data_container.h b/lib/sbi/openapi/model/operator_specific_data_container.h index cdf7c825d..5080909bc 100644 --- a/lib/sbi/openapi/model/operator_specific_data_container.h +++ b/lib/sbi/openapi/model/operator_specific_data_container.h @@ -39,6 +39,7 @@ OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_conta void OpenAPI_operator_specific_data_container_free(OpenAPI_operator_specific_data_container_t *operator_specific_data_container); OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_container_parseFromJSON(cJSON *operator_specific_data_containerJSON); cJSON *OpenAPI_operator_specific_data_container_convertToJSON(OpenAPI_operator_specific_data_container_t *operator_specific_data_container); +OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_container_copy(OpenAPI_operator_specific_data_container_t *dst, OpenAPI_operator_specific_data_container_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/parameter_over_pc5.c b/lib/sbi/openapi/model/parameter_over_pc5.c index e46ff2ed6..3b133395e 100644 --- a/lib/sbi/openapi/model/parameter_over_pc5.c +++ b/lib/sbi/openapi/model/parameter_over_pc5.c @@ -96,7 +96,7 @@ cJSON *OpenAPI_parameter_over_pc5_convertToJSON(OpenAPI_parameter_over_pc5_t *pa } } - if (parameter_over_pc5->auth_not_served >= 0) { + if (parameter_over_pc5->auth_not_served) { if (cJSON_AddBoolToObject(item, "authNotServed", parameter_over_pc5->auth_not_served) == NULL) { ogs_error("OpenAPI_parameter_over_pc5_convertToJSON() failed [auth_not_served]"); goto end; @@ -336,3 +336,37 @@ end: return NULL; } +OpenAPI_parameter_over_pc5_t *OpenAPI_parameter_over_pc5_copy(OpenAPI_parameter_over_pc5_t *dst, OpenAPI_parameter_over_pc5_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_parameter_over_pc5_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_parameter_over_pc5_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_parameter_over_pc5_free(dst); + dst = OpenAPI_parameter_over_pc5_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/parameter_over_pc5.h b/lib/sbi/openapi/model/parameter_over_pc5.h index 55e7d098a..a190bc464 100644 --- a/lib/sbi/openapi/model/parameter_over_pc5.h +++ b/lib/sbi/openapi/model/parameter_over_pc5.h @@ -48,6 +48,7 @@ OpenAPI_parameter_over_pc5_t *OpenAPI_parameter_over_pc5_create( void OpenAPI_parameter_over_pc5_free(OpenAPI_parameter_over_pc5_t *parameter_over_pc5); OpenAPI_parameter_over_pc5_t *OpenAPI_parameter_over_pc5_parseFromJSON(cJSON *parameter_over_pc5JSON); cJSON *OpenAPI_parameter_over_pc5_convertToJSON(OpenAPI_parameter_over_pc5_t *parameter_over_pc5); +OpenAPI_parameter_over_pc5_t *OpenAPI_parameter_over_pc5_copy(OpenAPI_parameter_over_pc5_t *dst, OpenAPI_parameter_over_pc5_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/parameter_over_uu.c b/lib/sbi/openapi/model/parameter_over_uu.c index 27f987c7a..03481d8f7 100644 --- a/lib/sbi/openapi/model/parameter_over_uu.c +++ b/lib/sbi/openapi/model/parameter_over_uu.c @@ -169,3 +169,37 @@ end: return NULL; } +OpenAPI_parameter_over_uu_t *OpenAPI_parameter_over_uu_copy(OpenAPI_parameter_over_uu_t *dst, OpenAPI_parameter_over_uu_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_parameter_over_uu_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_parameter_over_uu_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_parameter_over_uu_free(dst); + dst = OpenAPI_parameter_over_uu_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/parameter_over_uu.h b/lib/sbi/openapi/model/parameter_over_uu.h index d5cedb6d6..ba4abe643 100644 --- a/lib/sbi/openapi/model/parameter_over_uu.h +++ b/lib/sbi/openapi/model/parameter_over_uu.h @@ -34,6 +34,7 @@ OpenAPI_parameter_over_uu_t *OpenAPI_parameter_over_uu_create( void OpenAPI_parameter_over_uu_free(OpenAPI_parameter_over_uu_t *parameter_over_uu); OpenAPI_parameter_over_uu_t *OpenAPI_parameter_over_uu_parseFromJSON(cJSON *parameter_over_uuJSON); cJSON *OpenAPI_parameter_over_uu_convertToJSON(OpenAPI_parameter_over_uu_t *parameter_over_uu); +OpenAPI_parameter_over_uu_t *OpenAPI_parameter_over_uu_copy(OpenAPI_parameter_over_uu_t *dst, OpenAPI_parameter_over_uu_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/partial_record_method.c b/lib/sbi/openapi/model/partial_record_method.c new file mode 100644 index 000000000..7f2193f0f --- /dev/null +++ b/lib/sbi/openapi/model/partial_record_method.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "partial_record_method.h" + +OpenAPI_partial_record_method_t *OpenAPI_partial_record_method_create( + ) +{ + OpenAPI_partial_record_method_t *partial_record_method_local_var = OpenAPI_malloc(sizeof(OpenAPI_partial_record_method_t)); + if (!partial_record_method_local_var) { + return NULL; + } + + return partial_record_method_local_var; +} + +void OpenAPI_partial_record_method_free(OpenAPI_partial_record_method_t *partial_record_method) +{ + if (NULL == partial_record_method) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(partial_record_method); +} + +cJSON *OpenAPI_partial_record_method_convertToJSON(OpenAPI_partial_record_method_t *partial_record_method) +{ + cJSON *item = NULL; + + if (partial_record_method == NULL) { + ogs_error("OpenAPI_partial_record_method_convertToJSON() failed [PartialRecordMethod]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_partial_record_method_t *OpenAPI_partial_record_method_parseFromJSON(cJSON *partial_record_methodJSON) +{ + OpenAPI_partial_record_method_t *partial_record_method_local_var = NULL; + partial_record_method_local_var = OpenAPI_partial_record_method_create ( + ); + + return partial_record_method_local_var; +end: + return NULL; +} + +OpenAPI_partial_record_method_t *OpenAPI_partial_record_method_copy(OpenAPI_partial_record_method_t *dst, OpenAPI_partial_record_method_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_partial_record_method_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_partial_record_method_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_partial_record_method_free(dst); + dst = OpenAPI_partial_record_method_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/partial_record_method.h b/lib/sbi/openapi/model/partial_record_method.h new file mode 100644 index 000000000..ce16de17d --- /dev/null +++ b/lib/sbi/openapi/model/partial_record_method.h @@ -0,0 +1,36 @@ +/* + * partial_record_method.h + * + * + */ + +#ifndef _OpenAPI_partial_record_method_H_ +#define _OpenAPI_partial_record_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 struct OpenAPI_partial_record_method_s OpenAPI_partial_record_method_t; +typedef struct OpenAPI_partial_record_method_s { +} OpenAPI_partial_record_method_t; + +OpenAPI_partial_record_method_t *OpenAPI_partial_record_method_create( + ); +void OpenAPI_partial_record_method_free(OpenAPI_partial_record_method_t *partial_record_method); +OpenAPI_partial_record_method_t *OpenAPI_partial_record_method_parseFromJSON(cJSON *partial_record_methodJSON); +cJSON *OpenAPI_partial_record_method_convertToJSON(OpenAPI_partial_record_method_t *partial_record_method); +OpenAPI_partial_record_method_t *OpenAPI_partial_record_method_copy(OpenAPI_partial_record_method_t *dst, OpenAPI_partial_record_method_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_partial_record_method_H_ */ + diff --git a/lib/sbi/openapi/model/patch_item.c b/lib/sbi/openapi/model/patch_item.c index 56a6104fb..33765b9bf 100644 --- a/lib/sbi/openapi/model/patch_item.c +++ b/lib/sbi/openapi/model/patch_item.c @@ -140,3 +140,37 @@ end: return NULL; } +OpenAPI_patch_item_t *OpenAPI_patch_item_copy(OpenAPI_patch_item_t *dst, OpenAPI_patch_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_patch_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_patch_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_patch_item_free(dst); + dst = OpenAPI_patch_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/patch_item.h b/lib/sbi/openapi/model/patch_item.h index 53045038e..c8a4fdcaa 100644 --- a/lib/sbi/openapi/model/patch_item.h +++ b/lib/sbi/openapi/model/patch_item.h @@ -35,6 +35,7 @@ OpenAPI_patch_item_t *OpenAPI_patch_item_create( void OpenAPI_patch_item_free(OpenAPI_patch_item_t *patch_item); OpenAPI_patch_item_t *OpenAPI_patch_item_parseFromJSON(cJSON *patch_itemJSON); cJSON *OpenAPI_patch_item_convertToJSON(OpenAPI_patch_item_t *patch_item); +OpenAPI_patch_item_t *OpenAPI_patch_item_copy(OpenAPI_patch_item_t *dst, OpenAPI_patch_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/patch_result.c b/lib/sbi/openapi/model/patch_result.c index 63b78f23f..8bacad3ea 100644 --- a/lib/sbi/openapi/model/patch_result.c +++ b/lib/sbi/openapi/model/patch_result.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_patch_result_t *OpenAPI_patch_result_copy(OpenAPI_patch_result_t *dst, OpenAPI_patch_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_patch_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_patch_result_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_patch_result_free(dst); + dst = OpenAPI_patch_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/patch_result.h b/lib/sbi/openapi/model/patch_result.h index 9320924de..7e8d82306 100644 --- a/lib/sbi/openapi/model/patch_result.h +++ b/lib/sbi/openapi/model/patch_result.h @@ -29,6 +29,7 @@ OpenAPI_patch_result_t *OpenAPI_patch_result_create( void OpenAPI_patch_result_free(OpenAPI_patch_result_t *patch_result); OpenAPI_patch_result_t *OpenAPI_patch_result_parseFromJSON(cJSON *patch_resultJSON); cJSON *OpenAPI_patch_result_convertToJSON(OpenAPI_patch_result_t *patch_result); +OpenAPI_patch_result_t *OpenAPI_patch_result_copy(OpenAPI_patch_result_t *dst, OpenAPI_patch_result_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pc5_flow_bit_rates.c b/lib/sbi/openapi/model/pc5_flow_bit_rates.c index 9d845f3bd..05023943c 100644 --- a/lib/sbi/openapi/model/pc5_flow_bit_rates.c +++ b/lib/sbi/openapi/model/pc5_flow_bit_rates.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_pc5_flow_bit_rates_t *OpenAPI_pc5_flow_bit_rates_copy(OpenAPI_pc5_flow_bit_rates_t *dst, OpenAPI_pc5_flow_bit_rates_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pc5_flow_bit_rates_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pc5_flow_bit_rates_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pc5_flow_bit_rates_free(dst); + dst = OpenAPI_pc5_flow_bit_rates_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pc5_flow_bit_rates.h b/lib/sbi/openapi/model/pc5_flow_bit_rates.h index bcdf4f2da..d2649468a 100644 --- a/lib/sbi/openapi/model/pc5_flow_bit_rates.h +++ b/lib/sbi/openapi/model/pc5_flow_bit_rates.h @@ -30,6 +30,7 @@ OpenAPI_pc5_flow_bit_rates_t *OpenAPI_pc5_flow_bit_rates_create( void OpenAPI_pc5_flow_bit_rates_free(OpenAPI_pc5_flow_bit_rates_t *pc5_flow_bit_rates); OpenAPI_pc5_flow_bit_rates_t *OpenAPI_pc5_flow_bit_rates_parseFromJSON(cJSON *pc5_flow_bit_ratesJSON); cJSON *OpenAPI_pc5_flow_bit_rates_convertToJSON(OpenAPI_pc5_flow_bit_rates_t *pc5_flow_bit_rates); +OpenAPI_pc5_flow_bit_rates_t *OpenAPI_pc5_flow_bit_rates_copy(OpenAPI_pc5_flow_bit_rates_t *dst, OpenAPI_pc5_flow_bit_rates_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pc5_qo_s_para.c b/lib/sbi/openapi/model/pc5_qo_s_para.c index 146dc2530..a06249972 100644 --- a/lib/sbi/openapi/model/pc5_qo_s_para.c +++ b/lib/sbi/openapi/model/pc5_qo_s_para.c @@ -124,3 +124,37 @@ end: return NULL; } +OpenAPI_pc5_qo_s_para_t *OpenAPI_pc5_qo_s_para_copy(OpenAPI_pc5_qo_s_para_t *dst, OpenAPI_pc5_qo_s_para_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pc5_qo_s_para_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pc5_qo_s_para_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pc5_qo_s_para_free(dst); + dst = OpenAPI_pc5_qo_s_para_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pc5_qo_s_para.h b/lib/sbi/openapi/model/pc5_qo_s_para.h index 7d88da67b..7ffa5a702 100644 --- a/lib/sbi/openapi/model/pc5_qo_s_para.h +++ b/lib/sbi/openapi/model/pc5_qo_s_para.h @@ -31,6 +31,7 @@ OpenAPI_pc5_qo_s_para_t *OpenAPI_pc5_qo_s_para_create( void OpenAPI_pc5_qo_s_para_free(OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para); OpenAPI_pc5_qo_s_para_t *OpenAPI_pc5_qo_s_para_parseFromJSON(cJSON *pc5_qo_s_paraJSON); cJSON *OpenAPI_pc5_qo_s_para_convertToJSON(OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para); +OpenAPI_pc5_qo_s_para_t *OpenAPI_pc5_qo_s_para_copy(OpenAPI_pc5_qo_s_para_t *dst, OpenAPI_pc5_qo_s_para_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pc5_qos_flow_item.c b/lib/sbi/openapi/model/pc5_qos_flow_item.c index 4c91d6194..e51ae32a6 100644 --- a/lib/sbi/openapi/model/pc5_qos_flow_item.c +++ b/lib/sbi/openapi/model/pc5_qos_flow_item.c @@ -116,3 +116,37 @@ end: return NULL; } +OpenAPI_pc5_qos_flow_item_t *OpenAPI_pc5_qos_flow_item_copy(OpenAPI_pc5_qos_flow_item_t *dst, OpenAPI_pc5_qos_flow_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pc5_qos_flow_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pc5_qos_flow_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pc5_qos_flow_item_free(dst); + dst = OpenAPI_pc5_qos_flow_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pc5_qos_flow_item.h b/lib/sbi/openapi/model/pc5_qos_flow_item.h index dc807d1ab..154fc7851 100644 --- a/lib/sbi/openapi/model/pc5_qos_flow_item.h +++ b/lib/sbi/openapi/model/pc5_qos_flow_item.h @@ -33,6 +33,7 @@ OpenAPI_pc5_qos_flow_item_t *OpenAPI_pc5_qos_flow_item_create( void OpenAPI_pc5_qos_flow_item_free(OpenAPI_pc5_qos_flow_item_t *pc5_qos_flow_item); OpenAPI_pc5_qos_flow_item_t *OpenAPI_pc5_qos_flow_item_parseFromJSON(cJSON *pc5_qos_flow_itemJSON); cJSON *OpenAPI_pc5_qos_flow_item_convertToJSON(OpenAPI_pc5_qos_flow_item_t *pc5_qos_flow_item); +OpenAPI_pc5_qos_flow_item_t *OpenAPI_pc5_qos_flow_item_copy(OpenAPI_pc5_qos_flow_item_t *dst, OpenAPI_pc5_qos_flow_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pc5_qos_mapping.c b/lib/sbi/openapi/model/pc5_qos_mapping.c index 382bdd278..f835888c1 100644 --- a/lib/sbi/openapi/model/pc5_qos_mapping.c +++ b/lib/sbi/openapi/model/pc5_qos_mapping.c @@ -121,3 +121,37 @@ end: return NULL; } +OpenAPI_pc5_qos_mapping_t *OpenAPI_pc5_qos_mapping_copy(OpenAPI_pc5_qos_mapping_t *dst, OpenAPI_pc5_qos_mapping_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pc5_qos_mapping_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pc5_qos_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_pc5_qos_mapping_free(dst); + dst = OpenAPI_pc5_qos_mapping_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pc5_qos_mapping.h b/lib/sbi/openapi/model/pc5_qos_mapping.h index 40ecb7d79..54d33abc1 100644 --- a/lib/sbi/openapi/model/pc5_qos_mapping.h +++ b/lib/sbi/openapi/model/pc5_qos_mapping.h @@ -31,6 +31,7 @@ OpenAPI_pc5_qos_mapping_t *OpenAPI_pc5_qos_mapping_create( void OpenAPI_pc5_qos_mapping_free(OpenAPI_pc5_qos_mapping_t *pc5_qos_mapping); OpenAPI_pc5_qos_mapping_t *OpenAPI_pc5_qos_mapping_parseFromJSON(cJSON *pc5_qos_mappingJSON); cJSON *OpenAPI_pc5_qos_mapping_convertToJSON(OpenAPI_pc5_qos_mapping_t *pc5_qos_mapping); +OpenAPI_pc5_qos_mapping_t *OpenAPI_pc5_qos_mapping_copy(OpenAPI_pc5_qos_mapping_t *dst, OpenAPI_pc5_qos_mapping_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pcf_info.c b/lib/sbi/openapi/model/pcf_info.c index 93f1eed42..d0643447a 100644 --- a/lib/sbi/openapi/model/pcf_info.c +++ b/lib/sbi/openapi/model/pcf_info.c @@ -140,7 +140,7 @@ cJSON *OpenAPI_pcf_info_convertToJSON(OpenAPI_pcf_info_t *pcf_info) } } - if (pcf_info->v2x_support_ind >= 0) { + if (pcf_info->v2x_support_ind) { if (cJSON_AddBoolToObject(item, "v2xSupportInd", pcf_info->v2x_support_ind) == NULL) { ogs_error("OpenAPI_pcf_info_convertToJSON() failed [v2x_support_ind]"); goto end; @@ -271,3 +271,37 @@ end: return NULL; } +OpenAPI_pcf_info_t *OpenAPI_pcf_info_copy(OpenAPI_pcf_info_t *dst, OpenAPI_pcf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pcf_info_free(dst); + dst = OpenAPI_pcf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_info.h b/lib/sbi/openapi/model/pcf_info.h index f92edae26..df2b6972f 100644 --- a/lib/sbi/openapi/model/pcf_info.h +++ b/lib/sbi/openapi/model/pcf_info.h @@ -42,6 +42,7 @@ OpenAPI_pcf_info_t *OpenAPI_pcf_info_create( void OpenAPI_pcf_info_free(OpenAPI_pcf_info_t *pcf_info); OpenAPI_pcf_info_t *OpenAPI_pcf_info_parseFromJSON(cJSON *pcf_infoJSON); cJSON *OpenAPI_pcf_info_convertToJSON(OpenAPI_pcf_info_t *pcf_info); +OpenAPI_pcf_info_t *OpenAPI_pcf_info_copy(OpenAPI_pcf_info_t *dst, OpenAPI_pcf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pcscf_info.c b/lib/sbi/openapi/model/pcscf_info.c index 15fa1b2b6..ddb571798 100644 --- a/lib/sbi/openapi/model/pcscf_info.c +++ b/lib/sbi/openapi/model/pcscf_info.c @@ -133,3 +133,37 @@ end: return NULL; } +OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_copy(OpenAPI_pcscf_info_t *dst, OpenAPI_pcscf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcscf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcscf_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_pcscf_info_free(dst); + dst = OpenAPI_pcscf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcscf_info.h b/lib/sbi/openapi/model/pcscf_info.h index 3e4838a48..309671178 100644 --- a/lib/sbi/openapi/model/pcscf_info.h +++ b/lib/sbi/openapi/model/pcscf_info.h @@ -31,6 +31,7 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_create( void OpenAPI_pcscf_info_free(OpenAPI_pcscf_info_t *pcscf_info); OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_parseFromJSON(cJSON *pcscf_infoJSON); cJSON *OpenAPI_pcscf_info_convertToJSON(OpenAPI_pcscf_info_t *pcscf_info); +OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_copy(OpenAPI_pcscf_info_t *dst, OpenAPI_pcscf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pcscf_restoration_notification.c b/lib/sbi/openapi/model/pcscf_restoration_notification.c index 1ba0b8edd..881331008 100644 --- a/lib/sbi/openapi/model/pcscf_restoration_notification.c +++ b/lib/sbi/openapi/model/pcscf_restoration_notification.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification_copy(OpenAPI_pcscf_restoration_notification_t *dst, OpenAPI_pcscf_restoration_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcscf_restoration_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcscf_restoration_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pcscf_restoration_notification_free(dst); + dst = OpenAPI_pcscf_restoration_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcscf_restoration_notification.h b/lib/sbi/openapi/model/pcscf_restoration_notification.h index 5b36edf22..8132cb772 100644 --- a/lib/sbi/openapi/model/pcscf_restoration_notification.h +++ b/lib/sbi/openapi/model/pcscf_restoration_notification.h @@ -28,6 +28,7 @@ OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification void OpenAPI_pcscf_restoration_notification_free(OpenAPI_pcscf_restoration_notification_t *pcscf_restoration_notification); OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification_parseFromJSON(cJSON *pcscf_restoration_notificationJSON); cJSON *OpenAPI_pcscf_restoration_notification_convertToJSON(OpenAPI_pcscf_restoration_notification_t *pcscf_restoration_notification); +OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification_copy(OpenAPI_pcscf_restoration_notification_t *dst, OpenAPI_pcscf_restoration_notification_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pdu_session.c b/lib/sbi/openapi/model/pdu_session.c index 17b8ac184..24d0eddd5 100644 --- a/lib/sbi/openapi/model/pdu_session.c +++ b/lib/sbi/openapi/model/pdu_session.c @@ -128,3 +128,37 @@ end: return NULL; } +OpenAPI_pdu_session_t *OpenAPI_pdu_session_copy(OpenAPI_pdu_session_t *dst, OpenAPI_pdu_session_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pdu_session_free(dst); + dst = OpenAPI_pdu_session_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session.h b/lib/sbi/openapi/model/pdu_session.h index 62eb03ac6..f9e7b13b0 100644 --- a/lib/sbi/openapi/model/pdu_session.h +++ b/lib/sbi/openapi/model/pdu_session.h @@ -33,6 +33,7 @@ OpenAPI_pdu_session_t *OpenAPI_pdu_session_create( void OpenAPI_pdu_session_free(OpenAPI_pdu_session_t *pdu_session); OpenAPI_pdu_session_t *OpenAPI_pdu_session_parseFromJSON(cJSON *pdu_sessionJSON); cJSON *OpenAPI_pdu_session_convertToJSON(OpenAPI_pdu_session_t *pdu_session); +OpenAPI_pdu_session_t *OpenAPI_pdu_session_copy(OpenAPI_pdu_session_t *dst, OpenAPI_pdu_session_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pdu_session_context.c b/lib/sbi/openapi/model/pdu_session_context.c new file mode 100644 index 000000000..c3bbbd40c --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_context.c @@ -0,0 +1,611 @@ + +#include +#include +#include +#include "pdu_session_context.h" + +OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_create( + int pdu_session_id, + char *sm_context_ref, + OpenAPI_snssai_t *s_nssai, + char *dnn, + OpenAPI_access_type_e access_type, + OpenAPI_access_type_e additional_access_type, + OpenAPI_list_t *allocated_ebi_list, + char *hsmf_id, + char *hsmf_set_id, + char *hsmf_service_set_id, + OpenAPI_sbi_binding_level_e smf_binding, + char *vsmf_id, + char *vsmf_set_id, + char *vsmf_service_set_id, + OpenAPI_sbi_binding_level_e vsmf_binding, + char *ismf_id, + char *ismf_set_id, + char *ismf_service_set_id, + OpenAPI_sbi_binding_level_e ismf_binding, + char *ns_instance, + char *smf_service_instance_id, + int ma_pdu_session, + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para + ) +{ + OpenAPI_pdu_session_context_t *pdu_session_context_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_context_t)); + if (!pdu_session_context_local_var) { + return NULL; + } + pdu_session_context_local_var->pdu_session_id = pdu_session_id; + pdu_session_context_local_var->sm_context_ref = sm_context_ref; + pdu_session_context_local_var->s_nssai = s_nssai; + pdu_session_context_local_var->dnn = dnn; + pdu_session_context_local_var->access_type = access_type; + pdu_session_context_local_var->additional_access_type = additional_access_type; + pdu_session_context_local_var->allocated_ebi_list = allocated_ebi_list; + pdu_session_context_local_var->hsmf_id = hsmf_id; + pdu_session_context_local_var->hsmf_set_id = hsmf_set_id; + pdu_session_context_local_var->hsmf_service_set_id = hsmf_service_set_id; + pdu_session_context_local_var->smf_binding = smf_binding; + pdu_session_context_local_var->vsmf_id = vsmf_id; + pdu_session_context_local_var->vsmf_set_id = vsmf_set_id; + pdu_session_context_local_var->vsmf_service_set_id = vsmf_service_set_id; + pdu_session_context_local_var->vsmf_binding = vsmf_binding; + pdu_session_context_local_var->ismf_id = ismf_id; + pdu_session_context_local_var->ismf_set_id = ismf_set_id; + pdu_session_context_local_var->ismf_service_set_id = ismf_service_set_id; + pdu_session_context_local_var->ismf_binding = ismf_binding; + pdu_session_context_local_var->ns_instance = ns_instance; + pdu_session_context_local_var->smf_service_instance_id = smf_service_instance_id; + pdu_session_context_local_var->ma_pdu_session = ma_pdu_session; + pdu_session_context_local_var->cn_assisted_ran_para = cn_assisted_ran_para; + + return pdu_session_context_local_var; +} + +void OpenAPI_pdu_session_context_free(OpenAPI_pdu_session_context_t *pdu_session_context) +{ + if (NULL == pdu_session_context) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(pdu_session_context->sm_context_ref); + OpenAPI_snssai_free(pdu_session_context->s_nssai); + ogs_free(pdu_session_context->dnn); + OpenAPI_list_for_each(pdu_session_context->allocated_ebi_list, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(pdu_session_context->allocated_ebi_list); + ogs_free(pdu_session_context->hsmf_id); + ogs_free(pdu_session_context->hsmf_set_id); + ogs_free(pdu_session_context->hsmf_service_set_id); + ogs_free(pdu_session_context->vsmf_id); + ogs_free(pdu_session_context->vsmf_set_id); + ogs_free(pdu_session_context->vsmf_service_set_id); + ogs_free(pdu_session_context->ismf_id); + ogs_free(pdu_session_context->ismf_set_id); + ogs_free(pdu_session_context->ismf_service_set_id); + ogs_free(pdu_session_context->ns_instance); + ogs_free(pdu_session_context->smf_service_instance_id); + OpenAPI_cn_assisted_ran_para_free(pdu_session_context->cn_assisted_ran_para); + ogs_free(pdu_session_context); +} + +cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *pdu_session_context) +{ + cJSON *item = NULL; + + if (pdu_session_context == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [PduSessionContext]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pdu_session_context->pdu_session_id) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [pdu_session_id]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "pduSessionId", pdu_session_context->pdu_session_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [pdu_session_id]"); + goto end; + } + + if (!pdu_session_context->sm_context_ref) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [sm_context_ref]"); + goto end; + } + if (cJSON_AddStringToObject(item, "smContextRef", pdu_session_context->sm_context_ref) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [sm_context_ref]"); + goto end; + } + + if (!pdu_session_context->s_nssai) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_context->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (!pdu_session_context->dnn) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [dnn]"); + goto end; + } + if (cJSON_AddStringToObject(item, "dnn", pdu_session_context->dnn) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [dnn]"); + goto end; + } + + if (!pdu_session_context->access_type) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [access_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(pdu_session_context->access_type)) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [access_type]"); + goto end; + } + + if (pdu_session_context->additional_access_type) { + if (cJSON_AddStringToObject(item, "additionalAccessType", OpenAPI_access_type_ToString(pdu_session_context->additional_access_type)) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [additional_access_type]"); + goto end; + } + } + + if (pdu_session_context->allocated_ebi_list) { + cJSON *allocated_ebi_listList = cJSON_AddArrayToObject(item, "allocatedEbiList"); + if (allocated_ebi_listList == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [allocated_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *allocated_ebi_list_node; + if (pdu_session_context->allocated_ebi_list) { + OpenAPI_list_for_each(pdu_session_context->allocated_ebi_list, allocated_ebi_list_node) { + cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(allocated_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [allocated_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(allocated_ebi_listList, itemLocal); + } + } + } + + if (pdu_session_context->hsmf_id) { + if (cJSON_AddStringToObject(item, "hsmfId", pdu_session_context->hsmf_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [hsmf_id]"); + goto end; + } + } + + if (pdu_session_context->hsmf_set_id) { + if (cJSON_AddStringToObject(item, "hsmfSetId", pdu_session_context->hsmf_set_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [hsmf_set_id]"); + goto end; + } + } + + if (pdu_session_context->hsmf_service_set_id) { + if (cJSON_AddStringToObject(item, "hsmfServiceSetId", pdu_session_context->hsmf_service_set_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [hsmf_service_set_id]"); + goto end; + } + } + + if (pdu_session_context->smf_binding) { + if (cJSON_AddStringToObject(item, "smfBinding", OpenAPI_sbi_binding_level_ToString(pdu_session_context->smf_binding)) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [smf_binding]"); + goto end; + } + } + + if (pdu_session_context->vsmf_id) { + if (cJSON_AddStringToObject(item, "vsmfId", pdu_session_context->vsmf_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [vsmf_id]"); + goto end; + } + } + + if (pdu_session_context->vsmf_set_id) { + if (cJSON_AddStringToObject(item, "vsmfSetId", pdu_session_context->vsmf_set_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [vsmf_set_id]"); + goto end; + } + } + + if (pdu_session_context->vsmf_service_set_id) { + if (cJSON_AddStringToObject(item, "vsmfServiceSetId", pdu_session_context->vsmf_service_set_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [vsmf_service_set_id]"); + goto end; + } + } + + if (pdu_session_context->vsmf_binding) { + if (cJSON_AddStringToObject(item, "vsmfBinding", OpenAPI_sbi_binding_level_ToString(pdu_session_context->vsmf_binding)) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [vsmf_binding]"); + goto end; + } + } + + if (pdu_session_context->ismf_id) { + if (cJSON_AddStringToObject(item, "ismfId", pdu_session_context->ismf_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [ismf_id]"); + goto end; + } + } + + if (pdu_session_context->ismf_set_id) { + if (cJSON_AddStringToObject(item, "ismfSetId", pdu_session_context->ismf_set_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [ismf_set_id]"); + goto end; + } + } + + if (pdu_session_context->ismf_service_set_id) { + if (cJSON_AddStringToObject(item, "ismfServiceSetId", pdu_session_context->ismf_service_set_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [ismf_service_set_id]"); + goto end; + } + } + + if (pdu_session_context->ismf_binding) { + if (cJSON_AddStringToObject(item, "ismfBinding", OpenAPI_sbi_binding_level_ToString(pdu_session_context->ismf_binding)) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [ismf_binding]"); + goto end; + } + } + + if (pdu_session_context->ns_instance) { + if (cJSON_AddStringToObject(item, "nsInstance", pdu_session_context->ns_instance) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [ns_instance]"); + goto end; + } + } + + if (pdu_session_context->smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "smfServiceInstanceId", pdu_session_context->smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [smf_service_instance_id]"); + goto end; + } + } + + if (pdu_session_context->ma_pdu_session) { + if (cJSON_AddBoolToObject(item, "maPduSession", pdu_session_context->ma_pdu_session) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [ma_pdu_session]"); + goto end; + } + } + + if (pdu_session_context->cn_assisted_ran_para) { + cJSON *cn_assisted_ran_para_local_JSON = OpenAPI_cn_assisted_ran_para_convertToJSON(pdu_session_context->cn_assisted_ran_para); + if (cn_assisted_ran_para_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [cn_assisted_ran_para]"); + goto end; + } + cJSON_AddItemToObject(item, "cnAssistedRanPara", cn_assisted_ran_para_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [cn_assisted_ran_para]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *pdu_session_contextJSON) +{ + OpenAPI_pdu_session_context_t *pdu_session_context_local_var = NULL; + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "pduSessionId"); + if (!pdu_session_id) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + cJSON *sm_context_ref = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smContextRef"); + if (!sm_context_ref) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [sm_context_ref]"); + goto end; + } + + + if (!cJSON_IsString(sm_context_ref)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [sm_context_ref]"); + goto end; + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [s_nssai]"); + goto end; + } + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [dnn]"); + goto end; + } + + + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [dnn]"); + goto end; + } + + cJSON *access_type = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "accessType"); + if (!access_type) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [access_type]"); + goto end; + } + + OpenAPI_access_type_e access_typeVariable; + + if (!cJSON_IsString(access_type)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [access_type]"); + goto end; + } + access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring); + + cJSON *additional_access_type = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "additionalAccessType"); + + OpenAPI_access_type_e additional_access_typeVariable; + if (additional_access_type) { + if (!cJSON_IsString(additional_access_type)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [additional_access_type]"); + goto end; + } + additional_access_typeVariable = OpenAPI_access_type_FromString(additional_access_type->valuestring); + } + + cJSON *allocated_ebi_list = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "allocatedEbiList"); + + OpenAPI_list_t *allocated_ebi_listList; + if (allocated_ebi_list) { + cJSON *allocated_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(allocated_ebi_list)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [allocated_ebi_list]"); + goto end; + } + + allocated_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allocated_ebi_list_local_nonprimitive, allocated_ebi_list ) { + if (!cJSON_IsObject(allocated_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [allocated_ebi_list]"); + goto end; + } + OpenAPI_ebi_arp_mapping_t *allocated_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(allocated_ebi_list_local_nonprimitive); + + OpenAPI_list_add(allocated_ebi_listList, allocated_ebi_listItem); + } + } + + cJSON *hsmf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfId"); + + if (hsmf_id) { + if (!cJSON_IsString(hsmf_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [hsmf_id]"); + goto end; + } + } + + cJSON *hsmf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfSetId"); + + if (hsmf_set_id) { + if (!cJSON_IsString(hsmf_set_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [hsmf_set_id]"); + goto end; + } + } + + cJSON *hsmf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfServiceSetId"); + + if (hsmf_service_set_id) { + if (!cJSON_IsString(hsmf_service_set_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [hsmf_service_set_id]"); + goto end; + } + } + + cJSON *smf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smfBinding"); + + OpenAPI_sbi_binding_level_e smf_bindingVariable; + if (smf_binding) { + if (!cJSON_IsString(smf_binding)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [smf_binding]"); + goto end; + } + smf_bindingVariable = OpenAPI_sbi_binding_level_FromString(smf_binding->valuestring); + } + + cJSON *vsmf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfId"); + + if (vsmf_id) { + if (!cJSON_IsString(vsmf_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_id]"); + goto end; + } + } + + cJSON *vsmf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfSetId"); + + if (vsmf_set_id) { + if (!cJSON_IsString(vsmf_set_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_set_id]"); + goto end; + } + } + + cJSON *vsmf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfServiceSetId"); + + if (vsmf_service_set_id) { + if (!cJSON_IsString(vsmf_service_set_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_service_set_id]"); + goto end; + } + } + + cJSON *vsmf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfBinding"); + + OpenAPI_sbi_binding_level_e vsmf_bindingVariable; + if (vsmf_binding) { + if (!cJSON_IsString(vsmf_binding)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_binding]"); + goto end; + } + vsmf_bindingVariable = OpenAPI_sbi_binding_level_FromString(vsmf_binding->valuestring); + } + + cJSON *ismf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfId"); + + if (ismf_id) { + if (!cJSON_IsString(ismf_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_id]"); + goto end; + } + } + + cJSON *ismf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfSetId"); + + if (ismf_set_id) { + if (!cJSON_IsString(ismf_set_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_set_id]"); + goto end; + } + } + + cJSON *ismf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfServiceSetId"); + + if (ismf_service_set_id) { + if (!cJSON_IsString(ismf_service_set_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_service_set_id]"); + goto end; + } + } + + cJSON *ismf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfBinding"); + + OpenAPI_sbi_binding_level_e ismf_bindingVariable; + if (ismf_binding) { + if (!cJSON_IsString(ismf_binding)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_binding]"); + goto end; + } + ismf_bindingVariable = OpenAPI_sbi_binding_level_FromString(ismf_binding->valuestring); + } + + cJSON *ns_instance = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "nsInstance"); + + if (ns_instance) { + if (!cJSON_IsString(ns_instance)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ns_instance]"); + goto end; + } + } + + cJSON *smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smfServiceInstanceId"); + + if (smf_service_instance_id) { + if (!cJSON_IsString(smf_service_instance_id)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [smf_service_instance_id]"); + goto end; + } + } + + cJSON *ma_pdu_session = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "maPduSession"); + + if (ma_pdu_session) { + if (!cJSON_IsBool(ma_pdu_session)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ma_pdu_session]"); + goto end; + } + } + + cJSON *cn_assisted_ran_para = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "cnAssistedRanPara"); + + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_nonprim = NULL; + if (cn_assisted_ran_para) { + cn_assisted_ran_para_local_nonprim = OpenAPI_cn_assisted_ran_para_parseFromJSON(cn_assisted_ran_para); + } + + pdu_session_context_local_var = OpenAPI_pdu_session_context_create ( + pdu_session_id->valuedouble, + ogs_strdup(sm_context_ref->valuestring), + s_nssai_local_nonprim, + ogs_strdup(dnn->valuestring), + access_typeVariable, + additional_access_type ? additional_access_typeVariable : 0, + allocated_ebi_list ? allocated_ebi_listList : NULL, + hsmf_id ? ogs_strdup(hsmf_id->valuestring) : NULL, + hsmf_set_id ? ogs_strdup(hsmf_set_id->valuestring) : NULL, + hsmf_service_set_id ? ogs_strdup(hsmf_service_set_id->valuestring) : NULL, + smf_binding ? smf_bindingVariable : 0, + vsmf_id ? ogs_strdup(vsmf_id->valuestring) : NULL, + vsmf_set_id ? ogs_strdup(vsmf_set_id->valuestring) : NULL, + vsmf_service_set_id ? ogs_strdup(vsmf_service_set_id->valuestring) : NULL, + vsmf_binding ? vsmf_bindingVariable : 0, + ismf_id ? ogs_strdup(ismf_id->valuestring) : NULL, + ismf_set_id ? ogs_strdup(ismf_set_id->valuestring) : NULL, + ismf_service_set_id ? ogs_strdup(ismf_service_set_id->valuestring) : NULL, + ismf_binding ? ismf_bindingVariable : 0, + ns_instance ? ogs_strdup(ns_instance->valuestring) : NULL, + smf_service_instance_id ? ogs_strdup(smf_service_instance_id->valuestring) : NULL, + ma_pdu_session ? ma_pdu_session->valueint : 0, + cn_assisted_ran_para ? cn_assisted_ran_para_local_nonprim : NULL + ); + + return pdu_session_context_local_var; +end: + return NULL; +} + +OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_copy(OpenAPI_pdu_session_context_t *dst, OpenAPI_pdu_session_context_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_context_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pdu_session_context_free(dst); + dst = OpenAPI_pdu_session_context_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_context.h b/lib/sbi/openapi/model/pdu_session_context.h new file mode 100644 index 000000000..4c5ab2764 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_context.h @@ -0,0 +1,87 @@ +/* + * pdu_session_context.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_context_H_ +#define _OpenAPI_pdu_session_context_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "cn_assisted_ran_para.h" +#include "ebi_arp_mapping.h" +#include "sbi_binding_level.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_context_s OpenAPI_pdu_session_context_t; +typedef struct OpenAPI_pdu_session_context_s { + int pdu_session_id; + char *sm_context_ref; + struct OpenAPI_snssai_s *s_nssai; + char *dnn; + OpenAPI_access_type_e access_type; + OpenAPI_access_type_e additional_access_type; + OpenAPI_list_t *allocated_ebi_list; + char *hsmf_id; + char *hsmf_set_id; + char *hsmf_service_set_id; + OpenAPI_sbi_binding_level_e smf_binding; + char *vsmf_id; + char *vsmf_set_id; + char *vsmf_service_set_id; + OpenAPI_sbi_binding_level_e vsmf_binding; + char *ismf_id; + char *ismf_set_id; + char *ismf_service_set_id; + OpenAPI_sbi_binding_level_e ismf_binding; + char *ns_instance; + char *smf_service_instance_id; + int ma_pdu_session; + struct OpenAPI_cn_assisted_ran_para_s *cn_assisted_ran_para; +} OpenAPI_pdu_session_context_t; + +OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_create( + int pdu_session_id, + char *sm_context_ref, + OpenAPI_snssai_t *s_nssai, + char *dnn, + OpenAPI_access_type_e access_type, + OpenAPI_access_type_e additional_access_type, + OpenAPI_list_t *allocated_ebi_list, + char *hsmf_id, + char *hsmf_set_id, + char *hsmf_service_set_id, + OpenAPI_sbi_binding_level_e smf_binding, + char *vsmf_id, + char *vsmf_set_id, + char *vsmf_service_set_id, + OpenAPI_sbi_binding_level_e vsmf_binding, + char *ismf_id, + char *ismf_set_id, + char *ismf_service_set_id, + OpenAPI_sbi_binding_level_e ismf_binding, + char *ns_instance, + char *smf_service_instance_id, + int ma_pdu_session, + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para + ); +void OpenAPI_pdu_session_context_free(OpenAPI_pdu_session_context_t *pdu_session_context); +OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *pdu_session_contextJSON); +cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *pdu_session_context); +OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_copy(OpenAPI_pdu_session_context_t *dst, OpenAPI_pdu_session_context_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_context_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_create_data.c b/lib/sbi/openapi/model/pdu_session_create_data.c new file mode 100644 index 000000000..ff6d3d25f --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_create_data.c @@ -0,0 +1,1399 @@ + +#include +#include +#include +#include "pdu_session_create_data.h" + +OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( + char *supi, + int unauthenticated_supi, + char *pei, + int pdu_session_id, + char *dnn, + OpenAPI_snssai_t *s_nssai, + char *vsmf_id, + char *ismf_id, + OpenAPI_plmn_id_nid_t *serving_network, + OpenAPI_request_type_t *request_type, + OpenAPI_list_t *eps_bearer_id, + char pgw_s8c_fteid, + char *vsmf_pdu_session_uri, + char *ismf_pdu_session_uri, + OpenAPI_tunnel_info_t *vcn_tunnel_info, + OpenAPI_tunnel_info_t *icn_tunnel_info, + OpenAPI_tunnel_info_t *n9_forwarding_tunnel_info, + OpenAPI_tunnel_info_t *additional_cn_tunnel_info, + OpenAPI_access_type_e an_type, + OpenAPI_access_type_e additional_an_type, + OpenAPI_rat_type_e rat_type, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + char *gpsi, + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue, + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info, + char *supported_features, + char *h_pcf_id, + char *pcf_id, + char *pcf_group_id, + char *pcf_set_id, + int ho_preparation_indication, + OpenAPI_dnn_selection_mode_t *sel_mode, + int always_on_requested, + char *udm_group_id, + char *routing_indicator, + OpenAPI_eps_interworking_indication_t *eps_interworking_ind, + char *v_smf_service_instance_id, + char *i_smf_service_instance_id, + char *recovery_time, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + char *charging_id, + int old_pdu_session_id, + char *eps_bearer_ctx_status, + char *amf_nf_id, + OpenAPI_guami_t *guami, + int cp_ciot_enabled, + int cp_only_ind, + int invoke_nef, + int ma_request_ind, + int ma_nw_upgrade_ind, + OpenAPI_list_t *dnai_list, + OpenAPI_presence_state_t *presence_in_ladn, + OpenAPI_list_t *secondary_rat_usage_info, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status, + int dl_serving_plmn_rate_ctl + ) +{ + OpenAPI_pdu_session_create_data_t *pdu_session_create_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_create_data_t)); + if (!pdu_session_create_data_local_var) { + return NULL; + } + pdu_session_create_data_local_var->supi = supi; + pdu_session_create_data_local_var->unauthenticated_supi = unauthenticated_supi; + pdu_session_create_data_local_var->pei = pei; + pdu_session_create_data_local_var->pdu_session_id = pdu_session_id; + pdu_session_create_data_local_var->dnn = dnn; + pdu_session_create_data_local_var->s_nssai = s_nssai; + pdu_session_create_data_local_var->vsmf_id = vsmf_id; + pdu_session_create_data_local_var->ismf_id = ismf_id; + pdu_session_create_data_local_var->serving_network = serving_network; + pdu_session_create_data_local_var->request_type = request_type; + pdu_session_create_data_local_var->eps_bearer_id = eps_bearer_id; + pdu_session_create_data_local_var->pgw_s8c_fteid = pgw_s8c_fteid; + pdu_session_create_data_local_var->vsmf_pdu_session_uri = vsmf_pdu_session_uri; + pdu_session_create_data_local_var->ismf_pdu_session_uri = ismf_pdu_session_uri; + pdu_session_create_data_local_var->vcn_tunnel_info = vcn_tunnel_info; + pdu_session_create_data_local_var->icn_tunnel_info = icn_tunnel_info; + pdu_session_create_data_local_var->n9_forwarding_tunnel_info = n9_forwarding_tunnel_info; + pdu_session_create_data_local_var->additional_cn_tunnel_info = additional_cn_tunnel_info; + pdu_session_create_data_local_var->an_type = an_type; + pdu_session_create_data_local_var->additional_an_type = additional_an_type; + pdu_session_create_data_local_var->rat_type = rat_type; + pdu_session_create_data_local_var->ue_location = ue_location; + pdu_session_create_data_local_var->ue_time_zone = ue_time_zone; + pdu_session_create_data_local_var->add_ue_location = add_ue_location; + pdu_session_create_data_local_var->gpsi = gpsi; + pdu_session_create_data_local_var->n1_sm_info_from_ue = n1_sm_info_from_ue; + pdu_session_create_data_local_var->unknown_n1_sm_info = unknown_n1_sm_info; + pdu_session_create_data_local_var->supported_features = supported_features; + pdu_session_create_data_local_var->h_pcf_id = h_pcf_id; + pdu_session_create_data_local_var->pcf_id = pcf_id; + pdu_session_create_data_local_var->pcf_group_id = pcf_group_id; + pdu_session_create_data_local_var->pcf_set_id = pcf_set_id; + pdu_session_create_data_local_var->ho_preparation_indication = ho_preparation_indication; + pdu_session_create_data_local_var->sel_mode = sel_mode; + pdu_session_create_data_local_var->always_on_requested = always_on_requested; + pdu_session_create_data_local_var->udm_group_id = udm_group_id; + pdu_session_create_data_local_var->routing_indicator = routing_indicator; + pdu_session_create_data_local_var->eps_interworking_ind = eps_interworking_ind; + pdu_session_create_data_local_var->v_smf_service_instance_id = v_smf_service_instance_id; + pdu_session_create_data_local_var->i_smf_service_instance_id = i_smf_service_instance_id; + pdu_session_create_data_local_var->recovery_time = recovery_time; + pdu_session_create_data_local_var->roaming_charging_profile = roaming_charging_profile; + pdu_session_create_data_local_var->charging_id = charging_id; + pdu_session_create_data_local_var->old_pdu_session_id = old_pdu_session_id; + pdu_session_create_data_local_var->eps_bearer_ctx_status = eps_bearer_ctx_status; + pdu_session_create_data_local_var->amf_nf_id = amf_nf_id; + pdu_session_create_data_local_var->guami = guami; + pdu_session_create_data_local_var->cp_ciot_enabled = cp_ciot_enabled; + pdu_session_create_data_local_var->cp_only_ind = cp_only_ind; + pdu_session_create_data_local_var->invoke_nef = invoke_nef; + pdu_session_create_data_local_var->ma_request_ind = ma_request_ind; + pdu_session_create_data_local_var->ma_nw_upgrade_ind = ma_nw_upgrade_ind; + pdu_session_create_data_local_var->dnai_list = dnai_list; + pdu_session_create_data_local_var->presence_in_ladn = presence_in_ladn; + pdu_session_create_data_local_var->secondary_rat_usage_info = secondary_rat_usage_info; + pdu_session_create_data_local_var->small_data_rate_status = small_data_rate_status; + pdu_session_create_data_local_var->apn_rate_status = apn_rate_status; + pdu_session_create_data_local_var->dl_serving_plmn_rate_ctl = dl_serving_plmn_rate_ctl; + + return pdu_session_create_data_local_var; +} + +void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu_session_create_data) +{ + if (NULL == pdu_session_create_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(pdu_session_create_data->supi); + ogs_free(pdu_session_create_data->pei); + ogs_free(pdu_session_create_data->dnn); + OpenAPI_snssai_free(pdu_session_create_data->s_nssai); + ogs_free(pdu_session_create_data->vsmf_id); + ogs_free(pdu_session_create_data->ismf_id); + OpenAPI_plmn_id_nid_free(pdu_session_create_data->serving_network); + OpenAPI_request_type_free(pdu_session_create_data->request_type); + OpenAPI_list_for_each(pdu_session_create_data->eps_bearer_id, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pdu_session_create_data->eps_bearer_id); + ogs_free(pdu_session_create_data->vsmf_pdu_session_uri); + ogs_free(pdu_session_create_data->ismf_pdu_session_uri); + OpenAPI_tunnel_info_free(pdu_session_create_data->vcn_tunnel_info); + OpenAPI_tunnel_info_free(pdu_session_create_data->icn_tunnel_info); + OpenAPI_tunnel_info_free(pdu_session_create_data->n9_forwarding_tunnel_info); + OpenAPI_tunnel_info_free(pdu_session_create_data->additional_cn_tunnel_info); + OpenAPI_user_location_free(pdu_session_create_data->ue_location); + ogs_free(pdu_session_create_data->ue_time_zone); + OpenAPI_user_location_free(pdu_session_create_data->add_ue_location); + ogs_free(pdu_session_create_data->gpsi); + OpenAPI_ref_to_binary_data_free(pdu_session_create_data->n1_sm_info_from_ue); + OpenAPI_ref_to_binary_data_free(pdu_session_create_data->unknown_n1_sm_info); + ogs_free(pdu_session_create_data->supported_features); + ogs_free(pdu_session_create_data->h_pcf_id); + ogs_free(pdu_session_create_data->pcf_id); + ogs_free(pdu_session_create_data->pcf_group_id); + ogs_free(pdu_session_create_data->pcf_set_id); + OpenAPI_dnn_selection_mode_free(pdu_session_create_data->sel_mode); + ogs_free(pdu_session_create_data->udm_group_id); + ogs_free(pdu_session_create_data->routing_indicator); + OpenAPI_eps_interworking_indication_free(pdu_session_create_data->eps_interworking_ind); + ogs_free(pdu_session_create_data->v_smf_service_instance_id); + ogs_free(pdu_session_create_data->i_smf_service_instance_id); + ogs_free(pdu_session_create_data->recovery_time); + OpenAPI_roaming_charging_profile_free(pdu_session_create_data->roaming_charging_profile); + ogs_free(pdu_session_create_data->charging_id); + ogs_free(pdu_session_create_data->eps_bearer_ctx_status); + ogs_free(pdu_session_create_data->amf_nf_id); + OpenAPI_guami_free(pdu_session_create_data->guami); + OpenAPI_list_for_each(pdu_session_create_data->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pdu_session_create_data->dnai_list); + OpenAPI_presence_state_free(pdu_session_create_data->presence_in_ladn); + OpenAPI_list_for_each(pdu_session_create_data->secondary_rat_usage_info, node) { + OpenAPI_secondary_rat_usage_info_free(node->data); + } + OpenAPI_list_free(pdu_session_create_data->secondary_rat_usage_info); + OpenAPI_small_data_rate_status_free(pdu_session_create_data->small_data_rate_status); + OpenAPI_apn_rate_status_free(pdu_session_create_data->apn_rate_status); + ogs_free(pdu_session_create_data); +} + +cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_data_t *pdu_session_create_data) +{ + cJSON *item = NULL; + + if (pdu_session_create_data == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [PduSessionCreateData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pdu_session_create_data->supi) { + if (cJSON_AddStringToObject(item, "supi", pdu_session_create_data->supi) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [supi]"); + goto end; + } + } + + if (pdu_session_create_data->unauthenticated_supi) { + if (cJSON_AddBoolToObject(item, "unauthenticatedSupi", pdu_session_create_data->unauthenticated_supi) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [unauthenticated_supi]"); + goto end; + } + } + + if (pdu_session_create_data->pei) { + if (cJSON_AddStringToObject(item, "pei", pdu_session_create_data->pei) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [pei]"); + goto end; + } + } + + if (pdu_session_create_data->pdu_session_id) { + if (cJSON_AddNumberToObject(item, "pduSessionId", pdu_session_create_data->pdu_session_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + } + + if (!pdu_session_create_data->dnn) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [dnn]"); + goto end; + } + if (cJSON_AddStringToObject(item, "dnn", pdu_session_create_data->dnn) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [dnn]"); + goto end; + } + + if (pdu_session_create_data->s_nssai) { + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_create_data->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [s_nssai]"); + goto end; + } + } + + if (pdu_session_create_data->vsmf_id) { + if (cJSON_AddStringToObject(item, "vsmfId", pdu_session_create_data->vsmf_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [vsmf_id]"); + goto end; + } + } + + if (pdu_session_create_data->ismf_id) { + if (cJSON_AddStringToObject(item, "ismfId", pdu_session_create_data->ismf_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [ismf_id]"); + goto end; + } + } + + if (!pdu_session_create_data->serving_network) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [serving_network]"); + goto end; + } + cJSON *serving_network_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(pdu_session_create_data->serving_network); + if (serving_network_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [serving_network]"); + goto end; + } + cJSON_AddItemToObject(item, "servingNetwork", serving_network_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [serving_network]"); + goto end; + } + + if (pdu_session_create_data->request_type) { + cJSON *request_type_local_JSON = OpenAPI_request_type_convertToJSON(pdu_session_create_data->request_type); + if (request_type_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [request_type]"); + goto end; + } + cJSON_AddItemToObject(item, "requestType", request_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [request_type]"); + goto end; + } + } + + if (pdu_session_create_data->eps_bearer_id) { + cJSON *eps_bearer_id = cJSON_AddArrayToObject(item, "epsBearerId"); + if (eps_bearer_id == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [eps_bearer_id]"); + goto end; + } + + OpenAPI_lnode_t *eps_bearer_id_node; + OpenAPI_list_for_each(pdu_session_create_data->eps_bearer_id, eps_bearer_id_node) { + if (cJSON_AddNumberToObject(eps_bearer_id, "", *(double *)eps_bearer_id_node->data) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [eps_bearer_id]"); + goto end; + } + } + } + + if (pdu_session_create_data->pgw_s8c_fteid) { + if (cJSON_AddNumberToObject(item, "pgwS8cFteid", pdu_session_create_data->pgw_s8c_fteid) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [pgw_s8c_fteid]"); + goto end; + } + } + + if (pdu_session_create_data->vsmf_pdu_session_uri) { + if (cJSON_AddStringToObject(item, "vsmfPduSessionUri", pdu_session_create_data->vsmf_pdu_session_uri) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [vsmf_pdu_session_uri]"); + goto end; + } + } + + if (pdu_session_create_data->ismf_pdu_session_uri) { + if (cJSON_AddStringToObject(item, "ismfPduSessionUri", pdu_session_create_data->ismf_pdu_session_uri) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [ismf_pdu_session_uri]"); + goto end; + } + } + + if (pdu_session_create_data->vcn_tunnel_info) { + cJSON *vcn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(pdu_session_create_data->vcn_tunnel_info); + if (vcn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [vcn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "vcnTunnelInfo", vcn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [vcn_tunnel_info]"); + goto end; + } + } + + if (pdu_session_create_data->icn_tunnel_info) { + cJSON *icn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(pdu_session_create_data->icn_tunnel_info); + if (icn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [icn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "icnTunnelInfo", icn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [icn_tunnel_info]"); + goto end; + } + } + + if (pdu_session_create_data->n9_forwarding_tunnel_info) { + cJSON *n9_forwarding_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(pdu_session_create_data->n9_forwarding_tunnel_info); + if (n9_forwarding_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [n9_forwarding_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n9ForwardingTunnelInfo", n9_forwarding_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [n9_forwarding_tunnel_info]"); + goto end; + } + } + + if (pdu_session_create_data->additional_cn_tunnel_info) { + cJSON *additional_cn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(pdu_session_create_data->additional_cn_tunnel_info); + if (additional_cn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [additional_cn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "additionalCnTunnelInfo", additional_cn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [additional_cn_tunnel_info]"); + goto end; + } + } + + if (!pdu_session_create_data->an_type) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [an_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "anType", OpenAPI_access_type_ToString(pdu_session_create_data->an_type)) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [an_type]"); + goto end; + } + + if (pdu_session_create_data->additional_an_type) { + if (cJSON_AddStringToObject(item, "additionalAnType", OpenAPI_access_type_ToString(pdu_session_create_data->additional_an_type)) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [additional_an_type]"); + goto end; + } + } + + if (pdu_session_create_data->rat_type) { + if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(pdu_session_create_data->rat_type)) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [rat_type]"); + goto end; + } + } + + if (pdu_session_create_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(pdu_session_create_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + + if (pdu_session_create_data->ue_time_zone) { + if (cJSON_AddStringToObject(item, "ueTimeZone", pdu_session_create_data->ue_time_zone) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [ue_time_zone]"); + goto end; + } + } + + if (pdu_session_create_data->add_ue_location) { + cJSON *add_ue_location_local_JSON = OpenAPI_user_location_convertToJSON(pdu_session_create_data->add_ue_location); + if (add_ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "addUeLocation", add_ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + } + + if (pdu_session_create_data->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", pdu_session_create_data->gpsi) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (pdu_session_create_data->n1_sm_info_from_ue) { + cJSON *n1_sm_info_from_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(pdu_session_create_data->n1_sm_info_from_ue); + if (n1_sm_info_from_ue_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [n1_sm_info_from_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoFromUe", n1_sm_info_from_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [n1_sm_info_from_ue]"); + goto end; + } + } + + if (pdu_session_create_data->unknown_n1_sm_info) { + cJSON *unknown_n1_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(pdu_session_create_data->unknown_n1_sm_info); + if (unknown_n1_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [unknown_n1_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "unknownN1SmInfo", unknown_n1_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [unknown_n1_sm_info]"); + goto end; + } + } + + if (pdu_session_create_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pdu_session_create_data->supported_features) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (pdu_session_create_data->h_pcf_id) { + if (cJSON_AddStringToObject(item, "hPcfId", pdu_session_create_data->h_pcf_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [h_pcf_id]"); + goto end; + } + } + + if (pdu_session_create_data->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", pdu_session_create_data->pcf_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (pdu_session_create_data->pcf_group_id) { + if (cJSON_AddStringToObject(item, "pcfGroupId", pdu_session_create_data->pcf_group_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [pcf_group_id]"); + goto end; + } + } + + if (pdu_session_create_data->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", pdu_session_create_data->pcf_set_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (pdu_session_create_data->ho_preparation_indication) { + if (cJSON_AddBoolToObject(item, "hoPreparationIndication", pdu_session_create_data->ho_preparation_indication) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [ho_preparation_indication]"); + goto end; + } + } + + if (pdu_session_create_data->sel_mode) { + cJSON *sel_mode_local_JSON = OpenAPI_dnn_selection_mode_convertToJSON(pdu_session_create_data->sel_mode); + if (sel_mode_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [sel_mode]"); + goto end; + } + cJSON_AddItemToObject(item, "selMode", sel_mode_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [sel_mode]"); + goto end; + } + } + + if (pdu_session_create_data->always_on_requested) { + if (cJSON_AddBoolToObject(item, "alwaysOnRequested", pdu_session_create_data->always_on_requested) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [always_on_requested]"); + goto end; + } + } + + if (pdu_session_create_data->udm_group_id) { + if (cJSON_AddStringToObject(item, "udmGroupId", pdu_session_create_data->udm_group_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [udm_group_id]"); + goto end; + } + } + + if (pdu_session_create_data->routing_indicator) { + if (cJSON_AddStringToObject(item, "routingIndicator", pdu_session_create_data->routing_indicator) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [routing_indicator]"); + goto end; + } + } + + if (pdu_session_create_data->eps_interworking_ind) { + cJSON *eps_interworking_ind_local_JSON = OpenAPI_eps_interworking_indication_convertToJSON(pdu_session_create_data->eps_interworking_ind); + if (eps_interworking_ind_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [eps_interworking_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "epsInterworkingInd", eps_interworking_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [eps_interworking_ind]"); + goto end; + } + } + + if (pdu_session_create_data->v_smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "vSmfServiceInstanceId", pdu_session_create_data->v_smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [v_smf_service_instance_id]"); + goto end; + } + } + + if (pdu_session_create_data->i_smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "iSmfServiceInstanceId", pdu_session_create_data->i_smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [i_smf_service_instance_id]"); + goto end; + } + } + + if (pdu_session_create_data->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", pdu_session_create_data->recovery_time) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (pdu_session_create_data->roaming_charging_profile) { + cJSON *roaming_charging_profile_local_JSON = OpenAPI_roaming_charging_profile_convertToJSON(pdu_session_create_data->roaming_charging_profile); + if (roaming_charging_profile_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "roamingChargingProfile", roaming_charging_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + } + + if (pdu_session_create_data->charging_id) { + if (cJSON_AddStringToObject(item, "chargingId", pdu_session_create_data->charging_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [charging_id]"); + goto end; + } + } + + if (pdu_session_create_data->old_pdu_session_id) { + if (cJSON_AddNumberToObject(item, "oldPduSessionId", pdu_session_create_data->old_pdu_session_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [old_pdu_session_id]"); + goto end; + } + } + + if (pdu_session_create_data->eps_bearer_ctx_status) { + if (cJSON_AddStringToObject(item, "epsBearerCtxStatus", pdu_session_create_data->eps_bearer_ctx_status) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [eps_bearer_ctx_status]"); + goto end; + } + } + + if (pdu_session_create_data->amf_nf_id) { + if (cJSON_AddStringToObject(item, "amfNfId", pdu_session_create_data->amf_nf_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [amf_nf_id]"); + goto end; + } + } + + if (pdu_session_create_data->guami) { + cJSON *guami_local_JSON = OpenAPI_guami_convertToJSON(pdu_session_create_data->guami); + if (guami_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [guami]"); + goto end; + } + cJSON_AddItemToObject(item, "guami", guami_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [guami]"); + goto end; + } + } + + if (pdu_session_create_data->cp_ciot_enabled) { + if (cJSON_AddBoolToObject(item, "cpCiotEnabled", pdu_session_create_data->cp_ciot_enabled) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [cp_ciot_enabled]"); + goto end; + } + } + + if (pdu_session_create_data->cp_only_ind) { + if (cJSON_AddBoolToObject(item, "cpOnlyInd", pdu_session_create_data->cp_only_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [cp_only_ind]"); + goto end; + } + } + + if (pdu_session_create_data->invoke_nef) { + if (cJSON_AddBoolToObject(item, "invokeNef", pdu_session_create_data->invoke_nef) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [invoke_nef]"); + goto end; + } + } + + if (pdu_session_create_data->ma_request_ind) { + if (cJSON_AddBoolToObject(item, "maRequestInd", pdu_session_create_data->ma_request_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [ma_request_ind]"); + goto end; + } + } + + if (pdu_session_create_data->ma_nw_upgrade_ind) { + if (cJSON_AddBoolToObject(item, "maNwUpgradeInd", pdu_session_create_data->ma_nw_upgrade_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [ma_nw_upgrade_ind]"); + goto end; + } + } + + if (pdu_session_create_data->dnai_list) { + cJSON *dnai_list = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_list == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [dnai_list]"); + goto end; + } + + OpenAPI_lnode_t *dnai_list_node; + OpenAPI_list_for_each(pdu_session_create_data->dnai_list, dnai_list_node) { + if (cJSON_AddStringToObject(dnai_list, "", (char*)dnai_list_node->data) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (pdu_session_create_data->presence_in_ladn) { + cJSON *presence_in_ladn_local_JSON = OpenAPI_presence_state_convertToJSON(pdu_session_create_data->presence_in_ladn); + if (presence_in_ladn_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [presence_in_ladn]"); + goto end; + } + cJSON_AddItemToObject(item, "presenceInLadn", presence_in_ladn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [presence_in_ladn]"); + goto end; + } + } + + if (pdu_session_create_data->secondary_rat_usage_info) { + cJSON *secondary_rat_usage_infoList = cJSON_AddArrayToObject(item, "secondaryRatUsageInfo"); + if (secondary_rat_usage_infoList == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [secondary_rat_usage_info]"); + goto end; + } + + OpenAPI_lnode_t *secondary_rat_usage_info_node; + if (pdu_session_create_data->secondary_rat_usage_info) { + OpenAPI_list_for_each(pdu_session_create_data->secondary_rat_usage_info, secondary_rat_usage_info_node) { + cJSON *itemLocal = OpenAPI_secondary_rat_usage_info_convertToJSON(secondary_rat_usage_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [secondary_rat_usage_info]"); + goto end; + } + cJSON_AddItemToArray(secondary_rat_usage_infoList, itemLocal); + } + } + } + + if (pdu_session_create_data->small_data_rate_status) { + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(pdu_session_create_data->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "smallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + } + + if (pdu_session_create_data->apn_rate_status) { + cJSON *apn_rate_status_local_JSON = OpenAPI_apn_rate_status_convertToJSON(pdu_session_create_data->apn_rate_status); + if (apn_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "apnRateStatus", apn_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + } + + if (pdu_session_create_data->dl_serving_plmn_rate_ctl) { + if (cJSON_AddNumberToObject(item, "dlServingPlmnRateCtl", pdu_session_create_data->dl_serving_plmn_rate_ctl) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [dl_serving_plmn_rate_ctl]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON(cJSON *pdu_session_create_dataJSON) +{ + OpenAPI_pdu_session_create_data_t *pdu_session_create_data_local_var = NULL; + cJSON *supi = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "supi"); + + if (supi) { + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [supi]"); + goto end; + } + } + + cJSON *unauthenticated_supi = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "unauthenticatedSupi"); + + if (unauthenticated_supi) { + if (!cJSON_IsBool(unauthenticated_supi)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [unauthenticated_supi]"); + goto end; + } + } + + cJSON *pei = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "pei"); + + if (pei) { + if (!cJSON_IsString(pei)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [pei]"); + goto end; + } + } + + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "pduSessionId"); + + if (pdu_session_id) { + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + } + + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [dnn]"); + goto end; + } + + + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [dnn]"); + goto end; + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "sNssai"); + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + if (s_nssai) { + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + } + + cJSON *vsmf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "vsmfId"); + + if (vsmf_id) { + if (!cJSON_IsString(vsmf_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [vsmf_id]"); + goto end; + } + } + + cJSON *ismf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "ismfId"); + + if (ismf_id) { + if (!cJSON_IsString(ismf_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [ismf_id]"); + goto end; + } + } + + cJSON *serving_network = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "servingNetwork"); + if (!serving_network) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [serving_network]"); + goto end; + } + + OpenAPI_plmn_id_nid_t *serving_network_local_nonprim = NULL; + + serving_network_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(serving_network); + + cJSON *request_type = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "requestType"); + + OpenAPI_request_type_t *request_type_local_nonprim = NULL; + if (request_type) { + request_type_local_nonprim = OpenAPI_request_type_parseFromJSON(request_type); + } + + cJSON *eps_bearer_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "epsBearerId"); + + OpenAPI_list_t *eps_bearer_idList; + if (eps_bearer_id) { + cJSON *eps_bearer_id_local; + if (!cJSON_IsArray(eps_bearer_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [eps_bearer_id]"); + goto end; + } + eps_bearer_idList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eps_bearer_id_local, eps_bearer_id) { + if (!cJSON_IsNumber(eps_bearer_id_local)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [eps_bearer_id]"); + goto end; + } + OpenAPI_list_add(eps_bearer_idList, &eps_bearer_id_local->valuedouble); + } + } + + cJSON *pgw_s8c_fteid = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "pgwS8cFteid"); + + if (pgw_s8c_fteid) { + if (!cJSON_IsNumber(pgw_s8c_fteid)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [pgw_s8c_fteid]"); + goto end; + } + } + + cJSON *vsmf_pdu_session_uri = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "vsmfPduSessionUri"); + + if (vsmf_pdu_session_uri) { + if (!cJSON_IsString(vsmf_pdu_session_uri)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [vsmf_pdu_session_uri]"); + goto end; + } + } + + cJSON *ismf_pdu_session_uri = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "ismfPduSessionUri"); + + if (ismf_pdu_session_uri) { + if (!cJSON_IsString(ismf_pdu_session_uri)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [ismf_pdu_session_uri]"); + goto end; + } + } + + cJSON *vcn_tunnel_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "vcnTunnelInfo"); + + OpenAPI_tunnel_info_t *vcn_tunnel_info_local_nonprim = NULL; + if (vcn_tunnel_info) { + vcn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(vcn_tunnel_info); + } + + cJSON *icn_tunnel_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "icnTunnelInfo"); + + OpenAPI_tunnel_info_t *icn_tunnel_info_local_nonprim = NULL; + if (icn_tunnel_info) { + icn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(icn_tunnel_info); + } + + cJSON *n9_forwarding_tunnel_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "n9ForwardingTunnelInfo"); + + OpenAPI_tunnel_info_t *n9_forwarding_tunnel_info_local_nonprim = NULL; + if (n9_forwarding_tunnel_info) { + n9_forwarding_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(n9_forwarding_tunnel_info); + } + + cJSON *additional_cn_tunnel_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "additionalCnTunnelInfo"); + + OpenAPI_tunnel_info_t *additional_cn_tunnel_info_local_nonprim = NULL; + if (additional_cn_tunnel_info) { + additional_cn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(additional_cn_tunnel_info); + } + + cJSON *an_type = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "anType"); + if (!an_type) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [an_type]"); + goto end; + } + + OpenAPI_access_type_e an_typeVariable; + + if (!cJSON_IsString(an_type)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [an_type]"); + goto end; + } + an_typeVariable = OpenAPI_access_type_FromString(an_type->valuestring); + + cJSON *additional_an_type = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "additionalAnType"); + + OpenAPI_access_type_e additional_an_typeVariable; + if (additional_an_type) { + if (!cJSON_IsString(additional_an_type)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [additional_an_type]"); + goto end; + } + additional_an_typeVariable = OpenAPI_access_type_FromString(additional_an_type->valuestring); + } + + cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "ratType"); + + OpenAPI_rat_type_e rat_typeVariable; + if (rat_type) { + if (!cJSON_IsString(rat_type)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [rat_type]"); + goto end; + } + rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "ueTimeZone"); + + if (ue_time_zone) { + if (!cJSON_IsString(ue_time_zone)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [ue_time_zone]"); + goto end; + } + } + + cJSON *add_ue_location = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "addUeLocation"); + + OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL; + if (add_ue_location) { + add_ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(add_ue_location); + } + + cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "gpsi"); + + if (gpsi) { + if (!cJSON_IsString(gpsi)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + cJSON *n1_sm_info_from_ue = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "n1SmInfoFromUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue_local_nonprim = NULL; + if (n1_sm_info_from_ue) { + n1_sm_info_from_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_from_ue); + } + + cJSON *unknown_n1_sm_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "unknownN1SmInfo"); + + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info_local_nonprim = NULL; + if (unknown_n1_sm_info) { + unknown_n1_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(unknown_n1_sm_info); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *h_pcf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "hPcfId"); + + if (h_pcf_id) { + if (!cJSON_IsString(h_pcf_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [h_pcf_id]"); + goto end; + } + } + + cJSON *pcf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "pcfId"); + + if (pcf_id) { + if (!cJSON_IsString(pcf_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + cJSON *pcf_group_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "pcfGroupId"); + + if (pcf_group_id) { + if (!cJSON_IsString(pcf_group_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [pcf_group_id]"); + goto end; + } + } + + cJSON *pcf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "pcfSetId"); + + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + cJSON *ho_preparation_indication = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "hoPreparationIndication"); + + if (ho_preparation_indication) { + if (!cJSON_IsBool(ho_preparation_indication)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [ho_preparation_indication]"); + goto end; + } + } + + cJSON *sel_mode = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "selMode"); + + OpenAPI_dnn_selection_mode_t *sel_mode_local_nonprim = NULL; + if (sel_mode) { + sel_mode_local_nonprim = OpenAPI_dnn_selection_mode_parseFromJSON(sel_mode); + } + + cJSON *always_on_requested = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "alwaysOnRequested"); + + if (always_on_requested) { + if (!cJSON_IsBool(always_on_requested)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [always_on_requested]"); + goto end; + } + } + + cJSON *udm_group_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "udmGroupId"); + + if (udm_group_id) { + if (!cJSON_IsString(udm_group_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [udm_group_id]"); + goto end; + } + } + + cJSON *routing_indicator = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "routingIndicator"); + + if (routing_indicator) { + if (!cJSON_IsString(routing_indicator)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [routing_indicator]"); + goto end; + } + } + + cJSON *eps_interworking_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "epsInterworkingInd"); + + OpenAPI_eps_interworking_indication_t *eps_interworking_ind_local_nonprim = NULL; + if (eps_interworking_ind) { + eps_interworking_ind_local_nonprim = OpenAPI_eps_interworking_indication_parseFromJSON(eps_interworking_ind); + } + + cJSON *v_smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "vSmfServiceInstanceId"); + + if (v_smf_service_instance_id) { + if (!cJSON_IsString(v_smf_service_instance_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [v_smf_service_instance_id]"); + goto end; + } + } + + cJSON *i_smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "iSmfServiceInstanceId"); + + if (i_smf_service_instance_id) { + if (!cJSON_IsString(i_smf_service_instance_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [i_smf_service_instance_id]"); + goto end; + } + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + cJSON *roaming_charging_profile = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "roamingChargingProfile"); + + OpenAPI_roaming_charging_profile_t *roaming_charging_profile_local_nonprim = NULL; + if (roaming_charging_profile) { + roaming_charging_profile_local_nonprim = OpenAPI_roaming_charging_profile_parseFromJSON(roaming_charging_profile); + } + + cJSON *charging_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "chargingId"); + + if (charging_id) { + if (!cJSON_IsString(charging_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [charging_id]"); + goto end; + } + } + + cJSON *old_pdu_session_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "oldPduSessionId"); + + if (old_pdu_session_id) { + if (!cJSON_IsNumber(old_pdu_session_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [old_pdu_session_id]"); + goto end; + } + } + + cJSON *eps_bearer_ctx_status = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "epsBearerCtxStatus"); + + if (eps_bearer_ctx_status) { + if (!cJSON_IsString(eps_bearer_ctx_status)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [eps_bearer_ctx_status]"); + goto end; + } + } + + cJSON *amf_nf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "amfNfId"); + + if (amf_nf_id) { + if (!cJSON_IsString(amf_nf_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [amf_nf_id]"); + goto end; + } + } + + cJSON *guami = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "guami"); + + OpenAPI_guami_t *guami_local_nonprim = NULL; + if (guami) { + guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami); + } + + cJSON *cp_ciot_enabled = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "cpCiotEnabled"); + + if (cp_ciot_enabled) { + if (!cJSON_IsBool(cp_ciot_enabled)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [cp_ciot_enabled]"); + goto end; + } + } + + cJSON *cp_only_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "cpOnlyInd"); + + if (cp_only_ind) { + if (!cJSON_IsBool(cp_only_ind)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [cp_only_ind]"); + goto end; + } + } + + cJSON *invoke_nef = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "invokeNef"); + + if (invoke_nef) { + if (!cJSON_IsBool(invoke_nef)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [invoke_nef]"); + goto end; + } + } + + cJSON *ma_request_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "maRequestInd"); + + if (ma_request_ind) { + if (!cJSON_IsBool(ma_request_ind)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [ma_request_ind]"); + goto end; + } + } + + cJSON *ma_nw_upgrade_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "maNwUpgradeInd"); + + if (ma_nw_upgrade_ind) { + if (!cJSON_IsBool(ma_nw_upgrade_ind)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [ma_nw_upgrade_ind]"); + goto end; + } + } + + cJSON *dnai_list = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "dnaiList"); + + OpenAPI_list_t *dnai_listList; + if (dnai_list) { + cJSON *dnai_list_local; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + cJSON *presence_in_ladn = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "presenceInLadn"); + + OpenAPI_presence_state_t *presence_in_ladn_local_nonprim = NULL; + if (presence_in_ladn) { + presence_in_ladn_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_in_ladn); + } + + cJSON *secondary_rat_usage_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "secondaryRatUsageInfo"); + + OpenAPI_list_t *secondary_rat_usage_infoList; + if (secondary_rat_usage_info) { + cJSON *secondary_rat_usage_info_local_nonprimitive; + if (!cJSON_IsArray(secondary_rat_usage_info)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [secondary_rat_usage_info]"); + goto end; + } + + secondary_rat_usage_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_info_local_nonprimitive, secondary_rat_usage_info ) { + if (!cJSON_IsObject(secondary_rat_usage_info_local_nonprimitive)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [secondary_rat_usage_info]"); + goto end; + } + OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_infoItem = OpenAPI_secondary_rat_usage_info_parseFromJSON(secondary_rat_usage_info_local_nonprimitive); + + OpenAPI_list_add(secondary_rat_usage_infoList, secondary_rat_usage_infoItem); + } + } + + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "smallDataRateStatus"); + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + if (small_data_rate_status) { + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + } + + cJSON *apn_rate_status = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "apnRateStatus"); + + OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; + if (apn_rate_status) { + apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); + } + + cJSON *dl_serving_plmn_rate_ctl = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "dlServingPlmnRateCtl"); + + if (dl_serving_plmn_rate_ctl) { + if (!cJSON_IsNumber(dl_serving_plmn_rate_ctl)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [dl_serving_plmn_rate_ctl]"); + goto end; + } + } + + pdu_session_create_data_local_var = OpenAPI_pdu_session_create_data_create ( + supi ? ogs_strdup(supi->valuestring) : NULL, + unauthenticated_supi ? unauthenticated_supi->valueint : 0, + pei ? ogs_strdup(pei->valuestring) : NULL, + pdu_session_id ? pdu_session_id->valuedouble : 0, + ogs_strdup(dnn->valuestring), + s_nssai ? s_nssai_local_nonprim : NULL, + vsmf_id ? ogs_strdup(vsmf_id->valuestring) : NULL, + ismf_id ? ogs_strdup(ismf_id->valuestring) : NULL, + serving_network_local_nonprim, + request_type ? request_type_local_nonprim : NULL, + eps_bearer_id ? eps_bearer_idList : NULL, + pgw_s8c_fteid ? pgw_s8c_fteid->valueint : 0, + vsmf_pdu_session_uri ? ogs_strdup(vsmf_pdu_session_uri->valuestring) : NULL, + ismf_pdu_session_uri ? ogs_strdup(ismf_pdu_session_uri->valuestring) : NULL, + vcn_tunnel_info ? vcn_tunnel_info_local_nonprim : NULL, + icn_tunnel_info ? icn_tunnel_info_local_nonprim : NULL, + n9_forwarding_tunnel_info ? n9_forwarding_tunnel_info_local_nonprim : NULL, + additional_cn_tunnel_info ? additional_cn_tunnel_info_local_nonprim : NULL, + an_typeVariable, + additional_an_type ? additional_an_typeVariable : 0, + rat_type ? rat_typeVariable : 0, + ue_location ? ue_location_local_nonprim : NULL, + ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL, + add_ue_location ? add_ue_location_local_nonprim : NULL, + gpsi ? ogs_strdup(gpsi->valuestring) : NULL, + n1_sm_info_from_ue ? n1_sm_info_from_ue_local_nonprim : NULL, + unknown_n1_sm_info ? unknown_n1_sm_info_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + h_pcf_id ? ogs_strdup(h_pcf_id->valuestring) : NULL, + pcf_id ? ogs_strdup(pcf_id->valuestring) : NULL, + pcf_group_id ? ogs_strdup(pcf_group_id->valuestring) : NULL, + pcf_set_id ? ogs_strdup(pcf_set_id->valuestring) : NULL, + ho_preparation_indication ? ho_preparation_indication->valueint : 0, + sel_mode ? sel_mode_local_nonprim : NULL, + always_on_requested ? always_on_requested->valueint : 0, + udm_group_id ? ogs_strdup(udm_group_id->valuestring) : NULL, + routing_indicator ? ogs_strdup(routing_indicator->valuestring) : NULL, + eps_interworking_ind ? eps_interworking_ind_local_nonprim : NULL, + v_smf_service_instance_id ? ogs_strdup(v_smf_service_instance_id->valuestring) : NULL, + i_smf_service_instance_id ? ogs_strdup(i_smf_service_instance_id->valuestring) : NULL, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL, + roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, + charging_id ? ogs_strdup(charging_id->valuestring) : NULL, + old_pdu_session_id ? old_pdu_session_id->valuedouble : 0, + eps_bearer_ctx_status ? ogs_strdup(eps_bearer_ctx_status->valuestring) : NULL, + amf_nf_id ? ogs_strdup(amf_nf_id->valuestring) : NULL, + guami ? guami_local_nonprim : NULL, + cp_ciot_enabled ? cp_ciot_enabled->valueint : 0, + cp_only_ind ? cp_only_ind->valueint : 0, + invoke_nef ? invoke_nef->valueint : 0, + ma_request_ind ? ma_request_ind->valueint : 0, + ma_nw_upgrade_ind ? ma_nw_upgrade_ind->valueint : 0, + dnai_list ? dnai_listList : NULL, + presence_in_ladn ? presence_in_ladn_local_nonprim : NULL, + secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL, + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, + apn_rate_status ? apn_rate_status_local_nonprim : NULL, + dl_serving_plmn_rate_ctl ? dl_serving_plmn_rate_ctl->valuedouble : 0 + ); + + return pdu_session_create_data_local_var; +end: + return NULL; +} + +OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_copy(OpenAPI_pdu_session_create_data_t *dst, OpenAPI_pdu_session_create_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_create_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_create_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_pdu_session_create_data_free(dst); + dst = OpenAPI_pdu_session_create_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_create_data.h b/lib/sbi/openapi/model/pdu_session_create_data.h new file mode 100644 index 000000000..de1dd93b9 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_create_data.h @@ -0,0 +1,168 @@ +/* + * pdu_session_create_data.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_create_data_H_ +#define _OpenAPI_pdu_session_create_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "apn_rate_status.h" +#include "dnn_selection_mode.h" +#include "eps_interworking_indication.h" +#include "guami.h" +#include "plmn_id_nid.h" +#include "presence_state.h" +#include "rat_type.h" +#include "ref_to_binary_data.h" +#include "request_type.h" +#include "roaming_charging_profile.h" +#include "secondary_rat_usage_info.h" +#include "small_data_rate_status.h" +#include "snssai.h" +#include "tunnel_info.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_create_data_s OpenAPI_pdu_session_create_data_t; +typedef struct OpenAPI_pdu_session_create_data_s { + char *supi; + int unauthenticated_supi; + char *pei; + int pdu_session_id; + char *dnn; + struct OpenAPI_snssai_s *s_nssai; + char *vsmf_id; + char *ismf_id; + struct OpenAPI_plmn_id_nid_s *serving_network; + struct OpenAPI_request_type_s *request_type; + OpenAPI_list_t *eps_bearer_id; + char pgw_s8c_fteid; + char *vsmf_pdu_session_uri; + char *ismf_pdu_session_uri; + struct OpenAPI_tunnel_info_s *vcn_tunnel_info; + struct OpenAPI_tunnel_info_s *icn_tunnel_info; + struct OpenAPI_tunnel_info_s *n9_forwarding_tunnel_info; + struct OpenAPI_tunnel_info_s *additional_cn_tunnel_info; + OpenAPI_access_type_e an_type; + OpenAPI_access_type_e additional_an_type; + OpenAPI_rat_type_e rat_type; + struct OpenAPI_user_location_s *ue_location; + char *ue_time_zone; + struct OpenAPI_user_location_s *add_ue_location; + char *gpsi; + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_from_ue; + struct OpenAPI_ref_to_binary_data_s *unknown_n1_sm_info; + char *supported_features; + char *h_pcf_id; + char *pcf_id; + char *pcf_group_id; + char *pcf_set_id; + int ho_preparation_indication; + struct OpenAPI_dnn_selection_mode_s *sel_mode; + int always_on_requested; + char *udm_group_id; + char *routing_indicator; + struct OpenAPI_eps_interworking_indication_s *eps_interworking_ind; + char *v_smf_service_instance_id; + char *i_smf_service_instance_id; + char *recovery_time; + struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; + char *charging_id; + int old_pdu_session_id; + char *eps_bearer_ctx_status; + char *amf_nf_id; + struct OpenAPI_guami_s *guami; + int cp_ciot_enabled; + int cp_only_ind; + int invoke_nef; + int ma_request_ind; + int ma_nw_upgrade_ind; + OpenAPI_list_t *dnai_list; + struct OpenAPI_presence_state_s *presence_in_ladn; + OpenAPI_list_t *secondary_rat_usage_info; + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; + struct OpenAPI_apn_rate_status_s *apn_rate_status; + int dl_serving_plmn_rate_ctl; +} OpenAPI_pdu_session_create_data_t; + +OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( + char *supi, + int unauthenticated_supi, + char *pei, + int pdu_session_id, + char *dnn, + OpenAPI_snssai_t *s_nssai, + char *vsmf_id, + char *ismf_id, + OpenAPI_plmn_id_nid_t *serving_network, + OpenAPI_request_type_t *request_type, + OpenAPI_list_t *eps_bearer_id, + char pgw_s8c_fteid, + char *vsmf_pdu_session_uri, + char *ismf_pdu_session_uri, + OpenAPI_tunnel_info_t *vcn_tunnel_info, + OpenAPI_tunnel_info_t *icn_tunnel_info, + OpenAPI_tunnel_info_t *n9_forwarding_tunnel_info, + OpenAPI_tunnel_info_t *additional_cn_tunnel_info, + OpenAPI_access_type_e an_type, + OpenAPI_access_type_e additional_an_type, + OpenAPI_rat_type_e rat_type, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + char *gpsi, + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue, + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info, + char *supported_features, + char *h_pcf_id, + char *pcf_id, + char *pcf_group_id, + char *pcf_set_id, + int ho_preparation_indication, + OpenAPI_dnn_selection_mode_t *sel_mode, + int always_on_requested, + char *udm_group_id, + char *routing_indicator, + OpenAPI_eps_interworking_indication_t *eps_interworking_ind, + char *v_smf_service_instance_id, + char *i_smf_service_instance_id, + char *recovery_time, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + char *charging_id, + int old_pdu_session_id, + char *eps_bearer_ctx_status, + char *amf_nf_id, + OpenAPI_guami_t *guami, + int cp_ciot_enabled, + int cp_only_ind, + int invoke_nef, + int ma_request_ind, + int ma_nw_upgrade_ind, + OpenAPI_list_t *dnai_list, + OpenAPI_presence_state_t *presence_in_ladn, + OpenAPI_list_t *secondary_rat_usage_info, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status, + int dl_serving_plmn_rate_ctl + ); +void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu_session_create_data); +OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON(cJSON *pdu_session_create_dataJSON); +cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_data_t *pdu_session_create_data); +OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_copy(OpenAPI_pdu_session_create_data_t *dst, OpenAPI_pdu_session_create_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_create_data_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_create_error.c b/lib/sbi/openapi/model/pdu_session_create_error.c new file mode 100644 index 000000000..fb63d4daf --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_create_error.c @@ -0,0 +1,197 @@ + +#include +#include +#include +#include "pdu_session_create_error.h" + +OpenAPI_pdu_session_create_error_t *OpenAPI_pdu_session_create_error_create( + OpenAPI_problem_details_t *error, + char *n1sm_cause, + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + int back_off_timer, + char *recovery_time + ) +{ + OpenAPI_pdu_session_create_error_t *pdu_session_create_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_create_error_t)); + if (!pdu_session_create_error_local_var) { + return NULL; + } + pdu_session_create_error_local_var->error = error; + pdu_session_create_error_local_var->n1sm_cause = n1sm_cause; + pdu_session_create_error_local_var->n1_sm_info_to_ue = n1_sm_info_to_ue; + pdu_session_create_error_local_var->back_off_timer = back_off_timer; + pdu_session_create_error_local_var->recovery_time = recovery_time; + + return pdu_session_create_error_local_var; +} + +void OpenAPI_pdu_session_create_error_free(OpenAPI_pdu_session_create_error_t *pdu_session_create_error) +{ + if (NULL == pdu_session_create_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(pdu_session_create_error->error); + ogs_free(pdu_session_create_error->n1sm_cause); + OpenAPI_ref_to_binary_data_free(pdu_session_create_error->n1_sm_info_to_ue); + ogs_free(pdu_session_create_error->recovery_time); + ogs_free(pdu_session_create_error); +} + +cJSON *OpenAPI_pdu_session_create_error_convertToJSON(OpenAPI_pdu_session_create_error_t *pdu_session_create_error) +{ + cJSON *item = NULL; + + if (pdu_session_create_error == NULL) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [PduSessionCreateError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pdu_session_create_error->error) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(pdu_session_create_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [error]"); + goto end; + } + + if (pdu_session_create_error->n1sm_cause) { + if (cJSON_AddStringToObject(item, "n1smCause", pdu_session_create_error->n1sm_cause) == NULL) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [n1sm_cause]"); + goto end; + } + } + + if (pdu_session_create_error->n1_sm_info_to_ue) { + cJSON *n1_sm_info_to_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(pdu_session_create_error->n1_sm_info_to_ue); + if (n1_sm_info_to_ue_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoToUe", n1_sm_info_to_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + } + + if (pdu_session_create_error->back_off_timer) { + if (cJSON_AddNumberToObject(item, "backOffTimer", pdu_session_create_error->back_off_timer) == NULL) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [back_off_timer]"); + goto end; + } + } + + if (pdu_session_create_error->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", pdu_session_create_error->recovery_time) == NULL) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed [recovery_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pdu_session_create_error_t *OpenAPI_pdu_session_create_error_parseFromJSON(cJSON *pdu_session_create_errorJSON) +{ + OpenAPI_pdu_session_create_error_t *pdu_session_create_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(pdu_session_create_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_pdu_session_create_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *n1sm_cause = cJSON_GetObjectItemCaseSensitive(pdu_session_create_errorJSON, "n1smCause"); + + if (n1sm_cause) { + if (!cJSON_IsString(n1sm_cause)) { + ogs_error("OpenAPI_pdu_session_create_error_parseFromJSON() failed [n1sm_cause]"); + goto end; + } + } + + cJSON *n1_sm_info_to_ue = cJSON_GetObjectItemCaseSensitive(pdu_session_create_errorJSON, "n1SmInfoToUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue_local_nonprim = NULL; + if (n1_sm_info_to_ue) { + n1_sm_info_to_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_to_ue); + } + + cJSON *back_off_timer = cJSON_GetObjectItemCaseSensitive(pdu_session_create_errorJSON, "backOffTimer"); + + if (back_off_timer) { + if (!cJSON_IsNumber(back_off_timer)) { + ogs_error("OpenAPI_pdu_session_create_error_parseFromJSON() failed [back_off_timer]"); + goto end; + } + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(pdu_session_create_errorJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_pdu_session_create_error_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + pdu_session_create_error_local_var = OpenAPI_pdu_session_create_error_create ( + error_local_nonprim, + n1sm_cause ? ogs_strdup(n1sm_cause->valuestring) : NULL, + n1_sm_info_to_ue ? n1_sm_info_to_ue_local_nonprim : NULL, + back_off_timer ? back_off_timer->valuedouble : 0, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL + ); + + return pdu_session_create_error_local_var; +end: + return NULL; +} + +OpenAPI_pdu_session_create_error_t *OpenAPI_pdu_session_create_error_copy(OpenAPI_pdu_session_create_error_t *dst, OpenAPI_pdu_session_create_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_create_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_create_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pdu_session_create_error_free(dst); + dst = OpenAPI_pdu_session_create_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_create_error.h b/lib/sbi/openapi/model/pdu_session_create_error.h new file mode 100644 index 000000000..0b8e10f6a --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_create_error.h @@ -0,0 +1,48 @@ +/* + * pdu_session_create_error.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_create_error_H_ +#define _OpenAPI_pdu_session_create_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "problem_details.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_create_error_s OpenAPI_pdu_session_create_error_t; +typedef struct OpenAPI_pdu_session_create_error_s { + struct OpenAPI_problem_details_s *error; + char *n1sm_cause; + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_to_ue; + int back_off_timer; + char *recovery_time; +} OpenAPI_pdu_session_create_error_t; + +OpenAPI_pdu_session_create_error_t *OpenAPI_pdu_session_create_error_create( + OpenAPI_problem_details_t *error, + char *n1sm_cause, + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + int back_off_timer, + char *recovery_time + ); +void OpenAPI_pdu_session_create_error_free(OpenAPI_pdu_session_create_error_t *pdu_session_create_error); +OpenAPI_pdu_session_create_error_t *OpenAPI_pdu_session_create_error_parseFromJSON(cJSON *pdu_session_create_errorJSON); +cJSON *OpenAPI_pdu_session_create_error_convertToJSON(OpenAPI_pdu_session_create_error_t *pdu_session_create_error); +OpenAPI_pdu_session_create_error_t *OpenAPI_pdu_session_create_error_copy(OpenAPI_pdu_session_create_error_t *dst, OpenAPI_pdu_session_create_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_create_error_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_created_data.c b/lib/sbi/openapi/model/pdu_session_created_data.c new file mode 100644 index 000000000..69738ce09 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_created_data.c @@ -0,0 +1,833 @@ + +#include +#include +#include +#include "pdu_session_created_data.h" + +OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( + OpenAPI_pdu_session_type_e pdu_session_type, + char *ssc_mode, + OpenAPI_tunnel_info_t *hcn_tunnel_info, + OpenAPI_tunnel_info_t *cn_tunnel_info, + OpenAPI_tunnel_info_t *additional_cn_tunnel_info, + OpenAPI_ambr_t *session_ambr, + OpenAPI_list_t *qos_flows_setup_list, + char *h_smf_instance_id, + char *smf_instance_id, + int pdu_session_id, + OpenAPI_snssai_t *s_nssai, + int enable_pause_charging, + char *ue_ipv4_address, + char *ue_ipv6_prefix, + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, + OpenAPI_list_t *eps_bearer_info, + char *supported_features, + OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate, + int always_on_granted, + char *gpsi, + OpenAPI_up_security_t *up_security, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + char *h_smf_service_instance_id, + char *smf_service_instance_id, + char *recovery_time, + OpenAPI_list_t *dnai_list, + int ipv6_multi_homing_ind, + int ma_accepted_ind, + char *home_provided_charging_id, + int nef_ext_buf_support_ind + ) +{ + OpenAPI_pdu_session_created_data_t *pdu_session_created_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_created_data_t)); + if (!pdu_session_created_data_local_var) { + return NULL; + } + pdu_session_created_data_local_var->pdu_session_type = pdu_session_type; + pdu_session_created_data_local_var->ssc_mode = ssc_mode; + pdu_session_created_data_local_var->hcn_tunnel_info = hcn_tunnel_info; + pdu_session_created_data_local_var->cn_tunnel_info = cn_tunnel_info; + pdu_session_created_data_local_var->additional_cn_tunnel_info = additional_cn_tunnel_info; + pdu_session_created_data_local_var->session_ambr = session_ambr; + pdu_session_created_data_local_var->qos_flows_setup_list = qos_flows_setup_list; + pdu_session_created_data_local_var->h_smf_instance_id = h_smf_instance_id; + pdu_session_created_data_local_var->smf_instance_id = smf_instance_id; + pdu_session_created_data_local_var->pdu_session_id = pdu_session_id; + pdu_session_created_data_local_var->s_nssai = s_nssai; + pdu_session_created_data_local_var->enable_pause_charging = enable_pause_charging; + pdu_session_created_data_local_var->ue_ipv4_address = ue_ipv4_address; + pdu_session_created_data_local_var->ue_ipv6_prefix = ue_ipv6_prefix; + pdu_session_created_data_local_var->n1_sm_info_to_ue = n1_sm_info_to_ue; + pdu_session_created_data_local_var->eps_pdn_cnx_info = eps_pdn_cnx_info; + pdu_session_created_data_local_var->eps_bearer_info = eps_bearer_info; + pdu_session_created_data_local_var->supported_features = supported_features; + pdu_session_created_data_local_var->max_integrity_protected_data_rate = max_integrity_protected_data_rate; + pdu_session_created_data_local_var->always_on_granted = always_on_granted; + pdu_session_created_data_local_var->gpsi = gpsi; + pdu_session_created_data_local_var->up_security = up_security; + pdu_session_created_data_local_var->roaming_charging_profile = roaming_charging_profile; + pdu_session_created_data_local_var->h_smf_service_instance_id = h_smf_service_instance_id; + pdu_session_created_data_local_var->smf_service_instance_id = smf_service_instance_id; + pdu_session_created_data_local_var->recovery_time = recovery_time; + pdu_session_created_data_local_var->dnai_list = dnai_list; + pdu_session_created_data_local_var->ipv6_multi_homing_ind = ipv6_multi_homing_ind; + pdu_session_created_data_local_var->ma_accepted_ind = ma_accepted_ind; + pdu_session_created_data_local_var->home_provided_charging_id = home_provided_charging_id; + pdu_session_created_data_local_var->nef_ext_buf_support_ind = nef_ext_buf_support_ind; + + return pdu_session_created_data_local_var; +} + +void OpenAPI_pdu_session_created_data_free(OpenAPI_pdu_session_created_data_t *pdu_session_created_data) +{ + if (NULL == pdu_session_created_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(pdu_session_created_data->ssc_mode); + OpenAPI_tunnel_info_free(pdu_session_created_data->hcn_tunnel_info); + OpenAPI_tunnel_info_free(pdu_session_created_data->cn_tunnel_info); + OpenAPI_tunnel_info_free(pdu_session_created_data->additional_cn_tunnel_info); + OpenAPI_ambr_free(pdu_session_created_data->session_ambr); + OpenAPI_list_for_each(pdu_session_created_data->qos_flows_setup_list, node) { + OpenAPI_qos_flow_setup_item_free(node->data); + } + OpenAPI_list_free(pdu_session_created_data->qos_flows_setup_list); + ogs_free(pdu_session_created_data->h_smf_instance_id); + ogs_free(pdu_session_created_data->smf_instance_id); + OpenAPI_snssai_free(pdu_session_created_data->s_nssai); + ogs_free(pdu_session_created_data->ue_ipv4_address); + ogs_free(pdu_session_created_data->ue_ipv6_prefix); + OpenAPI_ref_to_binary_data_free(pdu_session_created_data->n1_sm_info_to_ue); + OpenAPI_eps_pdn_cnx_info_free(pdu_session_created_data->eps_pdn_cnx_info); + OpenAPI_list_for_each(pdu_session_created_data->eps_bearer_info, node) { + OpenAPI_eps_bearer_info_free(node->data); + } + OpenAPI_list_free(pdu_session_created_data->eps_bearer_info); + ogs_free(pdu_session_created_data->supported_features); + OpenAPI_max_integrity_protected_data_rate_free(pdu_session_created_data->max_integrity_protected_data_rate); + ogs_free(pdu_session_created_data->gpsi); + OpenAPI_up_security_free(pdu_session_created_data->up_security); + OpenAPI_roaming_charging_profile_free(pdu_session_created_data->roaming_charging_profile); + ogs_free(pdu_session_created_data->h_smf_service_instance_id); + ogs_free(pdu_session_created_data->smf_service_instance_id); + ogs_free(pdu_session_created_data->recovery_time); + OpenAPI_list_for_each(pdu_session_created_data->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pdu_session_created_data->dnai_list); + ogs_free(pdu_session_created_data->home_provided_charging_id); + ogs_free(pdu_session_created_data); +} + +cJSON *OpenAPI_pdu_session_created_data_convertToJSON(OpenAPI_pdu_session_created_data_t *pdu_session_created_data) +{ + cJSON *item = NULL; + + if (pdu_session_created_data == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [PduSessionCreatedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pdu_session_created_data->pdu_session_type) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [pdu_session_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "pduSessionType", OpenAPI_pdu_session_type_ToString(pdu_session_created_data->pdu_session_type)) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [pdu_session_type]"); + goto end; + } + + if (!pdu_session_created_data->ssc_mode) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [ssc_mode]"); + goto end; + } + if (cJSON_AddStringToObject(item, "sscMode", pdu_session_created_data->ssc_mode) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [ssc_mode]"); + goto end; + } + + if (pdu_session_created_data->hcn_tunnel_info) { + cJSON *hcn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(pdu_session_created_data->hcn_tunnel_info); + if (hcn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [hcn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "hcnTunnelInfo", hcn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [hcn_tunnel_info]"); + goto end; + } + } + + if (pdu_session_created_data->cn_tunnel_info) { + cJSON *cn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(pdu_session_created_data->cn_tunnel_info); + if (cn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [cn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "cnTunnelInfo", cn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [cn_tunnel_info]"); + goto end; + } + } + + if (pdu_session_created_data->additional_cn_tunnel_info) { + cJSON *additional_cn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(pdu_session_created_data->additional_cn_tunnel_info); + if (additional_cn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [additional_cn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "additionalCnTunnelInfo", additional_cn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [additional_cn_tunnel_info]"); + goto end; + } + } + + if (pdu_session_created_data->session_ambr) { + cJSON *session_ambr_local_JSON = OpenAPI_ambr_convertToJSON(pdu_session_created_data->session_ambr); + if (session_ambr_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [session_ambr]"); + goto end; + } + cJSON_AddItemToObject(item, "sessionAmbr", session_ambr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [session_ambr]"); + goto end; + } + } + + if (pdu_session_created_data->qos_flows_setup_list) { + cJSON *qos_flows_setup_listList = cJSON_AddArrayToObject(item, "qosFlowsSetupList"); + if (qos_flows_setup_listList == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [qos_flows_setup_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_setup_list_node; + if (pdu_session_created_data->qos_flows_setup_list) { + OpenAPI_list_for_each(pdu_session_created_data->qos_flows_setup_list, qos_flows_setup_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_setup_item_convertToJSON(qos_flows_setup_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [qos_flows_setup_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_setup_listList, itemLocal); + } + } + } + + if (pdu_session_created_data->h_smf_instance_id) { + if (cJSON_AddStringToObject(item, "hSmfInstanceId", pdu_session_created_data->h_smf_instance_id) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [h_smf_instance_id]"); + goto end; + } + } + + if (pdu_session_created_data->smf_instance_id) { + if (cJSON_AddStringToObject(item, "smfInstanceId", pdu_session_created_data->smf_instance_id) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [smf_instance_id]"); + goto end; + } + } + + if (pdu_session_created_data->pdu_session_id) { + if (cJSON_AddNumberToObject(item, "pduSessionId", pdu_session_created_data->pdu_session_id) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + } + + if (pdu_session_created_data->s_nssai) { + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_created_data->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [s_nssai]"); + goto end; + } + } + + if (pdu_session_created_data->enable_pause_charging) { + if (cJSON_AddBoolToObject(item, "enablePauseCharging", pdu_session_created_data->enable_pause_charging) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [enable_pause_charging]"); + goto end; + } + } + + if (pdu_session_created_data->ue_ipv4_address) { + if (cJSON_AddStringToObject(item, "ueIpv4Address", pdu_session_created_data->ue_ipv4_address) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [ue_ipv4_address]"); + goto end; + } + } + + if (pdu_session_created_data->ue_ipv6_prefix) { + if (cJSON_AddStringToObject(item, "ueIpv6Prefix", pdu_session_created_data->ue_ipv6_prefix) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [ue_ipv6_prefix]"); + goto end; + } + } + + if (pdu_session_created_data->n1_sm_info_to_ue) { + cJSON *n1_sm_info_to_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(pdu_session_created_data->n1_sm_info_to_ue); + if (n1_sm_info_to_ue_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoToUe", n1_sm_info_to_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + } + + if (pdu_session_created_data->eps_pdn_cnx_info) { + cJSON *eps_pdn_cnx_info_local_JSON = OpenAPI_eps_pdn_cnx_info_convertToJSON(pdu_session_created_data->eps_pdn_cnx_info); + if (eps_pdn_cnx_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [eps_pdn_cnx_info]"); + goto end; + } + cJSON_AddItemToObject(item, "epsPdnCnxInfo", eps_pdn_cnx_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [eps_pdn_cnx_info]"); + goto end; + } + } + + if (pdu_session_created_data->eps_bearer_info) { + cJSON *eps_bearer_infoList = cJSON_AddArrayToObject(item, "epsBearerInfo"); + if (eps_bearer_infoList == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [eps_bearer_info]"); + goto end; + } + + OpenAPI_lnode_t *eps_bearer_info_node; + if (pdu_session_created_data->eps_bearer_info) { + OpenAPI_list_for_each(pdu_session_created_data->eps_bearer_info, eps_bearer_info_node) { + cJSON *itemLocal = OpenAPI_eps_bearer_info_convertToJSON(eps_bearer_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [eps_bearer_info]"); + goto end; + } + cJSON_AddItemToArray(eps_bearer_infoList, itemLocal); + } + } + } + + if (pdu_session_created_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pdu_session_created_data->supported_features) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (pdu_session_created_data->max_integrity_protected_data_rate) { + cJSON *max_integrity_protected_data_rate_local_JSON = OpenAPI_max_integrity_protected_data_rate_convertToJSON(pdu_session_created_data->max_integrity_protected_data_rate); + if (max_integrity_protected_data_rate_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [max_integrity_protected_data_rate]"); + goto end; + } + cJSON_AddItemToObject(item, "maxIntegrityProtectedDataRate", max_integrity_protected_data_rate_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [max_integrity_protected_data_rate]"); + goto end; + } + } + + if (pdu_session_created_data->always_on_granted) { + if (cJSON_AddBoolToObject(item, "alwaysOnGranted", pdu_session_created_data->always_on_granted) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [always_on_granted]"); + goto end; + } + } + + if (pdu_session_created_data->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", pdu_session_created_data->gpsi) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (pdu_session_created_data->up_security) { + cJSON *up_security_local_JSON = OpenAPI_up_security_convertToJSON(pdu_session_created_data->up_security); + if (up_security_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [up_security]"); + goto end; + } + cJSON_AddItemToObject(item, "upSecurity", up_security_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [up_security]"); + goto end; + } + } + + if (pdu_session_created_data->roaming_charging_profile) { + cJSON *roaming_charging_profile_local_JSON = OpenAPI_roaming_charging_profile_convertToJSON(pdu_session_created_data->roaming_charging_profile); + if (roaming_charging_profile_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "roamingChargingProfile", roaming_charging_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + } + + if (pdu_session_created_data->h_smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "hSmfServiceInstanceId", pdu_session_created_data->h_smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [h_smf_service_instance_id]"); + goto end; + } + } + + if (pdu_session_created_data->smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "smfServiceInstanceId", pdu_session_created_data->smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [smf_service_instance_id]"); + goto end; + } + } + + if (pdu_session_created_data->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", pdu_session_created_data->recovery_time) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (pdu_session_created_data->dnai_list) { + cJSON *dnai_list = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_list == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [dnai_list]"); + goto end; + } + + OpenAPI_lnode_t *dnai_list_node; + OpenAPI_list_for_each(pdu_session_created_data->dnai_list, dnai_list_node) { + if (cJSON_AddStringToObject(dnai_list, "", (char*)dnai_list_node->data) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (pdu_session_created_data->ipv6_multi_homing_ind) { + if (cJSON_AddBoolToObject(item, "ipv6MultiHomingInd", pdu_session_created_data->ipv6_multi_homing_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [ipv6_multi_homing_ind]"); + goto end; + } + } + + if (pdu_session_created_data->ma_accepted_ind) { + if (cJSON_AddBoolToObject(item, "maAcceptedInd", pdu_session_created_data->ma_accepted_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [ma_accepted_ind]"); + goto end; + } + } + + if (pdu_session_created_data->home_provided_charging_id) { + if (cJSON_AddStringToObject(item, "homeProvidedChargingId", pdu_session_created_data->home_provided_charging_id) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [home_provided_charging_id]"); + goto end; + } + } + + if (pdu_session_created_data->nef_ext_buf_support_ind) { + if (cJSON_AddBoolToObject(item, "nefExtBufSupportInd", pdu_session_created_data->nef_ext_buf_support_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [nef_ext_buf_support_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJSON(cJSON *pdu_session_created_dataJSON) +{ + OpenAPI_pdu_session_created_data_t *pdu_session_created_data_local_var = NULL; + cJSON *pdu_session_type = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "pduSessionType"); + if (!pdu_session_type) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [pdu_session_type]"); + goto end; + } + + OpenAPI_pdu_session_type_e pdu_session_typeVariable; + + if (!cJSON_IsString(pdu_session_type)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [pdu_session_type]"); + goto end; + } + pdu_session_typeVariable = OpenAPI_pdu_session_type_FromString(pdu_session_type->valuestring); + + cJSON *ssc_mode = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "sscMode"); + if (!ssc_mode) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [ssc_mode]"); + goto end; + } + + + if (!cJSON_IsString(ssc_mode)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [ssc_mode]"); + goto end; + } + + cJSON *hcn_tunnel_info = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "hcnTunnelInfo"); + + OpenAPI_tunnel_info_t *hcn_tunnel_info_local_nonprim = NULL; + if (hcn_tunnel_info) { + hcn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(hcn_tunnel_info); + } + + cJSON *cn_tunnel_info = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "cnTunnelInfo"); + + OpenAPI_tunnel_info_t *cn_tunnel_info_local_nonprim = NULL; + if (cn_tunnel_info) { + cn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(cn_tunnel_info); + } + + cJSON *additional_cn_tunnel_info = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "additionalCnTunnelInfo"); + + OpenAPI_tunnel_info_t *additional_cn_tunnel_info_local_nonprim = NULL; + if (additional_cn_tunnel_info) { + additional_cn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(additional_cn_tunnel_info); + } + + cJSON *session_ambr = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "sessionAmbr"); + + OpenAPI_ambr_t *session_ambr_local_nonprim = NULL; + if (session_ambr) { + session_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(session_ambr); + } + + cJSON *qos_flows_setup_list = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "qosFlowsSetupList"); + + OpenAPI_list_t *qos_flows_setup_listList; + if (qos_flows_setup_list) { + cJSON *qos_flows_setup_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_setup_list)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [qos_flows_setup_list]"); + goto end; + } + + qos_flows_setup_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_setup_list_local_nonprimitive, qos_flows_setup_list ) { + if (!cJSON_IsObject(qos_flows_setup_list_local_nonprimitive)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [qos_flows_setup_list]"); + goto end; + } + OpenAPI_qos_flow_setup_item_t *qos_flows_setup_listItem = OpenAPI_qos_flow_setup_item_parseFromJSON(qos_flows_setup_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_setup_listList, qos_flows_setup_listItem); + } + } + + cJSON *h_smf_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "hSmfInstanceId"); + + if (h_smf_instance_id) { + if (!cJSON_IsString(h_smf_instance_id)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [h_smf_instance_id]"); + goto end; + } + } + + cJSON *smf_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "smfInstanceId"); + + if (smf_instance_id) { + if (!cJSON_IsString(smf_instance_id)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [smf_instance_id]"); + goto end; + } + } + + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "pduSessionId"); + + if (pdu_session_id) { + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "sNssai"); + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + if (s_nssai) { + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + } + + cJSON *enable_pause_charging = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "enablePauseCharging"); + + if (enable_pause_charging) { + if (!cJSON_IsBool(enable_pause_charging)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [enable_pause_charging]"); + goto end; + } + } + + cJSON *ue_ipv4_address = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "ueIpv4Address"); + + if (ue_ipv4_address) { + if (!cJSON_IsString(ue_ipv4_address)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [ue_ipv4_address]"); + goto end; + } + } + + cJSON *ue_ipv6_prefix = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "ueIpv6Prefix"); + + if (ue_ipv6_prefix) { + if (!cJSON_IsString(ue_ipv6_prefix)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [ue_ipv6_prefix]"); + goto end; + } + } + + cJSON *n1_sm_info_to_ue = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "n1SmInfoToUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue_local_nonprim = NULL; + if (n1_sm_info_to_ue) { + n1_sm_info_to_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_to_ue); + } + + cJSON *eps_pdn_cnx_info = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "epsPdnCnxInfo"); + + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info_local_nonprim = NULL; + if (eps_pdn_cnx_info) { + eps_pdn_cnx_info_local_nonprim = OpenAPI_eps_pdn_cnx_info_parseFromJSON(eps_pdn_cnx_info); + } + + cJSON *eps_bearer_info = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "epsBearerInfo"); + + OpenAPI_list_t *eps_bearer_infoList; + if (eps_bearer_info) { + cJSON *eps_bearer_info_local_nonprimitive; + if (!cJSON_IsArray(eps_bearer_info)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [eps_bearer_info]"); + goto end; + } + + eps_bearer_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eps_bearer_info_local_nonprimitive, eps_bearer_info ) { + if (!cJSON_IsObject(eps_bearer_info_local_nonprimitive)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [eps_bearer_info]"); + goto end; + } + OpenAPI_eps_bearer_info_t *eps_bearer_infoItem = OpenAPI_eps_bearer_info_parseFromJSON(eps_bearer_info_local_nonprimitive); + + OpenAPI_list_add(eps_bearer_infoList, eps_bearer_infoItem); + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *max_integrity_protected_data_rate = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "maxIntegrityProtectedDataRate"); + + OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate_local_nonprim = NULL; + if (max_integrity_protected_data_rate) { + max_integrity_protected_data_rate_local_nonprim = OpenAPI_max_integrity_protected_data_rate_parseFromJSON(max_integrity_protected_data_rate); + } + + cJSON *always_on_granted = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "alwaysOnGranted"); + + if (always_on_granted) { + if (!cJSON_IsBool(always_on_granted)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [always_on_granted]"); + goto end; + } + } + + cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "gpsi"); + + if (gpsi) { + if (!cJSON_IsString(gpsi)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + cJSON *up_security = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "upSecurity"); + + OpenAPI_up_security_t *up_security_local_nonprim = NULL; + if (up_security) { + up_security_local_nonprim = OpenAPI_up_security_parseFromJSON(up_security); + } + + cJSON *roaming_charging_profile = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "roamingChargingProfile"); + + OpenAPI_roaming_charging_profile_t *roaming_charging_profile_local_nonprim = NULL; + if (roaming_charging_profile) { + roaming_charging_profile_local_nonprim = OpenAPI_roaming_charging_profile_parseFromJSON(roaming_charging_profile); + } + + cJSON *h_smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "hSmfServiceInstanceId"); + + if (h_smf_service_instance_id) { + if (!cJSON_IsString(h_smf_service_instance_id)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [h_smf_service_instance_id]"); + goto end; + } + } + + cJSON *smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "smfServiceInstanceId"); + + if (smf_service_instance_id) { + if (!cJSON_IsString(smf_service_instance_id)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [smf_service_instance_id]"); + goto end; + } + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + cJSON *dnai_list = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "dnaiList"); + + OpenAPI_list_t *dnai_listList; + if (dnai_list) { + cJSON *dnai_list_local; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + cJSON *ipv6_multi_homing_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "ipv6MultiHomingInd"); + + if (ipv6_multi_homing_ind) { + if (!cJSON_IsBool(ipv6_multi_homing_ind)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [ipv6_multi_homing_ind]"); + goto end; + } + } + + cJSON *ma_accepted_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "maAcceptedInd"); + + if (ma_accepted_ind) { + if (!cJSON_IsBool(ma_accepted_ind)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [ma_accepted_ind]"); + goto end; + } + } + + cJSON *home_provided_charging_id = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "homeProvidedChargingId"); + + if (home_provided_charging_id) { + if (!cJSON_IsString(home_provided_charging_id)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [home_provided_charging_id]"); + goto end; + } + } + + cJSON *nef_ext_buf_support_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "nefExtBufSupportInd"); + + if (nef_ext_buf_support_ind) { + if (!cJSON_IsBool(nef_ext_buf_support_ind)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [nef_ext_buf_support_ind]"); + goto end; + } + } + + pdu_session_created_data_local_var = OpenAPI_pdu_session_created_data_create ( + pdu_session_typeVariable, + ogs_strdup(ssc_mode->valuestring), + hcn_tunnel_info ? hcn_tunnel_info_local_nonprim : NULL, + cn_tunnel_info ? cn_tunnel_info_local_nonprim : NULL, + additional_cn_tunnel_info ? additional_cn_tunnel_info_local_nonprim : NULL, + session_ambr ? session_ambr_local_nonprim : NULL, + qos_flows_setup_list ? qos_flows_setup_listList : NULL, + h_smf_instance_id ? ogs_strdup(h_smf_instance_id->valuestring) : NULL, + smf_instance_id ? ogs_strdup(smf_instance_id->valuestring) : NULL, + pdu_session_id ? pdu_session_id->valuedouble : 0, + s_nssai ? s_nssai_local_nonprim : NULL, + enable_pause_charging ? enable_pause_charging->valueint : 0, + ue_ipv4_address ? ogs_strdup(ue_ipv4_address->valuestring) : NULL, + ue_ipv6_prefix ? ogs_strdup(ue_ipv6_prefix->valuestring) : NULL, + n1_sm_info_to_ue ? n1_sm_info_to_ue_local_nonprim : NULL, + eps_pdn_cnx_info ? eps_pdn_cnx_info_local_nonprim : NULL, + eps_bearer_info ? eps_bearer_infoList : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + max_integrity_protected_data_rate ? max_integrity_protected_data_rate_local_nonprim : NULL, + always_on_granted ? always_on_granted->valueint : 0, + gpsi ? ogs_strdup(gpsi->valuestring) : NULL, + up_security ? up_security_local_nonprim : NULL, + roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, + h_smf_service_instance_id ? ogs_strdup(h_smf_service_instance_id->valuestring) : NULL, + smf_service_instance_id ? ogs_strdup(smf_service_instance_id->valuestring) : NULL, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL, + dnai_list ? dnai_listList : NULL, + ipv6_multi_homing_ind ? ipv6_multi_homing_ind->valueint : 0, + ma_accepted_ind ? ma_accepted_ind->valueint : 0, + home_provided_charging_id ? ogs_strdup(home_provided_charging_id->valuestring) : NULL, + nef_ext_buf_support_ind ? nef_ext_buf_support_ind->valueint : 0 + ); + + return pdu_session_created_data_local_var; +end: + return NULL; +} + +OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_copy(OpenAPI_pdu_session_created_data_t *dst, OpenAPI_pdu_session_created_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_created_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_created_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_pdu_session_created_data_free(dst); + dst = OpenAPI_pdu_session_created_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_created_data.h b/lib/sbi/openapi/model/pdu_session_created_data.h new file mode 100644 index 000000000..70aaa5965 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_created_data.h @@ -0,0 +1,109 @@ +/* + * pdu_session_created_data.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_created_data_H_ +#define _OpenAPI_pdu_session_created_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ambr.h" +#include "eps_bearer_info.h" +#include "eps_pdn_cnx_info.h" +#include "max_integrity_protected_data_rate.h" +#include "pdu_session_type.h" +#include "qos_flow_setup_item.h" +#include "ref_to_binary_data.h" +#include "roaming_charging_profile.h" +#include "snssai.h" +#include "tunnel_info.h" +#include "up_security.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_created_data_s OpenAPI_pdu_session_created_data_t; +typedef struct OpenAPI_pdu_session_created_data_s { + OpenAPI_pdu_session_type_e pdu_session_type; + char *ssc_mode; + struct OpenAPI_tunnel_info_s *hcn_tunnel_info; + struct OpenAPI_tunnel_info_s *cn_tunnel_info; + struct OpenAPI_tunnel_info_s *additional_cn_tunnel_info; + struct OpenAPI_ambr_s *session_ambr; + OpenAPI_list_t *qos_flows_setup_list; + char *h_smf_instance_id; + char *smf_instance_id; + int pdu_session_id; + struct OpenAPI_snssai_s *s_nssai; + int enable_pause_charging; + char *ue_ipv4_address; + char *ue_ipv6_prefix; + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_to_ue; + struct OpenAPI_eps_pdn_cnx_info_s *eps_pdn_cnx_info; + OpenAPI_list_t *eps_bearer_info; + char *supported_features; + struct OpenAPI_max_integrity_protected_data_rate_s *max_integrity_protected_data_rate; + int always_on_granted; + char *gpsi; + struct OpenAPI_up_security_s *up_security; + struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; + char *h_smf_service_instance_id; + char *smf_service_instance_id; + char *recovery_time; + OpenAPI_list_t *dnai_list; + int ipv6_multi_homing_ind; + int ma_accepted_ind; + char *home_provided_charging_id; + int nef_ext_buf_support_ind; +} OpenAPI_pdu_session_created_data_t; + +OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( + OpenAPI_pdu_session_type_e pdu_session_type, + char *ssc_mode, + OpenAPI_tunnel_info_t *hcn_tunnel_info, + OpenAPI_tunnel_info_t *cn_tunnel_info, + OpenAPI_tunnel_info_t *additional_cn_tunnel_info, + OpenAPI_ambr_t *session_ambr, + OpenAPI_list_t *qos_flows_setup_list, + char *h_smf_instance_id, + char *smf_instance_id, + int pdu_session_id, + OpenAPI_snssai_t *s_nssai, + int enable_pause_charging, + char *ue_ipv4_address, + char *ue_ipv6_prefix, + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, + OpenAPI_list_t *eps_bearer_info, + char *supported_features, + OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate, + int always_on_granted, + char *gpsi, + OpenAPI_up_security_t *up_security, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + char *h_smf_service_instance_id, + char *smf_service_instance_id, + char *recovery_time, + OpenAPI_list_t *dnai_list, + int ipv6_multi_homing_ind, + int ma_accepted_ind, + char *home_provided_charging_id, + int nef_ext_buf_support_ind + ); +void OpenAPI_pdu_session_created_data_free(OpenAPI_pdu_session_created_data_t *pdu_session_created_data); +OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJSON(cJSON *pdu_session_created_dataJSON); +cJSON *OpenAPI_pdu_session_created_data_convertToJSON(OpenAPI_pdu_session_created_data_t *pdu_session_created_data); +OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_copy(OpenAPI_pdu_session_created_data_t *dst, OpenAPI_pdu_session_created_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_created_data_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_management_data.c b/lib/sbi/openapi/model/pdu_session_management_data.c index 4c0bbadf8..8512a1451 100644 --- a/lib/sbi/openapi/model/pdu_session_management_data.c +++ b/lib/sbi/openapi/model/pdu_session_management_data.c @@ -14,7 +14,7 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_creat char *ipv4_addr, OpenAPI_list_t *ipv6_prefix, OpenAPI_list_t *ipv6_addrs, - OpenAPI_pdu_session_type_t *pdu_sess_type, + OpenAPI_pdu_session_type_e pdu_sess_type, char *ip_addr_ts, char *dnn, int pdu_session_id @@ -65,7 +65,6 @@ void OpenAPI_pdu_session_management_data_free(OpenAPI_pdu_session_management_dat ogs_free(node->data); } OpenAPI_list_free(pdu_session_management_data->ipv6_addrs); - OpenAPI_pdu_session_type_free(pdu_session_management_data->pdu_sess_type); ogs_free(pdu_session_management_data->ip_addr_ts); ogs_free(pdu_session_management_data->dnn); ogs_free(pdu_session_management_data); @@ -182,13 +181,7 @@ cJSON *OpenAPI_pdu_session_management_data_convertToJSON(OpenAPI_pdu_session_man } if (pdu_session_management_data->pdu_sess_type) { - cJSON *pdu_sess_type_local_JSON = OpenAPI_pdu_session_type_convertToJSON(pdu_session_management_data->pdu_sess_type); - if (pdu_sess_type_local_JSON == NULL) { - ogs_error("OpenAPI_pdu_session_management_data_convertToJSON() failed [pdu_sess_type]"); - goto end; - } - cJSON_AddItemToObject(item, "pduSessType", pdu_sess_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "pduSessType", OpenAPI_pdu_session_type_ToString(pdu_session_management_data->pdu_sess_type)) == NULL) { ogs_error("OpenAPI_pdu_session_management_data_convertToJSON() failed [pdu_sess_type]"); goto end; } @@ -339,9 +332,13 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_parse cJSON *pdu_sess_type = cJSON_GetObjectItemCaseSensitive(pdu_session_management_dataJSON, "pduSessType"); - OpenAPI_pdu_session_type_t *pdu_sess_type_local_nonprim = NULL; + OpenAPI_pdu_session_type_e pdu_sess_typeVariable; if (pdu_sess_type) { - pdu_sess_type_local_nonprim = OpenAPI_pdu_session_type_parseFromJSON(pdu_sess_type); + if (!cJSON_IsString(pdu_sess_type)) { + ogs_error("OpenAPI_pdu_session_management_data_parseFromJSON() failed [pdu_sess_type]"); + goto end; + } + pdu_sess_typeVariable = OpenAPI_pdu_session_type_FromString(pdu_sess_type->valuestring); } cJSON *ip_addr_ts = cJSON_GetObjectItemCaseSensitive(pdu_session_management_dataJSON, "ipAddrTs"); @@ -381,7 +378,7 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_parse ipv4_addr ? ogs_strdup(ipv4_addr->valuestring) : NULL, ipv6_prefix ? ipv6_prefixList : NULL, ipv6_addrs ? ipv6_addrsList : NULL, - pdu_sess_type ? pdu_sess_type_local_nonprim : NULL, + pdu_sess_type ? pdu_sess_typeVariable : 0, ip_addr_ts ? ogs_strdup(ip_addr_ts->valuestring) : NULL, dnn ? ogs_strdup(dnn->valuestring) : NULL, pdu_session_id ? pdu_session_id->valuedouble : 0 @@ -392,3 +389,37 @@ end: return NULL; } +OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_copy(OpenAPI_pdu_session_management_data_t *dst, OpenAPI_pdu_session_management_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_management_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_management_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_pdu_session_management_data_free(dst); + dst = OpenAPI_pdu_session_management_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_management_data.h b/lib/sbi/openapi/model/pdu_session_management_data.h index d9ad454d9..8668b5c2e 100644 --- a/lib/sbi/openapi/model/pdu_session_management_data.h +++ b/lib/sbi/openapi/model/pdu_session_management_data.h @@ -31,7 +31,7 @@ typedef struct OpenAPI_pdu_session_management_data_s { char *ipv4_addr; OpenAPI_list_t *ipv6_prefix; OpenAPI_list_t *ipv6_addrs; - struct OpenAPI_pdu_session_type_s *pdu_sess_type; + OpenAPI_pdu_session_type_e pdu_sess_type; char *ip_addr_ts; char *dnn; int pdu_session_id; @@ -47,7 +47,7 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_creat char *ipv4_addr, OpenAPI_list_t *ipv6_prefix, OpenAPI_list_t *ipv6_addrs, - OpenAPI_pdu_session_type_t *pdu_sess_type, + OpenAPI_pdu_session_type_e pdu_sess_type, char *ip_addr_ts, char *dnn, int pdu_session_id @@ -55,6 +55,7 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_creat void OpenAPI_pdu_session_management_data_free(OpenAPI_pdu_session_management_data_t *pdu_session_management_data); OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_parseFromJSON(cJSON *pdu_session_management_dataJSON); cJSON *OpenAPI_pdu_session_management_data_convertToJSON(OpenAPI_pdu_session_management_data_t *pdu_session_management_data); +OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_copy(OpenAPI_pdu_session_management_data_t *dst, OpenAPI_pdu_session_management_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pdu_session_notify_item.c b/lib/sbi/openapi/model/pdu_session_notify_item.c new file mode 100644 index 000000000..0b91691e6 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_notify_item.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "pdu_session_notify_item.h" + +OpenAPI_pdu_session_notify_item_t *OpenAPI_pdu_session_notify_item_create( + OpenAPI_notification_cause_t *notification_cause + ) +{ + OpenAPI_pdu_session_notify_item_t *pdu_session_notify_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_notify_item_t)); + if (!pdu_session_notify_item_local_var) { + return NULL; + } + pdu_session_notify_item_local_var->notification_cause = notification_cause; + + return pdu_session_notify_item_local_var; +} + +void OpenAPI_pdu_session_notify_item_free(OpenAPI_pdu_session_notify_item_t *pdu_session_notify_item) +{ + if (NULL == pdu_session_notify_item) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_notification_cause_free(pdu_session_notify_item->notification_cause); + ogs_free(pdu_session_notify_item); +} + +cJSON *OpenAPI_pdu_session_notify_item_convertToJSON(OpenAPI_pdu_session_notify_item_t *pdu_session_notify_item) +{ + cJSON *item = NULL; + + if (pdu_session_notify_item == NULL) { + ogs_error("OpenAPI_pdu_session_notify_item_convertToJSON() failed [PduSessionNotifyItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pdu_session_notify_item->notification_cause) { + ogs_error("OpenAPI_pdu_session_notify_item_convertToJSON() failed [notification_cause]"); + goto end; + } + cJSON *notification_cause_local_JSON = OpenAPI_notification_cause_convertToJSON(pdu_session_notify_item->notification_cause); + if (notification_cause_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_notify_item_convertToJSON() failed [notification_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "notificationCause", notification_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_notify_item_convertToJSON() failed [notification_cause]"); + goto end; + } + +end: + return item; +} + +OpenAPI_pdu_session_notify_item_t *OpenAPI_pdu_session_notify_item_parseFromJSON(cJSON *pdu_session_notify_itemJSON) +{ + OpenAPI_pdu_session_notify_item_t *pdu_session_notify_item_local_var = NULL; + cJSON *notification_cause = cJSON_GetObjectItemCaseSensitive(pdu_session_notify_itemJSON, "notificationCause"); + if (!notification_cause) { + ogs_error("OpenAPI_pdu_session_notify_item_parseFromJSON() failed [notification_cause]"); + goto end; + } + + OpenAPI_notification_cause_t *notification_cause_local_nonprim = NULL; + + notification_cause_local_nonprim = OpenAPI_notification_cause_parseFromJSON(notification_cause); + + pdu_session_notify_item_local_var = OpenAPI_pdu_session_notify_item_create ( + notification_cause_local_nonprim + ); + + return pdu_session_notify_item_local_var; +end: + return NULL; +} + +OpenAPI_pdu_session_notify_item_t *OpenAPI_pdu_session_notify_item_copy(OpenAPI_pdu_session_notify_item_t *dst, OpenAPI_pdu_session_notify_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_notify_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_notify_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pdu_session_notify_item_free(dst); + dst = OpenAPI_pdu_session_notify_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_notify_item.h b/lib/sbi/openapi/model/pdu_session_notify_item.h new file mode 100644 index 000000000..01dfcd0ee --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_notify_item.h @@ -0,0 +1,39 @@ +/* + * pdu_session_notify_item.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_notify_item_H_ +#define _OpenAPI_pdu_session_notify_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "notification_cause.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_notify_item_s OpenAPI_pdu_session_notify_item_t; +typedef struct OpenAPI_pdu_session_notify_item_s { + struct OpenAPI_notification_cause_s *notification_cause; +} OpenAPI_pdu_session_notify_item_t; + +OpenAPI_pdu_session_notify_item_t *OpenAPI_pdu_session_notify_item_create( + OpenAPI_notification_cause_t *notification_cause + ); +void OpenAPI_pdu_session_notify_item_free(OpenAPI_pdu_session_notify_item_t *pdu_session_notify_item); +OpenAPI_pdu_session_notify_item_t *OpenAPI_pdu_session_notify_item_parseFromJSON(cJSON *pdu_session_notify_itemJSON); +cJSON *OpenAPI_pdu_session_notify_item_convertToJSON(OpenAPI_pdu_session_notify_item_t *pdu_session_notify_item); +OpenAPI_pdu_session_notify_item_t *OpenAPI_pdu_session_notify_item_copy(OpenAPI_pdu_session_notify_item_t *dst, OpenAPI_pdu_session_notify_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_notify_item_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_status.c b/lib/sbi/openapi/model/pdu_session_status.c index 147f7b788..eced2667e 100644 --- a/lib/sbi/openapi/model/pdu_session_status.c +++ b/lib/sbi/openapi/model/pdu_session_status.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_copy(OpenAPI_pdu_session_status_t *dst, OpenAPI_pdu_session_status_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_status_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_status_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pdu_session_status_free(dst); + dst = OpenAPI_pdu_session_status_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_status.h b/lib/sbi/openapi/model/pdu_session_status.h index 76ad15d9f..3f389577f 100644 --- a/lib/sbi/openapi/model/pdu_session_status.h +++ b/lib/sbi/openapi/model/pdu_session_status.h @@ -26,6 +26,7 @@ OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_create( void OpenAPI_pdu_session_status_free(OpenAPI_pdu_session_status_t *pdu_session_status); OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_parseFromJSON(cJSON *pdu_session_statusJSON); cJSON *OpenAPI_pdu_session_status_convertToJSON(OpenAPI_pdu_session_status_t *pdu_session_status); +OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_copy(OpenAPI_pdu_session_status_t *dst, OpenAPI_pdu_session_status_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pdu_session_type.c b/lib/sbi/openapi/model/pdu_session_type.c index e8bf1ff1f..60c8c4b14 100644 --- a/lib/sbi/openapi/model/pdu_session_type.c +++ b/lib/sbi/openapi/model/pdu_session_type.c @@ -4,48 +4,27 @@ #include #include "pdu_session_type.h" -OpenAPI_pdu_session_type_t *OpenAPI_pdu_session_type_create( - ) +char* OpenAPI_pdu_session_type_ToString(OpenAPI_pdu_session_type_e pdu_session_type) { - OpenAPI_pdu_session_type_t *pdu_session_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_type_t)); - if (!pdu_session_type_local_var) { - return NULL; + const char *pdu_session_typeArray[] = { "NULL", "IPV4", "IPV6", "IPV4V6", "UNSTRUCTURED", "ETHERNET" }; + size_t sizeofArray = sizeof(pdu_session_typeArray) / sizeof(pdu_session_typeArray[0]); + if (pdu_session_type < sizeofArray) + return (char *)pdu_session_typeArray[pdu_session_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_pdu_session_type_e OpenAPI_pdu_session_type_FromString(char* pdu_session_type) +{ + int stringToReturn = 0; + const char *pdu_session_typeArray[] = { "NULL", "IPV4", "IPV6", "IPV4V6", "UNSTRUCTURED", "ETHERNET" }; + size_t sizeofArray = sizeof(pdu_session_typeArray) / sizeof(pdu_session_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(pdu_session_type, pdu_session_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - - return pdu_session_type_local_var; -} - -void OpenAPI_pdu_session_type_free(OpenAPI_pdu_session_type_t *pdu_session_type) -{ - if (NULL == pdu_session_type) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(pdu_session_type); -} - -cJSON *OpenAPI_pdu_session_type_convertToJSON(OpenAPI_pdu_session_type_t *pdu_session_type) -{ - cJSON *item = NULL; - - if (pdu_session_type == NULL) { - ogs_error("OpenAPI_pdu_session_type_convertToJSON() failed [PduSessionType]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_pdu_session_type_t *OpenAPI_pdu_session_type_parseFromJSON(cJSON *pdu_session_typeJSON) -{ - OpenAPI_pdu_session_type_t *pdu_session_type_local_var = NULL; - pdu_session_type_local_var = OpenAPI_pdu_session_type_create ( - ); - - return pdu_session_type_local_var; -end: - return NULL; + return 0; } diff --git a/lib/sbi/openapi/model/pdu_session_type.h b/lib/sbi/openapi/model/pdu_session_type.h index 632e245d1..2d1a66c15 100644 --- a/lib/sbi/openapi/model/pdu_session_type.h +++ b/lib/sbi/openapi/model/pdu_session_type.h @@ -17,15 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_pdu_session_type_s OpenAPI_pdu_session_type_t; -typedef struct OpenAPI_pdu_session_type_s { -} OpenAPI_pdu_session_type_t; +typedef enum { OpenAPI_pdu_session_type_NULL = 0, OpenAPI_pdu_session_type_IPV4, OpenAPI_pdu_session_type_IPV6, OpenAPI_pdu_session_type_IPV4V6, OpenAPI_pdu_session_type_UNSTRUCTURED, OpenAPI_pdu_session_type_ETHERNET } OpenAPI_pdu_session_type_e; -OpenAPI_pdu_session_type_t *OpenAPI_pdu_session_type_create( - ); -void OpenAPI_pdu_session_type_free(OpenAPI_pdu_session_type_t *pdu_session_type); -OpenAPI_pdu_session_type_t *OpenAPI_pdu_session_type_parseFromJSON(cJSON *pdu_session_typeJSON); -cJSON *OpenAPI_pdu_session_type_convertToJSON(OpenAPI_pdu_session_type_t *pdu_session_type); +char* OpenAPI_pdu_session_type_ToString(OpenAPI_pdu_session_type_e pdu_session_type); + +OpenAPI_pdu_session_type_e OpenAPI_pdu_session_type_FromString(char* pdu_session_type); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pdu_session_types.c b/lib/sbi/openapi/model/pdu_session_types.c index 2c667051f..3efad0158 100644 --- a/lib/sbi/openapi/model/pdu_session_types.c +++ b/lib/sbi/openapi/model/pdu_session_types.c @@ -5,7 +5,7 @@ #include "pdu_session_types.h" OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_create( - OpenAPI_pdu_session_type_t *default_session_type, + OpenAPI_pdu_session_type_e default_session_type, OpenAPI_list_t *allowed_session_types ) { @@ -25,10 +25,6 @@ void OpenAPI_pdu_session_types_free(OpenAPI_pdu_session_types_t *pdu_session_typ return; } OpenAPI_lnode_t *node; - OpenAPI_pdu_session_type_free(pdu_session_types->default_session_type); - OpenAPI_list_for_each(pdu_session_types->allowed_session_types, node) { - OpenAPI_pdu_session_type_free(node->data); - } OpenAPI_list_free(pdu_session_types->allowed_session_types); ogs_free(pdu_session_types); } @@ -47,33 +43,22 @@ cJSON *OpenAPI_pdu_session_types_convertToJSON(OpenAPI_pdu_session_types_t *pdu_ ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed [default_session_type]"); goto end; } - cJSON *default_session_type_local_JSON = OpenAPI_pdu_session_type_convertToJSON(pdu_session_types->default_session_type); - if (default_session_type_local_JSON == NULL) { - ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed [default_session_type]"); - goto end; - } - cJSON_AddItemToObject(item, "defaultSessionType", default_session_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "defaultSessionType", OpenAPI_pdu_session_type_ToString(pdu_session_types->default_session_type)) == NULL) { ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed [default_session_type]"); goto end; } if (pdu_session_types->allowed_session_types) { - cJSON *allowed_session_typesList = cJSON_AddArrayToObject(item, "allowedSessionTypes"); - if (allowed_session_typesList == NULL) { + cJSON *allowed_session_types = cJSON_AddArrayToObject(item, "allowedSessionTypes"); + if (allowed_session_types == NULL) { ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed [allowed_session_types]"); goto end; } - OpenAPI_lnode_t *allowed_session_types_node; - if (pdu_session_types->allowed_session_types) { - OpenAPI_list_for_each(pdu_session_types->allowed_session_types, allowed_session_types_node) { - cJSON *itemLocal = OpenAPI_pdu_session_type_convertToJSON(allowed_session_types_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed [allowed_session_types]"); - goto end; - } - cJSON_AddItemToArray(allowed_session_typesList, itemLocal); + OpenAPI_list_for_each(pdu_session_types->allowed_session_types, allowed_session_types_node) { + if (cJSON_AddStringToObject(allowed_session_types, "", OpenAPI_pdu_session_type_ToString((OpenAPI_pdu_session_type_e)allowed_session_types_node->data)) == NULL) { + ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed [allowed_session_types]"); + goto end; } } } @@ -91,9 +76,13 @@ OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_parseFromJSON(cJSON *pdu_ goto end; } - OpenAPI_pdu_session_type_t *default_session_type_local_nonprim = NULL; + OpenAPI_pdu_session_type_e default_session_typeVariable; - default_session_type_local_nonprim = OpenAPI_pdu_session_type_parseFromJSON(default_session_type); + if (!cJSON_IsString(default_session_type)) { + ogs_error("OpenAPI_pdu_session_types_parseFromJSON() failed [default_session_type]"); + goto end; + } + default_session_typeVariable = OpenAPI_pdu_session_type_FromString(default_session_type->valuestring); cJSON *allowed_session_types = cJSON_GetObjectItemCaseSensitive(pdu_session_typesJSON, "allowedSessionTypes"); @@ -108,18 +97,17 @@ OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_parseFromJSON(cJSON *pdu_ allowed_session_typesList = OpenAPI_list_create(); cJSON_ArrayForEach(allowed_session_types_local_nonprimitive, allowed_session_types ) { - if (!cJSON_IsObject(allowed_session_types_local_nonprimitive)) { + if (!cJSON_IsString(allowed_session_types_local_nonprimitive)) { ogs_error("OpenAPI_pdu_session_types_parseFromJSON() failed [allowed_session_types]"); goto end; } - OpenAPI_pdu_session_type_t *allowed_session_typesItem = OpenAPI_pdu_session_type_parseFromJSON(allowed_session_types_local_nonprimitive); - OpenAPI_list_add(allowed_session_typesList, allowed_session_typesItem); + OpenAPI_list_add(allowed_session_typesList, (void *)OpenAPI_pdu_session_type_FromString(allowed_session_types_local_nonprimitive->valuestring)); } } pdu_session_types_local_var = OpenAPI_pdu_session_types_create ( - default_session_type_local_nonprim, + default_session_typeVariable, allowed_session_types ? allowed_session_typesList : NULL ); @@ -128,3 +116,37 @@ end: return NULL; } +OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_copy(OpenAPI_pdu_session_types_t *dst, OpenAPI_pdu_session_types_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_types_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pdu_session_types_free(dst); + dst = OpenAPI_pdu_session_types_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_types.h b/lib/sbi/openapi/model/pdu_session_types.h index 385869a25..c2c9ffadf 100644 --- a/lib/sbi/openapi/model/pdu_session_types.h +++ b/lib/sbi/openapi/model/pdu_session_types.h @@ -20,17 +20,18 @@ extern "C" { typedef struct OpenAPI_pdu_session_types_s OpenAPI_pdu_session_types_t; typedef struct OpenAPI_pdu_session_types_s { - struct OpenAPI_pdu_session_type_s *default_session_type; + OpenAPI_pdu_session_type_e default_session_type; OpenAPI_list_t *allowed_session_types; } OpenAPI_pdu_session_types_t; OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_create( - OpenAPI_pdu_session_type_t *default_session_type, + OpenAPI_pdu_session_type_e default_session_type, OpenAPI_list_t *allowed_session_types ); void OpenAPI_pdu_session_types_free(OpenAPI_pdu_session_types_t *pdu_session_types); OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_parseFromJSON(cJSON *pdu_session_typesJSON); cJSON *OpenAPI_pdu_session_types_convertToJSON(OpenAPI_pdu_session_types_t *pdu_session_types); +OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_copy(OpenAPI_pdu_session_types_t *dst, OpenAPI_pdu_session_types_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pei_update_info.c b/lib/sbi/openapi/model/pei_update_info.c index 366c2f8cb..d2f2b9c66 100644 --- a/lib/sbi/openapi/model/pei_update_info.c +++ b/lib/sbi/openapi/model/pei_update_info.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_pei_update_info_t *OpenAPI_pei_update_info_copy(OpenAPI_pei_update_info_t *dst, OpenAPI_pei_update_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pei_update_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pei_update_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_pei_update_info_free(dst); + dst = OpenAPI_pei_update_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pei_update_info.h b/lib/sbi/openapi/model/pei_update_info.h index 4cbacb12a..2d37ce2b7 100644 --- a/lib/sbi/openapi/model/pei_update_info.h +++ b/lib/sbi/openapi/model/pei_update_info.h @@ -28,6 +28,7 @@ OpenAPI_pei_update_info_t *OpenAPI_pei_update_info_create( void OpenAPI_pei_update_info_free(OpenAPI_pei_update_info_t *pei_update_info); OpenAPI_pei_update_info_t *OpenAPI_pei_update_info_parseFromJSON(cJSON *pei_update_infoJSON); cJSON *OpenAPI_pei_update_info_convertToJSON(OpenAPI_pei_update_info_t *pei_update_info); +OpenAPI_pei_update_info_t *OpenAPI_pei_update_info_copy(OpenAPI_pei_update_info_t *dst, OpenAPI_pei_update_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/periodicity.c b/lib/sbi/openapi/model/periodicity.c index 0ea85f987..85cfd5614 100644 --- a/lib/sbi/openapi/model/periodicity.c +++ b/lib/sbi/openapi/model/periodicity.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_periodicity_t *OpenAPI_periodicity_copy(OpenAPI_periodicity_t *dst, OpenAPI_periodicity_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_periodicity_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_periodicity_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_periodicity_free(dst); + dst = OpenAPI_periodicity_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/periodicity.h b/lib/sbi/openapi/model/periodicity.h index 174be62ae..5599b2268 100644 --- a/lib/sbi/openapi/model/periodicity.h +++ b/lib/sbi/openapi/model/periodicity.h @@ -26,6 +26,7 @@ OpenAPI_periodicity_t *OpenAPI_periodicity_create( void OpenAPI_periodicity_free(OpenAPI_periodicity_t *periodicity); OpenAPI_periodicity_t *OpenAPI_periodicity_parseFromJSON(cJSON *periodicityJSON); cJSON *OpenAPI_periodicity_convertToJSON(OpenAPI_periodicity_t *periodicity); +OpenAPI_periodicity_t *OpenAPI_periodicity_copy(OpenAPI_periodicity_t *dst, OpenAPI_periodicity_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pfd_change_notification.c b/lib/sbi/openapi/model/pfd_change_notification.c index dcb400463..522504eaa 100644 --- a/lib/sbi/openapi/model/pfd_change_notification.c +++ b/lib/sbi/openapi/model/pfd_change_notification.c @@ -56,14 +56,14 @@ cJSON *OpenAPI_pfd_change_notification_convertToJSON(OpenAPI_pfd_change_notifica goto end; } - if (pfd_change_notification->removal_flag >= 0) { + if (pfd_change_notification->removal_flag) { if (cJSON_AddBoolToObject(item, "removalFlag", pfd_change_notification->removal_flag) == NULL) { ogs_error("OpenAPI_pfd_change_notification_convertToJSON() failed [removal_flag]"); goto end; } } - if (pfd_change_notification->partial_flag >= 0) { + if (pfd_change_notification->partial_flag) { if (cJSON_AddBoolToObject(item, "partialFlag", pfd_change_notification->partial_flag) == NULL) { ogs_error("OpenAPI_pfd_change_notification_convertToJSON() failed [partial_flag]"); goto end; @@ -162,3 +162,37 @@ end: return NULL; } +OpenAPI_pfd_change_notification_t *OpenAPI_pfd_change_notification_copy(OpenAPI_pfd_change_notification_t *dst, OpenAPI_pfd_change_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pfd_change_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pfd_change_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pfd_change_notification_free(dst); + dst = OpenAPI_pfd_change_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pfd_change_notification.h b/lib/sbi/openapi/model/pfd_change_notification.h index a0999f7fb..3966fd739 100644 --- a/lib/sbi/openapi/model/pfd_change_notification.h +++ b/lib/sbi/openapi/model/pfd_change_notification.h @@ -35,6 +35,7 @@ OpenAPI_pfd_change_notification_t *OpenAPI_pfd_change_notification_create( void OpenAPI_pfd_change_notification_free(OpenAPI_pfd_change_notification_t *pfd_change_notification); OpenAPI_pfd_change_notification_t *OpenAPI_pfd_change_notification_parseFromJSON(cJSON *pfd_change_notificationJSON); cJSON *OpenAPI_pfd_change_notification_convertToJSON(OpenAPI_pfd_change_notification_t *pfd_change_notification); +OpenAPI_pfd_change_notification_t *OpenAPI_pfd_change_notification_copy(OpenAPI_pfd_change_notification_t *dst, OpenAPI_pfd_change_notification_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pfd_content.c b/lib/sbi/openapi/model/pfd_content.c index 8ede9ca98..436cc92a8 100644 --- a/lib/sbi/openapi/model/pfd_content.c +++ b/lib/sbi/openapi/model/pfd_content.c @@ -222,3 +222,37 @@ end: return NULL; } +OpenAPI_pfd_content_t *OpenAPI_pfd_content_copy(OpenAPI_pfd_content_t *dst, OpenAPI_pfd_content_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pfd_content_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pfd_content_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pfd_content_free(dst); + dst = OpenAPI_pfd_content_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pfd_content.h b/lib/sbi/openapi/model/pfd_content.h index 6b5fc55f7..db88bd9c3 100644 --- a/lib/sbi/openapi/model/pfd_content.h +++ b/lib/sbi/openapi/model/pfd_content.h @@ -37,6 +37,7 @@ OpenAPI_pfd_content_t *OpenAPI_pfd_content_create( void OpenAPI_pfd_content_free(OpenAPI_pfd_content_t *pfd_content); OpenAPI_pfd_content_t *OpenAPI_pfd_content_parseFromJSON(cJSON *pfd_contentJSON); cJSON *OpenAPI_pfd_content_convertToJSON(OpenAPI_pfd_content_t *pfd_content); +OpenAPI_pfd_content_t *OpenAPI_pfd_content_copy(OpenAPI_pfd_content_t *dst, OpenAPI_pfd_content_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pfd_data.c b/lib/sbi/openapi/model/pfd_data.c index 16d525c2a..c4a705e93 100644 --- a/lib/sbi/openapi/model/pfd_data.c +++ b/lib/sbi/openapi/model/pfd_data.c @@ -135,3 +135,37 @@ end: return NULL; } +OpenAPI_pfd_data_t *OpenAPI_pfd_data_copy(OpenAPI_pfd_data_t *dst, OpenAPI_pfd_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pfd_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pfd_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_pfd_data_free(dst); + dst = OpenAPI_pfd_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pfd_data.h b/lib/sbi/openapi/model/pfd_data.h index 9676be8aa..b125ca822 100644 --- a/lib/sbi/openapi/model/pfd_data.h +++ b/lib/sbi/openapi/model/pfd_data.h @@ -30,6 +30,7 @@ OpenAPI_pfd_data_t *OpenAPI_pfd_data_create( void OpenAPI_pfd_data_free(OpenAPI_pfd_data_t *pfd_data); OpenAPI_pfd_data_t *OpenAPI_pfd_data_parseFromJSON(cJSON *pfd_dataJSON); cJSON *OpenAPI_pfd_data_convertToJSON(OpenAPI_pfd_data_t *pfd_data); +OpenAPI_pfd_data_t *OpenAPI_pfd_data_copy(OpenAPI_pfd_data_t *dst, OpenAPI_pfd_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pfd_data_for_app.c b/lib/sbi/openapi/model/pfd_data_for_app.c index 83ac31bfa..e211bdab9 100644 --- a/lib/sbi/openapi/model/pfd_data_for_app.c +++ b/lib/sbi/openapi/model/pfd_data_for_app.c @@ -149,3 +149,37 @@ end: return NULL; } +OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_copy(OpenAPI_pfd_data_for_app_t *dst, OpenAPI_pfd_data_for_app_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pfd_data_for_app_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pfd_data_for_app_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pfd_data_for_app_free(dst); + dst = OpenAPI_pfd_data_for_app_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pfd_data_for_app.h b/lib/sbi/openapi/model/pfd_data_for_app.h index b8b9742e2..a2059a1f7 100644 --- a/lib/sbi/openapi/model/pfd_data_for_app.h +++ b/lib/sbi/openapi/model/pfd_data_for_app.h @@ -33,6 +33,7 @@ OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_create( void OpenAPI_pfd_data_for_app_free(OpenAPI_pfd_data_for_app_t *pfd_data_for_app); OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_parseFromJSON(cJSON *pfd_data_for_appJSON); cJSON *OpenAPI_pfd_data_for_app_convertToJSON(OpenAPI_pfd_data_for_app_t *pfd_data_for_app); +OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_copy(OpenAPI_pfd_data_for_app_t *dst, OpenAPI_pfd_data_for_app_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pfd_data_for_app_ext.c b/lib/sbi/openapi/model/pfd_data_for_app_ext.c index 40d4c45ab..431f57e23 100644 --- a/lib/sbi/openapi/model/pfd_data_for_app_ext.c +++ b/lib/sbi/openapi/model/pfd_data_for_app_ext.c @@ -169,3 +169,37 @@ end: return NULL; } +OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_copy(OpenAPI_pfd_data_for_app_ext_t *dst, OpenAPI_pfd_data_for_app_ext_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pfd_data_for_app_ext_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pfd_data_for_app_ext_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pfd_data_for_app_ext_free(dst); + dst = OpenAPI_pfd_data_for_app_ext_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pfd_data_for_app_ext.h b/lib/sbi/openapi/model/pfd_data_for_app_ext.h index cfbfdd979..281b3617e 100644 --- a/lib/sbi/openapi/model/pfd_data_for_app_ext.h +++ b/lib/sbi/openapi/model/pfd_data_for_app_ext.h @@ -37,6 +37,7 @@ OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_create( void OpenAPI_pfd_data_for_app_ext_free(OpenAPI_pfd_data_for_app_ext_t *pfd_data_for_app_ext); OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_parseFromJSON(cJSON *pfd_data_for_app_extJSON); cJSON *OpenAPI_pfd_data_for_app_ext_convertToJSON(OpenAPI_pfd_data_for_app_ext_t *pfd_data_for_app_ext); +OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_copy(OpenAPI_pfd_data_for_app_ext_t *dst, OpenAPI_pfd_data_for_app_ext_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.c b/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.c index d684855a4..a06c28ffa 100644 --- a/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.c +++ b/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.c @@ -69,3 +69,37 @@ end: return NULL; } +OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_copy(OpenAPI_pfd_data_for_app_ext_all_of_t *dst, OpenAPI_pfd_data_for_app_ext_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pfd_data_for_app_ext_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pfd_data_for_app_ext_all_of_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pfd_data_for_app_ext_all_of_free(dst); + dst = OpenAPI_pfd_data_for_app_ext_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.h b/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.h index 457f85710..a3b93fc9c 100644 --- a/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.h +++ b/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.h @@ -28,6 +28,7 @@ OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_creat void OpenAPI_pfd_data_for_app_ext_all_of_free(OpenAPI_pfd_data_for_app_ext_all_of_t *pfd_data_for_app_ext_all_of); OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_parseFromJSON(cJSON *pfd_data_for_app_ext_all_ofJSON); cJSON *OpenAPI_pfd_data_for_app_ext_all_of_convertToJSON(OpenAPI_pfd_data_for_app_ext_all_of_t *pfd_data_for_app_ext_all_of); +OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_copy(OpenAPI_pfd_data_for_app_ext_all_of_t *dst, OpenAPI_pfd_data_for_app_ext_all_of_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pgw_info.c b/lib/sbi/openapi/model/pgw_info.c index d0441c275..57e7533cd 100644 --- a/lib/sbi/openapi/model/pgw_info.c +++ b/lib/sbi/openapi/model/pgw_info.c @@ -123,3 +123,37 @@ end: return NULL; } +OpenAPI_pgw_info_t *OpenAPI_pgw_info_copy(OpenAPI_pgw_info_t *dst, OpenAPI_pgw_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pgw_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pgw_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_pgw_info_free(dst); + dst = OpenAPI_pgw_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pgw_info.h b/lib/sbi/openapi/model/pgw_info.h index 70c39a18d..dbac4abba 100644 --- a/lib/sbi/openapi/model/pgw_info.h +++ b/lib/sbi/openapi/model/pgw_info.h @@ -33,6 +33,7 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_create( void OpenAPI_pgw_info_free(OpenAPI_pgw_info_t *pgw_info); OpenAPI_pgw_info_t *OpenAPI_pgw_info_parseFromJSON(cJSON *pgw_infoJSON); cJSON *OpenAPI_pgw_info_convertToJSON(OpenAPI_pgw_info_t *pgw_info); +OpenAPI_pgw_info_t *OpenAPI_pgw_info_copy(OpenAPI_pgw_info_t *dst, OpenAPI_pgw_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/plmn_ec_info.c b/lib/sbi/openapi/model/plmn_ec_info.c index 1650faf83..0d0b96629 100644 --- a/lib/sbi/openapi/model/plmn_ec_info.c +++ b/lib/sbi/openapi/model/plmn_ec_info.c @@ -56,14 +56,14 @@ cJSON *OpenAPI_plmn_ec_info_convertToJSON(OpenAPI_plmn_ec_info_t *plmn_ec_info) goto end; } - if (plmn_ec_info->ec_mode_a_restricted >= 0) { + if (plmn_ec_info->ec_mode_a_restricted) { if (cJSON_AddBoolToObject(item, "ecModeARestricted", plmn_ec_info->ec_mode_a_restricted) == NULL) { ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [ec_mode_a_restricted]"); goto end; } } - if (plmn_ec_info->ec_mode_b_restricted >= 0) { + if (plmn_ec_info->ec_mode_b_restricted) { if (cJSON_AddBoolToObject(item, "ecModeBRestricted", plmn_ec_info->ec_mode_b_restricted) == NULL) { ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [ec_mode_b_restricted]"); goto end; @@ -116,3 +116,37 @@ end: return NULL; } +OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_copy(OpenAPI_plmn_ec_info_t *dst, OpenAPI_plmn_ec_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_ec_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_ec_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_plmn_ec_info_free(dst); + dst = OpenAPI_plmn_ec_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_ec_info.h b/lib/sbi/openapi/model/plmn_ec_info.h index 6a140661a..633fe82bd 100644 --- a/lib/sbi/openapi/model/plmn_ec_info.h +++ b/lib/sbi/openapi/model/plmn_ec_info.h @@ -33,6 +33,7 @@ OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_create( void OpenAPI_plmn_ec_info_free(OpenAPI_plmn_ec_info_t *plmn_ec_info); OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_parseFromJSON(cJSON *plmn_ec_infoJSON); cJSON *OpenAPI_plmn_ec_info_convertToJSON(OpenAPI_plmn_ec_info_t *plmn_ec_info); +OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_copy(OpenAPI_plmn_ec_info_t *dst, OpenAPI_plmn_ec_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/plmn_id.c b/lib/sbi/openapi/model/plmn_id.c index 1cf6e8832..890002771 100644 --- a/lib/sbi/openapi/model/plmn_id.c +++ b/lib/sbi/openapi/model/plmn_id.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_plmn_id_t *OpenAPI_plmn_id_copy(OpenAPI_plmn_id_t *dst, OpenAPI_plmn_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_plmn_id_free(dst); + dst = OpenAPI_plmn_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_id.h b/lib/sbi/openapi/model/plmn_id.h index 2f308d91e..4b7ca6f66 100644 --- a/lib/sbi/openapi/model/plmn_id.h +++ b/lib/sbi/openapi/model/plmn_id.h @@ -30,6 +30,7 @@ OpenAPI_plmn_id_t *OpenAPI_plmn_id_create( void OpenAPI_plmn_id_free(OpenAPI_plmn_id_t *plmn_id); OpenAPI_plmn_id_t *OpenAPI_plmn_id_parseFromJSON(cJSON *plmn_idJSON); cJSON *OpenAPI_plmn_id_convertToJSON(OpenAPI_plmn_id_t *plmn_id); +OpenAPI_plmn_id_t *OpenAPI_plmn_id_copy(OpenAPI_plmn_id_t *dst, OpenAPI_plmn_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/plmn_id_nid.c b/lib/sbi/openapi/model/plmn_id_nid.c index 6fd8bb57f..9dbd76576 100644 --- a/lib/sbi/openapi/model/plmn_id_nid.c +++ b/lib/sbi/openapi/model/plmn_id_nid.c @@ -119,3 +119,37 @@ end: return NULL; } +OpenAPI_plmn_id_nid_t *OpenAPI_plmn_id_nid_copy(OpenAPI_plmn_id_nid_t *dst, OpenAPI_plmn_id_nid_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_id_nid_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_id_nid_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_plmn_id_nid_free(dst); + dst = OpenAPI_plmn_id_nid_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_id_nid.h b/lib/sbi/openapi/model/plmn_id_nid.h index a06c71485..49bcc2fae 100644 --- a/lib/sbi/openapi/model/plmn_id_nid.h +++ b/lib/sbi/openapi/model/plmn_id_nid.h @@ -32,6 +32,7 @@ OpenAPI_plmn_id_nid_t *OpenAPI_plmn_id_nid_create( void OpenAPI_plmn_id_nid_free(OpenAPI_plmn_id_nid_t *plmn_id_nid); OpenAPI_plmn_id_nid_t *OpenAPI_plmn_id_nid_parseFromJSON(cJSON *plmn_id_nidJSON); cJSON *OpenAPI_plmn_id_nid_convertToJSON(OpenAPI_plmn_id_nid_t *plmn_id_nid); +OpenAPI_plmn_id_nid_t *OpenAPI_plmn_id_nid_copy(OpenAPI_plmn_id_nid_t *dst, OpenAPI_plmn_id_nid_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/plmn_operator_class.c b/lib/sbi/openapi/model/plmn_operator_class.c index deb92d304..c3da330ca 100644 --- a/lib/sbi/openapi/model/plmn_operator_class.c +++ b/lib/sbi/openapi/model/plmn_operator_class.c @@ -123,3 +123,37 @@ end: return NULL; } +OpenAPI_plmn_operator_class_t *OpenAPI_plmn_operator_class_copy(OpenAPI_plmn_operator_class_t *dst, OpenAPI_plmn_operator_class_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_operator_class_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_operator_class_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_plmn_operator_class_free(dst); + dst = OpenAPI_plmn_operator_class_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_operator_class.h b/lib/sbi/openapi/model/plmn_operator_class.h index 47071d694..6e3fff3d5 100644 --- a/lib/sbi/openapi/model/plmn_operator_class.h +++ b/lib/sbi/openapi/model/plmn_operator_class.h @@ -31,6 +31,7 @@ OpenAPI_plmn_operator_class_t *OpenAPI_plmn_operator_class_create( void OpenAPI_plmn_operator_class_free(OpenAPI_plmn_operator_class_t *plmn_operator_class); OpenAPI_plmn_operator_class_t *OpenAPI_plmn_operator_class_parseFromJSON(cJSON *plmn_operator_classJSON); cJSON *OpenAPI_plmn_operator_class_convertToJSON(OpenAPI_plmn_operator_class_t *plmn_operator_class); +OpenAPI_plmn_operator_class_t *OpenAPI_plmn_operator_class_copy(OpenAPI_plmn_operator_class_t *dst, OpenAPI_plmn_operator_class_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/plmn_range.c b/lib/sbi/openapi/model/plmn_range.c index 199ed1e19..11c8ee91a 100644 --- a/lib/sbi/openapi/model/plmn_range.c +++ b/lib/sbi/openapi/model/plmn_range.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_plmn_range_t *OpenAPI_plmn_range_copy(OpenAPI_plmn_range_t *dst, OpenAPI_plmn_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_plmn_range_free(dst); + dst = OpenAPI_plmn_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_range.h b/lib/sbi/openapi/model/plmn_range.h index dd8658f59..39f8e08aa 100644 --- a/lib/sbi/openapi/model/plmn_range.h +++ b/lib/sbi/openapi/model/plmn_range.h @@ -32,6 +32,7 @@ OpenAPI_plmn_range_t *OpenAPI_plmn_range_create( void OpenAPI_plmn_range_free(OpenAPI_plmn_range_t *plmn_range); OpenAPI_plmn_range_t *OpenAPI_plmn_range_parseFromJSON(cJSON *plmn_rangeJSON); cJSON *OpenAPI_plmn_range_convertToJSON(OpenAPI_plmn_range_t *plmn_range); +OpenAPI_plmn_range_t *OpenAPI_plmn_range_copy(OpenAPI_plmn_range_t *dst, OpenAPI_plmn_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/plmn_rat_served.c b/lib/sbi/openapi/model/plmn_rat_served.c index 1280be422..efb32a0b0 100644 --- a/lib/sbi/openapi/model/plmn_rat_served.c +++ b/lib/sbi/openapi/model/plmn_rat_served.c @@ -133,3 +133,37 @@ end: return NULL; } +OpenAPI_plmn_rat_served_t *OpenAPI_plmn_rat_served_copy(OpenAPI_plmn_rat_served_t *dst, OpenAPI_plmn_rat_served_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_rat_served_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_rat_served_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_plmn_rat_served_free(dst); + dst = OpenAPI_plmn_rat_served_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_rat_served.h b/lib/sbi/openapi/model/plmn_rat_served.h index 4a1f37590..90aa1a0b8 100644 --- a/lib/sbi/openapi/model/plmn_rat_served.h +++ b/lib/sbi/openapi/model/plmn_rat_served.h @@ -32,6 +32,7 @@ OpenAPI_plmn_rat_served_t *OpenAPI_plmn_rat_served_create( void OpenAPI_plmn_rat_served_free(OpenAPI_plmn_rat_served_t *plmn_rat_served); OpenAPI_plmn_rat_served_t *OpenAPI_plmn_rat_served_parseFromJSON(cJSON *plmn_rat_servedJSON); cJSON *OpenAPI_plmn_rat_served_convertToJSON(OpenAPI_plmn_rat_served_t *plmn_rat_served); +OpenAPI_plmn_rat_served_t *OpenAPI_plmn_rat_served_copy(OpenAPI_plmn_rat_served_t *dst, OpenAPI_plmn_rat_served_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/plmn_route_selection_descriptor.c b/lib/sbi/openapi/model/plmn_route_selection_descriptor.c index 5453bcf1e..694d45716 100644 --- a/lib/sbi/openapi/model/plmn_route_selection_descriptor.c +++ b/lib/sbi/openapi/model/plmn_route_selection_descriptor.c @@ -128,3 +128,37 @@ end: return NULL; } +OpenAPI_plmn_route_selection_descriptor_t *OpenAPI_plmn_route_selection_descriptor_copy(OpenAPI_plmn_route_selection_descriptor_t *dst, OpenAPI_plmn_route_selection_descriptor_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_route_selection_descriptor_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_route_selection_descriptor_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_plmn_route_selection_descriptor_free(dst); + dst = OpenAPI_plmn_route_selection_descriptor_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_route_selection_descriptor.h b/lib/sbi/openapi/model/plmn_route_selection_descriptor.h index 7e35ab478..521e8e80b 100644 --- a/lib/sbi/openapi/model/plmn_route_selection_descriptor.h +++ b/lib/sbi/openapi/model/plmn_route_selection_descriptor.h @@ -32,6 +32,7 @@ OpenAPI_plmn_route_selection_descriptor_t *OpenAPI_plmn_route_selection_descript void OpenAPI_plmn_route_selection_descriptor_free(OpenAPI_plmn_route_selection_descriptor_t *plmn_route_selection_descriptor); OpenAPI_plmn_route_selection_descriptor_t *OpenAPI_plmn_route_selection_descriptor_parseFromJSON(cJSON *plmn_route_selection_descriptorJSON); cJSON *OpenAPI_plmn_route_selection_descriptor_convertToJSON(OpenAPI_plmn_route_selection_descriptor_t *plmn_route_selection_descriptor); +OpenAPI_plmn_route_selection_descriptor_t *OpenAPI_plmn_route_selection_descriptor_copy(OpenAPI_plmn_route_selection_descriptor_t *dst, OpenAPI_plmn_route_selection_descriptor_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/plmn_snssai.c b/lib/sbi/openapi/model/plmn_snssai.c index c1844d058..ece47e9fd 100644 --- a/lib/sbi/openapi/model/plmn_snssai.c +++ b/lib/sbi/openapi/model/plmn_snssai.c @@ -153,3 +153,37 @@ end: return NULL; } +OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_copy(OpenAPI_plmn_snssai_t *dst, OpenAPI_plmn_snssai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_snssai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_plmn_snssai_free(dst); + dst = OpenAPI_plmn_snssai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_snssai.h b/lib/sbi/openapi/model/plmn_snssai.h index 576d020f6..398753053 100644 --- a/lib/sbi/openapi/model/plmn_snssai.h +++ b/lib/sbi/openapi/model/plmn_snssai.h @@ -34,6 +34,7 @@ OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_create( void OpenAPI_plmn_snssai_free(OpenAPI_plmn_snssai_t *plmn_snssai); OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_parseFromJSON(cJSON *plmn_snssaiJSON); cJSON *OpenAPI_plmn_snssai_convertToJSON(OpenAPI_plmn_snssai_t *plmn_snssai); +OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_copy(OpenAPI_plmn_snssai_t *dst, OpenAPI_plmn_snssai_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point.c b/lib/sbi/openapi/model/point.c index 8cd9ee000..65018e575 100644 --- a/lib/sbi/openapi/model/point.c +++ b/lib/sbi/openapi/model/point.c @@ -107,3 +107,37 @@ end: return NULL; } +OpenAPI_point_t *OpenAPI_point_copy(OpenAPI_point_t *dst, OpenAPI_point_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_free(dst); + dst = OpenAPI_point_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point.h b/lib/sbi/openapi/model/point.h index f5aacaa61..6736a38e5 100644 --- a/lib/sbi/openapi/model/point.h +++ b/lib/sbi/openapi/model/point.h @@ -34,6 +34,7 @@ OpenAPI_point_t *OpenAPI_point_create( void OpenAPI_point_free(OpenAPI_point_t *point); OpenAPI_point_t *OpenAPI_point_parseFromJSON(cJSON *pointJSON); cJSON *OpenAPI_point_convertToJSON(OpenAPI_point_t *point); +OpenAPI_point_t *OpenAPI_point_copy(OpenAPI_point_t *dst, OpenAPI_point_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_all_of.c b/lib/sbi/openapi/model/point_all_of.c index 67ea92115..39508ad4c 100644 --- a/lib/sbi/openapi/model/point_all_of.c +++ b/lib/sbi/openapi/model/point_all_of.c @@ -78,3 +78,37 @@ end: return NULL; } +OpenAPI_point_all_of_t *OpenAPI_point_all_of_copy(OpenAPI_point_all_of_t *dst, OpenAPI_point_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_all_of_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_all_of_free(dst); + dst = OpenAPI_point_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_all_of.h b/lib/sbi/openapi/model/point_all_of.h index 49865e849..885997df5 100644 --- a/lib/sbi/openapi/model/point_all_of.h +++ b/lib/sbi/openapi/model/point_all_of.h @@ -29,6 +29,7 @@ OpenAPI_point_all_of_t *OpenAPI_point_all_of_create( void OpenAPI_point_all_of_free(OpenAPI_point_all_of_t *point_all_of); OpenAPI_point_all_of_t *OpenAPI_point_all_of_parseFromJSON(cJSON *point_all_ofJSON); cJSON *OpenAPI_point_all_of_convertToJSON(OpenAPI_point_all_of_t *point_all_of); +OpenAPI_point_all_of_t *OpenAPI_point_all_of_copy(OpenAPI_point_all_of_t *dst, OpenAPI_point_all_of_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_altitude.c b/lib/sbi/openapi/model/point_altitude.c index acdff6bb2..fdba4a6cd 100644 --- a/lib/sbi/openapi/model/point_altitude.c +++ b/lib/sbi/openapi/model/point_altitude.c @@ -131,3 +131,37 @@ end: return NULL; } +OpenAPI_point_altitude_t *OpenAPI_point_altitude_copy(OpenAPI_point_altitude_t *dst, OpenAPI_point_altitude_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_altitude_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_altitude_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_altitude_free(dst); + dst = OpenAPI_point_altitude_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_altitude.h b/lib/sbi/openapi/model/point_altitude.h index 200bef67f..959c13d6a 100644 --- a/lib/sbi/openapi/model/point_altitude.h +++ b/lib/sbi/openapi/model/point_altitude.h @@ -36,6 +36,7 @@ OpenAPI_point_altitude_t *OpenAPI_point_altitude_create( void OpenAPI_point_altitude_free(OpenAPI_point_altitude_t *point_altitude); OpenAPI_point_altitude_t *OpenAPI_point_altitude_parseFromJSON(cJSON *point_altitudeJSON); cJSON *OpenAPI_point_altitude_convertToJSON(OpenAPI_point_altitude_t *point_altitude); +OpenAPI_point_altitude_t *OpenAPI_point_altitude_copy(OpenAPI_point_altitude_t *dst, OpenAPI_point_altitude_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_altitude_all_of.c b/lib/sbi/openapi/model/point_altitude_all_of.c index 2d8e1183f..d4d06b2f6 100644 --- a/lib/sbi/openapi/model/point_altitude_all_of.c +++ b/lib/sbi/openapi/model/point_altitude_all_of.c @@ -102,3 +102,37 @@ end: return NULL; } +OpenAPI_point_altitude_all_of_t *OpenAPI_point_altitude_all_of_copy(OpenAPI_point_altitude_all_of_t *dst, OpenAPI_point_altitude_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_altitude_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_altitude_all_of_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_altitude_all_of_free(dst); + dst = OpenAPI_point_altitude_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_altitude_all_of.h b/lib/sbi/openapi/model/point_altitude_all_of.h index 6e8a5c177..65d42e5b2 100644 --- a/lib/sbi/openapi/model/point_altitude_all_of.h +++ b/lib/sbi/openapi/model/point_altitude_all_of.h @@ -31,6 +31,7 @@ OpenAPI_point_altitude_all_of_t *OpenAPI_point_altitude_all_of_create( void OpenAPI_point_altitude_all_of_free(OpenAPI_point_altitude_all_of_t *point_altitude_all_of); OpenAPI_point_altitude_all_of_t *OpenAPI_point_altitude_all_of_parseFromJSON(cJSON *point_altitude_all_ofJSON); cJSON *OpenAPI_point_altitude_all_of_convertToJSON(OpenAPI_point_altitude_all_of_t *point_altitude_all_of); +OpenAPI_point_altitude_all_of_t *OpenAPI_point_altitude_all_of_copy(OpenAPI_point_altitude_all_of_t *dst, OpenAPI_point_altitude_all_of_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_altitude_uncertainty.c b/lib/sbi/openapi/model/point_altitude_uncertainty.c index 5706ed0b4..7ba51db9d 100644 --- a/lib/sbi/openapi/model/point_altitude_uncertainty.c +++ b/lib/sbi/openapi/model/point_altitude_uncertainty.c @@ -208,3 +208,37 @@ end: return NULL; } +OpenAPI_point_altitude_uncertainty_t *OpenAPI_point_altitude_uncertainty_copy(OpenAPI_point_altitude_uncertainty_t *dst, OpenAPI_point_altitude_uncertainty_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_altitude_uncertainty_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_altitude_uncertainty_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_altitude_uncertainty_free(dst); + dst = OpenAPI_point_altitude_uncertainty_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_altitude_uncertainty.h b/lib/sbi/openapi/model/point_altitude_uncertainty.h index ed49a5311..f1541be45 100644 --- a/lib/sbi/openapi/model/point_altitude_uncertainty.h +++ b/lib/sbi/openapi/model/point_altitude_uncertainty.h @@ -43,6 +43,7 @@ OpenAPI_point_altitude_uncertainty_t *OpenAPI_point_altitude_uncertainty_create( void OpenAPI_point_altitude_uncertainty_free(OpenAPI_point_altitude_uncertainty_t *point_altitude_uncertainty); OpenAPI_point_altitude_uncertainty_t *OpenAPI_point_altitude_uncertainty_parseFromJSON(cJSON *point_altitude_uncertaintyJSON); cJSON *OpenAPI_point_altitude_uncertainty_convertToJSON(OpenAPI_point_altitude_uncertainty_t *point_altitude_uncertainty); +OpenAPI_point_altitude_uncertainty_t *OpenAPI_point_altitude_uncertainty_copy(OpenAPI_point_altitude_uncertainty_t *dst, OpenAPI_point_altitude_uncertainty_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_altitude_uncertainty_all_of.c b/lib/sbi/openapi/model/point_altitude_uncertainty_all_of.c index e40cf36ae..c1b4ec0ad 100644 --- a/lib/sbi/openapi/model/point_altitude_uncertainty_all_of.c +++ b/lib/sbi/openapi/model/point_altitude_uncertainty_all_of.c @@ -179,3 +179,37 @@ end: return NULL; } +OpenAPI_point_altitude_uncertainty_all_of_t *OpenAPI_point_altitude_uncertainty_all_of_copy(OpenAPI_point_altitude_uncertainty_all_of_t *dst, OpenAPI_point_altitude_uncertainty_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_altitude_uncertainty_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_altitude_uncertainty_all_of_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_altitude_uncertainty_all_of_free(dst); + dst = OpenAPI_point_altitude_uncertainty_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_altitude_uncertainty_all_of.h b/lib/sbi/openapi/model/point_altitude_uncertainty_all_of.h index e11f2c989..4784519ec 100644 --- a/lib/sbi/openapi/model/point_altitude_uncertainty_all_of.h +++ b/lib/sbi/openapi/model/point_altitude_uncertainty_all_of.h @@ -38,6 +38,7 @@ OpenAPI_point_altitude_uncertainty_all_of_t *OpenAPI_point_altitude_uncertainty_ void OpenAPI_point_altitude_uncertainty_all_of_free(OpenAPI_point_altitude_uncertainty_all_of_t *point_altitude_uncertainty_all_of); OpenAPI_point_altitude_uncertainty_all_of_t *OpenAPI_point_altitude_uncertainty_all_of_parseFromJSON(cJSON *point_altitude_uncertainty_all_ofJSON); cJSON *OpenAPI_point_altitude_uncertainty_all_of_convertToJSON(OpenAPI_point_altitude_uncertainty_all_of_t *point_altitude_uncertainty_all_of); +OpenAPI_point_altitude_uncertainty_all_of_t *OpenAPI_point_altitude_uncertainty_all_of_copy(OpenAPI_point_altitude_uncertainty_all_of_t *dst, OpenAPI_point_altitude_uncertainty_all_of_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_uncertainty_circle.c b/lib/sbi/openapi/model/point_uncertainty_circle.c index b6239e12f..8a633318a 100644 --- a/lib/sbi/openapi/model/point_uncertainty_circle.c +++ b/lib/sbi/openapi/model/point_uncertainty_circle.c @@ -131,3 +131,37 @@ end: return NULL; } +OpenAPI_point_uncertainty_circle_t *OpenAPI_point_uncertainty_circle_copy(OpenAPI_point_uncertainty_circle_t *dst, OpenAPI_point_uncertainty_circle_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_uncertainty_circle_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_uncertainty_circle_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_uncertainty_circle_free(dst); + dst = OpenAPI_point_uncertainty_circle_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_uncertainty_circle.h b/lib/sbi/openapi/model/point_uncertainty_circle.h index feea282c0..ea4d48921 100644 --- a/lib/sbi/openapi/model/point_uncertainty_circle.h +++ b/lib/sbi/openapi/model/point_uncertainty_circle.h @@ -36,6 +36,7 @@ OpenAPI_point_uncertainty_circle_t *OpenAPI_point_uncertainty_circle_create( void OpenAPI_point_uncertainty_circle_free(OpenAPI_point_uncertainty_circle_t *point_uncertainty_circle); OpenAPI_point_uncertainty_circle_t *OpenAPI_point_uncertainty_circle_parseFromJSON(cJSON *point_uncertainty_circleJSON); cJSON *OpenAPI_point_uncertainty_circle_convertToJSON(OpenAPI_point_uncertainty_circle_t *point_uncertainty_circle); +OpenAPI_point_uncertainty_circle_t *OpenAPI_point_uncertainty_circle_copy(OpenAPI_point_uncertainty_circle_t *dst, OpenAPI_point_uncertainty_circle_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_uncertainty_circle_all_of.c b/lib/sbi/openapi/model/point_uncertainty_circle_all_of.c index f2235a36d..3a52ebd64 100644 --- a/lib/sbi/openapi/model/point_uncertainty_circle_all_of.c +++ b/lib/sbi/openapi/model/point_uncertainty_circle_all_of.c @@ -102,3 +102,37 @@ end: return NULL; } +OpenAPI_point_uncertainty_circle_all_of_t *OpenAPI_point_uncertainty_circle_all_of_copy(OpenAPI_point_uncertainty_circle_all_of_t *dst, OpenAPI_point_uncertainty_circle_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_uncertainty_circle_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_uncertainty_circle_all_of_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_uncertainty_circle_all_of_free(dst); + dst = OpenAPI_point_uncertainty_circle_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_uncertainty_circle_all_of.h b/lib/sbi/openapi/model/point_uncertainty_circle_all_of.h index d280e3cce..765d2c3f9 100644 --- a/lib/sbi/openapi/model/point_uncertainty_circle_all_of.h +++ b/lib/sbi/openapi/model/point_uncertainty_circle_all_of.h @@ -31,6 +31,7 @@ OpenAPI_point_uncertainty_circle_all_of_t *OpenAPI_point_uncertainty_circle_all_ void OpenAPI_point_uncertainty_circle_all_of_free(OpenAPI_point_uncertainty_circle_all_of_t *point_uncertainty_circle_all_of); OpenAPI_point_uncertainty_circle_all_of_t *OpenAPI_point_uncertainty_circle_all_of_parseFromJSON(cJSON *point_uncertainty_circle_all_ofJSON); cJSON *OpenAPI_point_uncertainty_circle_all_of_convertToJSON(OpenAPI_point_uncertainty_circle_all_of_t *point_uncertainty_circle_all_of); +OpenAPI_point_uncertainty_circle_all_of_t *OpenAPI_point_uncertainty_circle_all_of_copy(OpenAPI_point_uncertainty_circle_all_of_t *dst, OpenAPI_point_uncertainty_circle_all_of_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_uncertainty_ellipse.c b/lib/sbi/openapi/model/point_uncertainty_ellipse.c index 4f64bc3e6..3581319ff 100644 --- a/lib/sbi/openapi/model/point_uncertainty_ellipse.c +++ b/lib/sbi/openapi/model/point_uncertainty_ellipse.c @@ -160,3 +160,37 @@ end: return NULL; } +OpenAPI_point_uncertainty_ellipse_t *OpenAPI_point_uncertainty_ellipse_copy(OpenAPI_point_uncertainty_ellipse_t *dst, OpenAPI_point_uncertainty_ellipse_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_uncertainty_ellipse_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_uncertainty_ellipse_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_uncertainty_ellipse_free(dst); + dst = OpenAPI_point_uncertainty_ellipse_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_uncertainty_ellipse.h b/lib/sbi/openapi/model/point_uncertainty_ellipse.h index 62d9bce55..297780730 100644 --- a/lib/sbi/openapi/model/point_uncertainty_ellipse.h +++ b/lib/sbi/openapi/model/point_uncertainty_ellipse.h @@ -39,6 +39,7 @@ OpenAPI_point_uncertainty_ellipse_t *OpenAPI_point_uncertainty_ellipse_create( void OpenAPI_point_uncertainty_ellipse_free(OpenAPI_point_uncertainty_ellipse_t *point_uncertainty_ellipse); OpenAPI_point_uncertainty_ellipse_t *OpenAPI_point_uncertainty_ellipse_parseFromJSON(cJSON *point_uncertainty_ellipseJSON); cJSON *OpenAPI_point_uncertainty_ellipse_convertToJSON(OpenAPI_point_uncertainty_ellipse_t *point_uncertainty_ellipse); +OpenAPI_point_uncertainty_ellipse_t *OpenAPI_point_uncertainty_ellipse_copy(OpenAPI_point_uncertainty_ellipse_t *dst, OpenAPI_point_uncertainty_ellipse_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/point_uncertainty_ellipse_all_of.c b/lib/sbi/openapi/model/point_uncertainty_ellipse_all_of.c index 5c6ab08c8..767e11ef4 100644 --- a/lib/sbi/openapi/model/point_uncertainty_ellipse_all_of.c +++ b/lib/sbi/openapi/model/point_uncertainty_ellipse_all_of.c @@ -131,3 +131,37 @@ end: return NULL; } +OpenAPI_point_uncertainty_ellipse_all_of_t *OpenAPI_point_uncertainty_ellipse_all_of_copy(OpenAPI_point_uncertainty_ellipse_all_of_t *dst, OpenAPI_point_uncertainty_ellipse_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_point_uncertainty_ellipse_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_point_uncertainty_ellipse_all_of_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_point_uncertainty_ellipse_all_of_free(dst); + dst = OpenAPI_point_uncertainty_ellipse_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/point_uncertainty_ellipse_all_of.h b/lib/sbi/openapi/model/point_uncertainty_ellipse_all_of.h index a0b1ac39c..f3e35a2bb 100644 --- a/lib/sbi/openapi/model/point_uncertainty_ellipse_all_of.h +++ b/lib/sbi/openapi/model/point_uncertainty_ellipse_all_of.h @@ -34,6 +34,7 @@ OpenAPI_point_uncertainty_ellipse_all_of_t *OpenAPI_point_uncertainty_ellipse_al void OpenAPI_point_uncertainty_ellipse_all_of_free(OpenAPI_point_uncertainty_ellipse_all_of_t *point_uncertainty_ellipse_all_of); OpenAPI_point_uncertainty_ellipse_all_of_t *OpenAPI_point_uncertainty_ellipse_all_of_parseFromJSON(cJSON *point_uncertainty_ellipse_all_ofJSON); cJSON *OpenAPI_point_uncertainty_ellipse_all_of_convertToJSON(OpenAPI_point_uncertainty_ellipse_all_of_t *point_uncertainty_ellipse_all_of); +OpenAPI_point_uncertainty_ellipse_all_of_t *OpenAPI_point_uncertainty_ellipse_all_of_copy(OpenAPI_point_uncertainty_ellipse_all_of_t *dst, OpenAPI_point_uncertainty_ellipse_all_of_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/policy_data_change_notification.c b/lib/sbi/openapi/model/policy_data_change_notification.c index 31aa014ba..2f6e51c8c 100644 --- a/lib/sbi/openapi/model/policy_data_change_notification.c +++ b/lib/sbi/openapi/model/policy_data_change_notification.c @@ -458,3 +458,37 @@ end: return NULL; } +OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notification_copy(OpenAPI_policy_data_change_notification_t *dst, OpenAPI_policy_data_change_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_policy_data_change_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_policy_data_change_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_policy_data_change_notification_free(dst); + dst = OpenAPI_policy_data_change_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/policy_data_change_notification.h b/lib/sbi/openapi/model/policy_data_change_notification.h index 234904089..deae9ce51 100644 --- a/lib/sbi/openapi/model/policy_data_change_notification.h +++ b/lib/sbi/openapi/model/policy_data_change_notification.h @@ -67,6 +67,7 @@ OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notificati void OpenAPI_policy_data_change_notification_free(OpenAPI_policy_data_change_notification_t *policy_data_change_notification); OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notification_parseFromJSON(cJSON *policy_data_change_notificationJSON); cJSON *OpenAPI_policy_data_change_notification_convertToJSON(OpenAPI_policy_data_change_notification_t *policy_data_change_notification); +OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notification_copy(OpenAPI_policy_data_change_notification_t *dst, OpenAPI_policy_data_change_notification_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/policy_data_subscription.c b/lib/sbi/openapi/model/policy_data_subscription.c index 3233d7c5b..f3951da25 100644 --- a/lib/sbi/openapi/model/policy_data_subscription.c +++ b/lib/sbi/openapi/model/policy_data_subscription.c @@ -232,3 +232,37 @@ end: return NULL; } +OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_copy(OpenAPI_policy_data_subscription_t *dst, OpenAPI_policy_data_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_policy_data_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_policy_data_subscription_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_policy_data_subscription_free(dst); + dst = OpenAPI_policy_data_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/policy_data_subscription.h b/lib/sbi/openapi/model/policy_data_subscription.h index 91325c1bf..28c1246f3 100644 --- a/lib/sbi/openapi/model/policy_data_subscription.h +++ b/lib/sbi/openapi/model/policy_data_subscription.h @@ -39,6 +39,7 @@ OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_create( void OpenAPI_policy_data_subscription_free(OpenAPI_policy_data_subscription_t *policy_data_subscription); OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_parseFromJSON(cJSON *policy_data_subscriptionJSON); cJSON *OpenAPI_policy_data_subscription_convertToJSON(OpenAPI_policy_data_subscription_t *policy_data_subscription); +OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_copy(OpenAPI_policy_data_subscription_t *dst, OpenAPI_policy_data_subscription_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/policy_req_trigger.c b/lib/sbi/openapi/model/policy_req_trigger.c new file mode 100644 index 000000000..634ed05e5 --- /dev/null +++ b/lib/sbi/openapi/model/policy_req_trigger.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "policy_req_trigger.h" + +char* OpenAPI_policy_req_trigger_ToString(OpenAPI_policy_req_trigger_e policy_req_trigger) +{ + const char *policy_req_triggerArray[] = { "NULL", "LOCATION_CHANGE", "PRA_CHANGE", "SARI_CHANGE", "RFSP_INDEX_CHANGE", "ALLOWED_NSSAI_CHANGE" }; + size_t sizeofArray = sizeof(policy_req_triggerArray) / sizeof(policy_req_triggerArray[0]); + if (policy_req_trigger < sizeofArray) + return (char *)policy_req_triggerArray[policy_req_trigger]; + else + return (char *)"Unknown"; +} + +OpenAPI_policy_req_trigger_e OpenAPI_policy_req_trigger_FromString(char* policy_req_trigger) +{ + int stringToReturn = 0; + const char *policy_req_triggerArray[] = { "NULL", "LOCATION_CHANGE", "PRA_CHANGE", "SARI_CHANGE", "RFSP_INDEX_CHANGE", "ALLOWED_NSSAI_CHANGE" }; + size_t sizeofArray = sizeof(policy_req_triggerArray) / sizeof(policy_req_triggerArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(policy_req_trigger, policy_req_triggerArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/policy_req_trigger.h b/lib/sbi/openapi/model/policy_req_trigger.h new file mode 100644 index 000000000..a79976f73 --- /dev/null +++ b/lib/sbi/openapi/model/policy_req_trigger.h @@ -0,0 +1,31 @@ +/* + * policy_req_trigger.h + * + * + */ + +#ifndef _OpenAPI_policy_req_trigger_H_ +#define _OpenAPI_policy_req_trigger_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_policy_req_trigger_NULL = 0, OpenAPI_policy_req_trigger_LOCATION_CHANGE, OpenAPI_policy_req_trigger_PRA_CHANGE, OpenAPI_policy_req_trigger_SARI_CHANGE, OpenAPI_policy_req_trigger_RFSP_INDEX_CHANGE, OpenAPI_policy_req_trigger_ALLOWED_NSSAI_CHANGE } OpenAPI_policy_req_trigger_e; + +char* OpenAPI_policy_req_trigger_ToString(OpenAPI_policy_req_trigger_e policy_req_trigger); + +OpenAPI_policy_req_trigger_e OpenAPI_policy_req_trigger_FromString(char* policy_req_trigger); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_policy_req_trigger_H_ */ + diff --git a/lib/sbi/openapi/model/polygon.c b/lib/sbi/openapi/model/polygon.c index 35fa3068a..6d29e3b0d 100644 --- a/lib/sbi/openapi/model/polygon.c +++ b/lib/sbi/openapi/model/polygon.c @@ -133,3 +133,37 @@ end: return NULL; } +OpenAPI_polygon_t *OpenAPI_polygon_copy(OpenAPI_polygon_t *dst, OpenAPI_polygon_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_polygon_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_polygon_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_polygon_free(dst); + dst = OpenAPI_polygon_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/polygon.h b/lib/sbi/openapi/model/polygon.h index b05329a23..4aedfb8ac 100644 --- a/lib/sbi/openapi/model/polygon.h +++ b/lib/sbi/openapi/model/polygon.h @@ -34,6 +34,7 @@ OpenAPI_polygon_t *OpenAPI_polygon_create( void OpenAPI_polygon_free(OpenAPI_polygon_t *polygon); OpenAPI_polygon_t *OpenAPI_polygon_parseFromJSON(cJSON *polygonJSON); cJSON *OpenAPI_polygon_convertToJSON(OpenAPI_polygon_t *polygon); +OpenAPI_polygon_t *OpenAPI_polygon_copy(OpenAPI_polygon_t *dst, OpenAPI_polygon_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/polygon_all_of.c b/lib/sbi/openapi/model/polygon_all_of.c index 4cc627298..679d646dc 100644 --- a/lib/sbi/openapi/model/polygon_all_of.c +++ b/lib/sbi/openapi/model/polygon_all_of.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_polygon_all_of_t *OpenAPI_polygon_all_of_copy(OpenAPI_polygon_all_of_t *dst, OpenAPI_polygon_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_polygon_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_polygon_all_of_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_polygon_all_of_free(dst); + dst = OpenAPI_polygon_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/polygon_all_of.h b/lib/sbi/openapi/model/polygon_all_of.h index 0cb20c885..522e317df 100644 --- a/lib/sbi/openapi/model/polygon_all_of.h +++ b/lib/sbi/openapi/model/polygon_all_of.h @@ -29,6 +29,7 @@ OpenAPI_polygon_all_of_t *OpenAPI_polygon_all_of_create( void OpenAPI_polygon_all_of_free(OpenAPI_polygon_all_of_t *polygon_all_of); OpenAPI_polygon_all_of_t *OpenAPI_polygon_all_of_parseFromJSON(cJSON *polygon_all_ofJSON); cJSON *OpenAPI_polygon_all_of_convertToJSON(OpenAPI_polygon_all_of_t *polygon_all_of); +OpenAPI_polygon_all_of_t *OpenAPI_polygon_all_of_copy(OpenAPI_polygon_all_of_t *dst, OpenAPI_polygon_all_of_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pp_active_time.c b/lib/sbi/openapi/model/pp_active_time.c index 77dbdc9c8..c2f4199e8 100644 --- a/lib/sbi/openapi/model/pp_active_time.c +++ b/lib/sbi/openapi/model/pp_active_time.c @@ -142,3 +142,37 @@ end: return NULL; } +OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_copy(OpenAPI_pp_active_time_t *dst, OpenAPI_pp_active_time_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pp_active_time_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pp_active_time_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pp_active_time_free(dst); + dst = OpenAPI_pp_active_time_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pp_active_time.h b/lib/sbi/openapi/model/pp_active_time.h index acd596a8e..6204ecaf4 100644 --- a/lib/sbi/openapi/model/pp_active_time.h +++ b/lib/sbi/openapi/model/pp_active_time.h @@ -34,6 +34,7 @@ OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_create( void OpenAPI_pp_active_time_free(OpenAPI_pp_active_time_t *pp_active_time); OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_parseFromJSON(cJSON *pp_active_timeJSON); cJSON *OpenAPI_pp_active_time_convertToJSON(OpenAPI_pp_active_time_t *pp_active_time); +OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_copy(OpenAPI_pp_active_time_t *dst, OpenAPI_pp_active_time_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pp_data.c b/lib/sbi/openapi/model/pp_data.c index 71dbb32e9..5b5d55dd2 100644 --- a/lib/sbi/openapi/model/pp_data.c +++ b/lib/sbi/openapi/model/pp_data.c @@ -209,3 +209,37 @@ end: return NULL; } +OpenAPI_pp_data_t *OpenAPI_pp_data_copy(OpenAPI_pp_data_t *dst, OpenAPI_pp_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pp_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pp_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_pp_data_free(dst); + dst = OpenAPI_pp_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pp_data.h b/lib/sbi/openapi/model/pp_data.h index 46c7343d5..a90d74860 100644 --- a/lib/sbi/openapi/model/pp_data.h +++ b/lib/sbi/openapi/model/pp_data.h @@ -45,6 +45,7 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_create( void OpenAPI_pp_data_free(OpenAPI_pp_data_t *pp_data); OpenAPI_pp_data_t *OpenAPI_pp_data_parseFromJSON(cJSON *pp_dataJSON); cJSON *OpenAPI_pp_data_convertToJSON(OpenAPI_pp_data_t *pp_data); +OpenAPI_pp_data_t *OpenAPI_pp_data_copy(OpenAPI_pp_data_t *dst, OpenAPI_pp_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pp_dl_packet_count_ext.c b/lib/sbi/openapi/model/pp_dl_packet_count_ext.c index b02c9de29..a43624c81 100644 --- a/lib/sbi/openapi/model/pp_dl_packet_count_ext.c +++ b/lib/sbi/openapi/model/pp_dl_packet_count_ext.c @@ -118,3 +118,37 @@ end: return NULL; } +OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_copy(OpenAPI_pp_dl_packet_count_ext_t *dst, OpenAPI_pp_dl_packet_count_ext_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pp_dl_packet_count_ext_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pp_dl_packet_count_ext_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pp_dl_packet_count_ext_free(dst); + dst = OpenAPI_pp_dl_packet_count_ext_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pp_dl_packet_count_ext.h b/lib/sbi/openapi/model/pp_dl_packet_count_ext.h index 777726d37..9cd69ef22 100644 --- a/lib/sbi/openapi/model/pp_dl_packet_count_ext.h +++ b/lib/sbi/openapi/model/pp_dl_packet_count_ext.h @@ -32,6 +32,7 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_create( void OpenAPI_pp_dl_packet_count_ext_free(OpenAPI_pp_dl_packet_count_ext_t *pp_dl_packet_count_ext); OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_parseFromJSON(cJSON *pp_dl_packet_count_extJSON); cJSON *OpenAPI_pp_dl_packet_count_ext_convertToJSON(OpenAPI_pp_dl_packet_count_ext_t *pp_dl_packet_count_ext); +OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_copy(OpenAPI_pp_dl_packet_count_ext_t *dst, OpenAPI_pp_dl_packet_count_ext_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pp_maximum_latency.c b/lib/sbi/openapi/model/pp_maximum_latency.c index fde257cfd..aae449cf0 100644 --- a/lib/sbi/openapi/model/pp_maximum_latency.c +++ b/lib/sbi/openapi/model/pp_maximum_latency.c @@ -142,3 +142,37 @@ end: return NULL; } +OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_copy(OpenAPI_pp_maximum_latency_t *dst, OpenAPI_pp_maximum_latency_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pp_maximum_latency_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pp_maximum_latency_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pp_maximum_latency_free(dst); + dst = OpenAPI_pp_maximum_latency_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pp_maximum_latency.h b/lib/sbi/openapi/model/pp_maximum_latency.h index 846a99ca0..4f77c9493 100644 --- a/lib/sbi/openapi/model/pp_maximum_latency.h +++ b/lib/sbi/openapi/model/pp_maximum_latency.h @@ -34,6 +34,7 @@ OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_create( void OpenAPI_pp_maximum_latency_free(OpenAPI_pp_maximum_latency_t *pp_maximum_latency); OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_parseFromJSON(cJSON *pp_maximum_latencyJSON); cJSON *OpenAPI_pp_maximum_latency_convertToJSON(OpenAPI_pp_maximum_latency_t *pp_maximum_latency); +OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_copy(OpenAPI_pp_maximum_latency_t *dst, OpenAPI_pp_maximum_latency_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pp_maximum_response_time.c b/lib/sbi/openapi/model/pp_maximum_response_time.c index 918766317..ea235f963 100644 --- a/lib/sbi/openapi/model/pp_maximum_response_time.c +++ b/lib/sbi/openapi/model/pp_maximum_response_time.c @@ -142,3 +142,37 @@ end: return NULL; } +OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_copy(OpenAPI_pp_maximum_response_time_t *dst, OpenAPI_pp_maximum_response_time_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pp_maximum_response_time_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pp_maximum_response_time_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pp_maximum_response_time_free(dst); + dst = OpenAPI_pp_maximum_response_time_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pp_maximum_response_time.h b/lib/sbi/openapi/model/pp_maximum_response_time.h index 3e6eb5fb5..411c199f0 100644 --- a/lib/sbi/openapi/model/pp_maximum_response_time.h +++ b/lib/sbi/openapi/model/pp_maximum_response_time.h @@ -34,6 +34,7 @@ OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_create( void OpenAPI_pp_maximum_response_time_free(OpenAPI_pp_maximum_response_time_t *pp_maximum_response_time); OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_parseFromJSON(cJSON *pp_maximum_response_timeJSON); cJSON *OpenAPI_pp_maximum_response_time_convertToJSON(OpenAPI_pp_maximum_response_time_t *pp_maximum_response_time); +OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_copy(OpenAPI_pp_maximum_response_time_t *dst, OpenAPI_pp_maximum_response_time_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pp_subs_reg_timer.c b/lib/sbi/openapi/model/pp_subs_reg_timer.c index bf146c9c2..f868e832a 100644 --- a/lib/sbi/openapi/model/pp_subs_reg_timer.c +++ b/lib/sbi/openapi/model/pp_subs_reg_timer.c @@ -142,3 +142,37 @@ end: return NULL; } +OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_copy(OpenAPI_pp_subs_reg_timer_t *dst, OpenAPI_pp_subs_reg_timer_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pp_subs_reg_timer_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pp_subs_reg_timer_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pp_subs_reg_timer_free(dst); + dst = OpenAPI_pp_subs_reg_timer_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pp_subs_reg_timer.h b/lib/sbi/openapi/model/pp_subs_reg_timer.h index 405354345..41bb9b2c6 100644 --- a/lib/sbi/openapi/model/pp_subs_reg_timer.h +++ b/lib/sbi/openapi/model/pp_subs_reg_timer.h @@ -34,6 +34,7 @@ OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_create( void OpenAPI_pp_subs_reg_timer_free(OpenAPI_pp_subs_reg_timer_t *pp_subs_reg_timer); OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_parseFromJSON(cJSON *pp_subs_reg_timerJSON); cJSON *OpenAPI_pp_subs_reg_timer_convertToJSON(OpenAPI_pp_subs_reg_timer_t *pp_subs_reg_timer); +OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_copy(OpenAPI_pp_subs_reg_timer_t *dst, OpenAPI_pp_subs_reg_timer_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pppp_to_pdb.c b/lib/sbi/openapi/model/pppp_to_pdb.c index e97ce34dd..51faff0d9 100644 --- a/lib/sbi/openapi/model/pppp_to_pdb.c +++ b/lib/sbi/openapi/model/pppp_to_pdb.c @@ -97,3 +97,37 @@ end: return NULL; } +OpenAPI_pppp_to_pdb_t *OpenAPI_pppp_to_pdb_copy(OpenAPI_pppp_to_pdb_t *dst, OpenAPI_pppp_to_pdb_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pppp_to_pdb_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pppp_to_pdb_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pppp_to_pdb_free(dst); + dst = OpenAPI_pppp_to_pdb_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pppp_to_pdb.h b/lib/sbi/openapi/model/pppp_to_pdb.h index 362b312bc..7fc6dd1c2 100644 --- a/lib/sbi/openapi/model/pppp_to_pdb.h +++ b/lib/sbi/openapi/model/pppp_to_pdb.h @@ -30,6 +30,7 @@ OpenAPI_pppp_to_pdb_t *OpenAPI_pppp_to_pdb_create( void OpenAPI_pppp_to_pdb_free(OpenAPI_pppp_to_pdb_t *pppp_to_pdb); OpenAPI_pppp_to_pdb_t *OpenAPI_pppp_to_pdb_parseFromJSON(cJSON *pppp_to_pdbJSON); cJSON *OpenAPI_pppp_to_pdb_convertToJSON(OpenAPI_pppp_to_pdb_t *pppp_to_pdb); +OpenAPI_pppp_to_pdb_t *OpenAPI_pppp_to_pdb_copy(OpenAPI_pppp_to_pdb_t *dst, OpenAPI_pppp_to_pdb_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/preemption_capability.c b/lib/sbi/openapi/model/preemption_capability.c index daa440fe2..92468e8ed 100644 --- a/lib/sbi/openapi/model/preemption_capability.c +++ b/lib/sbi/openapi/model/preemption_capability.c @@ -4,48 +4,27 @@ #include #include "preemption_capability.h" -OpenAPI_preemption_capability_t *OpenAPI_preemption_capability_create( - ) +char* OpenAPI_preemption_capability_ToString(OpenAPI_preemption_capability_e preemption_capability) { - OpenAPI_preemption_capability_t *preemption_capability_local_var = OpenAPI_malloc(sizeof(OpenAPI_preemption_capability_t)); - if (!preemption_capability_local_var) { - return NULL; + const char *preemption_capabilityArray[] = { "NULL", "NOT_PREEMPT", "MAY_PREEMPT" }; + size_t sizeofArray = sizeof(preemption_capabilityArray) / sizeof(preemption_capabilityArray[0]); + if (preemption_capability < sizeofArray) + return (char *)preemption_capabilityArray[preemption_capability]; + else + return (char *)"Unknown"; +} + +OpenAPI_preemption_capability_e OpenAPI_preemption_capability_FromString(char* preemption_capability) +{ + int stringToReturn = 0; + const char *preemption_capabilityArray[] = { "NULL", "NOT_PREEMPT", "MAY_PREEMPT" }; + size_t sizeofArray = sizeof(preemption_capabilityArray) / sizeof(preemption_capabilityArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(preemption_capability, preemption_capabilityArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - - return preemption_capability_local_var; -} - -void OpenAPI_preemption_capability_free(OpenAPI_preemption_capability_t *preemption_capability) -{ - if (NULL == preemption_capability) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(preemption_capability); -} - -cJSON *OpenAPI_preemption_capability_convertToJSON(OpenAPI_preemption_capability_t *preemption_capability) -{ - cJSON *item = NULL; - - if (preemption_capability == NULL) { - ogs_error("OpenAPI_preemption_capability_convertToJSON() failed [PreemptionCapability]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_preemption_capability_t *OpenAPI_preemption_capability_parseFromJSON(cJSON *preemption_capabilityJSON) -{ - OpenAPI_preemption_capability_t *preemption_capability_local_var = NULL; - preemption_capability_local_var = OpenAPI_preemption_capability_create ( - ); - - return preemption_capability_local_var; -end: - return NULL; + return 0; } diff --git a/lib/sbi/openapi/model/preemption_capability.h b/lib/sbi/openapi/model/preemption_capability.h index b07348cd6..000fdbed3 100644 --- a/lib/sbi/openapi/model/preemption_capability.h +++ b/lib/sbi/openapi/model/preemption_capability.h @@ -17,15 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_preemption_capability_s OpenAPI_preemption_capability_t; -typedef struct OpenAPI_preemption_capability_s { -} OpenAPI_preemption_capability_t; +typedef enum { OpenAPI_preemption_capability_NULL = 0, OpenAPI_preemption_capability_NOT_PREEMPT, OpenAPI_preemption_capability_MAY_PREEMPT } OpenAPI_preemption_capability_e; -OpenAPI_preemption_capability_t *OpenAPI_preemption_capability_create( - ); -void OpenAPI_preemption_capability_free(OpenAPI_preemption_capability_t *preemption_capability); -OpenAPI_preemption_capability_t *OpenAPI_preemption_capability_parseFromJSON(cJSON *preemption_capabilityJSON); -cJSON *OpenAPI_preemption_capability_convertToJSON(OpenAPI_preemption_capability_t *preemption_capability); +char* OpenAPI_preemption_capability_ToString(OpenAPI_preemption_capability_e preemption_capability); + +OpenAPI_preemption_capability_e OpenAPI_preemption_capability_FromString(char* preemption_capability); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/preemption_vulnerability.c b/lib/sbi/openapi/model/preemption_vulnerability.c index 6c5f674ad..d3561e8e9 100644 --- a/lib/sbi/openapi/model/preemption_vulnerability.c +++ b/lib/sbi/openapi/model/preemption_vulnerability.c @@ -4,48 +4,27 @@ #include #include "preemption_vulnerability.h" -OpenAPI_preemption_vulnerability_t *OpenAPI_preemption_vulnerability_create( - ) +char* OpenAPI_preemption_vulnerability_ToString(OpenAPI_preemption_vulnerability_e preemption_vulnerability) { - OpenAPI_preemption_vulnerability_t *preemption_vulnerability_local_var = OpenAPI_malloc(sizeof(OpenAPI_preemption_vulnerability_t)); - if (!preemption_vulnerability_local_var) { - return NULL; + const char *preemption_vulnerabilityArray[] = { "NULL", "NOT_PREEMPTABLE", "PREEMPTABLE" }; + size_t sizeofArray = sizeof(preemption_vulnerabilityArray) / sizeof(preemption_vulnerabilityArray[0]); + if (preemption_vulnerability < sizeofArray) + return (char *)preemption_vulnerabilityArray[preemption_vulnerability]; + else + return (char *)"Unknown"; +} + +OpenAPI_preemption_vulnerability_e OpenAPI_preemption_vulnerability_FromString(char* preemption_vulnerability) +{ + int stringToReturn = 0; + const char *preemption_vulnerabilityArray[] = { "NULL", "NOT_PREEMPTABLE", "PREEMPTABLE" }; + size_t sizeofArray = sizeof(preemption_vulnerabilityArray) / sizeof(preemption_vulnerabilityArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(preemption_vulnerability, preemption_vulnerabilityArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - - return preemption_vulnerability_local_var; -} - -void OpenAPI_preemption_vulnerability_free(OpenAPI_preemption_vulnerability_t *preemption_vulnerability) -{ - if (NULL == preemption_vulnerability) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(preemption_vulnerability); -} - -cJSON *OpenAPI_preemption_vulnerability_convertToJSON(OpenAPI_preemption_vulnerability_t *preemption_vulnerability) -{ - cJSON *item = NULL; - - if (preemption_vulnerability == NULL) { - ogs_error("OpenAPI_preemption_vulnerability_convertToJSON() failed [PreemptionVulnerability]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_preemption_vulnerability_t *OpenAPI_preemption_vulnerability_parseFromJSON(cJSON *preemption_vulnerabilityJSON) -{ - OpenAPI_preemption_vulnerability_t *preemption_vulnerability_local_var = NULL; - preemption_vulnerability_local_var = OpenAPI_preemption_vulnerability_create ( - ); - - return preemption_vulnerability_local_var; -end: - return NULL; + return 0; } diff --git a/lib/sbi/openapi/model/preemption_vulnerability.h b/lib/sbi/openapi/model/preemption_vulnerability.h index bf5bc625d..bc38cef80 100644 --- a/lib/sbi/openapi/model/preemption_vulnerability.h +++ b/lib/sbi/openapi/model/preemption_vulnerability.h @@ -17,15 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_preemption_vulnerability_s OpenAPI_preemption_vulnerability_t; -typedef struct OpenAPI_preemption_vulnerability_s { -} OpenAPI_preemption_vulnerability_t; +typedef enum { OpenAPI_preemption_vulnerability_NULL = 0, OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE, OpenAPI_preemption_vulnerability_PREEMPTABLE } OpenAPI_preemption_vulnerability_e; -OpenAPI_preemption_vulnerability_t *OpenAPI_preemption_vulnerability_create( - ); -void OpenAPI_preemption_vulnerability_free(OpenAPI_preemption_vulnerability_t *preemption_vulnerability); -OpenAPI_preemption_vulnerability_t *OpenAPI_preemption_vulnerability_parseFromJSON(cJSON *preemption_vulnerabilityJSON); -cJSON *OpenAPI_preemption_vulnerability_convertToJSON(OpenAPI_preemption_vulnerability_t *preemption_vulnerability); +char* OpenAPI_preemption_vulnerability_ToString(OpenAPI_preemption_vulnerability_e preemption_vulnerability); + +OpenAPI_preemption_vulnerability_e OpenAPI_preemption_vulnerability_FromString(char* preemption_vulnerability); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/preferred_search.c b/lib/sbi/openapi/model/preferred_search.c index e2794319b..f27d3c7e0 100644 --- a/lib/sbi/openapi/model/preferred_search.c +++ b/lib/sbi/openapi/model/preferred_search.c @@ -36,7 +36,7 @@ cJSON *OpenAPI_preferred_search_convertToJSON(OpenAPI_preferred_search_t *prefer } item = cJSON_CreateObject(); - if (preferred_search->preferred_tai_match_ind >= 0) { + if (preferred_search->preferred_tai_match_ind) { if (cJSON_AddBoolToObject(item, "preferredTaiMatchInd", preferred_search->preferred_tai_match_ind) == NULL) { ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_tai_match_ind]"); goto end; @@ -68,3 +68,37 @@ end: return NULL; } +OpenAPI_preferred_search_t *OpenAPI_preferred_search_copy(OpenAPI_preferred_search_t *dst, OpenAPI_preferred_search_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_preferred_search_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_preferred_search_free(dst); + dst = OpenAPI_preferred_search_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/preferred_search.h b/lib/sbi/openapi/model/preferred_search.h index 482afc746..85bb083c2 100644 --- a/lib/sbi/openapi/model/preferred_search.h +++ b/lib/sbi/openapi/model/preferred_search.h @@ -28,6 +28,7 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( void OpenAPI_preferred_search_free(OpenAPI_preferred_search_t *preferred_search); OpenAPI_preferred_search_t *OpenAPI_preferred_search_parseFromJSON(cJSON *preferred_searchJSON); cJSON *OpenAPI_preferred_search_convertToJSON(OpenAPI_preferred_search_t *preferred_search); +OpenAPI_preferred_search_t *OpenAPI_preferred_search_copy(OpenAPI_preferred_search_t *dst, OpenAPI_preferred_search_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/presence_info.c b/lib/sbi/openapi/model/presence_info.c index 691053fd6..874521ba3 100644 --- a/lib/sbi/openapi/model/presence_info.c +++ b/lib/sbi/openapi/model/presence_info.c @@ -343,3 +343,37 @@ end: return NULL; } +OpenAPI_presence_info_t *OpenAPI_presence_info_copy(OpenAPI_presence_info_t *dst, OpenAPI_presence_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_presence_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_presence_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_presence_info_free(dst); + dst = OpenAPI_presence_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/presence_info.h b/lib/sbi/openapi/model/presence_info.h index 213f5fb49..b96920e02 100644 --- a/lib/sbi/openapi/model/presence_info.h +++ b/lib/sbi/openapi/model/presence_info.h @@ -45,6 +45,7 @@ OpenAPI_presence_info_t *OpenAPI_presence_info_create( void OpenAPI_presence_info_free(OpenAPI_presence_info_t *presence_info); OpenAPI_presence_info_t *OpenAPI_presence_info_parseFromJSON(cJSON *presence_infoJSON); cJSON *OpenAPI_presence_info_convertToJSON(OpenAPI_presence_info_t *presence_info); +OpenAPI_presence_info_t *OpenAPI_presence_info_copy(OpenAPI_presence_info_t *dst, OpenAPI_presence_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/presence_state.c b/lib/sbi/openapi/model/presence_state.c index aa992862a..a26ec6115 100644 --- a/lib/sbi/openapi/model/presence_state.c +++ b/lib/sbi/openapi/model/presence_state.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_presence_state_t *OpenAPI_presence_state_copy(OpenAPI_presence_state_t *dst, OpenAPI_presence_state_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_presence_state_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_presence_state_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_presence_state_free(dst); + dst = OpenAPI_presence_state_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/presence_state.h b/lib/sbi/openapi/model/presence_state.h index 3f5e8966a..b7cda4566 100644 --- a/lib/sbi/openapi/model/presence_state.h +++ b/lib/sbi/openapi/model/presence_state.h @@ -26,6 +26,7 @@ OpenAPI_presence_state_t *OpenAPI_presence_state_create( void OpenAPI_presence_state_free(OpenAPI_presence_state_t *presence_state); OpenAPI_presence_state_t *OpenAPI_presence_state_parseFromJSON(cJSON *presence_stateJSON); cJSON *OpenAPI_presence_state_convertToJSON(OpenAPI_presence_state_t *presence_state); +OpenAPI_presence_state_t *OpenAPI_presence_state_copy(OpenAPI_presence_state_t *dst, OpenAPI_presence_state_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/privacy_parameter.c b/lib/sbi/openapi/model/privacy_parameter.c index a17042c5d..6472be2df 100644 --- a/lib/sbi/openapi/model/privacy_parameter.c +++ b/lib/sbi/openapi/model/privacy_parameter.c @@ -146,3 +146,37 @@ end: return NULL; } +OpenAPI_privacy_parameter_t *OpenAPI_privacy_parameter_copy(OpenAPI_privacy_parameter_t *dst, OpenAPI_privacy_parameter_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_privacy_parameter_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_privacy_parameter_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_privacy_parameter_free(dst); + dst = OpenAPI_privacy_parameter_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/privacy_parameter.h b/lib/sbi/openapi/model/privacy_parameter.h index c65683615..7de2fff74 100644 --- a/lib/sbi/openapi/model/privacy_parameter.h +++ b/lib/sbi/openapi/model/privacy_parameter.h @@ -32,6 +32,7 @@ OpenAPI_privacy_parameter_t *OpenAPI_privacy_parameter_create( void OpenAPI_privacy_parameter_free(OpenAPI_privacy_parameter_t *privacy_parameter); OpenAPI_privacy_parameter_t *OpenAPI_privacy_parameter_parseFromJSON(cJSON *privacy_parameterJSON); cJSON *OpenAPI_privacy_parameter_convertToJSON(OpenAPI_privacy_parameter_t *privacy_parameter); +OpenAPI_privacy_parameter_t *OpenAPI_privacy_parameter_copy(OpenAPI_privacy_parameter_t *dst, OpenAPI_privacy_parameter_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/problem_details.c b/lib/sbi/openapi/model/problem_details.c index efebad10e..80a1df843 100644 --- a/lib/sbi/openapi/model/problem_details.c +++ b/lib/sbi/openapi/model/problem_details.c @@ -238,3 +238,37 @@ end: return NULL; } +OpenAPI_problem_details_t *OpenAPI_problem_details_copy(OpenAPI_problem_details_t *dst, OpenAPI_problem_details_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_problem_details_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_problem_details_free(dst); + dst = OpenAPI_problem_details_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/problem_details.h b/lib/sbi/openapi/model/problem_details.h index 9e17ea11c..82a5f1a05 100644 --- a/lib/sbi/openapi/model/problem_details.h +++ b/lib/sbi/openapi/model/problem_details.h @@ -43,6 +43,7 @@ OpenAPI_problem_details_t *OpenAPI_problem_details_create( void OpenAPI_problem_details_free(OpenAPI_problem_details_t *problem_details); OpenAPI_problem_details_t *OpenAPI_problem_details_parseFromJSON(cJSON *problem_detailsJSON); cJSON *OpenAPI_problem_details_convertToJSON(OpenAPI_problem_details_t *problem_details); +OpenAPI_problem_details_t *OpenAPI_problem_details_copy(OpenAPI_problem_details_t *dst, OpenAPI_problem_details_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/problem_details_2.c b/lib/sbi/openapi/model/problem_details_2.c index 664099134..b6266cc9f 100644 --- a/lib/sbi/openapi/model/problem_details_2.c +++ b/lib/sbi/openapi/model/problem_details_2.c @@ -238,3 +238,37 @@ end: return NULL; } +OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_copy(OpenAPI_problem_details_2_t *dst, OpenAPI_problem_details_2_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_problem_details_2_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_problem_details_2_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_problem_details_2_free(dst); + dst = OpenAPI_problem_details_2_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/problem_details_2.h b/lib/sbi/openapi/model/problem_details_2.h index 02bc212cd..0585776f2 100644 --- a/lib/sbi/openapi/model/problem_details_2.h +++ b/lib/sbi/openapi/model/problem_details_2.h @@ -43,6 +43,7 @@ OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_create( void OpenAPI_problem_details_2_free(OpenAPI_problem_details_2_t *problem_details_2); OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_parseFromJSON(cJSON *problem_details_2JSON); cJSON *OpenAPI_problem_details_2_convertToJSON(OpenAPI_problem_details_2_t *problem_details_2); +OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_copy(OpenAPI_problem_details_2_t *dst, OpenAPI_problem_details_2_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/provisioned_data_sets.c b/lib/sbi/openapi/model/provisioned_data_sets.c index 44f7974ad..955761296 100644 --- a/lib/sbi/openapi/model/provisioned_data_sets.c +++ b/lib/sbi/openapi/model/provisioned_data_sets.c @@ -267,3 +267,37 @@ end: return NULL; } +OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_copy(OpenAPI_provisioned_data_sets_t *dst, OpenAPI_provisioned_data_sets_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_provisioned_data_sets_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_provisioned_data_sets_free(dst); + dst = OpenAPI_provisioned_data_sets_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/provisioned_data_sets.h b/lib/sbi/openapi/model/provisioned_data_sets.h index 67d7fdc6f..af779edf5 100644 --- a/lib/sbi/openapi/model/provisioned_data_sets.h +++ b/lib/sbi/openapi/model/provisioned_data_sets.h @@ -50,6 +50,7 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_create( void OpenAPI_provisioned_data_sets_free(OpenAPI_provisioned_data_sets_t *provisioned_data_sets); OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJSON *provisioned_data_setsJSON); cJSON *OpenAPI_provisioned_data_sets_convertToJSON(OpenAPI_provisioned_data_sets_t *provisioned_data_sets); +OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_copy(OpenAPI_provisioned_data_sets_t *dst, OpenAPI_provisioned_data_sets_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/psa_indication.c b/lib/sbi/openapi/model/psa_indication.c new file mode 100644 index 000000000..d59a6e400 --- /dev/null +++ b/lib/sbi/openapi/model/psa_indication.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "psa_indication.h" + +OpenAPI_psa_indication_t *OpenAPI_psa_indication_create( + ) +{ + OpenAPI_psa_indication_t *psa_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_psa_indication_t)); + if (!psa_indication_local_var) { + return NULL; + } + + return psa_indication_local_var; +} + +void OpenAPI_psa_indication_free(OpenAPI_psa_indication_t *psa_indication) +{ + if (NULL == psa_indication) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(psa_indication); +} + +cJSON *OpenAPI_psa_indication_convertToJSON(OpenAPI_psa_indication_t *psa_indication) +{ + cJSON *item = NULL; + + if (psa_indication == NULL) { + ogs_error("OpenAPI_psa_indication_convertToJSON() failed [PsaIndication]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_psa_indication_t *OpenAPI_psa_indication_parseFromJSON(cJSON *psa_indicationJSON) +{ + OpenAPI_psa_indication_t *psa_indication_local_var = NULL; + psa_indication_local_var = OpenAPI_psa_indication_create ( + ); + + return psa_indication_local_var; +end: + return NULL; +} + +OpenAPI_psa_indication_t *OpenAPI_psa_indication_copy(OpenAPI_psa_indication_t *dst, OpenAPI_psa_indication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_psa_indication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_psa_indication_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_psa_indication_free(dst); + dst = OpenAPI_psa_indication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/psa_indication.h b/lib/sbi/openapi/model/psa_indication.h new file mode 100644 index 000000000..ce98f691a --- /dev/null +++ b/lib/sbi/openapi/model/psa_indication.h @@ -0,0 +1,36 @@ +/* + * psa_indication.h + * + * Possible values are - PSA_INSERTED - PSA_REMOVED + */ + +#ifndef _OpenAPI_psa_indication_H_ +#define _OpenAPI_psa_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_psa_indication_s OpenAPI_psa_indication_t; +typedef struct OpenAPI_psa_indication_s { +} OpenAPI_psa_indication_t; + +OpenAPI_psa_indication_t *OpenAPI_psa_indication_create( + ); +void OpenAPI_psa_indication_free(OpenAPI_psa_indication_t *psa_indication); +OpenAPI_psa_indication_t *OpenAPI_psa_indication_parseFromJSON(cJSON *psa_indicationJSON); +cJSON *OpenAPI_psa_indication_convertToJSON(OpenAPI_psa_indication_t *psa_indication); +OpenAPI_psa_indication_t *OpenAPI_psa_indication_copy(OpenAPI_psa_indication_t *dst, OpenAPI_psa_indication_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_psa_indication_H_ */ + diff --git a/lib/sbi/openapi/model/psa_information.c b/lib/sbi/openapi/model/psa_information.c new file mode 100644 index 000000000..bd15ac8a6 --- /dev/null +++ b/lib/sbi/openapi/model/psa_information.c @@ -0,0 +1,192 @@ + +#include +#include +#include +#include "psa_information.h" + +OpenAPI_psa_information_t *OpenAPI_psa_information_create( + OpenAPI_psa_indication_t *psa_ind, + OpenAPI_list_t *dnai_list, + char *ue_ipv6_prefix, + char *psa_upf_id + ) +{ + OpenAPI_psa_information_t *psa_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_psa_information_t)); + if (!psa_information_local_var) { + return NULL; + } + psa_information_local_var->psa_ind = psa_ind; + psa_information_local_var->dnai_list = dnai_list; + psa_information_local_var->ue_ipv6_prefix = ue_ipv6_prefix; + psa_information_local_var->psa_upf_id = psa_upf_id; + + return psa_information_local_var; +} + +void OpenAPI_psa_information_free(OpenAPI_psa_information_t *psa_information) +{ + if (NULL == psa_information) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_psa_indication_free(psa_information->psa_ind); + OpenAPI_list_for_each(psa_information->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(psa_information->dnai_list); + ogs_free(psa_information->ue_ipv6_prefix); + ogs_free(psa_information->psa_upf_id); + ogs_free(psa_information); +} + +cJSON *OpenAPI_psa_information_convertToJSON(OpenAPI_psa_information_t *psa_information) +{ + cJSON *item = NULL; + + if (psa_information == NULL) { + ogs_error("OpenAPI_psa_information_convertToJSON() failed [PsaInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (psa_information->psa_ind) { + cJSON *psa_ind_local_JSON = OpenAPI_psa_indication_convertToJSON(psa_information->psa_ind); + if (psa_ind_local_JSON == NULL) { + ogs_error("OpenAPI_psa_information_convertToJSON() failed [psa_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "psaInd", psa_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_psa_information_convertToJSON() failed [psa_ind]"); + goto end; + } + } + + if (psa_information->dnai_list) { + cJSON *dnai_list = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_list == NULL) { + ogs_error("OpenAPI_psa_information_convertToJSON() failed [dnai_list]"); + goto end; + } + + OpenAPI_lnode_t *dnai_list_node; + OpenAPI_list_for_each(psa_information->dnai_list, dnai_list_node) { + if (cJSON_AddStringToObject(dnai_list, "", (char*)dnai_list_node->data) == NULL) { + ogs_error("OpenAPI_psa_information_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (psa_information->ue_ipv6_prefix) { + if (cJSON_AddStringToObject(item, "ueIpv6Prefix", psa_information->ue_ipv6_prefix) == NULL) { + ogs_error("OpenAPI_psa_information_convertToJSON() failed [ue_ipv6_prefix]"); + goto end; + } + } + + if (psa_information->psa_upf_id) { + if (cJSON_AddStringToObject(item, "psaUpfId", psa_information->psa_upf_id) == NULL) { + ogs_error("OpenAPI_psa_information_convertToJSON() failed [psa_upf_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_psa_information_t *OpenAPI_psa_information_parseFromJSON(cJSON *psa_informationJSON) +{ + OpenAPI_psa_information_t *psa_information_local_var = NULL; + cJSON *psa_ind = cJSON_GetObjectItemCaseSensitive(psa_informationJSON, "psaInd"); + + OpenAPI_psa_indication_t *psa_ind_local_nonprim = NULL; + if (psa_ind) { + psa_ind_local_nonprim = OpenAPI_psa_indication_parseFromJSON(psa_ind); + } + + cJSON *dnai_list = cJSON_GetObjectItemCaseSensitive(psa_informationJSON, "dnaiList"); + + OpenAPI_list_t *dnai_listList; + if (dnai_list) { + cJSON *dnai_list_local; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_psa_information_parseFromJSON() failed [dnai_list]"); + goto end; + } + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_psa_information_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + cJSON *ue_ipv6_prefix = cJSON_GetObjectItemCaseSensitive(psa_informationJSON, "ueIpv6Prefix"); + + if (ue_ipv6_prefix) { + if (!cJSON_IsString(ue_ipv6_prefix)) { + ogs_error("OpenAPI_psa_information_parseFromJSON() failed [ue_ipv6_prefix]"); + goto end; + } + } + + cJSON *psa_upf_id = cJSON_GetObjectItemCaseSensitive(psa_informationJSON, "psaUpfId"); + + if (psa_upf_id) { + if (!cJSON_IsString(psa_upf_id)) { + ogs_error("OpenAPI_psa_information_parseFromJSON() failed [psa_upf_id]"); + goto end; + } + } + + psa_information_local_var = OpenAPI_psa_information_create ( + psa_ind ? psa_ind_local_nonprim : NULL, + dnai_list ? dnai_listList : NULL, + ue_ipv6_prefix ? ogs_strdup(ue_ipv6_prefix->valuestring) : NULL, + psa_upf_id ? ogs_strdup(psa_upf_id->valuestring) : NULL + ); + + return psa_information_local_var; +end: + return NULL; +} + +OpenAPI_psa_information_t *OpenAPI_psa_information_copy(OpenAPI_psa_information_t *dst, OpenAPI_psa_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_psa_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_psa_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_psa_information_free(dst); + dst = OpenAPI_psa_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/psa_information.h b/lib/sbi/openapi/model/psa_information.h new file mode 100644 index 000000000..7ef31ce08 --- /dev/null +++ b/lib/sbi/openapi/model/psa_information.h @@ -0,0 +1,45 @@ +/* + * psa_information.h + * + * + */ + +#ifndef _OpenAPI_psa_information_H_ +#define _OpenAPI_psa_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "psa_indication.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_psa_information_s OpenAPI_psa_information_t; +typedef struct OpenAPI_psa_information_s { + struct OpenAPI_psa_indication_s *psa_ind; + OpenAPI_list_t *dnai_list; + char *ue_ipv6_prefix; + char *psa_upf_id; +} OpenAPI_psa_information_t; + +OpenAPI_psa_information_t *OpenAPI_psa_information_create( + OpenAPI_psa_indication_t *psa_ind, + OpenAPI_list_t *dnai_list, + char *ue_ipv6_prefix, + char *psa_upf_id + ); +void OpenAPI_psa_information_free(OpenAPI_psa_information_t *psa_information); +OpenAPI_psa_information_t *OpenAPI_psa_information_parseFromJSON(cJSON *psa_informationJSON); +cJSON *OpenAPI_psa_information_convertToJSON(OpenAPI_psa_information_t *psa_information); +OpenAPI_psa_information_t *OpenAPI_psa_information_copy(OpenAPI_psa_information_t *dst, OpenAPI_psa_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_psa_information_H_ */ + diff --git a/lib/sbi/openapi/model/ptw_parameters.c b/lib/sbi/openapi/model/ptw_parameters.c index 61bb24fa1..56896a309 100644 --- a/lib/sbi/openapi/model/ptw_parameters.c +++ b/lib/sbi/openapi/model/ptw_parameters.c @@ -100,3 +100,37 @@ end: return NULL; } +OpenAPI_ptw_parameters_t *OpenAPI_ptw_parameters_copy(OpenAPI_ptw_parameters_t *dst, OpenAPI_ptw_parameters_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ptw_parameters_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ptw_parameters_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ptw_parameters_free(dst); + dst = OpenAPI_ptw_parameters_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ptw_parameters.h b/lib/sbi/openapi/model/ptw_parameters.h index 150aab321..85bd70708 100644 --- a/lib/sbi/openapi/model/ptw_parameters.h +++ b/lib/sbi/openapi/model/ptw_parameters.h @@ -31,6 +31,7 @@ OpenAPI_ptw_parameters_t *OpenAPI_ptw_parameters_create( void OpenAPI_ptw_parameters_free(OpenAPI_ptw_parameters_t *ptw_parameters); OpenAPI_ptw_parameters_t *OpenAPI_ptw_parameters_parseFromJSON(cJSON *ptw_parametersJSON); cJSON *OpenAPI_ptw_parameters_convertToJSON(OpenAPI_ptw_parameters_t *ptw_parameters); +OpenAPI_ptw_parameters_t *OpenAPI_ptw_parameters_copy(OpenAPI_ptw_parameters_t *dst, OpenAPI_ptw_parameters_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pws_error_data.c b/lib/sbi/openapi/model/pws_error_data.c new file mode 100644 index 000000000..796aa8598 --- /dev/null +++ b/lib/sbi/openapi/model/pws_error_data.c @@ -0,0 +1,109 @@ + +#include +#include +#include +#include "pws_error_data.h" + +OpenAPI_pws_error_data_t *OpenAPI_pws_error_data_create( + int namf_cause + ) +{ + OpenAPI_pws_error_data_t *pws_error_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_pws_error_data_t)); + if (!pws_error_data_local_var) { + return NULL; + } + pws_error_data_local_var->namf_cause = namf_cause; + + return pws_error_data_local_var; +} + +void OpenAPI_pws_error_data_free(OpenAPI_pws_error_data_t *pws_error_data) +{ + if (NULL == pws_error_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(pws_error_data); +} + +cJSON *OpenAPI_pws_error_data_convertToJSON(OpenAPI_pws_error_data_t *pws_error_data) +{ + cJSON *item = NULL; + + if (pws_error_data == NULL) { + ogs_error("OpenAPI_pws_error_data_convertToJSON() failed [PWSErrorData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pws_error_data->namf_cause) { + ogs_error("OpenAPI_pws_error_data_convertToJSON() failed [namf_cause]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "namfCause", pws_error_data->namf_cause) == NULL) { + ogs_error("OpenAPI_pws_error_data_convertToJSON() failed [namf_cause]"); + goto end; + } + +end: + return item; +} + +OpenAPI_pws_error_data_t *OpenAPI_pws_error_data_parseFromJSON(cJSON *pws_error_dataJSON) +{ + OpenAPI_pws_error_data_t *pws_error_data_local_var = NULL; + cJSON *namf_cause = cJSON_GetObjectItemCaseSensitive(pws_error_dataJSON, "namfCause"); + if (!namf_cause) { + ogs_error("OpenAPI_pws_error_data_parseFromJSON() failed [namf_cause]"); + goto end; + } + + + if (!cJSON_IsNumber(namf_cause)) { + ogs_error("OpenAPI_pws_error_data_parseFromJSON() failed [namf_cause]"); + goto end; + } + + pws_error_data_local_var = OpenAPI_pws_error_data_create ( + namf_cause->valuedouble + ); + + return pws_error_data_local_var; +end: + return NULL; +} + +OpenAPI_pws_error_data_t *OpenAPI_pws_error_data_copy(OpenAPI_pws_error_data_t *dst, OpenAPI_pws_error_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pws_error_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pws_error_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_pws_error_data_free(dst); + dst = OpenAPI_pws_error_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pws_error_data.h b/lib/sbi/openapi/model/pws_error_data.h new file mode 100644 index 000000000..d21eaaf0b --- /dev/null +++ b/lib/sbi/openapi/model/pws_error_data.h @@ -0,0 +1,38 @@ +/* + * pws_error_data.h + * + * + */ + +#ifndef _OpenAPI_pws_error_data_H_ +#define _OpenAPI_pws_error_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pws_error_data_s OpenAPI_pws_error_data_t; +typedef struct OpenAPI_pws_error_data_s { + int namf_cause; +} OpenAPI_pws_error_data_t; + +OpenAPI_pws_error_data_t *OpenAPI_pws_error_data_create( + int namf_cause + ); +void OpenAPI_pws_error_data_free(OpenAPI_pws_error_data_t *pws_error_data); +OpenAPI_pws_error_data_t *OpenAPI_pws_error_data_parseFromJSON(cJSON *pws_error_dataJSON); +cJSON *OpenAPI_pws_error_data_convertToJSON(OpenAPI_pws_error_data_t *pws_error_data); +OpenAPI_pws_error_data_t *OpenAPI_pws_error_data_copy(OpenAPI_pws_error_data_t *dst, OpenAPI_pws_error_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pws_error_data_H_ */ + diff --git a/lib/sbi/openapi/model/pws_information.c b/lib/sbi/openapi/model/pws_information.c new file mode 100644 index 000000000..ea27e5eb7 --- /dev/null +++ b/lib/sbi/openapi/model/pws_information.c @@ -0,0 +1,201 @@ + +#include +#include +#include +#include "pws_information.h" + +OpenAPI_pws_information_t *OpenAPI_pws_information_create( + int message_identifier, + int serial_number, + OpenAPI_n2_info_content_t *pws_container, + int send_ran_response, + char *omc_id + ) +{ + OpenAPI_pws_information_t *pws_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_pws_information_t)); + if (!pws_information_local_var) { + return NULL; + } + pws_information_local_var->message_identifier = message_identifier; + pws_information_local_var->serial_number = serial_number; + pws_information_local_var->pws_container = pws_container; + pws_information_local_var->send_ran_response = send_ran_response; + pws_information_local_var->omc_id = omc_id; + + return pws_information_local_var; +} + +void OpenAPI_pws_information_free(OpenAPI_pws_information_t *pws_information) +{ + if (NULL == pws_information) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_n2_info_content_free(pws_information->pws_container); + ogs_free(pws_information->omc_id); + ogs_free(pws_information); +} + +cJSON *OpenAPI_pws_information_convertToJSON(OpenAPI_pws_information_t *pws_information) +{ + cJSON *item = NULL; + + if (pws_information == NULL) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [PwsInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pws_information->message_identifier) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [message_identifier]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "messageIdentifier", pws_information->message_identifier) == NULL) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [message_identifier]"); + goto end; + } + + if (!pws_information->serial_number) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [serial_number]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "serialNumber", pws_information->serial_number) == NULL) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [serial_number]"); + goto end; + } + + if (!pws_information->pws_container) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [pws_container]"); + goto end; + } + cJSON *pws_container_local_JSON = OpenAPI_n2_info_content_convertToJSON(pws_information->pws_container); + if (pws_container_local_JSON == NULL) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [pws_container]"); + goto end; + } + cJSON_AddItemToObject(item, "pwsContainer", pws_container_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [pws_container]"); + goto end; + } + + if (pws_information->send_ran_response) { + if (cJSON_AddBoolToObject(item, "sendRanResponse", pws_information->send_ran_response) == NULL) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [send_ran_response]"); + goto end; + } + } + + if (pws_information->omc_id) { + if (cJSON_AddStringToObject(item, "omcId", pws_information->omc_id) == NULL) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [omc_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_informationJSON) +{ + OpenAPI_pws_information_t *pws_information_local_var = NULL; + cJSON *message_identifier = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "messageIdentifier"); + if (!message_identifier) { + ogs_error("OpenAPI_pws_information_parseFromJSON() failed [message_identifier]"); + goto end; + } + + + if (!cJSON_IsNumber(message_identifier)) { + ogs_error("OpenAPI_pws_information_parseFromJSON() failed [message_identifier]"); + goto end; + } + + cJSON *serial_number = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "serialNumber"); + if (!serial_number) { + ogs_error("OpenAPI_pws_information_parseFromJSON() failed [serial_number]"); + goto end; + } + + + if (!cJSON_IsNumber(serial_number)) { + ogs_error("OpenAPI_pws_information_parseFromJSON() failed [serial_number]"); + goto end; + } + + cJSON *pws_container = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "pwsContainer"); + if (!pws_container) { + ogs_error("OpenAPI_pws_information_parseFromJSON() failed [pws_container]"); + goto end; + } + + OpenAPI_n2_info_content_t *pws_container_local_nonprim = NULL; + + pws_container_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(pws_container); + + cJSON *send_ran_response = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "sendRanResponse"); + + if (send_ran_response) { + if (!cJSON_IsBool(send_ran_response)) { + ogs_error("OpenAPI_pws_information_parseFromJSON() failed [send_ran_response]"); + goto end; + } + } + + cJSON *omc_id = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "omcId"); + + if (omc_id) { + if (!cJSON_IsString(omc_id)) { + ogs_error("OpenAPI_pws_information_parseFromJSON() failed [omc_id]"); + goto end; + } + } + + pws_information_local_var = OpenAPI_pws_information_create ( + message_identifier->valuedouble, + serial_number->valuedouble, + pws_container_local_nonprim, + send_ran_response ? send_ran_response->valueint : 0, + omc_id ? ogs_strdup(omc_id->valuestring) : NULL + ); + + return pws_information_local_var; +end: + return NULL; +} + +OpenAPI_pws_information_t *OpenAPI_pws_information_copy(OpenAPI_pws_information_t *dst, OpenAPI_pws_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pws_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_pws_information_free(dst); + dst = OpenAPI_pws_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pws_information.h b/lib/sbi/openapi/model/pws_information.h new file mode 100644 index 000000000..e9daa7ec1 --- /dev/null +++ b/lib/sbi/openapi/model/pws_information.h @@ -0,0 +1,47 @@ +/* + * pws_information.h + * + * + */ + +#ifndef _OpenAPI_pws_information_H_ +#define _OpenAPI_pws_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pws_information_s OpenAPI_pws_information_t; +typedef struct OpenAPI_pws_information_s { + int message_identifier; + int serial_number; + struct OpenAPI_n2_info_content_s *pws_container; + int send_ran_response; + char *omc_id; +} OpenAPI_pws_information_t; + +OpenAPI_pws_information_t *OpenAPI_pws_information_create( + int message_identifier, + int serial_number, + OpenAPI_n2_info_content_t *pws_container, + int send_ran_response, + char *omc_id + ); +void OpenAPI_pws_information_free(OpenAPI_pws_information_t *pws_information); +OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_informationJSON); +cJSON *OpenAPI_pws_information_convertToJSON(OpenAPI_pws_information_t *pws_information); +OpenAPI_pws_information_t *OpenAPI_pws_information_copy(OpenAPI_pws_information_t *dst, OpenAPI_pws_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pws_information_H_ */ + diff --git a/lib/sbi/openapi/model/pws_response_data.c b/lib/sbi/openapi/model/pws_response_data.c new file mode 100644 index 000000000..3bacb2469 --- /dev/null +++ b/lib/sbi/openapi/model/pws_response_data.c @@ -0,0 +1,207 @@ + +#include +#include +#include +#include "pws_response_data.h" + +OpenAPI_pws_response_data_t *OpenAPI_pws_response_data_create( + int ngap_message_type, + int serial_number, + int message_identifier, + OpenAPI_list_t *unknown_tai_list + ) +{ + OpenAPI_pws_response_data_t *pws_response_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_pws_response_data_t)); + if (!pws_response_data_local_var) { + return NULL; + } + pws_response_data_local_var->ngap_message_type = ngap_message_type; + pws_response_data_local_var->serial_number = serial_number; + pws_response_data_local_var->message_identifier = message_identifier; + pws_response_data_local_var->unknown_tai_list = unknown_tai_list; + + return pws_response_data_local_var; +} + +void OpenAPI_pws_response_data_free(OpenAPI_pws_response_data_t *pws_response_data) +{ + if (NULL == pws_response_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(pws_response_data->unknown_tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(pws_response_data->unknown_tai_list); + ogs_free(pws_response_data); +} + +cJSON *OpenAPI_pws_response_data_convertToJSON(OpenAPI_pws_response_data_t *pws_response_data) +{ + cJSON *item = NULL; + + if (pws_response_data == NULL) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [PWSResponseData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pws_response_data->ngap_message_type) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [ngap_message_type]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "ngapMessageType", pws_response_data->ngap_message_type) == NULL) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [ngap_message_type]"); + goto end; + } + + if (!pws_response_data->serial_number) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [serial_number]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "serialNumber", pws_response_data->serial_number) == NULL) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [serial_number]"); + goto end; + } + + if (!pws_response_data->message_identifier) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [message_identifier]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "messageIdentifier", pws_response_data->message_identifier) == NULL) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [message_identifier]"); + goto end; + } + + if (pws_response_data->unknown_tai_list) { + cJSON *unknown_tai_listList = cJSON_AddArrayToObject(item, "unknownTaiList"); + if (unknown_tai_listList == NULL) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [unknown_tai_list]"); + goto end; + } + + OpenAPI_lnode_t *unknown_tai_list_node; + if (pws_response_data->unknown_tai_list) { + OpenAPI_list_for_each(pws_response_data->unknown_tai_list, unknown_tai_list_node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(unknown_tai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pws_response_data_convertToJSON() failed [unknown_tai_list]"); + goto end; + } + cJSON_AddItemToArray(unknown_tai_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_pws_response_data_t *OpenAPI_pws_response_data_parseFromJSON(cJSON *pws_response_dataJSON) +{ + OpenAPI_pws_response_data_t *pws_response_data_local_var = NULL; + cJSON *ngap_message_type = cJSON_GetObjectItemCaseSensitive(pws_response_dataJSON, "ngapMessageType"); + if (!ngap_message_type) { + ogs_error("OpenAPI_pws_response_data_parseFromJSON() failed [ngap_message_type]"); + goto end; + } + + + if (!cJSON_IsNumber(ngap_message_type)) { + ogs_error("OpenAPI_pws_response_data_parseFromJSON() failed [ngap_message_type]"); + goto end; + } + + cJSON *serial_number = cJSON_GetObjectItemCaseSensitive(pws_response_dataJSON, "serialNumber"); + if (!serial_number) { + ogs_error("OpenAPI_pws_response_data_parseFromJSON() failed [serial_number]"); + goto end; + } + + + if (!cJSON_IsNumber(serial_number)) { + ogs_error("OpenAPI_pws_response_data_parseFromJSON() failed [serial_number]"); + goto end; + } + + cJSON *message_identifier = cJSON_GetObjectItemCaseSensitive(pws_response_dataJSON, "messageIdentifier"); + if (!message_identifier) { + ogs_error("OpenAPI_pws_response_data_parseFromJSON() failed [message_identifier]"); + goto end; + } + + + if (!cJSON_IsNumber(message_identifier)) { + ogs_error("OpenAPI_pws_response_data_parseFromJSON() failed [message_identifier]"); + goto end; + } + + cJSON *unknown_tai_list = cJSON_GetObjectItemCaseSensitive(pws_response_dataJSON, "unknownTaiList"); + + OpenAPI_list_t *unknown_tai_listList; + if (unknown_tai_list) { + cJSON *unknown_tai_list_local_nonprimitive; + if (!cJSON_IsArray(unknown_tai_list)) { + ogs_error("OpenAPI_pws_response_data_parseFromJSON() failed [unknown_tai_list]"); + goto end; + } + + unknown_tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(unknown_tai_list_local_nonprimitive, unknown_tai_list ) { + if (!cJSON_IsObject(unknown_tai_list_local_nonprimitive)) { + ogs_error("OpenAPI_pws_response_data_parseFromJSON() failed [unknown_tai_list]"); + goto end; + } + OpenAPI_tai_t *unknown_tai_listItem = OpenAPI_tai_parseFromJSON(unknown_tai_list_local_nonprimitive); + + OpenAPI_list_add(unknown_tai_listList, unknown_tai_listItem); + } + } + + pws_response_data_local_var = OpenAPI_pws_response_data_create ( + ngap_message_type->valuedouble, + serial_number->valuedouble, + message_identifier->valuedouble, + unknown_tai_list ? unknown_tai_listList : NULL + ); + + return pws_response_data_local_var; +end: + return NULL; +} + +OpenAPI_pws_response_data_t *OpenAPI_pws_response_data_copy(OpenAPI_pws_response_data_t *dst, OpenAPI_pws_response_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pws_response_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pws_response_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_pws_response_data_free(dst); + dst = OpenAPI_pws_response_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pws_response_data.h b/lib/sbi/openapi/model/pws_response_data.h new file mode 100644 index 000000000..767778bcb --- /dev/null +++ b/lib/sbi/openapi/model/pws_response_data.h @@ -0,0 +1,45 @@ +/* + * pws_response_data.h + * + * + */ + +#ifndef _OpenAPI_pws_response_data_H_ +#define _OpenAPI_pws_response_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pws_response_data_s OpenAPI_pws_response_data_t; +typedef struct OpenAPI_pws_response_data_s { + int ngap_message_type; + int serial_number; + int message_identifier; + OpenAPI_list_t *unknown_tai_list; +} OpenAPI_pws_response_data_t; + +OpenAPI_pws_response_data_t *OpenAPI_pws_response_data_create( + int ngap_message_type, + int serial_number, + int message_identifier, + OpenAPI_list_t *unknown_tai_list + ); +void OpenAPI_pws_response_data_free(OpenAPI_pws_response_data_t *pws_response_data); +OpenAPI_pws_response_data_t *OpenAPI_pws_response_data_parseFromJSON(cJSON *pws_response_dataJSON); +cJSON *OpenAPI_pws_response_data_convertToJSON(OpenAPI_pws_response_data_t *pws_response_data); +OpenAPI_pws_response_data_t *OpenAPI_pws_response_data_copy(OpenAPI_pws_response_data_t *dst, OpenAPI_pws_response_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pws_response_data_H_ */ + diff --git a/lib/sbi/openapi/model/qos_flow_access_type.c b/lib/sbi/openapi/model/qos_flow_access_type.c new file mode 100644 index 000000000..c5b168bff --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_access_type.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "qos_flow_access_type.h" + +OpenAPI_qos_flow_access_type_t *OpenAPI_qos_flow_access_type_create( + ) +{ + OpenAPI_qos_flow_access_type_t *qos_flow_access_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_access_type_t)); + if (!qos_flow_access_type_local_var) { + return NULL; + } + + return qos_flow_access_type_local_var; +} + +void OpenAPI_qos_flow_access_type_free(OpenAPI_qos_flow_access_type_t *qos_flow_access_type) +{ + if (NULL == qos_flow_access_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(qos_flow_access_type); +} + +cJSON *OpenAPI_qos_flow_access_type_convertToJSON(OpenAPI_qos_flow_access_type_t *qos_flow_access_type) +{ + cJSON *item = NULL; + + if (qos_flow_access_type == NULL) { + ogs_error("OpenAPI_qos_flow_access_type_convertToJSON() failed [QosFlowAccessType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_qos_flow_access_type_t *OpenAPI_qos_flow_access_type_parseFromJSON(cJSON *qos_flow_access_typeJSON) +{ + OpenAPI_qos_flow_access_type_t *qos_flow_access_type_local_var = NULL; + qos_flow_access_type_local_var = OpenAPI_qos_flow_access_type_create ( + ); + + return qos_flow_access_type_local_var; +end: + return NULL; +} + +OpenAPI_qos_flow_access_type_t *OpenAPI_qos_flow_access_type_copy(OpenAPI_qos_flow_access_type_t *dst, OpenAPI_qos_flow_access_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_flow_access_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_flow_access_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_flow_access_type_free(dst); + dst = OpenAPI_qos_flow_access_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_flow_access_type.h b/lib/sbi/openapi/model/qos_flow_access_type.h new file mode 100644 index 000000000..b6f7d1bd7 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_access_type.h @@ -0,0 +1,36 @@ +/* + * qos_flow_access_type.h + * + * Possible values are - 3GPP - NON_3GPP - 3GPP_AND_NON_3GPP + */ + +#ifndef _OpenAPI_qos_flow_access_type_H_ +#define _OpenAPI_qos_flow_access_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 struct OpenAPI_qos_flow_access_type_s OpenAPI_qos_flow_access_type_t; +typedef struct OpenAPI_qos_flow_access_type_s { +} OpenAPI_qos_flow_access_type_t; + +OpenAPI_qos_flow_access_type_t *OpenAPI_qos_flow_access_type_create( + ); +void OpenAPI_qos_flow_access_type_free(OpenAPI_qos_flow_access_type_t *qos_flow_access_type); +OpenAPI_qos_flow_access_type_t *OpenAPI_qos_flow_access_type_parseFromJSON(cJSON *qos_flow_access_typeJSON); +cJSON *OpenAPI_qos_flow_access_type_convertToJSON(OpenAPI_qos_flow_access_type_t *qos_flow_access_type); +OpenAPI_qos_flow_access_type_t *OpenAPI_qos_flow_access_type_copy(OpenAPI_qos_flow_access_type_t *dst, OpenAPI_qos_flow_access_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_flow_access_type_H_ */ + diff --git a/lib/sbi/openapi/model/qos_flow_add_modify_request_item.c b/lib/sbi/openapi/model/qos_flow_add_modify_request_item.c new file mode 100644 index 000000000..01d17d2ae --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_add_modify_request_item.c @@ -0,0 +1,214 @@ + +#include +#include +#include +#include "qos_flow_add_modify_request_item.h" + +OpenAPI_qos_flow_add_modify_request_item_t *OpenAPI_qos_flow_add_modify_request_item_create( + int qfi, + int ebi, + char qos_rules, + char qos_flow_description, + OpenAPI_qos_flow_profile_t *qos_flow_profile, + OpenAPI_qos_flow_access_type_t *associated_an_type + ) +{ + OpenAPI_qos_flow_add_modify_request_item_t *qos_flow_add_modify_request_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_add_modify_request_item_t)); + if (!qos_flow_add_modify_request_item_local_var) { + return NULL; + } + qos_flow_add_modify_request_item_local_var->qfi = qfi; + qos_flow_add_modify_request_item_local_var->ebi = ebi; + qos_flow_add_modify_request_item_local_var->qos_rules = qos_rules; + qos_flow_add_modify_request_item_local_var->qos_flow_description = qos_flow_description; + qos_flow_add_modify_request_item_local_var->qos_flow_profile = qos_flow_profile; + qos_flow_add_modify_request_item_local_var->associated_an_type = associated_an_type; + + return qos_flow_add_modify_request_item_local_var; +} + +void OpenAPI_qos_flow_add_modify_request_item_free(OpenAPI_qos_flow_add_modify_request_item_t *qos_flow_add_modify_request_item) +{ + if (NULL == qos_flow_add_modify_request_item) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_qos_flow_profile_free(qos_flow_add_modify_request_item->qos_flow_profile); + OpenAPI_qos_flow_access_type_free(qos_flow_add_modify_request_item->associated_an_type); + ogs_free(qos_flow_add_modify_request_item); +} + +cJSON *OpenAPI_qos_flow_add_modify_request_item_convertToJSON(OpenAPI_qos_flow_add_modify_request_item_t *qos_flow_add_modify_request_item) +{ + cJSON *item = NULL; + + if (qos_flow_add_modify_request_item == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [QosFlowAddModifyRequestItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!qos_flow_add_modify_request_item->qfi) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [qfi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "qfi", qos_flow_add_modify_request_item->qfi) == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [qfi]"); + goto end; + } + + if (qos_flow_add_modify_request_item->ebi) { + if (cJSON_AddNumberToObject(item, "ebi", qos_flow_add_modify_request_item->ebi) == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [ebi]"); + goto end; + } + } + + if (qos_flow_add_modify_request_item->qos_rules) { + if (cJSON_AddNumberToObject(item, "qosRules", qos_flow_add_modify_request_item->qos_rules) == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [qos_rules]"); + goto end; + } + } + + if (qos_flow_add_modify_request_item->qos_flow_description) { + if (cJSON_AddNumberToObject(item, "qosFlowDescription", qos_flow_add_modify_request_item->qos_flow_description) == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [qos_flow_description]"); + goto end; + } + } + + if (qos_flow_add_modify_request_item->qos_flow_profile) { + cJSON *qos_flow_profile_local_JSON = OpenAPI_qos_flow_profile_convertToJSON(qos_flow_add_modify_request_item->qos_flow_profile); + if (qos_flow_profile_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [qos_flow_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "qosFlowProfile", qos_flow_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [qos_flow_profile]"); + goto end; + } + } + + if (qos_flow_add_modify_request_item->associated_an_type) { + cJSON *associated_an_type_local_JSON = OpenAPI_qos_flow_access_type_convertToJSON(qos_flow_add_modify_request_item->associated_an_type); + if (associated_an_type_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [associated_an_type]"); + goto end; + } + cJSON_AddItemToObject(item, "associatedAnType", associated_an_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed [associated_an_type]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_qos_flow_add_modify_request_item_t *OpenAPI_qos_flow_add_modify_request_item_parseFromJSON(cJSON *qos_flow_add_modify_request_itemJSON) +{ + OpenAPI_qos_flow_add_modify_request_item_t *qos_flow_add_modify_request_item_local_var = NULL; + cJSON *qfi = cJSON_GetObjectItemCaseSensitive(qos_flow_add_modify_request_itemJSON, "qfi"); + if (!qfi) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_parseFromJSON() failed [qfi]"); + goto end; + } + + + if (!cJSON_IsNumber(qfi)) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_parseFromJSON() failed [qfi]"); + goto end; + } + + cJSON *ebi = cJSON_GetObjectItemCaseSensitive(qos_flow_add_modify_request_itemJSON, "ebi"); + + if (ebi) { + if (!cJSON_IsNumber(ebi)) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_parseFromJSON() failed [ebi]"); + goto end; + } + } + + cJSON *qos_rules = cJSON_GetObjectItemCaseSensitive(qos_flow_add_modify_request_itemJSON, "qosRules"); + + if (qos_rules) { + if (!cJSON_IsNumber(qos_rules)) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_parseFromJSON() failed [qos_rules]"); + goto end; + } + } + + cJSON *qos_flow_description = cJSON_GetObjectItemCaseSensitive(qos_flow_add_modify_request_itemJSON, "qosFlowDescription"); + + if (qos_flow_description) { + if (!cJSON_IsNumber(qos_flow_description)) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_parseFromJSON() failed [qos_flow_description]"); + goto end; + } + } + + cJSON *qos_flow_profile = cJSON_GetObjectItemCaseSensitive(qos_flow_add_modify_request_itemJSON, "qosFlowProfile"); + + OpenAPI_qos_flow_profile_t *qos_flow_profile_local_nonprim = NULL; + if (qos_flow_profile) { + qos_flow_profile_local_nonprim = OpenAPI_qos_flow_profile_parseFromJSON(qos_flow_profile); + } + + cJSON *associated_an_type = cJSON_GetObjectItemCaseSensitive(qos_flow_add_modify_request_itemJSON, "associatedAnType"); + + OpenAPI_qos_flow_access_type_t *associated_an_type_local_nonprim = NULL; + if (associated_an_type) { + associated_an_type_local_nonprim = OpenAPI_qos_flow_access_type_parseFromJSON(associated_an_type); + } + + qos_flow_add_modify_request_item_local_var = OpenAPI_qos_flow_add_modify_request_item_create ( + qfi->valuedouble, + ebi ? ebi->valuedouble : 0, + qos_rules ? qos_rules->valueint : 0, + qos_flow_description ? qos_flow_description->valueint : 0, + qos_flow_profile ? qos_flow_profile_local_nonprim : NULL, + associated_an_type ? associated_an_type_local_nonprim : NULL + ); + + return qos_flow_add_modify_request_item_local_var; +end: + return NULL; +} + +OpenAPI_qos_flow_add_modify_request_item_t *OpenAPI_qos_flow_add_modify_request_item_copy(OpenAPI_qos_flow_add_modify_request_item_t *dst, OpenAPI_qos_flow_add_modify_request_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_flow_add_modify_request_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_flow_add_modify_request_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_flow_add_modify_request_item_free(dst); + dst = OpenAPI_qos_flow_add_modify_request_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_flow_add_modify_request_item.h b/lib/sbi/openapi/model/qos_flow_add_modify_request_item.h new file mode 100644 index 000000000..472a13e3b --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_add_modify_request_item.h @@ -0,0 +1,50 @@ +/* + * qos_flow_add_modify_request_item.h + * + * + */ + +#ifndef _OpenAPI_qos_flow_add_modify_request_item_H_ +#define _OpenAPI_qos_flow_add_modify_request_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "qos_flow_access_type.h" +#include "qos_flow_profile.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_flow_add_modify_request_item_s OpenAPI_qos_flow_add_modify_request_item_t; +typedef struct OpenAPI_qos_flow_add_modify_request_item_s { + int qfi; + int ebi; + char qos_rules; + char qos_flow_description; + struct OpenAPI_qos_flow_profile_s *qos_flow_profile; + struct OpenAPI_qos_flow_access_type_s *associated_an_type; +} OpenAPI_qos_flow_add_modify_request_item_t; + +OpenAPI_qos_flow_add_modify_request_item_t *OpenAPI_qos_flow_add_modify_request_item_create( + int qfi, + int ebi, + char qos_rules, + char qos_flow_description, + OpenAPI_qos_flow_profile_t *qos_flow_profile, + OpenAPI_qos_flow_access_type_t *associated_an_type + ); +void OpenAPI_qos_flow_add_modify_request_item_free(OpenAPI_qos_flow_add_modify_request_item_t *qos_flow_add_modify_request_item); +OpenAPI_qos_flow_add_modify_request_item_t *OpenAPI_qos_flow_add_modify_request_item_parseFromJSON(cJSON *qos_flow_add_modify_request_itemJSON); +cJSON *OpenAPI_qos_flow_add_modify_request_item_convertToJSON(OpenAPI_qos_flow_add_modify_request_item_t *qos_flow_add_modify_request_item); +OpenAPI_qos_flow_add_modify_request_item_t *OpenAPI_qos_flow_add_modify_request_item_copy(OpenAPI_qos_flow_add_modify_request_item_t *dst, OpenAPI_qos_flow_add_modify_request_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_flow_add_modify_request_item_H_ */ + diff --git a/lib/sbi/openapi/model/qos_flow_item.c b/lib/sbi/openapi/model/qos_flow_item.c new file mode 100644 index 000000000..bea54fc68 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_item.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "qos_flow_item.h" + +OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( + int qfi, + OpenAPI_cause_t *cause + ) +{ + OpenAPI_qos_flow_item_t *qos_flow_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_item_t)); + if (!qos_flow_item_local_var) { + return NULL; + } + qos_flow_item_local_var->qfi = qfi; + qos_flow_item_local_var->cause = cause; + + return qos_flow_item_local_var; +} + +void OpenAPI_qos_flow_item_free(OpenAPI_qos_flow_item_t *qos_flow_item) +{ + if (NULL == qos_flow_item) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_cause_free(qos_flow_item->cause); + ogs_free(qos_flow_item); +} + +cJSON *OpenAPI_qos_flow_item_convertToJSON(OpenAPI_qos_flow_item_t *qos_flow_item) +{ + cJSON *item = NULL; + + if (qos_flow_item == NULL) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [QosFlowItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!qos_flow_item->qfi) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [qfi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "qfi", qos_flow_item->qfi) == NULL) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [qfi]"); + goto end; + } + + if (qos_flow_item->cause) { + cJSON *cause_local_JSON = OpenAPI_cause_convertToJSON(qos_flow_item->cause); + if (cause_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [cause]"); + goto end; + } + cJSON_AddItemToObject(item, "cause", cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [cause]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_parseFromJSON(cJSON *qos_flow_itemJSON) +{ + OpenAPI_qos_flow_item_t *qos_flow_item_local_var = NULL; + cJSON *qfi = cJSON_GetObjectItemCaseSensitive(qos_flow_itemJSON, "qfi"); + if (!qfi) { + ogs_error("OpenAPI_qos_flow_item_parseFromJSON() failed [qfi]"); + goto end; + } + + + if (!cJSON_IsNumber(qfi)) { + ogs_error("OpenAPI_qos_flow_item_parseFromJSON() failed [qfi]"); + goto end; + } + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(qos_flow_itemJSON, "cause"); + + OpenAPI_cause_t *cause_local_nonprim = NULL; + if (cause) { + cause_local_nonprim = OpenAPI_cause_parseFromJSON(cause); + } + + qos_flow_item_local_var = OpenAPI_qos_flow_item_create ( + qfi->valuedouble, + cause ? cause_local_nonprim : NULL + ); + + return qos_flow_item_local_var; +end: + return NULL; +} + +OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_copy(OpenAPI_qos_flow_item_t *dst, OpenAPI_qos_flow_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_flow_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_flow_item_free(dst); + dst = OpenAPI_qos_flow_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_flow_item.h b/lib/sbi/openapi/model/qos_flow_item.h new file mode 100644 index 000000000..b0a7dcd2d --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_item.h @@ -0,0 +1,41 @@ +/* + * qos_flow_item.h + * + * + */ + +#ifndef _OpenAPI_qos_flow_item_H_ +#define _OpenAPI_qos_flow_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "cause.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_flow_item_s OpenAPI_qos_flow_item_t; +typedef struct OpenAPI_qos_flow_item_s { + int qfi; + struct OpenAPI_cause_s *cause; +} OpenAPI_qos_flow_item_t; + +OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( + int qfi, + OpenAPI_cause_t *cause + ); +void OpenAPI_qos_flow_item_free(OpenAPI_qos_flow_item_t *qos_flow_item); +OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_parseFromJSON(cJSON *qos_flow_itemJSON); +cJSON *OpenAPI_qos_flow_item_convertToJSON(OpenAPI_qos_flow_item_t *qos_flow_item); +OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_copy(OpenAPI_qos_flow_item_t *dst, OpenAPI_qos_flow_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_flow_item_H_ */ + diff --git a/lib/sbi/openapi/model/qos_flow_notify_item.c b/lib/sbi/openapi/model/qos_flow_notify_item.c new file mode 100644 index 000000000..b3f475fa0 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_notify_item.c @@ -0,0 +1,138 @@ + +#include +#include +#include +#include "qos_flow_notify_item.h" + +OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_create( + int qfi, + OpenAPI_notification_cause_t *notification_cause + ) +{ + OpenAPI_qos_flow_notify_item_t *qos_flow_notify_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_notify_item_t)); + if (!qos_flow_notify_item_local_var) { + return NULL; + } + qos_flow_notify_item_local_var->qfi = qfi; + qos_flow_notify_item_local_var->notification_cause = notification_cause; + + return qos_flow_notify_item_local_var; +} + +void OpenAPI_qos_flow_notify_item_free(OpenAPI_qos_flow_notify_item_t *qos_flow_notify_item) +{ + if (NULL == qos_flow_notify_item) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_notification_cause_free(qos_flow_notify_item->notification_cause); + ogs_free(qos_flow_notify_item); +} + +cJSON *OpenAPI_qos_flow_notify_item_convertToJSON(OpenAPI_qos_flow_notify_item_t *qos_flow_notify_item) +{ + cJSON *item = NULL; + + if (qos_flow_notify_item == NULL) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed [QosFlowNotifyItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!qos_flow_notify_item->qfi) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed [qfi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "qfi", qos_flow_notify_item->qfi) == NULL) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed [qfi]"); + goto end; + } + + if (!qos_flow_notify_item->notification_cause) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed [notification_cause]"); + goto end; + } + cJSON *notification_cause_local_JSON = OpenAPI_notification_cause_convertToJSON(qos_flow_notify_item->notification_cause); + if (notification_cause_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed [notification_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "notificationCause", notification_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed [notification_cause]"); + goto end; + } + +end: + return item; +} + +OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_parseFromJSON(cJSON *qos_flow_notify_itemJSON) +{ + OpenAPI_qos_flow_notify_item_t *qos_flow_notify_item_local_var = NULL; + cJSON *qfi = cJSON_GetObjectItemCaseSensitive(qos_flow_notify_itemJSON, "qfi"); + if (!qfi) { + ogs_error("OpenAPI_qos_flow_notify_item_parseFromJSON() failed [qfi]"); + goto end; + } + + + if (!cJSON_IsNumber(qfi)) { + ogs_error("OpenAPI_qos_flow_notify_item_parseFromJSON() failed [qfi]"); + goto end; + } + + cJSON *notification_cause = cJSON_GetObjectItemCaseSensitive(qos_flow_notify_itemJSON, "notificationCause"); + if (!notification_cause) { + ogs_error("OpenAPI_qos_flow_notify_item_parseFromJSON() failed [notification_cause]"); + goto end; + } + + OpenAPI_notification_cause_t *notification_cause_local_nonprim = NULL; + + notification_cause_local_nonprim = OpenAPI_notification_cause_parseFromJSON(notification_cause); + + qos_flow_notify_item_local_var = OpenAPI_qos_flow_notify_item_create ( + qfi->valuedouble, + notification_cause_local_nonprim + ); + + return qos_flow_notify_item_local_var; +end: + return NULL; +} + +OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_copy(OpenAPI_qos_flow_notify_item_t *dst, OpenAPI_qos_flow_notify_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_flow_notify_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_flow_notify_item_free(dst); + dst = OpenAPI_qos_flow_notify_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_flow_notify_item.h b/lib/sbi/openapi/model/qos_flow_notify_item.h new file mode 100644 index 000000000..817d46e6a --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_notify_item.h @@ -0,0 +1,41 @@ +/* + * qos_flow_notify_item.h + * + * + */ + +#ifndef _OpenAPI_qos_flow_notify_item_H_ +#define _OpenAPI_qos_flow_notify_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "notification_cause.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_flow_notify_item_s OpenAPI_qos_flow_notify_item_t; +typedef struct OpenAPI_qos_flow_notify_item_s { + int qfi; + struct OpenAPI_notification_cause_s *notification_cause; +} OpenAPI_qos_flow_notify_item_t; + +OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_create( + int qfi, + OpenAPI_notification_cause_t *notification_cause + ); +void OpenAPI_qos_flow_notify_item_free(OpenAPI_qos_flow_notify_item_t *qos_flow_notify_item); +OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_parseFromJSON(cJSON *qos_flow_notify_itemJSON); +cJSON *OpenAPI_qos_flow_notify_item_convertToJSON(OpenAPI_qos_flow_notify_item_t *qos_flow_notify_item); +OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_copy(OpenAPI_qos_flow_notify_item_t *dst, OpenAPI_qos_flow_notify_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_flow_notify_item_H_ */ + diff --git a/lib/sbi/openapi/model/qos_flow_profile.c b/lib/sbi/openapi/model/qos_flow_profile.c new file mode 100644 index 000000000..c2cc250bd --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_profile.c @@ -0,0 +1,253 @@ + +#include +#include +#include +#include "qos_flow_profile.h" + +OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_create( + int _5qi, + OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi, + OpenAPI_dynamic5_qi_t *dynamic5_qi, + OpenAPI_arp_t *arp, + OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_info, + OpenAPI_reflective_qo_s_attribute_t *rqa, + OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info + ) +{ + OpenAPI_qos_flow_profile_t *qos_flow_profile_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_profile_t)); + if (!qos_flow_profile_local_var) { + return NULL; + } + qos_flow_profile_local_var->_5qi = _5qi; + qos_flow_profile_local_var->non_dynamic5_qi = non_dynamic5_qi; + qos_flow_profile_local_var->dynamic5_qi = dynamic5_qi; + qos_flow_profile_local_var->arp = arp; + qos_flow_profile_local_var->gbr_qos_flow_info = gbr_qos_flow_info; + qos_flow_profile_local_var->rqa = rqa; + qos_flow_profile_local_var->additional_qos_flow_info = additional_qos_flow_info; + + return qos_flow_profile_local_var; +} + +void OpenAPI_qos_flow_profile_free(OpenAPI_qos_flow_profile_t *qos_flow_profile) +{ + if (NULL == qos_flow_profile) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_non_dynamic5_qi_free(qos_flow_profile->non_dynamic5_qi); + OpenAPI_dynamic5_qi_free(qos_flow_profile->dynamic5_qi); + OpenAPI_arp_free(qos_flow_profile->arp); + OpenAPI_gbr_qos_flow_information_free(qos_flow_profile->gbr_qos_flow_info); + OpenAPI_reflective_qo_s_attribute_free(qos_flow_profile->rqa); + OpenAPI_additional_qos_flow_info_free(qos_flow_profile->additional_qos_flow_info); + ogs_free(qos_flow_profile); +} + +cJSON *OpenAPI_qos_flow_profile_convertToJSON(OpenAPI_qos_flow_profile_t *qos_flow_profile) +{ + cJSON *item = NULL; + + if (qos_flow_profile == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [QosFlowProfile]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!qos_flow_profile->_5qi) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [_5qi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "5qi", qos_flow_profile->_5qi) == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [_5qi]"); + goto end; + } + + if (qos_flow_profile->non_dynamic5_qi) { + cJSON *non_dynamic5_qi_local_JSON = OpenAPI_non_dynamic5_qi_convertToJSON(qos_flow_profile->non_dynamic5_qi); + if (non_dynamic5_qi_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [non_dynamic5_qi]"); + goto end; + } + cJSON_AddItemToObject(item, "nonDynamic5Qi", non_dynamic5_qi_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [non_dynamic5_qi]"); + goto end; + } + } + + if (qos_flow_profile->dynamic5_qi) { + cJSON *dynamic5_qi_local_JSON = OpenAPI_dynamic5_qi_convertToJSON(qos_flow_profile->dynamic5_qi); + if (dynamic5_qi_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [dynamic5_qi]"); + goto end; + } + cJSON_AddItemToObject(item, "dynamic5Qi", dynamic5_qi_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [dynamic5_qi]"); + goto end; + } + } + + if (qos_flow_profile->arp) { + cJSON *arp_local_JSON = OpenAPI_arp_convertToJSON(qos_flow_profile->arp); + if (arp_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [arp]"); + goto end; + } + cJSON_AddItemToObject(item, "arp", arp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [arp]"); + goto end; + } + } + + if (qos_flow_profile->gbr_qos_flow_info) { + cJSON *gbr_qos_flow_info_local_JSON = OpenAPI_gbr_qos_flow_information_convertToJSON(qos_flow_profile->gbr_qos_flow_info); + if (gbr_qos_flow_info_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [gbr_qos_flow_info]"); + goto end; + } + cJSON_AddItemToObject(item, "gbrQosFlowInfo", gbr_qos_flow_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [gbr_qos_flow_info]"); + goto end; + } + } + + if (qos_flow_profile->rqa) { + cJSON *rqa_local_JSON = OpenAPI_reflective_qo_s_attribute_convertToJSON(qos_flow_profile->rqa); + if (rqa_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [rqa]"); + goto end; + } + cJSON_AddItemToObject(item, "rqa", rqa_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [rqa]"); + goto end; + } + } + + if (qos_flow_profile->additional_qos_flow_info) { + cJSON *additional_qos_flow_info_local_JSON = OpenAPI_additional_qos_flow_info_convertToJSON(qos_flow_profile->additional_qos_flow_info); + if (additional_qos_flow_info_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [additional_qos_flow_info]"); + goto end; + } + cJSON_AddItemToObject(item, "additionalQosFlowInfo", additional_qos_flow_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [additional_qos_flow_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_parseFromJSON(cJSON *qos_flow_profileJSON) +{ + OpenAPI_qos_flow_profile_t *qos_flow_profile_local_var = NULL; + cJSON *_5qi = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "5qi"); + if (!_5qi) { + ogs_error("OpenAPI_qos_flow_profile_parseFromJSON() failed [_5qi]"); + goto end; + } + + + if (!cJSON_IsNumber(_5qi)) { + ogs_error("OpenAPI_qos_flow_profile_parseFromJSON() failed [_5qi]"); + goto end; + } + + cJSON *non_dynamic5_qi = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "nonDynamic5Qi"); + + OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi_local_nonprim = NULL; + if (non_dynamic5_qi) { + non_dynamic5_qi_local_nonprim = OpenAPI_non_dynamic5_qi_parseFromJSON(non_dynamic5_qi); + } + + cJSON *dynamic5_qi = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "dynamic5Qi"); + + OpenAPI_dynamic5_qi_t *dynamic5_qi_local_nonprim = NULL; + if (dynamic5_qi) { + dynamic5_qi_local_nonprim = OpenAPI_dynamic5_qi_parseFromJSON(dynamic5_qi); + } + + cJSON *arp = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "arp"); + + OpenAPI_arp_t *arp_local_nonprim = NULL; + if (arp) { + arp_local_nonprim = OpenAPI_arp_parseFromJSON(arp); + } + + cJSON *gbr_qos_flow_info = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "gbrQosFlowInfo"); + + OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_info_local_nonprim = NULL; + if (gbr_qos_flow_info) { + gbr_qos_flow_info_local_nonprim = OpenAPI_gbr_qos_flow_information_parseFromJSON(gbr_qos_flow_info); + } + + cJSON *rqa = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "rqa"); + + OpenAPI_reflective_qo_s_attribute_t *rqa_local_nonprim = NULL; + if (rqa) { + rqa_local_nonprim = OpenAPI_reflective_qo_s_attribute_parseFromJSON(rqa); + } + + cJSON *additional_qos_flow_info = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "additionalQosFlowInfo"); + + OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info_local_nonprim = NULL; + if (additional_qos_flow_info) { + additional_qos_flow_info_local_nonprim = OpenAPI_additional_qos_flow_info_parseFromJSON(additional_qos_flow_info); + } + + qos_flow_profile_local_var = OpenAPI_qos_flow_profile_create ( + _5qi->valuedouble, + non_dynamic5_qi ? non_dynamic5_qi_local_nonprim : NULL, + dynamic5_qi ? dynamic5_qi_local_nonprim : NULL, + arp ? arp_local_nonprim : NULL, + gbr_qos_flow_info ? gbr_qos_flow_info_local_nonprim : NULL, + rqa ? rqa_local_nonprim : NULL, + additional_qos_flow_info ? additional_qos_flow_info_local_nonprim : NULL + ); + + return qos_flow_profile_local_var; +end: + return NULL; +} + +OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_copy(OpenAPI_qos_flow_profile_t *dst, OpenAPI_qos_flow_profile_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_flow_profile_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_flow_profile_free(dst); + dst = OpenAPI_qos_flow_profile_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_flow_profile.h b/lib/sbi/openapi/model/qos_flow_profile.h new file mode 100644 index 000000000..53c9e1be7 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_profile.h @@ -0,0 +1,56 @@ +/* + * qos_flow_profile.h + * + * + */ + +#ifndef _OpenAPI_qos_flow_profile_H_ +#define _OpenAPI_qos_flow_profile_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "additional_qos_flow_info.h" +#include "arp.h" +#include "dynamic5_qi.h" +#include "gbr_qos_flow_information.h" +#include "non_dynamic5_qi.h" +#include "reflective_qo_s_attribute.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_flow_profile_s OpenAPI_qos_flow_profile_t; +typedef struct OpenAPI_qos_flow_profile_s { + int _5qi; + struct OpenAPI_non_dynamic5_qi_s *non_dynamic5_qi; + struct OpenAPI_dynamic5_qi_s *dynamic5_qi; + struct OpenAPI_arp_s *arp; + struct OpenAPI_gbr_qos_flow_information_s *gbr_qos_flow_info; + struct OpenAPI_reflective_qo_s_attribute_s *rqa; + struct OpenAPI_additional_qos_flow_info_s *additional_qos_flow_info; +} OpenAPI_qos_flow_profile_t; + +OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_create( + int _5qi, + OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi, + OpenAPI_dynamic5_qi_t *dynamic5_qi, + OpenAPI_arp_t *arp, + OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_info, + OpenAPI_reflective_qo_s_attribute_t *rqa, + OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info + ); +void OpenAPI_qos_flow_profile_free(OpenAPI_qos_flow_profile_t *qos_flow_profile); +OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_parseFromJSON(cJSON *qos_flow_profileJSON); +cJSON *OpenAPI_qos_flow_profile_convertToJSON(OpenAPI_qos_flow_profile_t *qos_flow_profile); +OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_copy(OpenAPI_qos_flow_profile_t *dst, OpenAPI_qos_flow_profile_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_flow_profile_H_ */ + diff --git a/lib/sbi/openapi/model/qos_flow_release_request_item.c b/lib/sbi/openapi/model/qos_flow_release_request_item.c new file mode 100644 index 000000000..7f69445a0 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_release_request_item.c @@ -0,0 +1,147 @@ + +#include +#include +#include +#include "qos_flow_release_request_item.h" + +OpenAPI_qos_flow_release_request_item_t *OpenAPI_qos_flow_release_request_item_create( + int qfi, + char qos_rules, + char qos_flow_description + ) +{ + OpenAPI_qos_flow_release_request_item_t *qos_flow_release_request_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_release_request_item_t)); + if (!qos_flow_release_request_item_local_var) { + return NULL; + } + qos_flow_release_request_item_local_var->qfi = qfi; + qos_flow_release_request_item_local_var->qos_rules = qos_rules; + qos_flow_release_request_item_local_var->qos_flow_description = qos_flow_description; + + return qos_flow_release_request_item_local_var; +} + +void OpenAPI_qos_flow_release_request_item_free(OpenAPI_qos_flow_release_request_item_t *qos_flow_release_request_item) +{ + if (NULL == qos_flow_release_request_item) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(qos_flow_release_request_item); +} + +cJSON *OpenAPI_qos_flow_release_request_item_convertToJSON(OpenAPI_qos_flow_release_request_item_t *qos_flow_release_request_item) +{ + cJSON *item = NULL; + + if (qos_flow_release_request_item == NULL) { + ogs_error("OpenAPI_qos_flow_release_request_item_convertToJSON() failed [QosFlowReleaseRequestItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!qos_flow_release_request_item->qfi) { + ogs_error("OpenAPI_qos_flow_release_request_item_convertToJSON() failed [qfi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "qfi", qos_flow_release_request_item->qfi) == NULL) { + ogs_error("OpenAPI_qos_flow_release_request_item_convertToJSON() failed [qfi]"); + goto end; + } + + if (qos_flow_release_request_item->qos_rules) { + if (cJSON_AddNumberToObject(item, "qosRules", qos_flow_release_request_item->qos_rules) == NULL) { + ogs_error("OpenAPI_qos_flow_release_request_item_convertToJSON() failed [qos_rules]"); + goto end; + } + } + + if (qos_flow_release_request_item->qos_flow_description) { + if (cJSON_AddNumberToObject(item, "qosFlowDescription", qos_flow_release_request_item->qos_flow_description) == NULL) { + ogs_error("OpenAPI_qos_flow_release_request_item_convertToJSON() failed [qos_flow_description]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_qos_flow_release_request_item_t *OpenAPI_qos_flow_release_request_item_parseFromJSON(cJSON *qos_flow_release_request_itemJSON) +{ + OpenAPI_qos_flow_release_request_item_t *qos_flow_release_request_item_local_var = NULL; + cJSON *qfi = cJSON_GetObjectItemCaseSensitive(qos_flow_release_request_itemJSON, "qfi"); + if (!qfi) { + ogs_error("OpenAPI_qos_flow_release_request_item_parseFromJSON() failed [qfi]"); + goto end; + } + + + if (!cJSON_IsNumber(qfi)) { + ogs_error("OpenAPI_qos_flow_release_request_item_parseFromJSON() failed [qfi]"); + goto end; + } + + cJSON *qos_rules = cJSON_GetObjectItemCaseSensitive(qos_flow_release_request_itemJSON, "qosRules"); + + if (qos_rules) { + if (!cJSON_IsNumber(qos_rules)) { + ogs_error("OpenAPI_qos_flow_release_request_item_parseFromJSON() failed [qos_rules]"); + goto end; + } + } + + cJSON *qos_flow_description = cJSON_GetObjectItemCaseSensitive(qos_flow_release_request_itemJSON, "qosFlowDescription"); + + if (qos_flow_description) { + if (!cJSON_IsNumber(qos_flow_description)) { + ogs_error("OpenAPI_qos_flow_release_request_item_parseFromJSON() failed [qos_flow_description]"); + goto end; + } + } + + qos_flow_release_request_item_local_var = OpenAPI_qos_flow_release_request_item_create ( + qfi->valuedouble, + qos_rules ? qos_rules->valueint : 0, + qos_flow_description ? qos_flow_description->valueint : 0 + ); + + return qos_flow_release_request_item_local_var; +end: + return NULL; +} + +OpenAPI_qos_flow_release_request_item_t *OpenAPI_qos_flow_release_request_item_copy(OpenAPI_qos_flow_release_request_item_t *dst, OpenAPI_qos_flow_release_request_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_flow_release_request_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_flow_release_request_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_flow_release_request_item_free(dst); + dst = OpenAPI_qos_flow_release_request_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_flow_release_request_item.h b/lib/sbi/openapi/model/qos_flow_release_request_item.h new file mode 100644 index 000000000..f9e6f4166 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_release_request_item.h @@ -0,0 +1,42 @@ +/* + * qos_flow_release_request_item.h + * + * + */ + +#ifndef _OpenAPI_qos_flow_release_request_item_H_ +#define _OpenAPI_qos_flow_release_request_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_flow_release_request_item_s OpenAPI_qos_flow_release_request_item_t; +typedef struct OpenAPI_qos_flow_release_request_item_s { + int qfi; + char qos_rules; + char qos_flow_description; +} OpenAPI_qos_flow_release_request_item_t; + +OpenAPI_qos_flow_release_request_item_t *OpenAPI_qos_flow_release_request_item_create( + int qfi, + char qos_rules, + char qos_flow_description + ); +void OpenAPI_qos_flow_release_request_item_free(OpenAPI_qos_flow_release_request_item_t *qos_flow_release_request_item); +OpenAPI_qos_flow_release_request_item_t *OpenAPI_qos_flow_release_request_item_parseFromJSON(cJSON *qos_flow_release_request_itemJSON); +cJSON *OpenAPI_qos_flow_release_request_item_convertToJSON(OpenAPI_qos_flow_release_request_item_t *qos_flow_release_request_item); +OpenAPI_qos_flow_release_request_item_t *OpenAPI_qos_flow_release_request_item_copy(OpenAPI_qos_flow_release_request_item_t *dst, OpenAPI_qos_flow_release_request_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_flow_release_request_item_H_ */ + diff --git a/lib/sbi/openapi/model/qos_flow_setup_item.c b/lib/sbi/openapi/model/qos_flow_setup_item.c new file mode 100644 index 000000000..8fd79f7a2 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_setup_item.c @@ -0,0 +1,219 @@ + +#include +#include +#include +#include "qos_flow_setup_item.h" + +OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_create( + int qfi, + char qos_rules, + int ebi, + char qos_flow_description, + OpenAPI_qos_flow_profile_t *qos_flow_profile, + OpenAPI_qos_flow_access_type_t *associated_an_type + ) +{ + OpenAPI_qos_flow_setup_item_t *qos_flow_setup_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_setup_item_t)); + if (!qos_flow_setup_item_local_var) { + return NULL; + } + qos_flow_setup_item_local_var->qfi = qfi; + qos_flow_setup_item_local_var->qos_rules = qos_rules; + qos_flow_setup_item_local_var->ebi = ebi; + qos_flow_setup_item_local_var->qos_flow_description = qos_flow_description; + qos_flow_setup_item_local_var->qos_flow_profile = qos_flow_profile; + qos_flow_setup_item_local_var->associated_an_type = associated_an_type; + + return qos_flow_setup_item_local_var; +} + +void OpenAPI_qos_flow_setup_item_free(OpenAPI_qos_flow_setup_item_t *qos_flow_setup_item) +{ + if (NULL == qos_flow_setup_item) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_qos_flow_profile_free(qos_flow_setup_item->qos_flow_profile); + OpenAPI_qos_flow_access_type_free(qos_flow_setup_item->associated_an_type); + ogs_free(qos_flow_setup_item); +} + +cJSON *OpenAPI_qos_flow_setup_item_convertToJSON(OpenAPI_qos_flow_setup_item_t *qos_flow_setup_item) +{ + cJSON *item = NULL; + + if (qos_flow_setup_item == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [QosFlowSetupItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!qos_flow_setup_item->qfi) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [qfi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "qfi", qos_flow_setup_item->qfi) == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [qfi]"); + goto end; + } + + if (!qos_flow_setup_item->qos_rules) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [qos_rules]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "qosRules", qos_flow_setup_item->qos_rules) == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [qos_rules]"); + goto end; + } + + if (qos_flow_setup_item->ebi) { + if (cJSON_AddNumberToObject(item, "ebi", qos_flow_setup_item->ebi) == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [ebi]"); + goto end; + } + } + + if (qos_flow_setup_item->qos_flow_description) { + if (cJSON_AddNumberToObject(item, "qosFlowDescription", qos_flow_setup_item->qos_flow_description) == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [qos_flow_description]"); + goto end; + } + } + + if (qos_flow_setup_item->qos_flow_profile) { + cJSON *qos_flow_profile_local_JSON = OpenAPI_qos_flow_profile_convertToJSON(qos_flow_setup_item->qos_flow_profile); + if (qos_flow_profile_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [qos_flow_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "qosFlowProfile", qos_flow_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [qos_flow_profile]"); + goto end; + } + } + + if (qos_flow_setup_item->associated_an_type) { + cJSON *associated_an_type_local_JSON = OpenAPI_qos_flow_access_type_convertToJSON(qos_flow_setup_item->associated_an_type); + if (associated_an_type_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [associated_an_type]"); + goto end; + } + cJSON_AddItemToObject(item, "associatedAnType", associated_an_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [associated_an_type]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_parseFromJSON(cJSON *qos_flow_setup_itemJSON) +{ + OpenAPI_qos_flow_setup_item_t *qos_flow_setup_item_local_var = NULL; + cJSON *qfi = cJSON_GetObjectItemCaseSensitive(qos_flow_setup_itemJSON, "qfi"); + if (!qfi) { + ogs_error("OpenAPI_qos_flow_setup_item_parseFromJSON() failed [qfi]"); + goto end; + } + + + if (!cJSON_IsNumber(qfi)) { + ogs_error("OpenAPI_qos_flow_setup_item_parseFromJSON() failed [qfi]"); + goto end; + } + + cJSON *qos_rules = cJSON_GetObjectItemCaseSensitive(qos_flow_setup_itemJSON, "qosRules"); + if (!qos_rules) { + ogs_error("OpenAPI_qos_flow_setup_item_parseFromJSON() failed [qos_rules]"); + goto end; + } + + + if (!cJSON_IsNumber(qos_rules)) { + ogs_error("OpenAPI_qos_flow_setup_item_parseFromJSON() failed [qos_rules]"); + goto end; + } + + cJSON *ebi = cJSON_GetObjectItemCaseSensitive(qos_flow_setup_itemJSON, "ebi"); + + if (ebi) { + if (!cJSON_IsNumber(ebi)) { + ogs_error("OpenAPI_qos_flow_setup_item_parseFromJSON() failed [ebi]"); + goto end; + } + } + + cJSON *qos_flow_description = cJSON_GetObjectItemCaseSensitive(qos_flow_setup_itemJSON, "qosFlowDescription"); + + if (qos_flow_description) { + if (!cJSON_IsNumber(qos_flow_description)) { + ogs_error("OpenAPI_qos_flow_setup_item_parseFromJSON() failed [qos_flow_description]"); + goto end; + } + } + + cJSON *qos_flow_profile = cJSON_GetObjectItemCaseSensitive(qos_flow_setup_itemJSON, "qosFlowProfile"); + + OpenAPI_qos_flow_profile_t *qos_flow_profile_local_nonprim = NULL; + if (qos_flow_profile) { + qos_flow_profile_local_nonprim = OpenAPI_qos_flow_profile_parseFromJSON(qos_flow_profile); + } + + cJSON *associated_an_type = cJSON_GetObjectItemCaseSensitive(qos_flow_setup_itemJSON, "associatedAnType"); + + OpenAPI_qos_flow_access_type_t *associated_an_type_local_nonprim = NULL; + if (associated_an_type) { + associated_an_type_local_nonprim = OpenAPI_qos_flow_access_type_parseFromJSON(associated_an_type); + } + + qos_flow_setup_item_local_var = OpenAPI_qos_flow_setup_item_create ( + qfi->valuedouble, + qos_rules->valueint, + ebi ? ebi->valuedouble : 0, + qos_flow_description ? qos_flow_description->valueint : 0, + qos_flow_profile ? qos_flow_profile_local_nonprim : NULL, + associated_an_type ? associated_an_type_local_nonprim : NULL + ); + + return qos_flow_setup_item_local_var; +end: + return NULL; +} + +OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_copy(OpenAPI_qos_flow_setup_item_t *dst, OpenAPI_qos_flow_setup_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_flow_setup_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_flow_setup_item_free(dst); + dst = OpenAPI_qos_flow_setup_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_flow_setup_item.h b/lib/sbi/openapi/model/qos_flow_setup_item.h new file mode 100644 index 000000000..546b93105 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_setup_item.h @@ -0,0 +1,50 @@ +/* + * qos_flow_setup_item.h + * + * + */ + +#ifndef _OpenAPI_qos_flow_setup_item_H_ +#define _OpenAPI_qos_flow_setup_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "qos_flow_access_type.h" +#include "qos_flow_profile.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_flow_setup_item_s OpenAPI_qos_flow_setup_item_t; +typedef struct OpenAPI_qos_flow_setup_item_s { + int qfi; + char qos_rules; + int ebi; + char qos_flow_description; + struct OpenAPI_qos_flow_profile_s *qos_flow_profile; + struct OpenAPI_qos_flow_access_type_s *associated_an_type; +} OpenAPI_qos_flow_setup_item_t; + +OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_create( + int qfi, + char qos_rules, + int ebi, + char qos_flow_description, + OpenAPI_qos_flow_profile_t *qos_flow_profile, + OpenAPI_qos_flow_access_type_t *associated_an_type + ); +void OpenAPI_qos_flow_setup_item_free(OpenAPI_qos_flow_setup_item_t *qos_flow_setup_item); +OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_parseFromJSON(cJSON *qos_flow_setup_itemJSON); +cJSON *OpenAPI_qos_flow_setup_item_convertToJSON(OpenAPI_qos_flow_setup_item_t *qos_flow_setup_item); +OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_copy(OpenAPI_qos_flow_setup_item_t *dst, OpenAPI_qos_flow_setup_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_flow_setup_item_H_ */ + diff --git a/lib/sbi/openapi/model/qos_flow_usage_report.c b/lib/sbi/openapi/model/qos_flow_usage_report.c new file mode 100644 index 000000000..b7343599b --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_usage_report.c @@ -0,0 +1,207 @@ + +#include +#include +#include +#include "qos_flow_usage_report.h" + +OpenAPI_qos_flow_usage_report_t *OpenAPI_qos_flow_usage_report_create( + int qfi, + char *start_time_stamp, + char *end_time_stamp, + long downlink_volume, + long uplink_volume + ) +{ + OpenAPI_qos_flow_usage_report_t *qos_flow_usage_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_usage_report_t)); + if (!qos_flow_usage_report_local_var) { + return NULL; + } + qos_flow_usage_report_local_var->qfi = qfi; + qos_flow_usage_report_local_var->start_time_stamp = start_time_stamp; + qos_flow_usage_report_local_var->end_time_stamp = end_time_stamp; + qos_flow_usage_report_local_var->downlink_volume = downlink_volume; + qos_flow_usage_report_local_var->uplink_volume = uplink_volume; + + return qos_flow_usage_report_local_var; +} + +void OpenAPI_qos_flow_usage_report_free(OpenAPI_qos_flow_usage_report_t *qos_flow_usage_report) +{ + if (NULL == qos_flow_usage_report) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(qos_flow_usage_report->start_time_stamp); + ogs_free(qos_flow_usage_report->end_time_stamp); + ogs_free(qos_flow_usage_report); +} + +cJSON *OpenAPI_qos_flow_usage_report_convertToJSON(OpenAPI_qos_flow_usage_report_t *qos_flow_usage_report) +{ + cJSON *item = NULL; + + if (qos_flow_usage_report == NULL) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [QosFlowUsageReport]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!qos_flow_usage_report->qfi) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [qfi]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "qfi", qos_flow_usage_report->qfi) == NULL) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [qfi]"); + goto end; + } + + if (!qos_flow_usage_report->start_time_stamp) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [start_time_stamp]"); + goto end; + } + if (cJSON_AddStringToObject(item, "startTimeStamp", qos_flow_usage_report->start_time_stamp) == NULL) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [start_time_stamp]"); + goto end; + } + + if (!qos_flow_usage_report->end_time_stamp) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [end_time_stamp]"); + goto end; + } + if (cJSON_AddStringToObject(item, "endTimeStamp", qos_flow_usage_report->end_time_stamp) == NULL) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [end_time_stamp]"); + goto end; + } + + if (!qos_flow_usage_report->downlink_volume) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [downlink_volume]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "downlinkVolume", qos_flow_usage_report->downlink_volume) == NULL) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [downlink_volume]"); + goto end; + } + + if (!qos_flow_usage_report->uplink_volume) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [uplink_volume]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "uplinkVolume", qos_flow_usage_report->uplink_volume) == NULL) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed [uplink_volume]"); + goto end; + } + +end: + return item; +} + +OpenAPI_qos_flow_usage_report_t *OpenAPI_qos_flow_usage_report_parseFromJSON(cJSON *qos_flow_usage_reportJSON) +{ + OpenAPI_qos_flow_usage_report_t *qos_flow_usage_report_local_var = NULL; + cJSON *qfi = cJSON_GetObjectItemCaseSensitive(qos_flow_usage_reportJSON, "qfi"); + if (!qfi) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [qfi]"); + goto end; + } + + + if (!cJSON_IsNumber(qfi)) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [qfi]"); + goto end; + } + + cJSON *start_time_stamp = cJSON_GetObjectItemCaseSensitive(qos_flow_usage_reportJSON, "startTimeStamp"); + if (!start_time_stamp) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [start_time_stamp]"); + goto end; + } + + + if (!cJSON_IsString(start_time_stamp)) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [start_time_stamp]"); + goto end; + } + + cJSON *end_time_stamp = cJSON_GetObjectItemCaseSensitive(qos_flow_usage_reportJSON, "endTimeStamp"); + if (!end_time_stamp) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [end_time_stamp]"); + goto end; + } + + + if (!cJSON_IsString(end_time_stamp)) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [end_time_stamp]"); + goto end; + } + + cJSON *downlink_volume = cJSON_GetObjectItemCaseSensitive(qos_flow_usage_reportJSON, "downlinkVolume"); + if (!downlink_volume) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [downlink_volume]"); + goto end; + } + + + if (!cJSON_IsNumber(downlink_volume)) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [downlink_volume]"); + goto end; + } + + cJSON *uplink_volume = cJSON_GetObjectItemCaseSensitive(qos_flow_usage_reportJSON, "uplinkVolume"); + if (!uplink_volume) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [uplink_volume]"); + goto end; + } + + + if (!cJSON_IsNumber(uplink_volume)) { + ogs_error("OpenAPI_qos_flow_usage_report_parseFromJSON() failed [uplink_volume]"); + goto end; + } + + qos_flow_usage_report_local_var = OpenAPI_qos_flow_usage_report_create ( + qfi->valuedouble, + ogs_strdup(start_time_stamp->valuestring), + ogs_strdup(end_time_stamp->valuestring), + downlink_volume->valuedouble, + uplink_volume->valuedouble + ); + + return qos_flow_usage_report_local_var; +end: + return NULL; +} + +OpenAPI_qos_flow_usage_report_t *OpenAPI_qos_flow_usage_report_copy(OpenAPI_qos_flow_usage_report_t *dst, OpenAPI_qos_flow_usage_report_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_flow_usage_report_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_flow_usage_report_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_flow_usage_report_free(dst); + dst = OpenAPI_qos_flow_usage_report_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_flow_usage_report.h b/lib/sbi/openapi/model/qos_flow_usage_report.h new file mode 100644 index 000000000..0794af0f5 --- /dev/null +++ b/lib/sbi/openapi/model/qos_flow_usage_report.h @@ -0,0 +1,46 @@ +/* + * qos_flow_usage_report.h + * + * + */ + +#ifndef _OpenAPI_qos_flow_usage_report_H_ +#define _OpenAPI_qos_flow_usage_report_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_qos_flow_usage_report_s OpenAPI_qos_flow_usage_report_t; +typedef struct OpenAPI_qos_flow_usage_report_s { + int qfi; + char *start_time_stamp; + char *end_time_stamp; + long downlink_volume; + long uplink_volume; +} OpenAPI_qos_flow_usage_report_t; + +OpenAPI_qos_flow_usage_report_t *OpenAPI_qos_flow_usage_report_create( + int qfi, + char *start_time_stamp, + char *end_time_stamp, + long downlink_volume, + long uplink_volume + ); +void OpenAPI_qos_flow_usage_report_free(OpenAPI_qos_flow_usage_report_t *qos_flow_usage_report); +OpenAPI_qos_flow_usage_report_t *OpenAPI_qos_flow_usage_report_parseFromJSON(cJSON *qos_flow_usage_reportJSON); +cJSON *OpenAPI_qos_flow_usage_report_convertToJSON(OpenAPI_qos_flow_usage_report_t *qos_flow_usage_report); +OpenAPI_qos_flow_usage_report_t *OpenAPI_qos_flow_usage_report_copy(OpenAPI_qos_flow_usage_report_t *dst, OpenAPI_qos_flow_usage_report_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_flow_usage_report_H_ */ + diff --git a/lib/sbi/openapi/model/qos_resource_type.c b/lib/sbi/openapi/model/qos_resource_type.c new file mode 100644 index 000000000..2f600d6d0 --- /dev/null +++ b/lib/sbi/openapi/model/qos_resource_type.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "qos_resource_type.h" + +OpenAPI_qos_resource_type_t *OpenAPI_qos_resource_type_create( + ) +{ + OpenAPI_qos_resource_type_t *qos_resource_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_resource_type_t)); + if (!qos_resource_type_local_var) { + return NULL; + } + + return qos_resource_type_local_var; +} + +void OpenAPI_qos_resource_type_free(OpenAPI_qos_resource_type_t *qos_resource_type) +{ + if (NULL == qos_resource_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(qos_resource_type); +} + +cJSON *OpenAPI_qos_resource_type_convertToJSON(OpenAPI_qos_resource_type_t *qos_resource_type) +{ + cJSON *item = NULL; + + if (qos_resource_type == NULL) { + ogs_error("OpenAPI_qos_resource_type_convertToJSON() failed [QosResourceType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_qos_resource_type_t *OpenAPI_qos_resource_type_parseFromJSON(cJSON *qos_resource_typeJSON) +{ + OpenAPI_qos_resource_type_t *qos_resource_type_local_var = NULL; + qos_resource_type_local_var = OpenAPI_qos_resource_type_create ( + ); + + return qos_resource_type_local_var; +end: + return NULL; +} + +OpenAPI_qos_resource_type_t *OpenAPI_qos_resource_type_copy(OpenAPI_qos_resource_type_t *dst, OpenAPI_qos_resource_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_resource_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_resource_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_qos_resource_type_free(dst); + dst = OpenAPI_qos_resource_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_resource_type.h b/lib/sbi/openapi/model/qos_resource_type.h new file mode 100644 index 000000000..81dfe49c1 --- /dev/null +++ b/lib/sbi/openapi/model/qos_resource_type.h @@ -0,0 +1,36 @@ +/* + * qos_resource_type.h + * + * + */ + +#ifndef _OpenAPI_qos_resource_type_H_ +#define _OpenAPI_qos_resource_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 struct OpenAPI_qos_resource_type_s OpenAPI_qos_resource_type_t; +typedef struct OpenAPI_qos_resource_type_s { +} OpenAPI_qos_resource_type_t; + +OpenAPI_qos_resource_type_t *OpenAPI_qos_resource_type_create( + ); +void OpenAPI_qos_resource_type_free(OpenAPI_qos_resource_type_t *qos_resource_type); +OpenAPI_qos_resource_type_t *OpenAPI_qos_resource_type_parseFromJSON(cJSON *qos_resource_typeJSON); +cJSON *OpenAPI_qos_resource_type_convertToJSON(OpenAPI_qos_resource_type_t *qos_resource_type); +OpenAPI_qos_resource_type_t *OpenAPI_qos_resource_type_copy(OpenAPI_qos_resource_type_t *dst, OpenAPI_qos_resource_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_resource_type_H_ */ + diff --git a/lib/sbi/openapi/model/radio_parameter_not_served.c b/lib/sbi/openapi/model/radio_parameter_not_served.c index 84b151a60..1632595ba 100644 --- a/lib/sbi/openapi/model/radio_parameter_not_served.c +++ b/lib/sbi/openapi/model/radio_parameter_not_served.c @@ -157,3 +157,37 @@ end: return NULL; } +OpenAPI_radio_parameter_not_served_t *OpenAPI_radio_parameter_not_served_copy(OpenAPI_radio_parameter_not_served_t *dst, OpenAPI_radio_parameter_not_served_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_radio_parameter_not_served_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_radio_parameter_not_served_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_radio_parameter_not_served_free(dst); + dst = OpenAPI_radio_parameter_not_served_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/radio_parameter_not_served.h b/lib/sbi/openapi/model/radio_parameter_not_served.h index a0a72a2d2..f38c775aa 100644 --- a/lib/sbi/openapi/model/radio_parameter_not_served.h +++ b/lib/sbi/openapi/model/radio_parameter_not_served.h @@ -36,6 +36,7 @@ OpenAPI_radio_parameter_not_served_t *OpenAPI_radio_parameter_not_served_create( void OpenAPI_radio_parameter_not_served_free(OpenAPI_radio_parameter_not_served_t *radio_parameter_not_served); OpenAPI_radio_parameter_not_served_t *OpenAPI_radio_parameter_not_served_parseFromJSON(cJSON *radio_parameter_not_servedJSON); cJSON *OpenAPI_radio_parameter_not_served_convertToJSON(OpenAPI_radio_parameter_not_served_t *radio_parameter_not_served); +OpenAPI_radio_parameter_not_served_t *OpenAPI_radio_parameter_not_served_copy(OpenAPI_radio_parameter_not_served_t *dst, OpenAPI_radio_parameter_not_served_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/rat_selector.c b/lib/sbi/openapi/model/rat_selector.c new file mode 100644 index 000000000..12254bd98 --- /dev/null +++ b/lib/sbi/openapi/model/rat_selector.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "rat_selector.h" + +char* OpenAPI_rat_selector_ToString(OpenAPI_rat_selector_e rat_selector) +{ + const char *rat_selectorArray[] = { "NULL", "E_UTRA", "NR" }; + size_t sizeofArray = sizeof(rat_selectorArray) / sizeof(rat_selectorArray[0]); + if (rat_selector < sizeofArray) + return (char *)rat_selectorArray[rat_selector]; + else + return (char *)"Unknown"; +} + +OpenAPI_rat_selector_e OpenAPI_rat_selector_FromString(char* rat_selector) +{ + int stringToReturn = 0; + const char *rat_selectorArray[] = { "NULL", "E_UTRA", "NR" }; + size_t sizeofArray = sizeof(rat_selectorArray) / sizeof(rat_selectorArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(rat_selector, rat_selectorArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/rat_selector.h b/lib/sbi/openapi/model/rat_selector.h new file mode 100644 index 000000000..5951085fa --- /dev/null +++ b/lib/sbi/openapi/model/rat_selector.h @@ -0,0 +1,31 @@ +/* + * rat_selector.h + * + * + */ + +#ifndef _OpenAPI_rat_selector_H_ +#define _OpenAPI_rat_selector_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_rat_selector_NULL = 0, OpenAPI_rat_selector_E_UTRA, OpenAPI_rat_selector_NR } OpenAPI_rat_selector_e; + +char* OpenAPI_rat_selector_ToString(OpenAPI_rat_selector_e rat_selector); + +OpenAPI_rat_selector_e OpenAPI_rat_selector_FromString(char* rat_selector); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_rat_selector_H_ */ + diff --git a/lib/sbi/openapi/model/rat_type.c b/lib/sbi/openapi/model/rat_type.c index c48e9f461..a10172622 100644 --- a/lib/sbi/openapi/model/rat_type.c +++ b/lib/sbi/openapi/model/rat_type.c @@ -4,48 +4,27 @@ #include #include "rat_type.h" -OpenAPI_rat_type_t *OpenAPI_rat_type_create( - ) +char* OpenAPI_rat_type_ToString(OpenAPI_rat_type_e rat_type) { - OpenAPI_rat_type_t *rat_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_rat_type_t)); - if (!rat_type_local_var) { - return NULL; + const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_DSL", "WIRELINE_PON", "LTE_M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA" }; + size_t sizeofArray = sizeof(rat_typeArray) / sizeof(rat_typeArray[0]); + if (rat_type < sizeofArray) + return (char *)rat_typeArray[rat_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_rat_type_e OpenAPI_rat_type_FromString(char* rat_type) +{ + int stringToReturn = 0; + const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_DSL", "WIRELINE_PON", "LTE_M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA" }; + size_t sizeofArray = sizeof(rat_typeArray) / sizeof(rat_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(rat_type, rat_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - - return rat_type_local_var; -} - -void OpenAPI_rat_type_free(OpenAPI_rat_type_t *rat_type) -{ - if (NULL == rat_type) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(rat_type); -} - -cJSON *OpenAPI_rat_type_convertToJSON(OpenAPI_rat_type_t *rat_type) -{ - cJSON *item = NULL; - - if (rat_type == NULL) { - ogs_error("OpenAPI_rat_type_convertToJSON() failed [RatType]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_rat_type_t *OpenAPI_rat_type_parseFromJSON(cJSON *rat_typeJSON) -{ - OpenAPI_rat_type_t *rat_type_local_var = NULL; - rat_type_local_var = OpenAPI_rat_type_create ( - ); - - return rat_type_local_var; -end: - return NULL; + return 0; } diff --git a/lib/sbi/openapi/model/rat_type.h b/lib/sbi/openapi/model/rat_type.h index b5332bee4..18d8cc6f9 100644 --- a/lib/sbi/openapi/model/rat_type.h +++ b/lib/sbi/openapi/model/rat_type.h @@ -17,15 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_rat_type_s OpenAPI_rat_type_t; -typedef struct OpenAPI_rat_type_s { -} OpenAPI_rat_type_t; +typedef enum { OpenAPI_rat_type_NULL = 0, OpenAPI_rat_type_NR, OpenAPI_rat_type_EUTRA, OpenAPI_rat_type_WLAN, OpenAPI_rat_type_VIRTUAL, OpenAPI_rat_type_NBIOT, OpenAPI_rat_type_WIRELINE, OpenAPI_rat_type_WIRELINE_CABLE, OpenAPI_rat_type_WIRELINE_DSL, OpenAPI_rat_type_WIRELINE_PON, OpenAPI_rat_type_LTE_M, OpenAPI_rat_type_NR_U, OpenAPI_rat_type_EUTRA_U, OpenAPI_rat_type_TRUSTED_N3GA, OpenAPI_rat_type_TRUSTED_WLAN, OpenAPI_rat_type_UTRA, OpenAPI_rat_type_GERA } OpenAPI_rat_type_e; -OpenAPI_rat_type_t *OpenAPI_rat_type_create( - ); -void OpenAPI_rat_type_free(OpenAPI_rat_type_t *rat_type); -OpenAPI_rat_type_t *OpenAPI_rat_type_parseFromJSON(cJSON *rat_typeJSON); -cJSON *OpenAPI_rat_type_convertToJSON(OpenAPI_rat_type_t *rat_type); +char* OpenAPI_rat_type_ToString(OpenAPI_rat_type_e rat_type); + +OpenAPI_rat_type_e OpenAPI_rat_type_FromString(char* rat_type); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ref_to_binary_data.c b/lib/sbi/openapi/model/ref_to_binary_data.c new file mode 100644 index 000000000..8d0076b3b --- /dev/null +++ b/lib/sbi/openapi/model/ref_to_binary_data.c @@ -0,0 +1,110 @@ + +#include +#include +#include +#include "ref_to_binary_data.h" + +OpenAPI_ref_to_binary_data_t *OpenAPI_ref_to_binary_data_create( + char *content_id + ) +{ + OpenAPI_ref_to_binary_data_t *ref_to_binary_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ref_to_binary_data_t)); + if (!ref_to_binary_data_local_var) { + return NULL; + } + ref_to_binary_data_local_var->content_id = content_id; + + return ref_to_binary_data_local_var; +} + +void OpenAPI_ref_to_binary_data_free(OpenAPI_ref_to_binary_data_t *ref_to_binary_data) +{ + if (NULL == ref_to_binary_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ref_to_binary_data->content_id); + ogs_free(ref_to_binary_data); +} + +cJSON *OpenAPI_ref_to_binary_data_convertToJSON(OpenAPI_ref_to_binary_data_t *ref_to_binary_data) +{ + cJSON *item = NULL; + + if (ref_to_binary_data == NULL) { + ogs_error("OpenAPI_ref_to_binary_data_convertToJSON() failed [RefToBinaryData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ref_to_binary_data->content_id) { + ogs_error("OpenAPI_ref_to_binary_data_convertToJSON() failed [content_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "contentId", ref_to_binary_data->content_id) == NULL) { + ogs_error("OpenAPI_ref_to_binary_data_convertToJSON() failed [content_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ref_to_binary_data_t *OpenAPI_ref_to_binary_data_parseFromJSON(cJSON *ref_to_binary_dataJSON) +{ + OpenAPI_ref_to_binary_data_t *ref_to_binary_data_local_var = NULL; + cJSON *content_id = cJSON_GetObjectItemCaseSensitive(ref_to_binary_dataJSON, "contentId"); + if (!content_id) { + ogs_error("OpenAPI_ref_to_binary_data_parseFromJSON() failed [content_id]"); + goto end; + } + + + if (!cJSON_IsString(content_id)) { + ogs_error("OpenAPI_ref_to_binary_data_parseFromJSON() failed [content_id]"); + goto end; + } + + ref_to_binary_data_local_var = OpenAPI_ref_to_binary_data_create ( + ogs_strdup(content_id->valuestring) + ); + + return ref_to_binary_data_local_var; +end: + return NULL; +} + +OpenAPI_ref_to_binary_data_t *OpenAPI_ref_to_binary_data_copy(OpenAPI_ref_to_binary_data_t *dst, OpenAPI_ref_to_binary_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ref_to_binary_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ref_to_binary_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_ref_to_binary_data_free(dst); + dst = OpenAPI_ref_to_binary_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ref_to_binary_data.h b/lib/sbi/openapi/model/ref_to_binary_data.h new file mode 100644 index 000000000..24230e8d7 --- /dev/null +++ b/lib/sbi/openapi/model/ref_to_binary_data.h @@ -0,0 +1,38 @@ +/* + * ref_to_binary_data.h + * + * + */ + +#ifndef _OpenAPI_ref_to_binary_data_H_ +#define _OpenAPI_ref_to_binary_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ref_to_binary_data_s OpenAPI_ref_to_binary_data_t; +typedef struct OpenAPI_ref_to_binary_data_s { + char *content_id; +} OpenAPI_ref_to_binary_data_t; + +OpenAPI_ref_to_binary_data_t *OpenAPI_ref_to_binary_data_create( + char *content_id + ); +void OpenAPI_ref_to_binary_data_free(OpenAPI_ref_to_binary_data_t *ref_to_binary_data); +OpenAPI_ref_to_binary_data_t *OpenAPI_ref_to_binary_data_parseFromJSON(cJSON *ref_to_binary_dataJSON); +cJSON *OpenAPI_ref_to_binary_data_convertToJSON(OpenAPI_ref_to_binary_data_t *ref_to_binary_data); +OpenAPI_ref_to_binary_data_t *OpenAPI_ref_to_binary_data_copy(OpenAPI_ref_to_binary_data_t *dst, OpenAPI_ref_to_binary_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ref_to_binary_data_H_ */ + diff --git a/lib/sbi/openapi/model/reflective_qo_s_attribute.c b/lib/sbi/openapi/model/reflective_qo_s_attribute.c new file mode 100644 index 000000000..1834461a2 --- /dev/null +++ b/lib/sbi/openapi/model/reflective_qo_s_attribute.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "reflective_qo_s_attribute.h" + +OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_create( + ) +{ + OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute_local_var = OpenAPI_malloc(sizeof(OpenAPI_reflective_qo_s_attribute_t)); + if (!reflective_qo_s_attribute_local_var) { + return NULL; + } + + return reflective_qo_s_attribute_local_var; +} + +void OpenAPI_reflective_qo_s_attribute_free(OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute) +{ + if (NULL == reflective_qo_s_attribute) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(reflective_qo_s_attribute); +} + +cJSON *OpenAPI_reflective_qo_s_attribute_convertToJSON(OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute) +{ + cJSON *item = NULL; + + if (reflective_qo_s_attribute == NULL) { + ogs_error("OpenAPI_reflective_qo_s_attribute_convertToJSON() failed [ReflectiveQoSAttribute]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_parseFromJSON(cJSON *reflective_qo_s_attributeJSON) +{ + OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute_local_var = NULL; + reflective_qo_s_attribute_local_var = OpenAPI_reflective_qo_s_attribute_create ( + ); + + return reflective_qo_s_attribute_local_var; +end: + return NULL; +} + +OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_copy(OpenAPI_reflective_qo_s_attribute_t *dst, OpenAPI_reflective_qo_s_attribute_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_reflective_qo_s_attribute_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_reflective_qo_s_attribute_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_reflective_qo_s_attribute_free(dst); + dst = OpenAPI_reflective_qo_s_attribute_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/reflective_qo_s_attribute.h b/lib/sbi/openapi/model/reflective_qo_s_attribute.h new file mode 100644 index 000000000..970fffdd5 --- /dev/null +++ b/lib/sbi/openapi/model/reflective_qo_s_attribute.h @@ -0,0 +1,36 @@ +/* + * reflective_qo_s_attribute.h + * + * + */ + +#ifndef _OpenAPI_reflective_qo_s_attribute_H_ +#define _OpenAPI_reflective_qo_s_attribute_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_reflective_qo_s_attribute_s OpenAPI_reflective_qo_s_attribute_t; +typedef struct OpenAPI_reflective_qo_s_attribute_s { +} OpenAPI_reflective_qo_s_attribute_t; + +OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_create( + ); +void OpenAPI_reflective_qo_s_attribute_free(OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute); +OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_parseFromJSON(cJSON *reflective_qo_s_attributeJSON); +cJSON *OpenAPI_reflective_qo_s_attribute_convertToJSON(OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute); +OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_copy(OpenAPI_reflective_qo_s_attribute_t *dst, OpenAPI_reflective_qo_s_attribute_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reflective_qo_s_attribute_H_ */ + diff --git a/lib/sbi/openapi/model/registration_context_container.c b/lib/sbi/openapi/model/registration_context_container.c new file mode 100644 index 000000000..61306e5e0 --- /dev/null +++ b/lib/sbi/openapi/model/registration_context_container.c @@ -0,0 +1,539 @@ + +#include +#include +#include +#include "registration_context_container.h" + +OpenAPI_registration_context_container_t *OpenAPI_registration_context_container_create( + OpenAPI_ue_context_t *ue_context, + char *local_time_zone, + OpenAPI_access_type_e an_type, + int an_n2_ap_id, + OpenAPI_global_ran_node_id_t *ran_node_id, + char *initial_amf_name, + OpenAPI_user_location_t *user_location, + char *rrc_est_cause, + int ue_context_request, + int initial_amf_n2_ap_id, + char *an_n2_i_pv4_addr, + char *an_n2_i_pv6_addr, + OpenAPI_allowed_nssai_t *allowed_nssai, + OpenAPI_list_t *configured_nssai, + OpenAPI_list_t *rejected_nssai_in_plmn, + OpenAPI_list_t *rejected_nssai_in_ta + ) +{ + OpenAPI_registration_context_container_t *registration_context_container_local_var = OpenAPI_malloc(sizeof(OpenAPI_registration_context_container_t)); + if (!registration_context_container_local_var) { + return NULL; + } + registration_context_container_local_var->ue_context = ue_context; + registration_context_container_local_var->local_time_zone = local_time_zone; + registration_context_container_local_var->an_type = an_type; + registration_context_container_local_var->an_n2_ap_id = an_n2_ap_id; + registration_context_container_local_var->ran_node_id = ran_node_id; + registration_context_container_local_var->initial_amf_name = initial_amf_name; + registration_context_container_local_var->user_location = user_location; + registration_context_container_local_var->rrc_est_cause = rrc_est_cause; + registration_context_container_local_var->ue_context_request = ue_context_request; + registration_context_container_local_var->initial_amf_n2_ap_id = initial_amf_n2_ap_id; + registration_context_container_local_var->an_n2_i_pv4_addr = an_n2_i_pv4_addr; + registration_context_container_local_var->an_n2_i_pv6_addr = an_n2_i_pv6_addr; + registration_context_container_local_var->allowed_nssai = allowed_nssai; + registration_context_container_local_var->configured_nssai = configured_nssai; + registration_context_container_local_var->rejected_nssai_in_plmn = rejected_nssai_in_plmn; + registration_context_container_local_var->rejected_nssai_in_ta = rejected_nssai_in_ta; + + return registration_context_container_local_var; +} + +void OpenAPI_registration_context_container_free(OpenAPI_registration_context_container_t *registration_context_container) +{ + if (NULL == registration_context_container) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ue_context_free(registration_context_container->ue_context); + ogs_free(registration_context_container->local_time_zone); + OpenAPI_global_ran_node_id_free(registration_context_container->ran_node_id); + ogs_free(registration_context_container->initial_amf_name); + OpenAPI_user_location_free(registration_context_container->user_location); + ogs_free(registration_context_container->rrc_est_cause); + ogs_free(registration_context_container->an_n2_i_pv4_addr); + ogs_free(registration_context_container->an_n2_i_pv6_addr); + OpenAPI_allowed_nssai_free(registration_context_container->allowed_nssai); + OpenAPI_list_for_each(registration_context_container->configured_nssai, node) { + OpenAPI_configured_snssai_free(node->data); + } + OpenAPI_list_free(registration_context_container->configured_nssai); + OpenAPI_list_for_each(registration_context_container->rejected_nssai_in_plmn, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(registration_context_container->rejected_nssai_in_plmn); + OpenAPI_list_for_each(registration_context_container->rejected_nssai_in_ta, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(registration_context_container->rejected_nssai_in_ta); + ogs_free(registration_context_container); +} + +cJSON *OpenAPI_registration_context_container_convertToJSON(OpenAPI_registration_context_container_t *registration_context_container) +{ + cJSON *item = NULL; + + if (registration_context_container == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [RegistrationContextContainer]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!registration_context_container->ue_context) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [ue_context]"); + goto end; + } + cJSON *ue_context_local_JSON = OpenAPI_ue_context_convertToJSON(registration_context_container->ue_context); + if (ue_context_local_JSON == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [ue_context]"); + goto end; + } + cJSON_AddItemToObject(item, "ueContext", ue_context_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [ue_context]"); + goto end; + } + + if (registration_context_container->local_time_zone) { + if (cJSON_AddStringToObject(item, "localTimeZone", registration_context_container->local_time_zone) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [local_time_zone]"); + goto end; + } + } + + if (!registration_context_container->an_type) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [an_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "anType", OpenAPI_access_type_ToString(registration_context_container->an_type)) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [an_type]"); + goto end; + } + + if (!registration_context_container->an_n2_ap_id) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [an_n2_ap_id]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "anN2ApId", registration_context_container->an_n2_ap_id) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [an_n2_ap_id]"); + goto end; + } + + if (!registration_context_container->ran_node_id) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [ran_node_id]"); + goto end; + } + cJSON *ran_node_id_local_JSON = OpenAPI_global_ran_node_id_convertToJSON(registration_context_container->ran_node_id); + if (ran_node_id_local_JSON == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [ran_node_id]"); + goto end; + } + cJSON_AddItemToObject(item, "ranNodeId", ran_node_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [ran_node_id]"); + goto end; + } + + if (!registration_context_container->initial_amf_name) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [initial_amf_name]"); + goto end; + } + if (cJSON_AddStringToObject(item, "initialAmfName", registration_context_container->initial_amf_name) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [initial_amf_name]"); + goto end; + } + + if (!registration_context_container->user_location) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [user_location]"); + goto end; + } + cJSON *user_location_local_JSON = OpenAPI_user_location_convertToJSON(registration_context_container->user_location); + if (user_location_local_JSON == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [user_location]"); + goto end; + } + cJSON_AddItemToObject(item, "userLocation", user_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [user_location]"); + goto end; + } + + if (registration_context_container->rrc_est_cause) { + if (cJSON_AddStringToObject(item, "rrcEstCause", registration_context_container->rrc_est_cause) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [rrc_est_cause]"); + goto end; + } + } + + if (registration_context_container->ue_context_request) { + if (cJSON_AddBoolToObject(item, "ueContextRequest", registration_context_container->ue_context_request) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [ue_context_request]"); + goto end; + } + } + + if (registration_context_container->initial_amf_n2_ap_id) { + if (cJSON_AddNumberToObject(item, "initialAmfN2ApId", registration_context_container->initial_amf_n2_ap_id) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [initial_amf_n2_ap_id]"); + goto end; + } + } + + if (registration_context_container->an_n2_i_pv4_addr) { + if (cJSON_AddStringToObject(item, "anN2IPv4Addr", registration_context_container->an_n2_i_pv4_addr) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [an_n2_i_pv4_addr]"); + goto end; + } + } + + if (registration_context_container->an_n2_i_pv6_addr) { + if (cJSON_AddStringToObject(item, "anN2IPv6Addr", registration_context_container->an_n2_i_pv6_addr) == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [an_n2_i_pv6_addr]"); + goto end; + } + } + + if (registration_context_container->allowed_nssai) { + cJSON *allowed_nssai_local_JSON = OpenAPI_allowed_nssai_convertToJSON(registration_context_container->allowed_nssai); + if (allowed_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [allowed_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "allowedNssai", allowed_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [allowed_nssai]"); + goto end; + } + } + + if (registration_context_container->configured_nssai) { + cJSON *configured_nssaiList = cJSON_AddArrayToObject(item, "configuredNssai"); + if (configured_nssaiList == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [configured_nssai]"); + goto end; + } + + OpenAPI_lnode_t *configured_nssai_node; + if (registration_context_container->configured_nssai) { + OpenAPI_list_for_each(registration_context_container->configured_nssai, configured_nssai_node) { + cJSON *itemLocal = OpenAPI_configured_snssai_convertToJSON(configured_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [configured_nssai]"); + goto end; + } + cJSON_AddItemToArray(configured_nssaiList, itemLocal); + } + } + } + + if (registration_context_container->rejected_nssai_in_plmn) { + cJSON *rejected_nssai_in_plmnList = cJSON_AddArrayToObject(item, "rejectedNssaiInPlmn"); + if (rejected_nssai_in_plmnList == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [rejected_nssai_in_plmn]"); + goto end; + } + + OpenAPI_lnode_t *rejected_nssai_in_plmn_node; + if (registration_context_container->rejected_nssai_in_plmn) { + OpenAPI_list_for_each(registration_context_container->rejected_nssai_in_plmn, rejected_nssai_in_plmn_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(rejected_nssai_in_plmn_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [rejected_nssai_in_plmn]"); + goto end; + } + cJSON_AddItemToArray(rejected_nssai_in_plmnList, itemLocal); + } + } + } + + if (registration_context_container->rejected_nssai_in_ta) { + cJSON *rejected_nssai_in_taList = cJSON_AddArrayToObject(item, "rejectedNssaiInTa"); + if (rejected_nssai_in_taList == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [rejected_nssai_in_ta]"); + goto end; + } + + OpenAPI_lnode_t *rejected_nssai_in_ta_node; + if (registration_context_container->rejected_nssai_in_ta) { + OpenAPI_list_for_each(registration_context_container->rejected_nssai_in_ta, rejected_nssai_in_ta_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(rejected_nssai_in_ta_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed [rejected_nssai_in_ta]"); + goto end; + } + cJSON_AddItemToArray(rejected_nssai_in_taList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_registration_context_container_t *OpenAPI_registration_context_container_parseFromJSON(cJSON *registration_context_containerJSON) +{ + OpenAPI_registration_context_container_t *registration_context_container_local_var = NULL; + cJSON *ue_context = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "ueContext"); + if (!ue_context) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [ue_context]"); + goto end; + } + + OpenAPI_ue_context_t *ue_context_local_nonprim = NULL; + + ue_context_local_nonprim = OpenAPI_ue_context_parseFromJSON(ue_context); + + cJSON *local_time_zone = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "localTimeZone"); + + if (local_time_zone) { + if (!cJSON_IsString(local_time_zone)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [local_time_zone]"); + goto end; + } + } + + cJSON *an_type = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "anType"); + if (!an_type) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [an_type]"); + goto end; + } + + OpenAPI_access_type_e an_typeVariable; + + if (!cJSON_IsString(an_type)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [an_type]"); + goto end; + } + an_typeVariable = OpenAPI_access_type_FromString(an_type->valuestring); + + cJSON *an_n2_ap_id = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "anN2ApId"); + if (!an_n2_ap_id) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [an_n2_ap_id]"); + goto end; + } + + + if (!cJSON_IsNumber(an_n2_ap_id)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [an_n2_ap_id]"); + goto end; + } + + cJSON *ran_node_id = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "ranNodeId"); + if (!ran_node_id) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [ran_node_id]"); + goto end; + } + + OpenAPI_global_ran_node_id_t *ran_node_id_local_nonprim = NULL; + + ran_node_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(ran_node_id); + + cJSON *initial_amf_name = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "initialAmfName"); + if (!initial_amf_name) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [initial_amf_name]"); + goto end; + } + + + if (!cJSON_IsString(initial_amf_name)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [initial_amf_name]"); + goto end; + } + + cJSON *user_location = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "userLocation"); + if (!user_location) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [user_location]"); + goto end; + } + + OpenAPI_user_location_t *user_location_local_nonprim = NULL; + + user_location_local_nonprim = OpenAPI_user_location_parseFromJSON(user_location); + + cJSON *rrc_est_cause = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "rrcEstCause"); + + if (rrc_est_cause) { + if (!cJSON_IsString(rrc_est_cause)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [rrc_est_cause]"); + goto end; + } + } + + cJSON *ue_context_request = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "ueContextRequest"); + + if (ue_context_request) { + if (!cJSON_IsBool(ue_context_request)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [ue_context_request]"); + goto end; + } + } + + cJSON *initial_amf_n2_ap_id = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "initialAmfN2ApId"); + + if (initial_amf_n2_ap_id) { + if (!cJSON_IsNumber(initial_amf_n2_ap_id)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [initial_amf_n2_ap_id]"); + goto end; + } + } + + cJSON *an_n2_i_pv4_addr = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "anN2IPv4Addr"); + + if (an_n2_i_pv4_addr) { + if (!cJSON_IsString(an_n2_i_pv4_addr)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [an_n2_i_pv4_addr]"); + goto end; + } + } + + cJSON *an_n2_i_pv6_addr = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "anN2IPv6Addr"); + + if (an_n2_i_pv6_addr) { + if (!cJSON_IsString(an_n2_i_pv6_addr)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [an_n2_i_pv6_addr]"); + goto end; + } + } + + cJSON *allowed_nssai = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "allowedNssai"); + + OpenAPI_allowed_nssai_t *allowed_nssai_local_nonprim = NULL; + if (allowed_nssai) { + allowed_nssai_local_nonprim = OpenAPI_allowed_nssai_parseFromJSON(allowed_nssai); + } + + cJSON *configured_nssai = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "configuredNssai"); + + OpenAPI_list_t *configured_nssaiList; + if (configured_nssai) { + cJSON *configured_nssai_local_nonprimitive; + if (!cJSON_IsArray(configured_nssai)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [configured_nssai]"); + goto end; + } + + configured_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(configured_nssai_local_nonprimitive, configured_nssai ) { + if (!cJSON_IsObject(configured_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [configured_nssai]"); + goto end; + } + OpenAPI_configured_snssai_t *configured_nssaiItem = OpenAPI_configured_snssai_parseFromJSON(configured_nssai_local_nonprimitive); + + OpenAPI_list_add(configured_nssaiList, configured_nssaiItem); + } + } + + cJSON *rejected_nssai_in_plmn = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "rejectedNssaiInPlmn"); + + OpenAPI_list_t *rejected_nssai_in_plmnList; + if (rejected_nssai_in_plmn) { + cJSON *rejected_nssai_in_plmn_local_nonprimitive; + if (!cJSON_IsArray(rejected_nssai_in_plmn)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [rejected_nssai_in_plmn]"); + goto end; + } + + rejected_nssai_in_plmnList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rejected_nssai_in_plmn_local_nonprimitive, rejected_nssai_in_plmn ) { + if (!cJSON_IsObject(rejected_nssai_in_plmn_local_nonprimitive)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [rejected_nssai_in_plmn]"); + goto end; + } + OpenAPI_snssai_t *rejected_nssai_in_plmnItem = OpenAPI_snssai_parseFromJSON(rejected_nssai_in_plmn_local_nonprimitive); + + OpenAPI_list_add(rejected_nssai_in_plmnList, rejected_nssai_in_plmnItem); + } + } + + cJSON *rejected_nssai_in_ta = cJSON_GetObjectItemCaseSensitive(registration_context_containerJSON, "rejectedNssaiInTa"); + + OpenAPI_list_t *rejected_nssai_in_taList; + if (rejected_nssai_in_ta) { + cJSON *rejected_nssai_in_ta_local_nonprimitive; + if (!cJSON_IsArray(rejected_nssai_in_ta)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [rejected_nssai_in_ta]"); + goto end; + } + + rejected_nssai_in_taList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rejected_nssai_in_ta_local_nonprimitive, rejected_nssai_in_ta ) { + if (!cJSON_IsObject(rejected_nssai_in_ta_local_nonprimitive)) { + ogs_error("OpenAPI_registration_context_container_parseFromJSON() failed [rejected_nssai_in_ta]"); + goto end; + } + OpenAPI_snssai_t *rejected_nssai_in_taItem = OpenAPI_snssai_parseFromJSON(rejected_nssai_in_ta_local_nonprimitive); + + OpenAPI_list_add(rejected_nssai_in_taList, rejected_nssai_in_taItem); + } + } + + registration_context_container_local_var = OpenAPI_registration_context_container_create ( + ue_context_local_nonprim, + local_time_zone ? ogs_strdup(local_time_zone->valuestring) : NULL, + an_typeVariable, + an_n2_ap_id->valuedouble, + ran_node_id_local_nonprim, + ogs_strdup(initial_amf_name->valuestring), + user_location_local_nonprim, + rrc_est_cause ? ogs_strdup(rrc_est_cause->valuestring) : NULL, + ue_context_request ? ue_context_request->valueint : 0, + initial_amf_n2_ap_id ? initial_amf_n2_ap_id->valuedouble : 0, + an_n2_i_pv4_addr ? ogs_strdup(an_n2_i_pv4_addr->valuestring) : NULL, + an_n2_i_pv6_addr ? ogs_strdup(an_n2_i_pv6_addr->valuestring) : NULL, + allowed_nssai ? allowed_nssai_local_nonprim : NULL, + configured_nssai ? configured_nssaiList : NULL, + rejected_nssai_in_plmn ? rejected_nssai_in_plmnList : NULL, + rejected_nssai_in_ta ? rejected_nssai_in_taList : NULL + ); + + return registration_context_container_local_var; +end: + return NULL; +} + +OpenAPI_registration_context_container_t *OpenAPI_registration_context_container_copy(OpenAPI_registration_context_container_t *dst, OpenAPI_registration_context_container_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_registration_context_container_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_registration_context_container_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_registration_context_container_free(dst); + dst = OpenAPI_registration_context_container_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/registration_context_container.h b/lib/sbi/openapi/model/registration_context_container.h new file mode 100644 index 000000000..8006f300d --- /dev/null +++ b/lib/sbi/openapi/model/registration_context_container.h @@ -0,0 +1,75 @@ +/* + * registration_context_container.h + * + * + */ + +#ifndef _OpenAPI_registration_context_container_H_ +#define _OpenAPI_registration_context_container_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "allowed_nssai.h" +#include "configured_snssai.h" +#include "global_ran_node_id.h" +#include "snssai.h" +#include "ue_context.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_registration_context_container_s OpenAPI_registration_context_container_t; +typedef struct OpenAPI_registration_context_container_s { + struct OpenAPI_ue_context_s *ue_context; + char *local_time_zone; + OpenAPI_access_type_e an_type; + int an_n2_ap_id; + struct OpenAPI_global_ran_node_id_s *ran_node_id; + char *initial_amf_name; + struct OpenAPI_user_location_s *user_location; + char *rrc_est_cause; + int ue_context_request; + int initial_amf_n2_ap_id; + char *an_n2_i_pv4_addr; + char *an_n2_i_pv6_addr; + struct OpenAPI_allowed_nssai_s *allowed_nssai; + OpenAPI_list_t *configured_nssai; + OpenAPI_list_t *rejected_nssai_in_plmn; + OpenAPI_list_t *rejected_nssai_in_ta; +} OpenAPI_registration_context_container_t; + +OpenAPI_registration_context_container_t *OpenAPI_registration_context_container_create( + OpenAPI_ue_context_t *ue_context, + char *local_time_zone, + OpenAPI_access_type_e an_type, + int an_n2_ap_id, + OpenAPI_global_ran_node_id_t *ran_node_id, + char *initial_amf_name, + OpenAPI_user_location_t *user_location, + char *rrc_est_cause, + int ue_context_request, + int initial_amf_n2_ap_id, + char *an_n2_i_pv4_addr, + char *an_n2_i_pv6_addr, + OpenAPI_allowed_nssai_t *allowed_nssai, + OpenAPI_list_t *configured_nssai, + OpenAPI_list_t *rejected_nssai_in_plmn, + OpenAPI_list_t *rejected_nssai_in_ta + ); +void OpenAPI_registration_context_container_free(OpenAPI_registration_context_container_t *registration_context_container); +OpenAPI_registration_context_container_t *OpenAPI_registration_context_container_parseFromJSON(cJSON *registration_context_containerJSON); +cJSON *OpenAPI_registration_context_container_convertToJSON(OpenAPI_registration_context_container_t *registration_context_container); +OpenAPI_registration_context_container_t *OpenAPI_registration_context_container_copy(OpenAPI_registration_context_container_t *dst, OpenAPI_registration_context_container_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_registration_context_container_H_ */ + diff --git a/lib/sbi/openapi/model/registration_reason.c b/lib/sbi/openapi/model/registration_reason.c index 6deb4819e..cfdfd73d5 100644 --- a/lib/sbi/openapi/model/registration_reason.c +++ b/lib/sbi/openapi/model/registration_reason.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_registration_reason_t *OpenAPI_registration_reason_copy(OpenAPI_registration_reason_t *dst, OpenAPI_registration_reason_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_registration_reason_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_registration_reason_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_registration_reason_free(dst); + dst = OpenAPI_registration_reason_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/registration_reason.h b/lib/sbi/openapi/model/registration_reason.h index cad023f79..785af9de6 100644 --- a/lib/sbi/openapi/model/registration_reason.h +++ b/lib/sbi/openapi/model/registration_reason.h @@ -26,6 +26,7 @@ OpenAPI_registration_reason_t *OpenAPI_registration_reason_create( void OpenAPI_registration_reason_free(OpenAPI_registration_reason_t *registration_reason); OpenAPI_registration_reason_t *OpenAPI_registration_reason_parseFromJSON(cJSON *registration_reasonJSON); cJSON *OpenAPI_registration_reason_convertToJSON(OpenAPI_registration_reason_t *registration_reason); +OpenAPI_registration_reason_t *OpenAPI_registration_reason_copy(OpenAPI_registration_reason_t *dst, OpenAPI_registration_reason_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/release_data.c b/lib/sbi/openapi/model/release_data.c new file mode 100644 index 000000000..0b5d7520a --- /dev/null +++ b/lib/sbi/openapi/model/release_data.c @@ -0,0 +1,320 @@ + +#include +#include +#include +#include "release_data.h" + +OpenAPI_release_data_t *OpenAPI_release_data_create( + OpenAPI_cause_t *cause, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + OpenAPI_list_t *secondary_rat_usage_report, + OpenAPI_list_t *secondary_rat_usage_info + ) +{ + OpenAPI_release_data_t *release_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_release_data_t)); + if (!release_data_local_var) { + return NULL; + } + release_data_local_var->cause = cause; + release_data_local_var->ng_ap_cause = ng_ap_cause; + release_data_local_var->_5g_mm_cause_value = _5g_mm_cause_value; + release_data_local_var->ue_location = ue_location; + release_data_local_var->ue_time_zone = ue_time_zone; + release_data_local_var->add_ue_location = add_ue_location; + release_data_local_var->secondary_rat_usage_report = secondary_rat_usage_report; + release_data_local_var->secondary_rat_usage_info = secondary_rat_usage_info; + + return release_data_local_var; +} + +void OpenAPI_release_data_free(OpenAPI_release_data_t *release_data) +{ + if (NULL == release_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_cause_free(release_data->cause); + OpenAPI_ng_ap_cause_free(release_data->ng_ap_cause); + OpenAPI_user_location_free(release_data->ue_location); + ogs_free(release_data->ue_time_zone); + OpenAPI_user_location_free(release_data->add_ue_location); + OpenAPI_list_for_each(release_data->secondary_rat_usage_report, node) { + OpenAPI_secondary_rat_usage_report_free(node->data); + } + OpenAPI_list_free(release_data->secondary_rat_usage_report); + OpenAPI_list_for_each(release_data->secondary_rat_usage_info, node) { + OpenAPI_secondary_rat_usage_info_free(node->data); + } + OpenAPI_list_free(release_data->secondary_rat_usage_info); + ogs_free(release_data); +} + +cJSON *OpenAPI_release_data_convertToJSON(OpenAPI_release_data_t *release_data) +{ + cJSON *item = NULL; + + if (release_data == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [ReleaseData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (release_data->cause) { + cJSON *cause_local_JSON = OpenAPI_cause_convertToJSON(release_data->cause); + if (cause_local_JSON == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [cause]"); + goto end; + } + cJSON_AddItemToObject(item, "cause", cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [cause]"); + goto end; + } + } + + if (release_data->ng_ap_cause) { + cJSON *ng_ap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(release_data->ng_ap_cause); + if (ng_ap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngApCause", ng_ap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + } + + if (release_data->_5g_mm_cause_value) { + if (cJSON_AddNumberToObject(item, "5gMmCauseValue", release_data->_5g_mm_cause_value) == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + if (release_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(release_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + + if (release_data->ue_time_zone) { + if (cJSON_AddStringToObject(item, "ueTimeZone", release_data->ue_time_zone) == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [ue_time_zone]"); + goto end; + } + } + + if (release_data->add_ue_location) { + cJSON *add_ue_location_local_JSON = OpenAPI_user_location_convertToJSON(release_data->add_ue_location); + if (add_ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "addUeLocation", add_ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + } + + if (release_data->secondary_rat_usage_report) { + cJSON *secondary_rat_usage_reportList = cJSON_AddArrayToObject(item, "secondaryRatUsageReport"); + if (secondary_rat_usage_reportList == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [secondary_rat_usage_report]"); + goto end; + } + + OpenAPI_lnode_t *secondary_rat_usage_report_node; + if (release_data->secondary_rat_usage_report) { + OpenAPI_list_for_each(release_data->secondary_rat_usage_report, secondary_rat_usage_report_node) { + cJSON *itemLocal = OpenAPI_secondary_rat_usage_report_convertToJSON(secondary_rat_usage_report_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [secondary_rat_usage_report]"); + goto end; + } + cJSON_AddItemToArray(secondary_rat_usage_reportList, itemLocal); + } + } + } + + if (release_data->secondary_rat_usage_info) { + cJSON *secondary_rat_usage_infoList = cJSON_AddArrayToObject(item, "secondaryRatUsageInfo"); + if (secondary_rat_usage_infoList == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [secondary_rat_usage_info]"); + goto end; + } + + OpenAPI_lnode_t *secondary_rat_usage_info_node; + if (release_data->secondary_rat_usage_info) { + OpenAPI_list_for_each(release_data->secondary_rat_usage_info, secondary_rat_usage_info_node) { + cJSON *itemLocal = OpenAPI_secondary_rat_usage_info_convertToJSON(secondary_rat_usage_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [secondary_rat_usage_info]"); + goto end; + } + cJSON_AddItemToArray(secondary_rat_usage_infoList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_release_data_t *OpenAPI_release_data_parseFromJSON(cJSON *release_dataJSON) +{ + OpenAPI_release_data_t *release_data_local_var = NULL; + cJSON *cause = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "cause"); + + OpenAPI_cause_t *cause_local_nonprim = NULL; + if (cause) { + cause_local_nonprim = OpenAPI_cause_parseFromJSON(cause); + } + + cJSON *ng_ap_cause = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "ngApCause"); + + OpenAPI_ng_ap_cause_t *ng_ap_cause_local_nonprim = NULL; + if (ng_ap_cause) { + ng_ap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ng_ap_cause); + } + + cJSON *_5g_mm_cause_value = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "5gMmCauseValue"); + + if (_5g_mm_cause_value) { + if (!cJSON_IsNumber(_5g_mm_cause_value)) { + ogs_error("OpenAPI_release_data_parseFromJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "ueTimeZone"); + + if (ue_time_zone) { + if (!cJSON_IsString(ue_time_zone)) { + ogs_error("OpenAPI_release_data_parseFromJSON() failed [ue_time_zone]"); + goto end; + } + } + + cJSON *add_ue_location = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "addUeLocation"); + + OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL; + if (add_ue_location) { + add_ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(add_ue_location); + } + + cJSON *secondary_rat_usage_report = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "secondaryRatUsageReport"); + + OpenAPI_list_t *secondary_rat_usage_reportList; + if (secondary_rat_usage_report) { + cJSON *secondary_rat_usage_report_local_nonprimitive; + if (!cJSON_IsArray(secondary_rat_usage_report)) { + ogs_error("OpenAPI_release_data_parseFromJSON() failed [secondary_rat_usage_report]"); + goto end; + } + + secondary_rat_usage_reportList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_report_local_nonprimitive, secondary_rat_usage_report ) { + if (!cJSON_IsObject(secondary_rat_usage_report_local_nonprimitive)) { + ogs_error("OpenAPI_release_data_parseFromJSON() failed [secondary_rat_usage_report]"); + goto end; + } + OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_reportItem = OpenAPI_secondary_rat_usage_report_parseFromJSON(secondary_rat_usage_report_local_nonprimitive); + + OpenAPI_list_add(secondary_rat_usage_reportList, secondary_rat_usage_reportItem); + } + } + + cJSON *secondary_rat_usage_info = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "secondaryRatUsageInfo"); + + OpenAPI_list_t *secondary_rat_usage_infoList; + if (secondary_rat_usage_info) { + cJSON *secondary_rat_usage_info_local_nonprimitive; + if (!cJSON_IsArray(secondary_rat_usage_info)) { + ogs_error("OpenAPI_release_data_parseFromJSON() failed [secondary_rat_usage_info]"); + goto end; + } + + secondary_rat_usage_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_info_local_nonprimitive, secondary_rat_usage_info ) { + if (!cJSON_IsObject(secondary_rat_usage_info_local_nonprimitive)) { + ogs_error("OpenAPI_release_data_parseFromJSON() failed [secondary_rat_usage_info]"); + goto end; + } + OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_infoItem = OpenAPI_secondary_rat_usage_info_parseFromJSON(secondary_rat_usage_info_local_nonprimitive); + + OpenAPI_list_add(secondary_rat_usage_infoList, secondary_rat_usage_infoItem); + } + } + + release_data_local_var = OpenAPI_release_data_create ( + cause ? cause_local_nonprim : NULL, + ng_ap_cause ? ng_ap_cause_local_nonprim : NULL, + _5g_mm_cause_value ? _5g_mm_cause_value->valuedouble : 0, + ue_location ? ue_location_local_nonprim : NULL, + ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL, + add_ue_location ? add_ue_location_local_nonprim : NULL, + secondary_rat_usage_report ? secondary_rat_usage_reportList : NULL, + secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL + ); + + return release_data_local_var; +end: + return NULL; +} + +OpenAPI_release_data_t *OpenAPI_release_data_copy(OpenAPI_release_data_t *dst, OpenAPI_release_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_release_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_release_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_release_data_free(dst); + dst = OpenAPI_release_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/release_data.h b/lib/sbi/openapi/model/release_data.h new file mode 100644 index 000000000..ec93b07f3 --- /dev/null +++ b/lib/sbi/openapi/model/release_data.h @@ -0,0 +1,57 @@ +/* + * release_data.h + * + * + */ + +#ifndef _OpenAPI_release_data_H_ +#define _OpenAPI_release_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "cause.h" +#include "ng_ap_cause.h" +#include "secondary_rat_usage_info.h" +#include "secondary_rat_usage_report.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_release_data_s OpenAPI_release_data_t; +typedef struct OpenAPI_release_data_s { + struct OpenAPI_cause_s *cause; + struct OpenAPI_ng_ap_cause_s *ng_ap_cause; + int _5g_mm_cause_value; + struct OpenAPI_user_location_s *ue_location; + char *ue_time_zone; + struct OpenAPI_user_location_s *add_ue_location; + OpenAPI_list_t *secondary_rat_usage_report; + OpenAPI_list_t *secondary_rat_usage_info; +} OpenAPI_release_data_t; + +OpenAPI_release_data_t *OpenAPI_release_data_create( + OpenAPI_cause_t *cause, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + OpenAPI_list_t *secondary_rat_usage_report, + OpenAPI_list_t *secondary_rat_usage_info + ); +void OpenAPI_release_data_free(OpenAPI_release_data_t *release_data); +OpenAPI_release_data_t *OpenAPI_release_data_parseFromJSON(cJSON *release_dataJSON); +cJSON *OpenAPI_release_data_convertToJSON(OpenAPI_release_data_t *release_data); +OpenAPI_release_data_t *OpenAPI_release_data_copy(OpenAPI_release_data_t *dst, OpenAPI_release_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_release_data_H_ */ + diff --git a/lib/sbi/openapi/model/released_data.c b/lib/sbi/openapi/model/released_data.c new file mode 100644 index 000000000..06510abf5 --- /dev/null +++ b/lib/sbi/openapi/model/released_data.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "released_data.h" + +OpenAPI_released_data_t *OpenAPI_released_data_create( + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status + ) +{ + OpenAPI_released_data_t *released_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_released_data_t)); + if (!released_data_local_var) { + return NULL; + } + released_data_local_var->small_data_rate_status = small_data_rate_status; + released_data_local_var->apn_rate_status = apn_rate_status; + + return released_data_local_var; +} + +void OpenAPI_released_data_free(OpenAPI_released_data_t *released_data) +{ + if (NULL == released_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_small_data_rate_status_free(released_data->small_data_rate_status); + OpenAPI_apn_rate_status_free(released_data->apn_rate_status); + ogs_free(released_data); +} + +cJSON *OpenAPI_released_data_convertToJSON(OpenAPI_released_data_t *released_data) +{ + cJSON *item = NULL; + + if (released_data == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [ReleasedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (released_data->small_data_rate_status) { + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(released_data->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "smallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + } + + if (released_data->apn_rate_status) { + cJSON *apn_rate_status_local_JSON = OpenAPI_apn_rate_status_convertToJSON(released_data->apn_rate_status); + if (apn_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "apnRateStatus", apn_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_released_data_t *OpenAPI_released_data_parseFromJSON(cJSON *released_dataJSON) +{ + OpenAPI_released_data_t *released_data_local_var = NULL; + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(released_dataJSON, "smallDataRateStatus"); + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + if (small_data_rate_status) { + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + } + + cJSON *apn_rate_status = cJSON_GetObjectItemCaseSensitive(released_dataJSON, "apnRateStatus"); + + OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; + if (apn_rate_status) { + apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); + } + + released_data_local_var = OpenAPI_released_data_create ( + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, + apn_rate_status ? apn_rate_status_local_nonprim : NULL + ); + + return released_data_local_var; +end: + return NULL; +} + +OpenAPI_released_data_t *OpenAPI_released_data_copy(OpenAPI_released_data_t *dst, OpenAPI_released_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_released_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_released_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_released_data_free(dst); + dst = OpenAPI_released_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/released_data.h b/lib/sbi/openapi/model/released_data.h new file mode 100644 index 000000000..c2e3945bd --- /dev/null +++ b/lib/sbi/openapi/model/released_data.h @@ -0,0 +1,42 @@ +/* + * released_data.h + * + * + */ + +#ifndef _OpenAPI_released_data_H_ +#define _OpenAPI_released_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "apn_rate_status.h" +#include "small_data_rate_status.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_released_data_s OpenAPI_released_data_t; +typedef struct OpenAPI_released_data_s { + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; + struct OpenAPI_apn_rate_status_s *apn_rate_status; +} OpenAPI_released_data_t; + +OpenAPI_released_data_t *OpenAPI_released_data_create( + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status + ); +void OpenAPI_released_data_free(OpenAPI_released_data_t *released_data); +OpenAPI_released_data_t *OpenAPI_released_data_parseFromJSON(cJSON *released_dataJSON); +cJSON *OpenAPI_released_data_convertToJSON(OpenAPI_released_data_t *released_data); +OpenAPI_released_data_t *OpenAPI_released_data_copy(OpenAPI_released_data_t *dst, OpenAPI_released_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_released_data_H_ */ + diff --git a/lib/sbi/openapi/model/report_item.c b/lib/sbi/openapi/model/report_item.c index caf2542a2..955f997f3 100644 --- a/lib/sbi/openapi/model/report_item.c +++ b/lib/sbi/openapi/model/report_item.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_report_item_t *OpenAPI_report_item_copy(OpenAPI_report_item_t *dst, OpenAPI_report_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_report_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_report_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_report_item_free(dst); + dst = OpenAPI_report_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/report_item.h b/lib/sbi/openapi/model/report_item.h index e727ca1a6..42b832da9 100644 --- a/lib/sbi/openapi/model/report_item.h +++ b/lib/sbi/openapi/model/report_item.h @@ -28,6 +28,7 @@ OpenAPI_report_item_t *OpenAPI_report_item_create( void OpenAPI_report_item_free(OpenAPI_report_item_t *report_item); OpenAPI_report_item_t *OpenAPI_report_item_parseFromJSON(cJSON *report_itemJSON); cJSON *OpenAPI_report_item_convertToJSON(OpenAPI_report_item_t *report_item); +OpenAPI_report_item_t *OpenAPI_report_item_copy(OpenAPI_report_item_t *dst, OpenAPI_report_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/reporting_options.c b/lib/sbi/openapi/model/reporting_options.c index a85709298..72f822b82 100644 --- a/lib/sbi/openapi/model/reporting_options.c +++ b/lib/sbi/openapi/model/reporting_options.c @@ -169,3 +169,37 @@ end: return NULL; } +OpenAPI_reporting_options_t *OpenAPI_reporting_options_copy(OpenAPI_reporting_options_t *dst, OpenAPI_reporting_options_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_reporting_options_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_reporting_options_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_reporting_options_free(dst); + dst = OpenAPI_reporting_options_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/reporting_options.h b/lib/sbi/openapi/model/reporting_options.h index 0c65baec0..0b4c146c3 100644 --- a/lib/sbi/openapi/model/reporting_options.h +++ b/lib/sbi/openapi/model/reporting_options.h @@ -39,6 +39,7 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_create( void OpenAPI_reporting_options_free(OpenAPI_reporting_options_t *reporting_options); OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *reporting_optionsJSON); cJSON *OpenAPI_reporting_options_convertToJSON(OpenAPI_reporting_options_t *reporting_options); +OpenAPI_reporting_options_t *OpenAPI_reporting_options_copy(OpenAPI_reporting_options_t *dst, OpenAPI_reporting_options_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/request_indication.c b/lib/sbi/openapi/model/request_indication.c new file mode 100644 index 000000000..940352437 --- /dev/null +++ b/lib/sbi/openapi/model/request_indication.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "request_indication.h" + +OpenAPI_request_indication_t *OpenAPI_request_indication_create( + ) +{ + OpenAPI_request_indication_t *request_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_request_indication_t)); + if (!request_indication_local_var) { + return NULL; + } + + return request_indication_local_var; +} + +void OpenAPI_request_indication_free(OpenAPI_request_indication_t *request_indication) +{ + if (NULL == request_indication) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(request_indication); +} + +cJSON *OpenAPI_request_indication_convertToJSON(OpenAPI_request_indication_t *request_indication) +{ + cJSON *item = NULL; + + if (request_indication == NULL) { + ogs_error("OpenAPI_request_indication_convertToJSON() failed [RequestIndication]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_request_indication_t *OpenAPI_request_indication_parseFromJSON(cJSON *request_indicationJSON) +{ + OpenAPI_request_indication_t *request_indication_local_var = NULL; + request_indication_local_var = OpenAPI_request_indication_create ( + ); + + return request_indication_local_var; +end: + return NULL; +} + +OpenAPI_request_indication_t *OpenAPI_request_indication_copy(OpenAPI_request_indication_t *dst, OpenAPI_request_indication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_request_indication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_request_indication_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_request_indication_free(dst); + dst = OpenAPI_request_indication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/request_indication.h b/lib/sbi/openapi/model/request_indication.h new file mode 100644 index 000000000..862158f84 --- /dev/null +++ b/lib/sbi/openapi/model/request_indication.h @@ -0,0 +1,36 @@ +/* + * request_indication.h + * + * Possible values are - UE_REQ_PDU_SES_MOD - UE_REQ_PDU_SES_REL - PDU_SES_MOB - NW_REQ_PDU_SES_AUTH - NW_REQ_PDU_SES_MOD - NW_REQ_PDU_SES_REL - EBI_ASSIGNMENT_REQ + */ + +#ifndef _OpenAPI_request_indication_H_ +#define _OpenAPI_request_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_request_indication_s OpenAPI_request_indication_t; +typedef struct OpenAPI_request_indication_s { +} OpenAPI_request_indication_t; + +OpenAPI_request_indication_t *OpenAPI_request_indication_create( + ); +void OpenAPI_request_indication_free(OpenAPI_request_indication_t *request_indication); +OpenAPI_request_indication_t *OpenAPI_request_indication_parseFromJSON(cJSON *request_indicationJSON); +cJSON *OpenAPI_request_indication_convertToJSON(OpenAPI_request_indication_t *request_indication); +OpenAPI_request_indication_t *OpenAPI_request_indication_copy(OpenAPI_request_indication_t *dst, OpenAPI_request_indication_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_request_indication_H_ */ + diff --git a/lib/sbi/openapi/model/request_type.c b/lib/sbi/openapi/model/request_type.c new file mode 100644 index 000000000..3783318bd --- /dev/null +++ b/lib/sbi/openapi/model/request_type.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "request_type.h" + +OpenAPI_request_type_t *OpenAPI_request_type_create( + ) +{ + OpenAPI_request_type_t *request_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_request_type_t)); + if (!request_type_local_var) { + return NULL; + } + + return request_type_local_var; +} + +void OpenAPI_request_type_free(OpenAPI_request_type_t *request_type) +{ + if (NULL == request_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(request_type); +} + +cJSON *OpenAPI_request_type_convertToJSON(OpenAPI_request_type_t *request_type) +{ + cJSON *item = NULL; + + if (request_type == NULL) { + ogs_error("OpenAPI_request_type_convertToJSON() failed [RequestType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_request_type_t *OpenAPI_request_type_parseFromJSON(cJSON *request_typeJSON) +{ + OpenAPI_request_type_t *request_type_local_var = NULL; + request_type_local_var = OpenAPI_request_type_create ( + ); + + return request_type_local_var; +end: + return NULL; +} + +OpenAPI_request_type_t *OpenAPI_request_type_copy(OpenAPI_request_type_t *dst, OpenAPI_request_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_request_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_request_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_request_type_free(dst); + dst = OpenAPI_request_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/request_type.h b/lib/sbi/openapi/model/request_type.h new file mode 100644 index 000000000..a292e246e --- /dev/null +++ b/lib/sbi/openapi/model/request_type.h @@ -0,0 +1,36 @@ +/* + * request_type.h + * + * Possible values are - INITIAL_REQUEST - EXISTING_PDU_SESSION - INITIAL_EMERGENCY_REQUEST - EXISTING_EMERGENCY_PDU_SESSION + */ + +#ifndef _OpenAPI_request_type_H_ +#define _OpenAPI_request_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 struct OpenAPI_request_type_s OpenAPI_request_type_t; +typedef struct OpenAPI_request_type_s { +} OpenAPI_request_type_t; + +OpenAPI_request_type_t *OpenAPI_request_type_create( + ); +void OpenAPI_request_type_free(OpenAPI_request_type_t *request_type); +OpenAPI_request_type_t *OpenAPI_request_type_parseFromJSON(cJSON *request_typeJSON); +cJSON *OpenAPI_request_type_convertToJSON(OpenAPI_request_type_t *request_type); +OpenAPI_request_type_t *OpenAPI_request_type_copy(OpenAPI_request_type_t *dst, OpenAPI_request_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_request_type_H_ */ + diff --git a/lib/sbi/openapi/model/resource_item.c b/lib/sbi/openapi/model/resource_item.c index d1dd476d7..a2f6ff047 100644 --- a/lib/sbi/openapi/model/resource_item.c +++ b/lib/sbi/openapi/model/resource_item.c @@ -122,3 +122,37 @@ end: return NULL; } +OpenAPI_resource_item_t *OpenAPI_resource_item_copy(OpenAPI_resource_item_t *dst, OpenAPI_resource_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_resource_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_resource_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_resource_item_free(dst); + dst = OpenAPI_resource_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/resource_item.h b/lib/sbi/openapi/model/resource_item.h index 345a19de5..860a9a556 100644 --- a/lib/sbi/openapi/model/resource_item.h +++ b/lib/sbi/openapi/model/resource_item.h @@ -30,6 +30,7 @@ OpenAPI_resource_item_t *OpenAPI_resource_item_create( void OpenAPI_resource_item_free(OpenAPI_resource_item_t *resource_item); OpenAPI_resource_item_t *OpenAPI_resource_item_parseFromJSON(cJSON *resource_itemJSON); cJSON *OpenAPI_resource_item_convertToJSON(OpenAPI_resource_item_t *resource_item); +OpenAPI_resource_item_t *OpenAPI_resource_item_copy(OpenAPI_resource_item_t *dst, OpenAPI_resource_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/resource_status.c b/lib/sbi/openapi/model/resource_status.c new file mode 100644 index 000000000..56bdfb41d --- /dev/null +++ b/lib/sbi/openapi/model/resource_status.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "resource_status.h" + +OpenAPI_resource_status_t *OpenAPI_resource_status_create( + ) +{ + OpenAPI_resource_status_t *resource_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_resource_status_t)); + if (!resource_status_local_var) { + return NULL; + } + + return resource_status_local_var; +} + +void OpenAPI_resource_status_free(OpenAPI_resource_status_t *resource_status) +{ + if (NULL == resource_status) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(resource_status); +} + +cJSON *OpenAPI_resource_status_convertToJSON(OpenAPI_resource_status_t *resource_status) +{ + cJSON *item = NULL; + + if (resource_status == NULL) { + ogs_error("OpenAPI_resource_status_convertToJSON() failed [ResourceStatus]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_resource_status_t *OpenAPI_resource_status_parseFromJSON(cJSON *resource_statusJSON) +{ + OpenAPI_resource_status_t *resource_status_local_var = NULL; + resource_status_local_var = OpenAPI_resource_status_create ( + ); + + return resource_status_local_var; +end: + return NULL; +} + +OpenAPI_resource_status_t *OpenAPI_resource_status_copy(OpenAPI_resource_status_t *dst, OpenAPI_resource_status_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_resource_status_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_resource_status_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_resource_status_free(dst); + dst = OpenAPI_resource_status_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/resource_status.h b/lib/sbi/openapi/model/resource_status.h new file mode 100644 index 000000000..23042b968 --- /dev/null +++ b/lib/sbi/openapi/model/resource_status.h @@ -0,0 +1,36 @@ +/* + * resource_status.h + * + * Possible values are - RELEASED - UNCHANGED - UPDATED + */ + +#ifndef _OpenAPI_resource_status_H_ +#define _OpenAPI_resource_status_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_resource_status_s OpenAPI_resource_status_t; +typedef struct OpenAPI_resource_status_s { +} OpenAPI_resource_status_t; + +OpenAPI_resource_status_t *OpenAPI_resource_status_create( + ); +void OpenAPI_resource_status_free(OpenAPI_resource_status_t *resource_status); +OpenAPI_resource_status_t *OpenAPI_resource_status_parseFromJSON(cJSON *resource_statusJSON); +cJSON *OpenAPI_resource_status_convertToJSON(OpenAPI_resource_status_t *resource_status); +OpenAPI_resource_status_t *OpenAPI_resource_status_copy(OpenAPI_resource_status_t *dst, OpenAPI_resource_status_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_resource_status_H_ */ + diff --git a/lib/sbi/openapi/model/restriction_type.c b/lib/sbi/openapi/model/restriction_type.c index 2181a0bda..d5652de03 100644 --- a/lib/sbi/openapi/model/restriction_type.c +++ b/lib/sbi/openapi/model/restriction_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_restriction_type_t *OpenAPI_restriction_type_copy(OpenAPI_restriction_type_t *dst, OpenAPI_restriction_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_restriction_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_restriction_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_restriction_type_free(dst); + dst = OpenAPI_restriction_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/restriction_type.h b/lib/sbi/openapi/model/restriction_type.h index a93d4d0ce..3e84f9060 100644 --- a/lib/sbi/openapi/model/restriction_type.h +++ b/lib/sbi/openapi/model/restriction_type.h @@ -26,6 +26,7 @@ OpenAPI_restriction_type_t *OpenAPI_restriction_type_create( void OpenAPI_restriction_type_free(OpenAPI_restriction_type_t *restriction_type); OpenAPI_restriction_type_t *OpenAPI_restriction_type_parseFromJSON(cJSON *restriction_typeJSON); cJSON *OpenAPI_restriction_type_convertToJSON(OpenAPI_restriction_type_t *restriction_type); +OpenAPI_restriction_type_t *OpenAPI_restriction_type_copy(OpenAPI_restriction_type_t *dst, OpenAPI_restriction_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/resynchronization_info.c b/lib/sbi/openapi/model/resynchronization_info.c index b1518d207..5dae4e726 100644 --- a/lib/sbi/openapi/model/resynchronization_info.c +++ b/lib/sbi/openapi/model/resynchronization_info.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_resynchronization_info_t *OpenAPI_resynchronization_info_copy(OpenAPI_resynchronization_info_t *dst, OpenAPI_resynchronization_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_resynchronization_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_resynchronization_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_resynchronization_info_free(dst); + dst = OpenAPI_resynchronization_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/resynchronization_info.h b/lib/sbi/openapi/model/resynchronization_info.h index 89b5bd89d..e92be2748 100644 --- a/lib/sbi/openapi/model/resynchronization_info.h +++ b/lib/sbi/openapi/model/resynchronization_info.h @@ -30,6 +30,7 @@ OpenAPI_resynchronization_info_t *OpenAPI_resynchronization_info_create( void OpenAPI_resynchronization_info_free(OpenAPI_resynchronization_info_t *resynchronization_info); OpenAPI_resynchronization_info_t *OpenAPI_resynchronization_info_parseFromJSON(cJSON *resynchronization_infoJSON); cJSON *OpenAPI_resynchronization_info_convertToJSON(OpenAPI_resynchronization_info_t *resynchronization_info); +OpenAPI_resynchronization_info_t *OpenAPI_resynchronization_info_copy(OpenAPI_resynchronization_info_t *dst, OpenAPI_resynchronization_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/rg_auth_ctx.c b/lib/sbi/openapi/model/rg_auth_ctx.c index 98a921be9..b3562969e 100644 --- a/lib/sbi/openapi/model/rg_auth_ctx.c +++ b/lib/sbi/openapi/model/rg_auth_ctx.c @@ -57,7 +57,7 @@ cJSON *OpenAPI_rg_auth_ctx_convertToJSON(OpenAPI_rg_auth_ctx_t *rg_auth_ctx) } } - if (rg_auth_ctx->auth_ind >= 0) { + if (rg_auth_ctx->auth_ind) { if (cJSON_AddBoolToObject(item, "authInd", rg_auth_ctx->auth_ind) == NULL) { ogs_error("OpenAPI_rg_auth_ctx_convertToJSON() failed [auth_ind]"); goto end; @@ -114,3 +114,37 @@ end: return NULL; } +OpenAPI_rg_auth_ctx_t *OpenAPI_rg_auth_ctx_copy(OpenAPI_rg_auth_ctx_t *dst, OpenAPI_rg_auth_ctx_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_rg_auth_ctx_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_rg_auth_ctx_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_rg_auth_ctx_free(dst); + dst = OpenAPI_rg_auth_ctx_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/rg_auth_ctx.h b/lib/sbi/openapi/model/rg_auth_ctx.h index 04f1549cc..f635a1759 100644 --- a/lib/sbi/openapi/model/rg_auth_ctx.h +++ b/lib/sbi/openapi/model/rg_auth_ctx.h @@ -33,6 +33,7 @@ OpenAPI_rg_auth_ctx_t *OpenAPI_rg_auth_ctx_create( void OpenAPI_rg_auth_ctx_free(OpenAPI_rg_auth_ctx_t *rg_auth_ctx); OpenAPI_rg_auth_ctx_t *OpenAPI_rg_auth_ctx_parseFromJSON(cJSON *rg_auth_ctxJSON); cJSON *OpenAPI_rg_auth_ctx_convertToJSON(OpenAPI_rg_auth_ctx_t *rg_auth_ctx); +OpenAPI_rg_auth_ctx_t *OpenAPI_rg_auth_ctx_copy(OpenAPI_rg_auth_ctx_t *dst, OpenAPI_rg_auth_ctx_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/rg_authentication_info.c b/lib/sbi/openapi/model/rg_authentication_info.c index 0017e6db2..a88478520 100644 --- a/lib/sbi/openapi/model/rg_authentication_info.c +++ b/lib/sbi/openapi/model/rg_authentication_info.c @@ -94,3 +94,37 @@ end: return NULL; } +OpenAPI_rg_authentication_info_t *OpenAPI_rg_authentication_info_copy(OpenAPI_rg_authentication_info_t *dst, OpenAPI_rg_authentication_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_rg_authentication_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_rg_authentication_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_rg_authentication_info_free(dst); + dst = OpenAPI_rg_authentication_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/rg_authentication_info.h b/lib/sbi/openapi/model/rg_authentication_info.h index ff2c30d13..51db3ae14 100644 --- a/lib/sbi/openapi/model/rg_authentication_info.h +++ b/lib/sbi/openapi/model/rg_authentication_info.h @@ -30,6 +30,7 @@ OpenAPI_rg_authentication_info_t *OpenAPI_rg_authentication_info_create( void OpenAPI_rg_authentication_info_free(OpenAPI_rg_authentication_info_t *rg_authentication_info); OpenAPI_rg_authentication_info_t *OpenAPI_rg_authentication_info_parseFromJSON(cJSON *rg_authentication_infoJSON); cJSON *OpenAPI_rg_authentication_info_convertToJSON(OpenAPI_rg_authentication_info_t *rg_authentication_info); +OpenAPI_rg_authentication_info_t *OpenAPI_rg_authentication_info_copy(OpenAPI_rg_authentication_info_t *dst, OpenAPI_rg_authentication_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/rm_info.c b/lib/sbi/openapi/model/rm_info.c index 230f7c22b..f34d5979e 100644 --- a/lib/sbi/openapi/model/rm_info.c +++ b/lib/sbi/openapi/model/rm_info.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_rm_info_t *OpenAPI_rm_info_copy(OpenAPI_rm_info_t *dst, OpenAPI_rm_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_rm_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_rm_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_rm_info_free(dst); + dst = OpenAPI_rm_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/rm_info.h b/lib/sbi/openapi/model/rm_info.h index 66aa2672b..bc2afdbe7 100644 --- a/lib/sbi/openapi/model/rm_info.h +++ b/lib/sbi/openapi/model/rm_info.h @@ -32,6 +32,7 @@ OpenAPI_rm_info_t *OpenAPI_rm_info_create( void OpenAPI_rm_info_free(OpenAPI_rm_info_t *rm_info); OpenAPI_rm_info_t *OpenAPI_rm_info_parseFromJSON(cJSON *rm_infoJSON); cJSON *OpenAPI_rm_info_convertToJSON(OpenAPI_rm_info_t *rm_info); +OpenAPI_rm_info_t *OpenAPI_rm_info_copy(OpenAPI_rm_info_t *dst, OpenAPI_rm_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/rm_state.c b/lib/sbi/openapi/model/rm_state.c index f836d81d2..c18b53583 100644 --- a/lib/sbi/openapi/model/rm_state.c +++ b/lib/sbi/openapi/model/rm_state.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_rm_state_t *OpenAPI_rm_state_copy(OpenAPI_rm_state_t *dst, OpenAPI_rm_state_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_rm_state_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_rm_state_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_rm_state_free(dst); + dst = OpenAPI_rm_state_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/rm_state.h b/lib/sbi/openapi/model/rm_state.h index 294ea96db..68860b9b5 100644 --- a/lib/sbi/openapi/model/rm_state.h +++ b/lib/sbi/openapi/model/rm_state.h @@ -26,6 +26,7 @@ OpenAPI_rm_state_t *OpenAPI_rm_state_create( void OpenAPI_rm_state_free(OpenAPI_rm_state_t *rm_state); OpenAPI_rm_state_t *OpenAPI_rm_state_parseFromJSON(cJSON *rm_stateJSON); cJSON *OpenAPI_rm_state_convertToJSON(OpenAPI_rm_state_t *rm_state); +OpenAPI_rm_state_t *OpenAPI_rm_state_copy(OpenAPI_rm_state_t *dst, OpenAPI_rm_state_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/roaming_charging_profile.c b/lib/sbi/openapi/model/roaming_charging_profile.c new file mode 100644 index 000000000..b95824c21 --- /dev/null +++ b/lib/sbi/openapi/model/roaming_charging_profile.c @@ -0,0 +1,159 @@ + +#include +#include +#include +#include "roaming_charging_profile.h" + +OpenAPI_roaming_charging_profile_t *OpenAPI_roaming_charging_profile_create( + OpenAPI_list_t *triggers, + OpenAPI_partial_record_method_t *partial_record_method + ) +{ + OpenAPI_roaming_charging_profile_t *roaming_charging_profile_local_var = OpenAPI_malloc(sizeof(OpenAPI_roaming_charging_profile_t)); + if (!roaming_charging_profile_local_var) { + return NULL; + } + roaming_charging_profile_local_var->triggers = triggers; + roaming_charging_profile_local_var->partial_record_method = partial_record_method; + + return roaming_charging_profile_local_var; +} + +void OpenAPI_roaming_charging_profile_free(OpenAPI_roaming_charging_profile_t *roaming_charging_profile) +{ + if (NULL == roaming_charging_profile) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(roaming_charging_profile->triggers, node) { + OpenAPI_trigger_free(node->data); + } + OpenAPI_list_free(roaming_charging_profile->triggers); + OpenAPI_partial_record_method_free(roaming_charging_profile->partial_record_method); + ogs_free(roaming_charging_profile); +} + +cJSON *OpenAPI_roaming_charging_profile_convertToJSON(OpenAPI_roaming_charging_profile_t *roaming_charging_profile) +{ + cJSON *item = NULL; + + if (roaming_charging_profile == NULL) { + ogs_error("OpenAPI_roaming_charging_profile_convertToJSON() failed [RoamingChargingProfile]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (roaming_charging_profile->triggers) { + cJSON *triggersList = cJSON_AddArrayToObject(item, "triggers"); + if (triggersList == NULL) { + ogs_error("OpenAPI_roaming_charging_profile_convertToJSON() failed [triggers]"); + goto end; + } + + OpenAPI_lnode_t *triggers_node; + if (roaming_charging_profile->triggers) { + OpenAPI_list_for_each(roaming_charging_profile->triggers, triggers_node) { + cJSON *itemLocal = OpenAPI_trigger_convertToJSON(triggers_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_roaming_charging_profile_convertToJSON() failed [triggers]"); + goto end; + } + cJSON_AddItemToArray(triggersList, itemLocal); + } + } + } + + if (roaming_charging_profile->partial_record_method) { + cJSON *partial_record_method_local_JSON = OpenAPI_partial_record_method_convertToJSON(roaming_charging_profile->partial_record_method); + if (partial_record_method_local_JSON == NULL) { + ogs_error("OpenAPI_roaming_charging_profile_convertToJSON() failed [partial_record_method]"); + goto end; + } + cJSON_AddItemToObject(item, "partialRecordMethod", partial_record_method_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_roaming_charging_profile_convertToJSON() failed [partial_record_method]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_roaming_charging_profile_t *OpenAPI_roaming_charging_profile_parseFromJSON(cJSON *roaming_charging_profileJSON) +{ + OpenAPI_roaming_charging_profile_t *roaming_charging_profile_local_var = NULL; + cJSON *triggers = cJSON_GetObjectItemCaseSensitive(roaming_charging_profileJSON, "triggers"); + + OpenAPI_list_t *triggersList; + if (triggers) { + cJSON *triggers_local_nonprimitive; + if (!cJSON_IsArray(triggers)) { + ogs_error("OpenAPI_roaming_charging_profile_parseFromJSON() failed [triggers]"); + goto end; + } + + triggersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(triggers_local_nonprimitive, triggers ) { + if (!cJSON_IsObject(triggers_local_nonprimitive)) { + ogs_error("OpenAPI_roaming_charging_profile_parseFromJSON() failed [triggers]"); + goto end; + } + OpenAPI_trigger_t *triggersItem = OpenAPI_trigger_parseFromJSON(triggers_local_nonprimitive); + + OpenAPI_list_add(triggersList, triggersItem); + } + } + + cJSON *partial_record_method = cJSON_GetObjectItemCaseSensitive(roaming_charging_profileJSON, "partialRecordMethod"); + + OpenAPI_partial_record_method_t *partial_record_method_local_nonprim = NULL; + if (partial_record_method) { + partial_record_method_local_nonprim = OpenAPI_partial_record_method_parseFromJSON(partial_record_method); + } + + roaming_charging_profile_local_var = OpenAPI_roaming_charging_profile_create ( + triggers ? triggersList : NULL, + partial_record_method ? partial_record_method_local_nonprim : NULL + ); + + return roaming_charging_profile_local_var; +end: + return NULL; +} + +OpenAPI_roaming_charging_profile_t *OpenAPI_roaming_charging_profile_copy(OpenAPI_roaming_charging_profile_t *dst, OpenAPI_roaming_charging_profile_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_roaming_charging_profile_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_roaming_charging_profile_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_roaming_charging_profile_free(dst); + dst = OpenAPI_roaming_charging_profile_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/roaming_charging_profile.h b/lib/sbi/openapi/model/roaming_charging_profile.h new file mode 100644 index 000000000..b5be087b9 --- /dev/null +++ b/lib/sbi/openapi/model/roaming_charging_profile.h @@ -0,0 +1,42 @@ +/* + * roaming_charging_profile.h + * + * + */ + +#ifndef _OpenAPI_roaming_charging_profile_H_ +#define _OpenAPI_roaming_charging_profile_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "partial_record_method.h" +#include "trigger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_roaming_charging_profile_s OpenAPI_roaming_charging_profile_t; +typedef struct OpenAPI_roaming_charging_profile_s { + OpenAPI_list_t *triggers; + struct OpenAPI_partial_record_method_s *partial_record_method; +} OpenAPI_roaming_charging_profile_t; + +OpenAPI_roaming_charging_profile_t *OpenAPI_roaming_charging_profile_create( + OpenAPI_list_t *triggers, + OpenAPI_partial_record_method_t *partial_record_method + ); +void OpenAPI_roaming_charging_profile_free(OpenAPI_roaming_charging_profile_t *roaming_charging_profile); +OpenAPI_roaming_charging_profile_t *OpenAPI_roaming_charging_profile_parseFromJSON(cJSON *roaming_charging_profileJSON); +cJSON *OpenAPI_roaming_charging_profile_convertToJSON(OpenAPI_roaming_charging_profile_t *roaming_charging_profile); +OpenAPI_roaming_charging_profile_t *OpenAPI_roaming_charging_profile_copy(OpenAPI_roaming_charging_profile_t *dst, OpenAPI_roaming_charging_profile_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_roaming_charging_profile_H_ */ + diff --git a/lib/sbi/openapi/model/roaming_odb.c b/lib/sbi/openapi/model/roaming_odb.c index be03b3efc..2d92e3d80 100644 --- a/lib/sbi/openapi/model/roaming_odb.c +++ b/lib/sbi/openapi/model/roaming_odb.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_copy(OpenAPI_roaming_odb_t *dst, OpenAPI_roaming_odb_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_roaming_odb_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_roaming_odb_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_roaming_odb_free(dst); + dst = OpenAPI_roaming_odb_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/roaming_odb.h b/lib/sbi/openapi/model/roaming_odb.h index f541d6af6..3e47ff8e2 100644 --- a/lib/sbi/openapi/model/roaming_odb.h +++ b/lib/sbi/openapi/model/roaming_odb.h @@ -26,6 +26,7 @@ OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_create( void OpenAPI_roaming_odb_free(OpenAPI_roaming_odb_t *roaming_odb); OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_parseFromJSON(cJSON *roaming_odbJSON); cJSON *OpenAPI_roaming_odb_convertToJSON(OpenAPI_roaming_odb_t *roaming_odb); +OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_copy(OpenAPI_roaming_odb_t *dst, OpenAPI_roaming_odb_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/route_information.c b/lib/sbi/openapi/model/route_information.c index 0be118c9d..edbbc4064 100644 --- a/lib/sbi/openapi/model/route_information.c +++ b/lib/sbi/openapi/model/route_information.c @@ -113,3 +113,37 @@ end: return NULL; } +OpenAPI_route_information_t *OpenAPI_route_information_copy(OpenAPI_route_information_t *dst, OpenAPI_route_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_route_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_route_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_route_information_free(dst); + dst = OpenAPI_route_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/route_information.h b/lib/sbi/openapi/model/route_information.h index d45234a98..7a946b664 100644 --- a/lib/sbi/openapi/model/route_information.h +++ b/lib/sbi/openapi/model/route_information.h @@ -32,6 +32,7 @@ OpenAPI_route_information_t *OpenAPI_route_information_create( void OpenAPI_route_information_free(OpenAPI_route_information_t *route_information); OpenAPI_route_information_t *OpenAPI_route_information_parseFromJSON(cJSON *route_informationJSON); cJSON *OpenAPI_route_information_convertToJSON(OpenAPI_route_information_t *route_information); +OpenAPI_route_information_t *OpenAPI_route_information_copy(OpenAPI_route_information_t *dst, OpenAPI_route_information_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/route_to_location.c b/lib/sbi/openapi/model/route_to_location.c index d4ff26fca..1fcf1a5c5 100644 --- a/lib/sbi/openapi/model/route_to_location.c +++ b/lib/sbi/openapi/model/route_to_location.c @@ -118,3 +118,37 @@ end: return NULL; } +OpenAPI_route_to_location_t *OpenAPI_route_to_location_copy(OpenAPI_route_to_location_t *dst, OpenAPI_route_to_location_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_route_to_location_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_route_to_location_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_route_to_location_free(dst); + dst = OpenAPI_route_to_location_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/route_to_location.h b/lib/sbi/openapi/model/route_to_location.h index 5317bf149..a7d26076f 100644 --- a/lib/sbi/openapi/model/route_to_location.h +++ b/lib/sbi/openapi/model/route_to_location.h @@ -33,6 +33,7 @@ OpenAPI_route_to_location_t *OpenAPI_route_to_location_create( void OpenAPI_route_to_location_free(OpenAPI_route_to_location_t *route_to_location); OpenAPI_route_to_location_t *OpenAPI_route_to_location_parseFromJSON(cJSON *route_to_locationJSON); cJSON *OpenAPI_route_to_location_convertToJSON(OpenAPI_route_to_location_t *route_to_location); +OpenAPI_route_to_location_t *OpenAPI_route_to_location_copy(OpenAPI_route_to_location_t *dst, OpenAPI_route_to_location_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sbi_binding_level.c b/lib/sbi/openapi/model/sbi_binding_level.c new file mode 100644 index 000000000..d5572c1cb --- /dev/null +++ b/lib/sbi/openapi/model/sbi_binding_level.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "sbi_binding_level.h" + +char* OpenAPI_sbi_binding_level_ToString(OpenAPI_sbi_binding_level_e sbi_binding_level) +{ + const char *sbi_binding_levelArray[] = { "NULL", "NF_INSTANCE_BINDING", "NF_SET_BINDING", "NF_SERVICE_SET_BINDING" }; + size_t sizeofArray = sizeof(sbi_binding_levelArray) / sizeof(sbi_binding_levelArray[0]); + if (sbi_binding_level < sizeofArray) + return (char *)sbi_binding_levelArray[sbi_binding_level]; + else + return (char *)"Unknown"; +} + +OpenAPI_sbi_binding_level_e OpenAPI_sbi_binding_level_FromString(char* sbi_binding_level) +{ + int stringToReturn = 0; + const char *sbi_binding_levelArray[] = { "NULL", "NF_INSTANCE_BINDING", "NF_SET_BINDING", "NF_SERVICE_SET_BINDING" }; + size_t sizeofArray = sizeof(sbi_binding_levelArray) / sizeof(sbi_binding_levelArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(sbi_binding_level, sbi_binding_levelArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/sbi_binding_level.h b/lib/sbi/openapi/model/sbi_binding_level.h new file mode 100644 index 000000000..9e58f17f3 --- /dev/null +++ b/lib/sbi/openapi/model/sbi_binding_level.h @@ -0,0 +1,31 @@ +/* + * sbi_binding_level.h + * + * + */ + +#ifndef _OpenAPI_sbi_binding_level_H_ +#define _OpenAPI_sbi_binding_level_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_sbi_binding_level_NULL = 0, OpenAPI_sbi_binding_level_NF_INSTANCE_BINDING, OpenAPI_sbi_binding_level_NF_SET_BINDING, OpenAPI_sbi_binding_level_NF_SERVICE_SET_BINDING } OpenAPI_sbi_binding_level_e; + +char* OpenAPI_sbi_binding_level_ToString(OpenAPI_sbi_binding_level_e sbi_binding_level); + +OpenAPI_sbi_binding_level_e OpenAPI_sbi_binding_level_FromString(char* sbi_binding_level); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sbi_binding_level_H_ */ + diff --git a/lib/sbi/openapi/model/sc_type.c b/lib/sbi/openapi/model/sc_type.c new file mode 100644 index 000000000..93a4fec21 --- /dev/null +++ b/lib/sbi/openapi/model/sc_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "sc_type.h" + +char* OpenAPI_sc_type_ToString(OpenAPI_sc_type_e sc_type) +{ + const char *sc_typeArray[] = { "NULL", "NATIVE", "MAPPED" }; + size_t sizeofArray = sizeof(sc_typeArray) / sizeof(sc_typeArray[0]); + if (sc_type < sizeofArray) + return (char *)sc_typeArray[sc_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_sc_type_e OpenAPI_sc_type_FromString(char* sc_type) +{ + int stringToReturn = 0; + const char *sc_typeArray[] = { "NULL", "NATIVE", "MAPPED" }; + size_t sizeofArray = sizeof(sc_typeArray) / sizeof(sc_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(sc_type, sc_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/sc_type.h b/lib/sbi/openapi/model/sc_type.h new file mode 100644 index 000000000..ed6dba172 --- /dev/null +++ b/lib/sbi/openapi/model/sc_type.h @@ -0,0 +1,31 @@ +/* + * sc_type.h + * + * + */ + +#ifndef _OpenAPI_sc_type_H_ +#define _OpenAPI_sc_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_sc_type_NULL = 0, OpenAPI_sc_type_NATIVE, OpenAPI_sc_type_MAPPED } OpenAPI_sc_type_e; + +char* OpenAPI_sc_type_ToString(OpenAPI_sc_type_e sc_type); + +OpenAPI_sc_type_e OpenAPI_sc_type_FromString(char* sc_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sc_type_H_ */ + diff --git a/lib/sbi/openapi/model/scheduled_communication_time.c b/lib/sbi/openapi/model/scheduled_communication_time.c index 6a6a82c0f..41de7878e 100644 --- a/lib/sbi/openapi/model/scheduled_communication_time.c +++ b/lib/sbi/openapi/model/scheduled_communication_time.c @@ -132,3 +132,37 @@ end: return NULL; } +OpenAPI_scheduled_communication_time_t *OpenAPI_scheduled_communication_time_copy(OpenAPI_scheduled_communication_time_t *dst, OpenAPI_scheduled_communication_time_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scheduled_communication_time_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scheduled_communication_time_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_scheduled_communication_time_free(dst); + dst = OpenAPI_scheduled_communication_time_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scheduled_communication_time.h b/lib/sbi/openapi/model/scheduled_communication_time.h index 99825cde8..027969afb 100644 --- a/lib/sbi/openapi/model/scheduled_communication_time.h +++ b/lib/sbi/openapi/model/scheduled_communication_time.h @@ -32,6 +32,7 @@ OpenAPI_scheduled_communication_time_t *OpenAPI_scheduled_communication_time_cre void OpenAPI_scheduled_communication_time_free(OpenAPI_scheduled_communication_time_t *scheduled_communication_time); OpenAPI_scheduled_communication_time_t *OpenAPI_scheduled_communication_time_parseFromJSON(cJSON *scheduled_communication_timeJSON); cJSON *OpenAPI_scheduled_communication_time_convertToJSON(OpenAPI_scheduled_communication_time_t *scheduled_communication_time); +OpenAPI_scheduled_communication_time_t *OpenAPI_scheduled_communication_time_copy(OpenAPI_scheduled_communication_time_t *dst, OpenAPI_scheduled_communication_time_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/scheduled_communication_time_rm.c b/lib/sbi/openapi/model/scheduled_communication_time_rm.c index 44ed5dc11..83d7cdd22 100644 --- a/lib/sbi/openapi/model/scheduled_communication_time_rm.c +++ b/lib/sbi/openapi/model/scheduled_communication_time_rm.c @@ -132,3 +132,37 @@ end: return NULL; } +OpenAPI_scheduled_communication_time_rm_t *OpenAPI_scheduled_communication_time_rm_copy(OpenAPI_scheduled_communication_time_rm_t *dst, OpenAPI_scheduled_communication_time_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scheduled_communication_time_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scheduled_communication_time_rm_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_scheduled_communication_time_rm_free(dst); + dst = OpenAPI_scheduled_communication_time_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scheduled_communication_time_rm.h b/lib/sbi/openapi/model/scheduled_communication_time_rm.h index 7149f4f33..9a4a63290 100644 --- a/lib/sbi/openapi/model/scheduled_communication_time_rm.h +++ b/lib/sbi/openapi/model/scheduled_communication_time_rm.h @@ -34,6 +34,7 @@ OpenAPI_scheduled_communication_time_rm_t *OpenAPI_scheduled_communication_time_ void OpenAPI_scheduled_communication_time_rm_free(OpenAPI_scheduled_communication_time_rm_t *scheduled_communication_time_rm); OpenAPI_scheduled_communication_time_rm_t *OpenAPI_scheduled_communication_time_rm_parseFromJSON(cJSON *scheduled_communication_time_rmJSON); cJSON *OpenAPI_scheduled_communication_time_rm_convertToJSON(OpenAPI_scheduled_communication_time_rm_t *scheduled_communication_time_rm); +OpenAPI_scheduled_communication_time_rm_t *OpenAPI_scheduled_communication_time_rm_copy(OpenAPI_scheduled_communication_time_rm_t *dst, OpenAPI_scheduled_communication_time_rm_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/scheduled_communication_type.c b/lib/sbi/openapi/model/scheduled_communication_type.c index 86a8ebf45..66ac1629d 100644 --- a/lib/sbi/openapi/model/scheduled_communication_type.c +++ b/lib/sbi/openapi/model/scheduled_communication_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_scheduled_communication_type_t *OpenAPI_scheduled_communication_type_copy(OpenAPI_scheduled_communication_type_t *dst, OpenAPI_scheduled_communication_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scheduled_communication_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scheduled_communication_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_scheduled_communication_type_free(dst); + dst = OpenAPI_scheduled_communication_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scheduled_communication_type.h b/lib/sbi/openapi/model/scheduled_communication_type.h index 4e8f96059..c962a073a 100644 --- a/lib/sbi/openapi/model/scheduled_communication_type.h +++ b/lib/sbi/openapi/model/scheduled_communication_type.h @@ -26,6 +26,7 @@ OpenAPI_scheduled_communication_type_t *OpenAPI_scheduled_communication_type_cre void OpenAPI_scheduled_communication_type_free(OpenAPI_scheduled_communication_type_t *scheduled_communication_type); OpenAPI_scheduled_communication_type_t *OpenAPI_scheduled_communication_type_parseFromJSON(cJSON *scheduled_communication_typeJSON); cJSON *OpenAPI_scheduled_communication_type_convertToJSON(OpenAPI_scheduled_communication_type_t *scheduled_communication_type); +OpenAPI_scheduled_communication_type_t *OpenAPI_scheduled_communication_type_copy(OpenAPI_scheduled_communication_type_t *dst, OpenAPI_scheduled_communication_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/scheduled_communication_type_rm.c b/lib/sbi/openapi/model/scheduled_communication_type_rm.c index 3695baf9d..dcd177f48 100644 --- a/lib/sbi/openapi/model/scheduled_communication_type_rm.c +++ b/lib/sbi/openapi/model/scheduled_communication_type_rm.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_scheduled_communication_type_rm_t *OpenAPI_scheduled_communication_type_rm_copy(OpenAPI_scheduled_communication_type_rm_t *dst, OpenAPI_scheduled_communication_type_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scheduled_communication_type_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scheduled_communication_type_rm_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_scheduled_communication_type_rm_free(dst); + dst = OpenAPI_scheduled_communication_type_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scheduled_communication_type_rm.h b/lib/sbi/openapi/model/scheduled_communication_type_rm.h index 7b7ee29c7..3de5e8e40 100644 --- a/lib/sbi/openapi/model/scheduled_communication_type_rm.h +++ b/lib/sbi/openapi/model/scheduled_communication_type_rm.h @@ -28,6 +28,7 @@ OpenAPI_scheduled_communication_type_rm_t *OpenAPI_scheduled_communication_type_ void OpenAPI_scheduled_communication_type_rm_free(OpenAPI_scheduled_communication_type_rm_t *scheduled_communication_type_rm); OpenAPI_scheduled_communication_type_rm_t *OpenAPI_scheduled_communication_type_rm_parseFromJSON(cJSON *scheduled_communication_type_rmJSON); cJSON *OpenAPI_scheduled_communication_type_rm_convertToJSON(OpenAPI_scheduled_communication_type_rm_t *scheduled_communication_type_rm); +OpenAPI_scheduled_communication_type_rm_t *OpenAPI_scheduled_communication_type_rm_copy(OpenAPI_scheduled_communication_type_rm_t *dst, OpenAPI_scheduled_communication_type_rm_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sdm_subs_modification.c b/lib/sbi/openapi/model/sdm_subs_modification.c index a8c33f228..5b03be622 100644 --- a/lib/sbi/openapi/model/sdm_subs_modification.c +++ b/lib/sbi/openapi/model/sdm_subs_modification.c @@ -112,3 +112,37 @@ end: return NULL; } +OpenAPI_sdm_subs_modification_t *OpenAPI_sdm_subs_modification_copy(OpenAPI_sdm_subs_modification_t *dst, OpenAPI_sdm_subs_modification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sdm_subs_modification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sdm_subs_modification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sdm_subs_modification_free(dst); + dst = OpenAPI_sdm_subs_modification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sdm_subs_modification.h b/lib/sbi/openapi/model/sdm_subs_modification.h index 4049404f5..ff14b200e 100644 --- a/lib/sbi/openapi/model/sdm_subs_modification.h +++ b/lib/sbi/openapi/model/sdm_subs_modification.h @@ -30,6 +30,7 @@ OpenAPI_sdm_subs_modification_t *OpenAPI_sdm_subs_modification_create( void OpenAPI_sdm_subs_modification_free(OpenAPI_sdm_subs_modification_t *sdm_subs_modification); OpenAPI_sdm_subs_modification_t *OpenAPI_sdm_subs_modification_parseFromJSON(cJSON *sdm_subs_modificationJSON); cJSON *OpenAPI_sdm_subs_modification_convertToJSON(OpenAPI_sdm_subs_modification_t *sdm_subs_modification); +OpenAPI_sdm_subs_modification_t *OpenAPI_sdm_subs_modification_copy(OpenAPI_sdm_subs_modification_t *dst, OpenAPI_sdm_subs_modification_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sdm_subscription.c b/lib/sbi/openapi/model/sdm_subscription.c index 0a644929a..3bc0e7150 100644 --- a/lib/sbi/openapi/model/sdm_subscription.c +++ b/lib/sbi/openapi/model/sdm_subscription.c @@ -80,7 +80,7 @@ cJSON *OpenAPI_sdm_subscription_convertToJSON(OpenAPI_sdm_subscription_t *sdm_su goto end; } - if (sdm_subscription->implicit_unsubscribe >= 0) { + if (sdm_subscription->implicit_unsubscribe) { if (cJSON_AddBoolToObject(item, "implicitUnsubscribe", sdm_subscription->implicit_unsubscribe) == NULL) { ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [implicit_unsubscribe]"); goto end; @@ -168,7 +168,7 @@ cJSON *OpenAPI_sdm_subscription_convertToJSON(OpenAPI_sdm_subscription_t *sdm_su } } - if (sdm_subscription->immediate_report >= 0) { + if (sdm_subscription->immediate_report) { if (cJSON_AddBoolToObject(item, "immediateReport", sdm_subscription->immediate_report) == NULL) { ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [immediate_report]"); goto end; @@ -337,3 +337,37 @@ end: return NULL; } +OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_copy(OpenAPI_sdm_subscription_t *dst, OpenAPI_sdm_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sdm_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sdm_subscription_free(dst); + dst = OpenAPI_sdm_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sdm_subscription.h b/lib/sbi/openapi/model/sdm_subscription.h index ad924e3eb..1282a61d1 100644 --- a/lib/sbi/openapi/model/sdm_subscription.h +++ b/lib/sbi/openapi/model/sdm_subscription.h @@ -53,6 +53,7 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( void OpenAPI_sdm_subscription_free(OpenAPI_sdm_subscription_t *sdm_subscription); OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_subscriptionJSON); cJSON *OpenAPI_sdm_subscription_convertToJSON(OpenAPI_sdm_subscription_t *sdm_subscription); +OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_copy(OpenAPI_sdm_subscription_t *dst, OpenAPI_sdm_subscription_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/seaf_data.c b/lib/sbi/openapi/model/seaf_data.c new file mode 100644 index 000000000..4513b96f0 --- /dev/null +++ b/lib/sbi/openapi/model/seaf_data.c @@ -0,0 +1,220 @@ + +#include +#include +#include +#include "seaf_data.h" + +OpenAPI_seaf_data_t *OpenAPI_seaf_data_create( + OpenAPI_ng_ksi_t *ng_ksi, + OpenAPI_key_amf_t *key_amf, + char *nh, + int ncc, + int key_amf_change_ind, + int key_amf_h_derivation_ind + ) +{ + OpenAPI_seaf_data_t *seaf_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_seaf_data_t)); + if (!seaf_data_local_var) { + return NULL; + } + seaf_data_local_var->ng_ksi = ng_ksi; + seaf_data_local_var->key_amf = key_amf; + seaf_data_local_var->nh = nh; + seaf_data_local_var->ncc = ncc; + seaf_data_local_var->key_amf_change_ind = key_amf_change_ind; + seaf_data_local_var->key_amf_h_derivation_ind = key_amf_h_derivation_ind; + + return seaf_data_local_var; +} + +void OpenAPI_seaf_data_free(OpenAPI_seaf_data_t *seaf_data) +{ + if (NULL == seaf_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ng_ksi_free(seaf_data->ng_ksi); + OpenAPI_key_amf_free(seaf_data->key_amf); + ogs_free(seaf_data->nh); + ogs_free(seaf_data); +} + +cJSON *OpenAPI_seaf_data_convertToJSON(OpenAPI_seaf_data_t *seaf_data) +{ + cJSON *item = NULL; + + if (seaf_data == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [SeafData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!seaf_data->ng_ksi) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [ng_ksi]"); + goto end; + } + cJSON *ng_ksi_local_JSON = OpenAPI_ng_ksi_convertToJSON(seaf_data->ng_ksi); + if (ng_ksi_local_JSON == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [ng_ksi]"); + goto end; + } + cJSON_AddItemToObject(item, "ngKsi", ng_ksi_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [ng_ksi]"); + goto end; + } + + if (!seaf_data->key_amf) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [key_amf]"); + goto end; + } + cJSON *key_amf_local_JSON = OpenAPI_key_amf_convertToJSON(seaf_data->key_amf); + if (key_amf_local_JSON == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [key_amf]"); + goto end; + } + cJSON_AddItemToObject(item, "keyAmf", key_amf_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [key_amf]"); + goto end; + } + + if (seaf_data->nh) { + if (cJSON_AddStringToObject(item, "nh", seaf_data->nh) == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [nh]"); + goto end; + } + } + + if (seaf_data->ncc) { + if (cJSON_AddNumberToObject(item, "ncc", seaf_data->ncc) == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [ncc]"); + goto end; + } + } + + if (seaf_data->key_amf_change_ind) { + if (cJSON_AddBoolToObject(item, "keyAmfChangeInd", seaf_data->key_amf_change_ind) == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [key_amf_change_ind]"); + goto end; + } + } + + if (seaf_data->key_amf_h_derivation_ind) { + if (cJSON_AddBoolToObject(item, "keyAmfHDerivationInd", seaf_data->key_amf_h_derivation_ind) == NULL) { + ogs_error("OpenAPI_seaf_data_convertToJSON() failed [key_amf_h_derivation_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_seaf_data_t *OpenAPI_seaf_data_parseFromJSON(cJSON *seaf_dataJSON) +{ + OpenAPI_seaf_data_t *seaf_data_local_var = NULL; + cJSON *ng_ksi = cJSON_GetObjectItemCaseSensitive(seaf_dataJSON, "ngKsi"); + if (!ng_ksi) { + ogs_error("OpenAPI_seaf_data_parseFromJSON() failed [ng_ksi]"); + goto end; + } + + OpenAPI_ng_ksi_t *ng_ksi_local_nonprim = NULL; + + ng_ksi_local_nonprim = OpenAPI_ng_ksi_parseFromJSON(ng_ksi); + + cJSON *key_amf = cJSON_GetObjectItemCaseSensitive(seaf_dataJSON, "keyAmf"); + if (!key_amf) { + ogs_error("OpenAPI_seaf_data_parseFromJSON() failed [key_amf]"); + goto end; + } + + OpenAPI_key_amf_t *key_amf_local_nonprim = NULL; + + key_amf_local_nonprim = OpenAPI_key_amf_parseFromJSON(key_amf); + + cJSON *nh = cJSON_GetObjectItemCaseSensitive(seaf_dataJSON, "nh"); + + if (nh) { + if (!cJSON_IsString(nh)) { + ogs_error("OpenAPI_seaf_data_parseFromJSON() failed [nh]"); + goto end; + } + } + + cJSON *ncc = cJSON_GetObjectItemCaseSensitive(seaf_dataJSON, "ncc"); + + if (ncc) { + if (!cJSON_IsNumber(ncc)) { + ogs_error("OpenAPI_seaf_data_parseFromJSON() failed [ncc]"); + goto end; + } + } + + cJSON *key_amf_change_ind = cJSON_GetObjectItemCaseSensitive(seaf_dataJSON, "keyAmfChangeInd"); + + if (key_amf_change_ind) { + if (!cJSON_IsBool(key_amf_change_ind)) { + ogs_error("OpenAPI_seaf_data_parseFromJSON() failed [key_amf_change_ind]"); + goto end; + } + } + + cJSON *key_amf_h_derivation_ind = cJSON_GetObjectItemCaseSensitive(seaf_dataJSON, "keyAmfHDerivationInd"); + + if (key_amf_h_derivation_ind) { + if (!cJSON_IsBool(key_amf_h_derivation_ind)) { + ogs_error("OpenAPI_seaf_data_parseFromJSON() failed [key_amf_h_derivation_ind]"); + goto end; + } + } + + seaf_data_local_var = OpenAPI_seaf_data_create ( + ng_ksi_local_nonprim, + key_amf_local_nonprim, + nh ? ogs_strdup(nh->valuestring) : NULL, + ncc ? ncc->valuedouble : 0, + key_amf_change_ind ? key_amf_change_ind->valueint : 0, + key_amf_h_derivation_ind ? key_amf_h_derivation_ind->valueint : 0 + ); + + return seaf_data_local_var; +end: + return NULL; +} + +OpenAPI_seaf_data_t *OpenAPI_seaf_data_copy(OpenAPI_seaf_data_t *dst, OpenAPI_seaf_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_seaf_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_seaf_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_seaf_data_free(dst); + dst = OpenAPI_seaf_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/seaf_data.h b/lib/sbi/openapi/model/seaf_data.h new file mode 100644 index 000000000..3fe4b3058 --- /dev/null +++ b/lib/sbi/openapi/model/seaf_data.h @@ -0,0 +1,50 @@ +/* + * seaf_data.h + * + * + */ + +#ifndef _OpenAPI_seaf_data_H_ +#define _OpenAPI_seaf_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "key_amf.h" +#include "ng_ksi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_seaf_data_s OpenAPI_seaf_data_t; +typedef struct OpenAPI_seaf_data_s { + struct OpenAPI_ng_ksi_s *ng_ksi; + struct OpenAPI_key_amf_s *key_amf; + char *nh; + int ncc; + int key_amf_change_ind; + int key_amf_h_derivation_ind; +} OpenAPI_seaf_data_t; + +OpenAPI_seaf_data_t *OpenAPI_seaf_data_create( + OpenAPI_ng_ksi_t *ng_ksi, + OpenAPI_key_amf_t *key_amf, + char *nh, + int ncc, + int key_amf_change_ind, + int key_amf_h_derivation_ind + ); +void OpenAPI_seaf_data_free(OpenAPI_seaf_data_t *seaf_data); +OpenAPI_seaf_data_t *OpenAPI_seaf_data_parseFromJSON(cJSON *seaf_dataJSON); +cJSON *OpenAPI_seaf_data_convertToJSON(OpenAPI_seaf_data_t *seaf_data); +OpenAPI_seaf_data_t *OpenAPI_seaf_data_copy(OpenAPI_seaf_data_t *dst, OpenAPI_seaf_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_seaf_data_H_ */ + diff --git a/lib/sbi/openapi/model/search_result.c b/lib/sbi/openapi/model/search_result.c index 4a1d48e5f..84a059c3d 100644 --- a/lib/sbi/openapi/model/search_result.c +++ b/lib/sbi/openapi/model/search_result.c @@ -206,3 +206,37 @@ end: return NULL; } +OpenAPI_search_result_t *OpenAPI_search_result_copy(OpenAPI_search_result_t *dst, OpenAPI_search_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_search_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_search_result_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_search_result_free(dst); + dst = OpenAPI_search_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/search_result.h b/lib/sbi/openapi/model/search_result.h index 4609fb32a..6bd9e6542 100644 --- a/lib/sbi/openapi/model/search_result.h +++ b/lib/sbi/openapi/model/search_result.h @@ -40,6 +40,7 @@ OpenAPI_search_result_t *OpenAPI_search_result_create( void OpenAPI_search_result_free(OpenAPI_search_result_t *search_result); OpenAPI_search_result_t *OpenAPI_search_result_parseFromJSON(cJSON *search_resultJSON); cJSON *OpenAPI_search_result_convertToJSON(OpenAPI_search_result_t *search_result); +OpenAPI_search_result_t *OpenAPI_search_result_copy(OpenAPI_search_result_t *dst, OpenAPI_search_result_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/secondary_rat_usage_info.c b/lib/sbi/openapi/model/secondary_rat_usage_info.c new file mode 100644 index 000000000..ac4852f5e --- /dev/null +++ b/lib/sbi/openapi/model/secondary_rat_usage_info.c @@ -0,0 +1,211 @@ + +#include +#include +#include +#include "secondary_rat_usage_info.h" + +OpenAPI_secondary_rat_usage_info_t *OpenAPI_secondary_rat_usage_info_create( + OpenAPI_rat_type_e secondary_rat_type, + OpenAPI_list_t *qos_flows_usage_data, + OpenAPI_list_t *pdu_session_usage_data + ) +{ + OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_secondary_rat_usage_info_t)); + if (!secondary_rat_usage_info_local_var) { + return NULL; + } + secondary_rat_usage_info_local_var->secondary_rat_type = secondary_rat_type; + secondary_rat_usage_info_local_var->qos_flows_usage_data = qos_flows_usage_data; + secondary_rat_usage_info_local_var->pdu_session_usage_data = pdu_session_usage_data; + + return secondary_rat_usage_info_local_var; +} + +void OpenAPI_secondary_rat_usage_info_free(OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_info) +{ + if (NULL == secondary_rat_usage_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(secondary_rat_usage_info->qos_flows_usage_data, node) { + OpenAPI_qos_flow_usage_report_free(node->data); + } + OpenAPI_list_free(secondary_rat_usage_info->qos_flows_usage_data); + OpenAPI_list_for_each(secondary_rat_usage_info->pdu_session_usage_data, node) { + OpenAPI_volume_timed_report_free(node->data); + } + OpenAPI_list_free(secondary_rat_usage_info->pdu_session_usage_data); + ogs_free(secondary_rat_usage_info); +} + +cJSON *OpenAPI_secondary_rat_usage_info_convertToJSON(OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_info) +{ + cJSON *item = NULL; + + if (secondary_rat_usage_info == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_info_convertToJSON() failed [SecondaryRatUsageInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!secondary_rat_usage_info->secondary_rat_type) { + ogs_error("OpenAPI_secondary_rat_usage_info_convertToJSON() failed [secondary_rat_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "secondaryRatType", OpenAPI_rat_type_ToString(secondary_rat_usage_info->secondary_rat_type)) == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_info_convertToJSON() failed [secondary_rat_type]"); + goto end; + } + + if (secondary_rat_usage_info->qos_flows_usage_data) { + cJSON *qos_flows_usage_dataList = cJSON_AddArrayToObject(item, "qosFlowsUsageData"); + if (qos_flows_usage_dataList == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_info_convertToJSON() failed [qos_flows_usage_data]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_usage_data_node; + if (secondary_rat_usage_info->qos_flows_usage_data) { + OpenAPI_list_for_each(secondary_rat_usage_info->qos_flows_usage_data, qos_flows_usage_data_node) { + cJSON *itemLocal = OpenAPI_qos_flow_usage_report_convertToJSON(qos_flows_usage_data_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_info_convertToJSON() failed [qos_flows_usage_data]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_usage_dataList, itemLocal); + } + } + } + + if (secondary_rat_usage_info->pdu_session_usage_data) { + cJSON *pdu_session_usage_dataList = cJSON_AddArrayToObject(item, "pduSessionUsageData"); + if (pdu_session_usage_dataList == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_info_convertToJSON() failed [pdu_session_usage_data]"); + goto end; + } + + OpenAPI_lnode_t *pdu_session_usage_data_node; + if (secondary_rat_usage_info->pdu_session_usage_data) { + OpenAPI_list_for_each(secondary_rat_usage_info->pdu_session_usage_data, pdu_session_usage_data_node) { + cJSON *itemLocal = OpenAPI_volume_timed_report_convertToJSON(pdu_session_usage_data_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_info_convertToJSON() failed [pdu_session_usage_data]"); + goto end; + } + cJSON_AddItemToArray(pdu_session_usage_dataList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_secondary_rat_usage_info_t *OpenAPI_secondary_rat_usage_info_parseFromJSON(cJSON *secondary_rat_usage_infoJSON) +{ + OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_info_local_var = NULL; + cJSON *secondary_rat_type = cJSON_GetObjectItemCaseSensitive(secondary_rat_usage_infoJSON, "secondaryRatType"); + if (!secondary_rat_type) { + ogs_error("OpenAPI_secondary_rat_usage_info_parseFromJSON() failed [secondary_rat_type]"); + goto end; + } + + OpenAPI_rat_type_e secondary_rat_typeVariable; + + if (!cJSON_IsString(secondary_rat_type)) { + ogs_error("OpenAPI_secondary_rat_usage_info_parseFromJSON() failed [secondary_rat_type]"); + goto end; + } + secondary_rat_typeVariable = OpenAPI_rat_type_FromString(secondary_rat_type->valuestring); + + cJSON *qos_flows_usage_data = cJSON_GetObjectItemCaseSensitive(secondary_rat_usage_infoJSON, "qosFlowsUsageData"); + + OpenAPI_list_t *qos_flows_usage_dataList; + if (qos_flows_usage_data) { + cJSON *qos_flows_usage_data_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_usage_data)) { + ogs_error("OpenAPI_secondary_rat_usage_info_parseFromJSON() failed [qos_flows_usage_data]"); + goto end; + } + + qos_flows_usage_dataList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_usage_data_local_nonprimitive, qos_flows_usage_data ) { + if (!cJSON_IsObject(qos_flows_usage_data_local_nonprimitive)) { + ogs_error("OpenAPI_secondary_rat_usage_info_parseFromJSON() failed [qos_flows_usage_data]"); + goto end; + } + OpenAPI_qos_flow_usage_report_t *qos_flows_usage_dataItem = OpenAPI_qos_flow_usage_report_parseFromJSON(qos_flows_usage_data_local_nonprimitive); + + OpenAPI_list_add(qos_flows_usage_dataList, qos_flows_usage_dataItem); + } + } + + cJSON *pdu_session_usage_data = cJSON_GetObjectItemCaseSensitive(secondary_rat_usage_infoJSON, "pduSessionUsageData"); + + OpenAPI_list_t *pdu_session_usage_dataList; + if (pdu_session_usage_data) { + cJSON *pdu_session_usage_data_local_nonprimitive; + if (!cJSON_IsArray(pdu_session_usage_data)) { + ogs_error("OpenAPI_secondary_rat_usage_info_parseFromJSON() failed [pdu_session_usage_data]"); + goto end; + } + + pdu_session_usage_dataList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pdu_session_usage_data_local_nonprimitive, pdu_session_usage_data ) { + if (!cJSON_IsObject(pdu_session_usage_data_local_nonprimitive)) { + ogs_error("OpenAPI_secondary_rat_usage_info_parseFromJSON() failed [pdu_session_usage_data]"); + goto end; + } + OpenAPI_volume_timed_report_t *pdu_session_usage_dataItem = OpenAPI_volume_timed_report_parseFromJSON(pdu_session_usage_data_local_nonprimitive); + + OpenAPI_list_add(pdu_session_usage_dataList, pdu_session_usage_dataItem); + } + } + + secondary_rat_usage_info_local_var = OpenAPI_secondary_rat_usage_info_create ( + secondary_rat_typeVariable, + qos_flows_usage_data ? qos_flows_usage_dataList : NULL, + pdu_session_usage_data ? pdu_session_usage_dataList : NULL + ); + + return secondary_rat_usage_info_local_var; +end: + return NULL; +} + +OpenAPI_secondary_rat_usage_info_t *OpenAPI_secondary_rat_usage_info_copy(OpenAPI_secondary_rat_usage_info_t *dst, OpenAPI_secondary_rat_usage_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_secondary_rat_usage_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_secondary_rat_usage_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_secondary_rat_usage_info_free(dst); + dst = OpenAPI_secondary_rat_usage_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/secondary_rat_usage_info.h b/lib/sbi/openapi/model/secondary_rat_usage_info.h new file mode 100644 index 000000000..5c36b01e6 --- /dev/null +++ b/lib/sbi/openapi/model/secondary_rat_usage_info.h @@ -0,0 +1,45 @@ +/* + * secondary_rat_usage_info.h + * + * + */ + +#ifndef _OpenAPI_secondary_rat_usage_info_H_ +#define _OpenAPI_secondary_rat_usage_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "qos_flow_usage_report.h" +#include "rat_type.h" +#include "volume_timed_report.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_secondary_rat_usage_info_s OpenAPI_secondary_rat_usage_info_t; +typedef struct OpenAPI_secondary_rat_usage_info_s { + OpenAPI_rat_type_e secondary_rat_type; + OpenAPI_list_t *qos_flows_usage_data; + OpenAPI_list_t *pdu_session_usage_data; +} OpenAPI_secondary_rat_usage_info_t; + +OpenAPI_secondary_rat_usage_info_t *OpenAPI_secondary_rat_usage_info_create( + OpenAPI_rat_type_e secondary_rat_type, + OpenAPI_list_t *qos_flows_usage_data, + OpenAPI_list_t *pdu_session_usage_data + ); +void OpenAPI_secondary_rat_usage_info_free(OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_info); +OpenAPI_secondary_rat_usage_info_t *OpenAPI_secondary_rat_usage_info_parseFromJSON(cJSON *secondary_rat_usage_infoJSON); +cJSON *OpenAPI_secondary_rat_usage_info_convertToJSON(OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_info); +OpenAPI_secondary_rat_usage_info_t *OpenAPI_secondary_rat_usage_info_copy(OpenAPI_secondary_rat_usage_info_t *dst, OpenAPI_secondary_rat_usage_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_secondary_rat_usage_info_H_ */ + diff --git a/lib/sbi/openapi/model/secondary_rat_usage_report.c b/lib/sbi/openapi/model/secondary_rat_usage_report.c new file mode 100644 index 000000000..ac03ef48b --- /dev/null +++ b/lib/sbi/openapi/model/secondary_rat_usage_report.c @@ -0,0 +1,166 @@ + +#include +#include +#include +#include "secondary_rat_usage_report.h" + +OpenAPI_secondary_rat_usage_report_t *OpenAPI_secondary_rat_usage_report_create( + OpenAPI_rat_type_e secondary_rat_type, + OpenAPI_list_t *qos_flows_usage_data + ) +{ + OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_secondary_rat_usage_report_t)); + if (!secondary_rat_usage_report_local_var) { + return NULL; + } + secondary_rat_usage_report_local_var->secondary_rat_type = secondary_rat_type; + secondary_rat_usage_report_local_var->qos_flows_usage_data = qos_flows_usage_data; + + return secondary_rat_usage_report_local_var; +} + +void OpenAPI_secondary_rat_usage_report_free(OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_report) +{ + if (NULL == secondary_rat_usage_report) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(secondary_rat_usage_report->qos_flows_usage_data, node) { + OpenAPI_qos_flow_usage_report_free(node->data); + } + OpenAPI_list_free(secondary_rat_usage_report->qos_flows_usage_data); + ogs_free(secondary_rat_usage_report); +} + +cJSON *OpenAPI_secondary_rat_usage_report_convertToJSON(OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_report) +{ + cJSON *item = NULL; + + if (secondary_rat_usage_report == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_report_convertToJSON() failed [SecondaryRatUsageReport]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!secondary_rat_usage_report->secondary_rat_type) { + ogs_error("OpenAPI_secondary_rat_usage_report_convertToJSON() failed [secondary_rat_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "secondaryRatType", OpenAPI_rat_type_ToString(secondary_rat_usage_report->secondary_rat_type)) == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_report_convertToJSON() failed [secondary_rat_type]"); + goto end; + } + + if (!secondary_rat_usage_report->qos_flows_usage_data) { + ogs_error("OpenAPI_secondary_rat_usage_report_convertToJSON() failed [qos_flows_usage_data]"); + goto end; + } + cJSON *qos_flows_usage_dataList = cJSON_AddArrayToObject(item, "qosFlowsUsageData"); + if (qos_flows_usage_dataList == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_report_convertToJSON() failed [qos_flows_usage_data]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_usage_data_node; + if (secondary_rat_usage_report->qos_flows_usage_data) { + OpenAPI_list_for_each(secondary_rat_usage_report->qos_flows_usage_data, qos_flows_usage_data_node) { + cJSON *itemLocal = OpenAPI_qos_flow_usage_report_convertToJSON(qos_flows_usage_data_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_secondary_rat_usage_report_convertToJSON() failed [qos_flows_usage_data]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_usage_dataList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_secondary_rat_usage_report_t *OpenAPI_secondary_rat_usage_report_parseFromJSON(cJSON *secondary_rat_usage_reportJSON) +{ + OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_report_local_var = NULL; + cJSON *secondary_rat_type = cJSON_GetObjectItemCaseSensitive(secondary_rat_usage_reportJSON, "secondaryRatType"); + if (!secondary_rat_type) { + ogs_error("OpenAPI_secondary_rat_usage_report_parseFromJSON() failed [secondary_rat_type]"); + goto end; + } + + OpenAPI_rat_type_e secondary_rat_typeVariable; + + if (!cJSON_IsString(secondary_rat_type)) { + ogs_error("OpenAPI_secondary_rat_usage_report_parseFromJSON() failed [secondary_rat_type]"); + goto end; + } + secondary_rat_typeVariable = OpenAPI_rat_type_FromString(secondary_rat_type->valuestring); + + cJSON *qos_flows_usage_data = cJSON_GetObjectItemCaseSensitive(secondary_rat_usage_reportJSON, "qosFlowsUsageData"); + if (!qos_flows_usage_data) { + ogs_error("OpenAPI_secondary_rat_usage_report_parseFromJSON() failed [qos_flows_usage_data]"); + goto end; + } + + OpenAPI_list_t *qos_flows_usage_dataList; + + cJSON *qos_flows_usage_data_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_usage_data)) { + ogs_error("OpenAPI_secondary_rat_usage_report_parseFromJSON() failed [qos_flows_usage_data]"); + goto end; + } + + qos_flows_usage_dataList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_usage_data_local_nonprimitive, qos_flows_usage_data ) { + if (!cJSON_IsObject(qos_flows_usage_data_local_nonprimitive)) { + ogs_error("OpenAPI_secondary_rat_usage_report_parseFromJSON() failed [qos_flows_usage_data]"); + goto end; + } + OpenAPI_qos_flow_usage_report_t *qos_flows_usage_dataItem = OpenAPI_qos_flow_usage_report_parseFromJSON(qos_flows_usage_data_local_nonprimitive); + + OpenAPI_list_add(qos_flows_usage_dataList, qos_flows_usage_dataItem); + } + + secondary_rat_usage_report_local_var = OpenAPI_secondary_rat_usage_report_create ( + secondary_rat_typeVariable, + qos_flows_usage_dataList + ); + + return secondary_rat_usage_report_local_var; +end: + return NULL; +} + +OpenAPI_secondary_rat_usage_report_t *OpenAPI_secondary_rat_usage_report_copy(OpenAPI_secondary_rat_usage_report_t *dst, OpenAPI_secondary_rat_usage_report_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_secondary_rat_usage_report_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_secondary_rat_usage_report_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_secondary_rat_usage_report_free(dst); + dst = OpenAPI_secondary_rat_usage_report_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/secondary_rat_usage_report.h b/lib/sbi/openapi/model/secondary_rat_usage_report.h new file mode 100644 index 000000000..ed0b7b304 --- /dev/null +++ b/lib/sbi/openapi/model/secondary_rat_usage_report.h @@ -0,0 +1,42 @@ +/* + * secondary_rat_usage_report.h + * + * + */ + +#ifndef _OpenAPI_secondary_rat_usage_report_H_ +#define _OpenAPI_secondary_rat_usage_report_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "qos_flow_usage_report.h" +#include "rat_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_secondary_rat_usage_report_s OpenAPI_secondary_rat_usage_report_t; +typedef struct OpenAPI_secondary_rat_usage_report_s { + OpenAPI_rat_type_e secondary_rat_type; + OpenAPI_list_t *qos_flows_usage_data; +} OpenAPI_secondary_rat_usage_report_t; + +OpenAPI_secondary_rat_usage_report_t *OpenAPI_secondary_rat_usage_report_create( + OpenAPI_rat_type_e secondary_rat_type, + OpenAPI_list_t *qos_flows_usage_data + ); +void OpenAPI_secondary_rat_usage_report_free(OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_report); +OpenAPI_secondary_rat_usage_report_t *OpenAPI_secondary_rat_usage_report_parseFromJSON(cJSON *secondary_rat_usage_reportJSON); +cJSON *OpenAPI_secondary_rat_usage_report_convertToJSON(OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_report); +OpenAPI_secondary_rat_usage_report_t *OpenAPI_secondary_rat_usage_report_copy(OpenAPI_secondary_rat_usage_report_t *dst, OpenAPI_secondary_rat_usage_report_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_secondary_rat_usage_report_H_ */ + diff --git a/lib/sbi/openapi/model/send_mo_data_req_data.c b/lib/sbi/openapi/model/send_mo_data_req_data.c new file mode 100644 index 000000000..cffa8b81b --- /dev/null +++ b/lib/sbi/openapi/model/send_mo_data_req_data.c @@ -0,0 +1,186 @@ + +#include +#include +#include +#include "send_mo_data_req_data.h" + +OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_create( + OpenAPI_ref_to_binary_data_t *mo_data, + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, + OpenAPI_user_location_t *ue_location + ) +{ + OpenAPI_send_mo_data_req_data_t *send_mo_data_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_send_mo_data_req_data_t)); + if (!send_mo_data_req_data_local_var) { + return NULL; + } + send_mo_data_req_data_local_var->mo_data = mo_data; + send_mo_data_req_data_local_var->mo_exp_data_ind = mo_exp_data_ind; + send_mo_data_req_data_local_var->mo_exp_data_counter = mo_exp_data_counter; + send_mo_data_req_data_local_var->ue_location = ue_location; + + return send_mo_data_req_data_local_var; +} + +void OpenAPI_send_mo_data_req_data_free(OpenAPI_send_mo_data_req_data_t *send_mo_data_req_data) +{ + if (NULL == send_mo_data_req_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ref_to_binary_data_free(send_mo_data_req_data->mo_data); + OpenAPI_mo_exception_data_flag_free(send_mo_data_req_data->mo_exp_data_ind); + OpenAPI_mo_exp_data_counter_free(send_mo_data_req_data->mo_exp_data_counter); + OpenAPI_user_location_free(send_mo_data_req_data->ue_location); + ogs_free(send_mo_data_req_data); +} + +cJSON *OpenAPI_send_mo_data_req_data_convertToJSON(OpenAPI_send_mo_data_req_data_t *send_mo_data_req_data) +{ + cJSON *item = NULL; + + if (send_mo_data_req_data == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [SendMoDataReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!send_mo_data_req_data->mo_data) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_data]"); + goto end; + } + cJSON *mo_data_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(send_mo_data_req_data->mo_data); + if (mo_data_local_JSON == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_data]"); + goto end; + } + cJSON_AddItemToObject(item, "moData", mo_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_data]"); + goto end; + } + + if (send_mo_data_req_data->mo_exp_data_ind) { + cJSON *mo_exp_data_ind_local_JSON = OpenAPI_mo_exception_data_flag_convertToJSON(send_mo_data_req_data->mo_exp_data_ind); + if (mo_exp_data_ind_local_JSON == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_exp_data_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataInd", mo_exp_data_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_exp_data_ind]"); + goto end; + } + } + + if (send_mo_data_req_data->mo_exp_data_counter) { + cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(send_mo_data_req_data->mo_exp_data_counter); + if (mo_exp_data_counter_local_JSON == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataCounter", mo_exp_data_counter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + } + + if (send_mo_data_req_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(send_mo_data_req_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_parseFromJSON(cJSON *send_mo_data_req_dataJSON) +{ + OpenAPI_send_mo_data_req_data_t *send_mo_data_req_data_local_var = NULL; + cJSON *mo_data = cJSON_GetObjectItemCaseSensitive(send_mo_data_req_dataJSON, "moData"); + if (!mo_data) { + ogs_error("OpenAPI_send_mo_data_req_data_parseFromJSON() failed [mo_data]"); + goto end; + } + + OpenAPI_ref_to_binary_data_t *mo_data_local_nonprim = NULL; + + mo_data_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(mo_data); + + cJSON *mo_exp_data_ind = cJSON_GetObjectItemCaseSensitive(send_mo_data_req_dataJSON, "moExpDataInd"); + + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind_local_nonprim = NULL; + if (mo_exp_data_ind) { + mo_exp_data_ind_local_nonprim = OpenAPI_mo_exception_data_flag_parseFromJSON(mo_exp_data_ind); + } + + cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(send_mo_data_req_dataJSON, "moExpDataCounter"); + + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; + if (mo_exp_data_counter) { + mo_exp_data_counter_local_nonprim = OpenAPI_mo_exp_data_counter_parseFromJSON(mo_exp_data_counter); + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(send_mo_data_req_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + send_mo_data_req_data_local_var = OpenAPI_send_mo_data_req_data_create ( + mo_data_local_nonprim, + mo_exp_data_ind ? mo_exp_data_ind_local_nonprim : NULL, + mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, + ue_location ? ue_location_local_nonprim : NULL + ); + + return send_mo_data_req_data_local_var; +end: + return NULL; +} + +OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_copy(OpenAPI_send_mo_data_req_data_t *dst, OpenAPI_send_mo_data_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_send_mo_data_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_send_mo_data_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_send_mo_data_req_data_free(dst); + dst = OpenAPI_send_mo_data_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/send_mo_data_req_data.h b/lib/sbi/openapi/model/send_mo_data_req_data.h new file mode 100644 index 000000000..9c8420e79 --- /dev/null +++ b/lib/sbi/openapi/model/send_mo_data_req_data.h @@ -0,0 +1,48 @@ +/* + * send_mo_data_req_data.h + * + * + */ + +#ifndef _OpenAPI_send_mo_data_req_data_H_ +#define _OpenAPI_send_mo_data_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mo_exception_data_flag.h" +#include "mo_exp_data_counter.h" +#include "ref_to_binary_data.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_send_mo_data_req_data_s OpenAPI_send_mo_data_req_data_t; +typedef struct OpenAPI_send_mo_data_req_data_s { + struct OpenAPI_ref_to_binary_data_s *mo_data; + struct OpenAPI_mo_exception_data_flag_s *mo_exp_data_ind; + struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; + struct OpenAPI_user_location_s *ue_location; +} OpenAPI_send_mo_data_req_data_t; + +OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_create( + OpenAPI_ref_to_binary_data_t *mo_data, + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, + OpenAPI_user_location_t *ue_location + ); +void OpenAPI_send_mo_data_req_data_free(OpenAPI_send_mo_data_req_data_t *send_mo_data_req_data); +OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_parseFromJSON(cJSON *send_mo_data_req_dataJSON); +cJSON *OpenAPI_send_mo_data_req_data_convertToJSON(OpenAPI_send_mo_data_req_data_t *send_mo_data_req_data); +OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_copy(OpenAPI_send_mo_data_req_data_t *dst, OpenAPI_send_mo_data_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_send_mo_data_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/sequence_number.c b/lib/sbi/openapi/model/sequence_number.c index df9b48ddf..2f563909f 100644 --- a/lib/sbi/openapi/model/sequence_number.c +++ b/lib/sbi/openapi/model/sequence_number.c @@ -171,3 +171,37 @@ end: return NULL; } +OpenAPI_sequence_number_t *OpenAPI_sequence_number_copy(OpenAPI_sequence_number_t *dst, OpenAPI_sequence_number_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sequence_number_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sequence_number_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sequence_number_free(dst); + dst = OpenAPI_sequence_number_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sequence_number.h b/lib/sbi/openapi/model/sequence_number.h index aba289933..732f210a2 100644 --- a/lib/sbi/openapi/model/sequence_number.h +++ b/lib/sbi/openapi/model/sequence_number.h @@ -38,6 +38,7 @@ OpenAPI_sequence_number_t *OpenAPI_sequence_number_create( void OpenAPI_sequence_number_free(OpenAPI_sequence_number_t *sequence_number); OpenAPI_sequence_number_t *OpenAPI_sequence_number_parseFromJSON(cJSON *sequence_numberJSON); cJSON *OpenAPI_sequence_number_convertToJSON(OpenAPI_sequence_number_t *sequence_number); +OpenAPI_sequence_number_t *OpenAPI_sequence_number_copy(OpenAPI_sequence_number_t *dst, OpenAPI_sequence_number_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_application_server_address.c b/lib/sbi/openapi/model/service_application_server_address.c index 708342de2..4629a4d8a 100644 --- a/lib/sbi/openapi/model/service_application_server_address.c +++ b/lib/sbi/openapi/model/service_application_server_address.c @@ -364,3 +364,37 @@ end: return NULL; } +OpenAPI_service_application_server_address_t *OpenAPI_service_application_server_address_copy(OpenAPI_service_application_server_address_t *dst, OpenAPI_service_application_server_address_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_application_server_address_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_application_server_address_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_application_server_address_free(dst); + dst = OpenAPI_service_application_server_address_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_application_server_address.h b/lib/sbi/openapi/model/service_application_server_address.h index 40bcf6523..a4cd16ee7 100644 --- a/lib/sbi/openapi/model/service_application_server_address.h +++ b/lib/sbi/openapi/model/service_application_server_address.h @@ -43,6 +43,7 @@ OpenAPI_service_application_server_address_t *OpenAPI_service_application_server void OpenAPI_service_application_server_address_free(OpenAPI_service_application_server_address_t *service_application_server_address); OpenAPI_service_application_server_address_t *OpenAPI_service_application_server_address_parseFromJSON(cJSON *service_application_server_addressJSON); cJSON *OpenAPI_service_application_server_address_convertToJSON(OpenAPI_service_application_server_address_t *service_application_server_address); +OpenAPI_service_application_server_address_t *OpenAPI_service_application_server_address_copy(OpenAPI_service_application_server_address_t *dst, OpenAPI_service_application_server_address_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_area_restriction.c b/lib/sbi/openapi/model/service_area_restriction.c index d338a9423..5df525493 100644 --- a/lib/sbi/openapi/model/service_area_restriction.c +++ b/lib/sbi/openapi/model/service_area_restriction.c @@ -161,3 +161,37 @@ end: return NULL; } +OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_copy(OpenAPI_service_area_restriction_t *dst, OpenAPI_service_area_restriction_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_area_restriction_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_area_restriction_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_area_restriction_free(dst); + dst = OpenAPI_service_area_restriction_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_area_restriction.h b/lib/sbi/openapi/model/service_area_restriction.h index 2f28e1499..fd7a3150c 100644 --- a/lib/sbi/openapi/model/service_area_restriction.h +++ b/lib/sbi/openapi/model/service_area_restriction.h @@ -36,6 +36,7 @@ OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_create( void OpenAPI_service_area_restriction_free(OpenAPI_service_area_restriction_t *service_area_restriction); OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_parseFromJSON(cJSON *service_area_restrictionJSON); cJSON *OpenAPI_service_area_restriction_convertToJSON(OpenAPI_service_area_restriction_t *service_area_restriction); +OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_copy(OpenAPI_service_area_restriction_t *dst, OpenAPI_service_area_restriction_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_id_to_frequency.c b/lib/sbi/openapi/model/service_id_to_frequency.c index be4a6e5e6..375ed7d52 100644 --- a/lib/sbi/openapi/model/service_id_to_frequency.c +++ b/lib/sbi/openapi/model/service_id_to_frequency.c @@ -141,3 +141,37 @@ end: return NULL; } +OpenAPI_service_id_to_frequency_t *OpenAPI_service_id_to_frequency_copy(OpenAPI_service_id_to_frequency_t *dst, OpenAPI_service_id_to_frequency_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_id_to_frequency_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_id_to_frequency_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_id_to_frequency_free(dst); + dst = OpenAPI_service_id_to_frequency_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_id_to_frequency.h b/lib/sbi/openapi/model/service_id_to_frequency.h index f85086b1c..e1ee3fc7f 100644 --- a/lib/sbi/openapi/model/service_id_to_frequency.h +++ b/lib/sbi/openapi/model/service_id_to_frequency.h @@ -32,6 +32,7 @@ OpenAPI_service_id_to_frequency_t *OpenAPI_service_id_to_frequency_create( void OpenAPI_service_id_to_frequency_free(OpenAPI_service_id_to_frequency_t *service_id_to_frequency); OpenAPI_service_id_to_frequency_t *OpenAPI_service_id_to_frequency_parseFromJSON(cJSON *service_id_to_frequencyJSON); cJSON *OpenAPI_service_id_to_frequency_convertToJSON(OpenAPI_service_id_to_frequency_t *service_id_to_frequency); +OpenAPI_service_id_to_frequency_t *OpenAPI_service_id_to_frequency_copy(OpenAPI_service_id_to_frequency_t *dst, OpenAPI_service_id_to_frequency_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_id_to_layer2_id.c b/lib/sbi/openapi/model/service_id_to_layer2_id.c index 615cc1703..998158b64 100644 --- a/lib/sbi/openapi/model/service_id_to_layer2_id.c +++ b/lib/sbi/openapi/model/service_id_to_layer2_id.c @@ -122,3 +122,37 @@ end: return NULL; } +OpenAPI_service_id_to_layer2_id_t *OpenAPI_service_id_to_layer2_id_copy(OpenAPI_service_id_to_layer2_id_t *dst, OpenAPI_service_id_to_layer2_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_id_to_layer2_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_id_to_layer2_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_id_to_layer2_id_free(dst); + dst = OpenAPI_service_id_to_layer2_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_id_to_layer2_id.h b/lib/sbi/openapi/model/service_id_to_layer2_id.h index c297df0b6..c146f6277 100644 --- a/lib/sbi/openapi/model/service_id_to_layer2_id.h +++ b/lib/sbi/openapi/model/service_id_to_layer2_id.h @@ -30,6 +30,7 @@ OpenAPI_service_id_to_layer2_id_t *OpenAPI_service_id_to_layer2_id_create( void OpenAPI_service_id_to_layer2_id_free(OpenAPI_service_id_to_layer2_id_t *service_id_to_layer2_id); OpenAPI_service_id_to_layer2_id_t *OpenAPI_service_id_to_layer2_id_parseFromJSON(cJSON *service_id_to_layer2_idJSON); cJSON *OpenAPI_service_id_to_layer2_id_convertToJSON(OpenAPI_service_id_to_layer2_id_t *service_id_to_layer2_id); +OpenAPI_service_id_to_layer2_id_t *OpenAPI_service_id_to_layer2_id_copy(OpenAPI_service_id_to_layer2_id_t *dst, OpenAPI_service_id_to_layer2_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_id_to_pppr.c b/lib/sbi/openapi/model/service_id_to_pppr.c index 6b8b507fb..0866d6ee0 100644 --- a/lib/sbi/openapi/model/service_id_to_pppr.c +++ b/lib/sbi/openapi/model/service_id_to_pppr.c @@ -121,3 +121,37 @@ end: return NULL; } +OpenAPI_service_id_to_pppr_t *OpenAPI_service_id_to_pppr_copy(OpenAPI_service_id_to_pppr_t *dst, OpenAPI_service_id_to_pppr_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_id_to_pppr_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_id_to_pppr_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_id_to_pppr_free(dst); + dst = OpenAPI_service_id_to_pppr_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_id_to_pppr.h b/lib/sbi/openapi/model/service_id_to_pppr.h index 9250e60b2..a1be7e118 100644 --- a/lib/sbi/openapi/model/service_id_to_pppr.h +++ b/lib/sbi/openapi/model/service_id_to_pppr.h @@ -30,6 +30,7 @@ OpenAPI_service_id_to_pppr_t *OpenAPI_service_id_to_pppr_create( void OpenAPI_service_id_to_pppr_free(OpenAPI_service_id_to_pppr_t *service_id_to_pppr); OpenAPI_service_id_to_pppr_t *OpenAPI_service_id_to_pppr_parseFromJSON(cJSON *service_id_to_ppprJSON); cJSON *OpenAPI_service_id_to_pppr_convertToJSON(OpenAPI_service_id_to_pppr_t *service_id_to_pppr); +OpenAPI_service_id_to_pppr_t *OpenAPI_service_id_to_pppr_copy(OpenAPI_service_id_to_pppr_t *dst, OpenAPI_service_id_to_pppr_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_name_cond.c b/lib/sbi/openapi/model/service_name_cond.c index d637beea2..bb1c94752 100644 --- a/lib/sbi/openapi/model/service_name_cond.c +++ b/lib/sbi/openapi/model/service_name_cond.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_service_name_cond_t *OpenAPI_service_name_cond_copy(OpenAPI_service_name_cond_t *dst, OpenAPI_service_name_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_name_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_name_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_name_cond_free(dst); + dst = OpenAPI_service_name_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_name_cond.h b/lib/sbi/openapi/model/service_name_cond.h index 6274ebf30..da64dead2 100644 --- a/lib/sbi/openapi/model/service_name_cond.h +++ b/lib/sbi/openapi/model/service_name_cond.h @@ -28,6 +28,7 @@ OpenAPI_service_name_cond_t *OpenAPI_service_name_cond_create( void OpenAPI_service_name_cond_free(OpenAPI_service_name_cond_t *service_name_cond); OpenAPI_service_name_cond_t *OpenAPI_service_name_cond_parseFromJSON(cJSON *service_name_condJSON); cJSON *OpenAPI_service_name_cond_convertToJSON(OpenAPI_service_name_cond_t *service_name_cond); +OpenAPI_service_name_cond_t *OpenAPI_service_name_cond_copy(OpenAPI_service_name_cond_t *dst, OpenAPI_service_name_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_parameter_data.c b/lib/sbi/openapi/model/service_parameter_data.c index c72be0036..2ec6dc132 100644 --- a/lib/sbi/openapi/model/service_parameter_data.c +++ b/lib/sbi/openapi/model/service_parameter_data.c @@ -281,3 +281,37 @@ end: return NULL; } +OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_copy(OpenAPI_service_parameter_data_t *dst, OpenAPI_service_parameter_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_parameter_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_parameter_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_service_parameter_data_free(dst); + dst = OpenAPI_service_parameter_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_parameter_data.h b/lib/sbi/openapi/model/service_parameter_data.h index cbeb7137d..e0e83f7db 100644 --- a/lib/sbi/openapi/model/service_parameter_data.h +++ b/lib/sbi/openapi/model/service_parameter_data.h @@ -51,6 +51,7 @@ OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_create( void OpenAPI_service_parameter_data_free(OpenAPI_service_parameter_data_t *service_parameter_data); OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_parseFromJSON(cJSON *service_parameter_dataJSON); cJSON *OpenAPI_service_parameter_data_convertToJSON(OpenAPI_service_parameter_data_t *service_parameter_data); +OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_copy(OpenAPI_service_parameter_data_t *dst, OpenAPI_service_parameter_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_to_pdu_session.c b/lib/sbi/openapi/model/service_to_pdu_session.c index 058a40c77..e4112e186 100644 --- a/lib/sbi/openapi/model/service_to_pdu_session.c +++ b/lib/sbi/openapi/model/service_to_pdu_session.c @@ -6,8 +6,8 @@ OpenAPI_service_to_pdu_session_t *OpenAPI_service_to_pdu_session_create( OpenAPI_list_t *ser_ids, - OpenAPI_pdu_session_type_t *pdu_session_type, - OpenAPI_ssc_mode_t *ssc_mode, + OpenAPI_pdu_session_type_e pdu_session_type, + OpenAPI_ssc_mode_e ssc_mode, OpenAPI_list_t *slice_info, OpenAPI_list_t *dnns ) @@ -35,8 +35,6 @@ void OpenAPI_service_to_pdu_session_free(OpenAPI_service_to_pdu_session_t *servi ogs_free(node->data); } OpenAPI_list_free(service_to_pdu_session->ser_ids); - OpenAPI_pdu_session_type_free(service_to_pdu_session->pdu_session_type); - OpenAPI_ssc_mode_free(service_to_pdu_session->ssc_mode); OpenAPI_list_for_each(service_to_pdu_session->slice_info, node) { OpenAPI_snssai_free(node->data); } @@ -77,26 +75,14 @@ cJSON *OpenAPI_service_to_pdu_session_convertToJSON(OpenAPI_service_to_pdu_sessi } if (service_to_pdu_session->pdu_session_type) { - cJSON *pdu_session_type_local_JSON = OpenAPI_pdu_session_type_convertToJSON(service_to_pdu_session->pdu_session_type); - if (pdu_session_type_local_JSON == NULL) { - ogs_error("OpenAPI_service_to_pdu_session_convertToJSON() failed [pdu_session_type]"); - goto end; - } - cJSON_AddItemToObject(item, "pduSessionType", pdu_session_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "pduSessionType", OpenAPI_pdu_session_type_ToString(service_to_pdu_session->pdu_session_type)) == NULL) { ogs_error("OpenAPI_service_to_pdu_session_convertToJSON() failed [pdu_session_type]"); goto end; } } if (service_to_pdu_session->ssc_mode) { - cJSON *ssc_mode_local_JSON = OpenAPI_ssc_mode_convertToJSON(service_to_pdu_session->ssc_mode); - if (ssc_mode_local_JSON == NULL) { - ogs_error("OpenAPI_service_to_pdu_session_convertToJSON() failed [ssc_mode]"); - goto end; - } - cJSON_AddItemToObject(item, "sscMode", ssc_mode_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "sscMode", OpenAPI_ssc_mode_ToString(service_to_pdu_session->ssc_mode)) == NULL) { ogs_error("OpenAPI_service_to_pdu_session_convertToJSON() failed [ssc_mode]"); goto end; } @@ -170,16 +156,24 @@ OpenAPI_service_to_pdu_session_t *OpenAPI_service_to_pdu_session_parseFromJSON(c cJSON *pdu_session_type = cJSON_GetObjectItemCaseSensitive(service_to_pdu_sessionJSON, "pduSessionType"); - OpenAPI_pdu_session_type_t *pdu_session_type_local_nonprim = NULL; + OpenAPI_pdu_session_type_e pdu_session_typeVariable; if (pdu_session_type) { - pdu_session_type_local_nonprim = OpenAPI_pdu_session_type_parseFromJSON(pdu_session_type); + if (!cJSON_IsString(pdu_session_type)) { + ogs_error("OpenAPI_service_to_pdu_session_parseFromJSON() failed [pdu_session_type]"); + goto end; + } + pdu_session_typeVariable = OpenAPI_pdu_session_type_FromString(pdu_session_type->valuestring); } cJSON *ssc_mode = cJSON_GetObjectItemCaseSensitive(service_to_pdu_sessionJSON, "sscMode"); - OpenAPI_ssc_mode_t *ssc_mode_local_nonprim = NULL; + OpenAPI_ssc_mode_e ssc_modeVariable; if (ssc_mode) { - ssc_mode_local_nonprim = OpenAPI_ssc_mode_parseFromJSON(ssc_mode); + if (!cJSON_IsString(ssc_mode)) { + ogs_error("OpenAPI_service_to_pdu_session_parseFromJSON() failed [ssc_mode]"); + goto end; + } + ssc_modeVariable = OpenAPI_ssc_mode_FromString(ssc_mode->valuestring); } cJSON *slice_info = cJSON_GetObjectItemCaseSensitive(service_to_pdu_sessionJSON, "sliceInfo"); @@ -227,8 +221,8 @@ OpenAPI_service_to_pdu_session_t *OpenAPI_service_to_pdu_session_parseFromJSON(c service_to_pdu_session_local_var = OpenAPI_service_to_pdu_session_create ( ser_idsList, - pdu_session_type ? pdu_session_type_local_nonprim : NULL, - ssc_mode ? ssc_mode_local_nonprim : NULL, + pdu_session_type ? pdu_session_typeVariable : 0, + ssc_mode ? ssc_modeVariable : 0, slice_info ? slice_infoList : NULL, dnns ? dnnsList : NULL ); @@ -238,3 +232,37 @@ end: return NULL; } +OpenAPI_service_to_pdu_session_t *OpenAPI_service_to_pdu_session_copy(OpenAPI_service_to_pdu_session_t *dst, OpenAPI_service_to_pdu_session_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_to_pdu_session_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_to_pdu_session_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_to_pdu_session_free(dst); + dst = OpenAPI_service_to_pdu_session_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_to_pdu_session.h b/lib/sbi/openapi/model/service_to_pdu_session.h index eb3969786..81803b528 100644 --- a/lib/sbi/openapi/model/service_to_pdu_session.h +++ b/lib/sbi/openapi/model/service_to_pdu_session.h @@ -23,22 +23,23 @@ extern "C" { typedef struct OpenAPI_service_to_pdu_session_s OpenAPI_service_to_pdu_session_t; typedef struct OpenAPI_service_to_pdu_session_s { OpenAPI_list_t *ser_ids; - struct OpenAPI_pdu_session_type_s *pdu_session_type; - struct OpenAPI_ssc_mode_s *ssc_mode; + OpenAPI_pdu_session_type_e pdu_session_type; + OpenAPI_ssc_mode_e ssc_mode; OpenAPI_list_t *slice_info; OpenAPI_list_t *dnns; } OpenAPI_service_to_pdu_session_t; OpenAPI_service_to_pdu_session_t *OpenAPI_service_to_pdu_session_create( OpenAPI_list_t *ser_ids, - OpenAPI_pdu_session_type_t *pdu_session_type, - OpenAPI_ssc_mode_t *ssc_mode, + OpenAPI_pdu_session_type_e pdu_session_type, + OpenAPI_ssc_mode_e ssc_mode, OpenAPI_list_t *slice_info, OpenAPI_list_t *dnns ); void OpenAPI_service_to_pdu_session_free(OpenAPI_service_to_pdu_session_t *service_to_pdu_session); OpenAPI_service_to_pdu_session_t *OpenAPI_service_to_pdu_session_parseFromJSON(cJSON *service_to_pdu_sessionJSON); cJSON *OpenAPI_service_to_pdu_session_convertToJSON(OpenAPI_service_to_pdu_session_t *service_to_pdu_session); +OpenAPI_service_to_pdu_session_t *OpenAPI_service_to_pdu_session_copy(OpenAPI_service_to_pdu_session_t *dst, OpenAPI_service_to_pdu_session_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_to_tx.c b/lib/sbi/openapi/model/service_to_tx.c index 0bfd66183..6c8f7d006 100644 --- a/lib/sbi/openapi/model/service_to_tx.c +++ b/lib/sbi/openapi/model/service_to_tx.c @@ -151,3 +151,37 @@ end: return NULL; } +OpenAPI_service_to_tx_t *OpenAPI_service_to_tx_copy(OpenAPI_service_to_tx_t *dst, OpenAPI_service_to_tx_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_to_tx_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_to_tx_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_to_tx_free(dst); + dst = OpenAPI_service_to_tx_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_to_tx.h b/lib/sbi/openapi/model/service_to_tx.h index cfbb363d1..54f18524b 100644 --- a/lib/sbi/openapi/model/service_to_tx.h +++ b/lib/sbi/openapi/model/service_to_tx.h @@ -33,6 +33,7 @@ OpenAPI_service_to_tx_t *OpenAPI_service_to_tx_create( void OpenAPI_service_to_tx_free(OpenAPI_service_to_tx_t *service_to_tx); OpenAPI_service_to_tx_t *OpenAPI_service_to_tx_parseFromJSON(cJSON *service_to_txJSON); cJSON *OpenAPI_service_to_tx_convertToJSON(OpenAPI_service_to_tx_t *service_to_tx); +OpenAPI_service_to_tx_t *OpenAPI_service_to_tx_copy(OpenAPI_service_to_tx_t *dst, OpenAPI_service_to_tx_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/service_type_unrelated_class.c b/lib/sbi/openapi/model/service_type_unrelated_class.c index ced490a26..d102c7c65 100644 --- a/lib/sbi/openapi/model/service_type_unrelated_class.c +++ b/lib/sbi/openapi/model/service_type_unrelated_class.c @@ -189,3 +189,37 @@ end: return NULL; } +OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_copy(OpenAPI_service_type_unrelated_class_t *dst, OpenAPI_service_type_unrelated_class_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_type_unrelated_class_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_type_unrelated_class_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_service_type_unrelated_class_free(dst); + dst = OpenAPI_service_type_unrelated_class_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_type_unrelated_class.h b/lib/sbi/openapi/model/service_type_unrelated_class.h index 04cbe8417..a4c5a99a4 100644 --- a/lib/sbi/openapi/model/service_type_unrelated_class.h +++ b/lib/sbi/openapi/model/service_type_unrelated_class.h @@ -40,6 +40,7 @@ OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_cre void OpenAPI_service_type_unrelated_class_free(OpenAPI_service_type_unrelated_class_t *service_type_unrelated_class); OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_parseFromJSON(cJSON *service_type_unrelated_classJSON); cJSON *OpenAPI_service_type_unrelated_class_convertToJSON(OpenAPI_service_type_unrelated_class_t *service_type_unrelated_class); +OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_copy(OpenAPI_service_type_unrelated_class_t *dst, OpenAPI_service_type_unrelated_class_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/session_management_subscription_data.c b/lib/sbi/openapi/model/session_management_subscription_data.c index 740ed0360..73fbf4c85 100644 --- a/lib/sbi/openapi/model/session_management_subscription_data.c +++ b/lib/sbi/openapi/model/session_management_subscription_data.c @@ -482,3 +482,37 @@ end: return NULL; } +OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subscription_data_copy(OpenAPI_session_management_subscription_data_t *dst, OpenAPI_session_management_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_session_management_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_session_management_subscription_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_session_management_subscription_data_free(dst); + dst = OpenAPI_session_management_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/session_management_subscription_data.h b/lib/sbi/openapi/model/session_management_subscription_data.h index a6c41f13d..0ee761551 100644 --- a/lib/sbi/openapi/model/session_management_subscription_data.h +++ b/lib/sbi/openapi/model/session_management_subscription_data.h @@ -57,6 +57,7 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc void OpenAPI_session_management_subscription_data_free(OpenAPI_session_management_subscription_data_t *session_management_subscription_data); OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subscription_data_parseFromJSON(cJSON *session_management_subscription_dataJSON); cJSON *OpenAPI_session_management_subscription_data_convertToJSON(OpenAPI_session_management_subscription_data_t *session_management_subscription_data); +OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subscription_data_copy(OpenAPI_session_management_subscription_data_t *dst, OpenAPI_session_management_subscription_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/shared_data.c b/lib/sbi/openapi/model/shared_data.c index 452e8ce57..9c19e90d9 100644 --- a/lib/sbi/openapi/model/shared_data.c +++ b/lib/sbi/openapi/model/shared_data.c @@ -329,3 +329,37 @@ end: return NULL; } +OpenAPI_shared_data_t *OpenAPI_shared_data_copy(OpenAPI_shared_data_t *dst, OpenAPI_shared_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_shared_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_shared_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_shared_data_free(dst); + dst = OpenAPI_shared_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/shared_data.h b/lib/sbi/openapi/model/shared_data.h index dbbf7f41d..7fd3beccf 100644 --- a/lib/sbi/openapi/model/shared_data.h +++ b/lib/sbi/openapi/model/shared_data.h @@ -49,6 +49,7 @@ OpenAPI_shared_data_t *OpenAPI_shared_data_create( void OpenAPI_shared_data_free(OpenAPI_shared_data_t *shared_data); OpenAPI_shared_data_t *OpenAPI_shared_data_parseFromJSON(cJSON *shared_dataJSON); cJSON *OpenAPI_shared_data_convertToJSON(OpenAPI_shared_data_t *shared_data); +OpenAPI_shared_data_t *OpenAPI_shared_data_copy(OpenAPI_shared_data_t *dst, OpenAPI_shared_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/slrb_configurations.c b/lib/sbi/openapi/model/slrb_configurations.c index 6aaf41cc9..4be239795 100644 --- a/lib/sbi/openapi/model/slrb_configurations.c +++ b/lib/sbi/openapi/model/slrb_configurations.c @@ -103,3 +103,37 @@ end: return NULL; } +OpenAPI_slrb_configurations_t *OpenAPI_slrb_configurations_copy(OpenAPI_slrb_configurations_t *dst, OpenAPI_slrb_configurations_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slrb_configurations_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slrb_configurations_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_slrb_configurations_free(dst); + dst = OpenAPI_slrb_configurations_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slrb_configurations.h b/lib/sbi/openapi/model/slrb_configurations.h index b62955357..ff879a65b 100644 --- a/lib/sbi/openapi/model/slrb_configurations.h +++ b/lib/sbi/openapi/model/slrb_configurations.h @@ -31,6 +31,7 @@ OpenAPI_slrb_configurations_t *OpenAPI_slrb_configurations_create( void OpenAPI_slrb_configurations_free(OpenAPI_slrb_configurations_t *slrb_configurations); OpenAPI_slrb_configurations_t *OpenAPI_slrb_configurations_parseFromJSON(cJSON *slrb_configurationsJSON); cJSON *OpenAPI_slrb_configurations_convertToJSON(OpenAPI_slrb_configurations_t *slrb_configurations); +OpenAPI_slrb_configurations_t *OpenAPI_slrb_configurations_copy(OpenAPI_slrb_configurations_t *dst, OpenAPI_slrb_configurations_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sm_context.c b/lib/sbi/openapi/model/sm_context.c new file mode 100644 index 000000000..a6e29e70d --- /dev/null +++ b/lib/sbi/openapi/model/sm_context.c @@ -0,0 +1,931 @@ + +#include +#include +#include +#include "sm_context.h" + +OpenAPI_sm_context_t *OpenAPI_sm_context_create( + int pdu_session_id, + char *dnn, + OpenAPI_snssai_t *s_nssai, + OpenAPI_snssai_t *hplmn_snssai, + OpenAPI_pdu_session_type_e pdu_session_type, + char *gpsi, + char *h_smf_uri, + char *smf_uri, + char *pdu_session_ref, + char *pcf_id, + char *pcf_group_id, + char *pcf_set_id, + OpenAPI_dnn_selection_mode_t *sel_mode, + char *udm_group_id, + char *routing_indicator, + OpenAPI_ambr_t *session_ambr, + OpenAPI_list_t *qos_flows_list, + char *h_smf_instance_id, + char *smf_instance_id, + int enable_pause_charging, + char *ue_ipv4_address, + char *ue_ipv6_prefix, + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, + OpenAPI_list_t *eps_bearer_info, + OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate, + int always_on_granted, + OpenAPI_up_security_t *up_security, + char *h_smf_service_instance_id, + char *smf_service_instance_id, + char *recovery_time, + int forwarding_ind, + OpenAPI_tunnel_info_t *psa_tunnel_info, + char *home_provided_charging_id, + OpenAPI_charging_information_t *charging_info, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + int nef_ext_buf_support_ind + ) +{ + OpenAPI_sm_context_t *sm_context_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_t)); + if (!sm_context_local_var) { + return NULL; + } + sm_context_local_var->pdu_session_id = pdu_session_id; + sm_context_local_var->dnn = dnn; + sm_context_local_var->s_nssai = s_nssai; + sm_context_local_var->hplmn_snssai = hplmn_snssai; + sm_context_local_var->pdu_session_type = pdu_session_type; + sm_context_local_var->gpsi = gpsi; + sm_context_local_var->h_smf_uri = h_smf_uri; + sm_context_local_var->smf_uri = smf_uri; + sm_context_local_var->pdu_session_ref = pdu_session_ref; + sm_context_local_var->pcf_id = pcf_id; + sm_context_local_var->pcf_group_id = pcf_group_id; + sm_context_local_var->pcf_set_id = pcf_set_id; + sm_context_local_var->sel_mode = sel_mode; + sm_context_local_var->udm_group_id = udm_group_id; + sm_context_local_var->routing_indicator = routing_indicator; + sm_context_local_var->session_ambr = session_ambr; + sm_context_local_var->qos_flows_list = qos_flows_list; + sm_context_local_var->h_smf_instance_id = h_smf_instance_id; + sm_context_local_var->smf_instance_id = smf_instance_id; + sm_context_local_var->enable_pause_charging = enable_pause_charging; + sm_context_local_var->ue_ipv4_address = ue_ipv4_address; + sm_context_local_var->ue_ipv6_prefix = ue_ipv6_prefix; + sm_context_local_var->eps_pdn_cnx_info = eps_pdn_cnx_info; + sm_context_local_var->eps_bearer_info = eps_bearer_info; + sm_context_local_var->max_integrity_protected_data_rate = max_integrity_protected_data_rate; + sm_context_local_var->always_on_granted = always_on_granted; + sm_context_local_var->up_security = up_security; + sm_context_local_var->h_smf_service_instance_id = h_smf_service_instance_id; + sm_context_local_var->smf_service_instance_id = smf_service_instance_id; + sm_context_local_var->recovery_time = recovery_time; + sm_context_local_var->forwarding_ind = forwarding_ind; + sm_context_local_var->psa_tunnel_info = psa_tunnel_info; + sm_context_local_var->home_provided_charging_id = home_provided_charging_id; + sm_context_local_var->charging_info = charging_info; + sm_context_local_var->roaming_charging_profile = roaming_charging_profile; + sm_context_local_var->nef_ext_buf_support_ind = nef_ext_buf_support_ind; + + return sm_context_local_var; +} + +void OpenAPI_sm_context_free(OpenAPI_sm_context_t *sm_context) +{ + if (NULL == sm_context) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(sm_context->dnn); + OpenAPI_snssai_free(sm_context->s_nssai); + OpenAPI_snssai_free(sm_context->hplmn_snssai); + ogs_free(sm_context->gpsi); + ogs_free(sm_context->h_smf_uri); + ogs_free(sm_context->smf_uri); + ogs_free(sm_context->pdu_session_ref); + ogs_free(sm_context->pcf_id); + ogs_free(sm_context->pcf_group_id); + ogs_free(sm_context->pcf_set_id); + OpenAPI_dnn_selection_mode_free(sm_context->sel_mode); + ogs_free(sm_context->udm_group_id); + ogs_free(sm_context->routing_indicator); + OpenAPI_ambr_free(sm_context->session_ambr); + OpenAPI_list_for_each(sm_context->qos_flows_list, node) { + OpenAPI_qos_flow_setup_item_free(node->data); + } + OpenAPI_list_free(sm_context->qos_flows_list); + ogs_free(sm_context->h_smf_instance_id); + ogs_free(sm_context->smf_instance_id); + ogs_free(sm_context->ue_ipv4_address); + ogs_free(sm_context->ue_ipv6_prefix); + OpenAPI_eps_pdn_cnx_info_free(sm_context->eps_pdn_cnx_info); + OpenAPI_list_for_each(sm_context->eps_bearer_info, node) { + OpenAPI_eps_bearer_info_free(node->data); + } + OpenAPI_list_free(sm_context->eps_bearer_info); + OpenAPI_max_integrity_protected_data_rate_free(sm_context->max_integrity_protected_data_rate); + OpenAPI_up_security_free(sm_context->up_security); + ogs_free(sm_context->h_smf_service_instance_id); + ogs_free(sm_context->smf_service_instance_id); + ogs_free(sm_context->recovery_time); + OpenAPI_tunnel_info_free(sm_context->psa_tunnel_info); + ogs_free(sm_context->home_provided_charging_id); + OpenAPI_charging_information_free(sm_context->charging_info); + OpenAPI_roaming_charging_profile_free(sm_context->roaming_charging_profile); + ogs_free(sm_context); +} + +cJSON *OpenAPI_sm_context_convertToJSON(OpenAPI_sm_context_t *sm_context) +{ + cJSON *item = NULL; + + if (sm_context == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [SmContext]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sm_context->pdu_session_id) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pdu_session_id]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "pduSessionId", sm_context->pdu_session_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pdu_session_id]"); + goto end; + } + + if (!sm_context->dnn) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [dnn]"); + goto end; + } + if (cJSON_AddStringToObject(item, "dnn", sm_context->dnn) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [dnn]"); + goto end; + } + + if (!sm_context->s_nssai) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(sm_context->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (sm_context->hplmn_snssai) { + cJSON *hplmn_snssai_local_JSON = OpenAPI_snssai_convertToJSON(sm_context->hplmn_snssai); + if (hplmn_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [hplmn_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "hplmnSnssai", hplmn_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [hplmn_snssai]"); + goto end; + } + } + + if (!sm_context->pdu_session_type) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pdu_session_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "pduSessionType", OpenAPI_pdu_session_type_ToString(sm_context->pdu_session_type)) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pdu_session_type]"); + goto end; + } + + if (sm_context->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", sm_context->gpsi) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (sm_context->h_smf_uri) { + if (cJSON_AddStringToObject(item, "hSmfUri", sm_context->h_smf_uri) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [h_smf_uri]"); + goto end; + } + } + + if (sm_context->smf_uri) { + if (cJSON_AddStringToObject(item, "smfUri", sm_context->smf_uri) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [smf_uri]"); + goto end; + } + } + + if (sm_context->pdu_session_ref) { + if (cJSON_AddStringToObject(item, "pduSessionRef", sm_context->pdu_session_ref) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pdu_session_ref]"); + goto end; + } + } + + if (sm_context->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", sm_context->pcf_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (sm_context->pcf_group_id) { + if (cJSON_AddStringToObject(item, "pcfGroupId", sm_context->pcf_group_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pcf_group_id]"); + goto end; + } + } + + if (sm_context->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", sm_context->pcf_set_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (sm_context->sel_mode) { + cJSON *sel_mode_local_JSON = OpenAPI_dnn_selection_mode_convertToJSON(sm_context->sel_mode); + if (sel_mode_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [sel_mode]"); + goto end; + } + cJSON_AddItemToObject(item, "selMode", sel_mode_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [sel_mode]"); + goto end; + } + } + + if (sm_context->udm_group_id) { + if (cJSON_AddStringToObject(item, "udmGroupId", sm_context->udm_group_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [udm_group_id]"); + goto end; + } + } + + if (sm_context->routing_indicator) { + if (cJSON_AddStringToObject(item, "routingIndicator", sm_context->routing_indicator) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [routing_indicator]"); + goto end; + } + } + + if (!sm_context->session_ambr) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [session_ambr]"); + goto end; + } + cJSON *session_ambr_local_JSON = OpenAPI_ambr_convertToJSON(sm_context->session_ambr); + if (session_ambr_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [session_ambr]"); + goto end; + } + cJSON_AddItemToObject(item, "sessionAmbr", session_ambr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [session_ambr]"); + goto end; + } + + if (!sm_context->qos_flows_list) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [qos_flows_list]"); + goto end; + } + cJSON *qos_flows_listList = cJSON_AddArrayToObject(item, "qosFlowsList"); + if (qos_flows_listList == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [qos_flows_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_list_node; + if (sm_context->qos_flows_list) { + OpenAPI_list_for_each(sm_context->qos_flows_list, qos_flows_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_setup_item_convertToJSON(qos_flows_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [qos_flows_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_listList, itemLocal); + } + } + + if (sm_context->h_smf_instance_id) { + if (cJSON_AddStringToObject(item, "hSmfInstanceId", sm_context->h_smf_instance_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [h_smf_instance_id]"); + goto end; + } + } + + if (sm_context->smf_instance_id) { + if (cJSON_AddStringToObject(item, "smfInstanceId", sm_context->smf_instance_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [smf_instance_id]"); + goto end; + } + } + + if (sm_context->enable_pause_charging) { + if (cJSON_AddBoolToObject(item, "enablePauseCharging", sm_context->enable_pause_charging) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [enable_pause_charging]"); + goto end; + } + } + + if (sm_context->ue_ipv4_address) { + if (cJSON_AddStringToObject(item, "ueIpv4Address", sm_context->ue_ipv4_address) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [ue_ipv4_address]"); + goto end; + } + } + + if (sm_context->ue_ipv6_prefix) { + if (cJSON_AddStringToObject(item, "ueIpv6Prefix", sm_context->ue_ipv6_prefix) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [ue_ipv6_prefix]"); + goto end; + } + } + + if (sm_context->eps_pdn_cnx_info) { + cJSON *eps_pdn_cnx_info_local_JSON = OpenAPI_eps_pdn_cnx_info_convertToJSON(sm_context->eps_pdn_cnx_info); + if (eps_pdn_cnx_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [eps_pdn_cnx_info]"); + goto end; + } + cJSON_AddItemToObject(item, "epsPdnCnxInfo", eps_pdn_cnx_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [eps_pdn_cnx_info]"); + goto end; + } + } + + if (sm_context->eps_bearer_info) { + cJSON *eps_bearer_infoList = cJSON_AddArrayToObject(item, "epsBearerInfo"); + if (eps_bearer_infoList == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [eps_bearer_info]"); + goto end; + } + + OpenAPI_lnode_t *eps_bearer_info_node; + if (sm_context->eps_bearer_info) { + OpenAPI_list_for_each(sm_context->eps_bearer_info, eps_bearer_info_node) { + cJSON *itemLocal = OpenAPI_eps_bearer_info_convertToJSON(eps_bearer_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [eps_bearer_info]"); + goto end; + } + cJSON_AddItemToArray(eps_bearer_infoList, itemLocal); + } + } + } + + if (sm_context->max_integrity_protected_data_rate) { + cJSON *max_integrity_protected_data_rate_local_JSON = OpenAPI_max_integrity_protected_data_rate_convertToJSON(sm_context->max_integrity_protected_data_rate); + if (max_integrity_protected_data_rate_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [max_integrity_protected_data_rate]"); + goto end; + } + cJSON_AddItemToObject(item, "maxIntegrityProtectedDataRate", max_integrity_protected_data_rate_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [max_integrity_protected_data_rate]"); + goto end; + } + } + + if (sm_context->always_on_granted) { + if (cJSON_AddBoolToObject(item, "alwaysOnGranted", sm_context->always_on_granted) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [always_on_granted]"); + goto end; + } + } + + if (sm_context->up_security) { + cJSON *up_security_local_JSON = OpenAPI_up_security_convertToJSON(sm_context->up_security); + if (up_security_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [up_security]"); + goto end; + } + cJSON_AddItemToObject(item, "upSecurity", up_security_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [up_security]"); + goto end; + } + } + + if (sm_context->h_smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "hSmfServiceInstanceId", sm_context->h_smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [h_smf_service_instance_id]"); + goto end; + } + } + + if (sm_context->smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "smfServiceInstanceId", sm_context->smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [smf_service_instance_id]"); + goto end; + } + } + + if (sm_context->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", sm_context->recovery_time) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (sm_context->forwarding_ind) { + if (cJSON_AddBoolToObject(item, "forwardingInd", sm_context->forwarding_ind) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [forwarding_ind]"); + goto end; + } + } + + if (sm_context->psa_tunnel_info) { + cJSON *psa_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(sm_context->psa_tunnel_info); + if (psa_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [psa_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "psaTunnelInfo", psa_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [psa_tunnel_info]"); + goto end; + } + } + + if (sm_context->home_provided_charging_id) { + if (cJSON_AddStringToObject(item, "homeProvidedChargingId", sm_context->home_provided_charging_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [home_provided_charging_id]"); + goto end; + } + } + + if (sm_context->charging_info) { + cJSON *charging_info_local_JSON = OpenAPI_charging_information_convertToJSON(sm_context->charging_info); + if (charging_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [charging_info]"); + goto end; + } + cJSON_AddItemToObject(item, "chargingInfo", charging_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [charging_info]"); + goto end; + } + } + + if (sm_context->roaming_charging_profile) { + cJSON *roaming_charging_profile_local_JSON = OpenAPI_roaming_charging_profile_convertToJSON(sm_context->roaming_charging_profile); + if (roaming_charging_profile_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "roamingChargingProfile", roaming_charging_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [roaming_charging_profile]"); + goto end; + } + } + + if (sm_context->nef_ext_buf_support_ind) { + if (cJSON_AddBoolToObject(item, "nefExtBufSupportInd", sm_context->nef_ext_buf_support_ind) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [nef_ext_buf_support_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) +{ + OpenAPI_sm_context_t *sm_context_local_var = NULL; + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pduSessionId"); + if (!pdu_session_id) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [dnn]"); + goto end; + } + + + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [dnn]"); + goto end; + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [s_nssai]"); + goto end; + } + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + + cJSON *hplmn_snssai = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "hplmnSnssai"); + + OpenAPI_snssai_t *hplmn_snssai_local_nonprim = NULL; + if (hplmn_snssai) { + hplmn_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(hplmn_snssai); + } + + cJSON *pdu_session_type = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pduSessionType"); + if (!pdu_session_type) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_type]"); + goto end; + } + + OpenAPI_pdu_session_type_e pdu_session_typeVariable; + + if (!cJSON_IsString(pdu_session_type)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_type]"); + goto end; + } + pdu_session_typeVariable = OpenAPI_pdu_session_type_FromString(pdu_session_type->valuestring); + + cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "gpsi"); + + if (gpsi) { + if (!cJSON_IsString(gpsi)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + cJSON *h_smf_uri = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "hSmfUri"); + + if (h_smf_uri) { + if (!cJSON_IsString(h_smf_uri)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [h_smf_uri]"); + goto end; + } + } + + cJSON *smf_uri = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "smfUri"); + + if (smf_uri) { + if (!cJSON_IsString(smf_uri)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [smf_uri]"); + goto end; + } + } + + cJSON *pdu_session_ref = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pduSessionRef"); + + if (pdu_session_ref) { + if (!cJSON_IsString(pdu_session_ref)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_ref]"); + goto end; + } + } + + cJSON *pcf_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pcfId"); + + if (pcf_id) { + if (!cJSON_IsString(pcf_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + cJSON *pcf_group_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pcfGroupId"); + + if (pcf_group_id) { + if (!cJSON_IsString(pcf_group_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pcf_group_id]"); + goto end; + } + } + + cJSON *pcf_set_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pcfSetId"); + + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + cJSON *sel_mode = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "selMode"); + + OpenAPI_dnn_selection_mode_t *sel_mode_local_nonprim = NULL; + if (sel_mode) { + sel_mode_local_nonprim = OpenAPI_dnn_selection_mode_parseFromJSON(sel_mode); + } + + cJSON *udm_group_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "udmGroupId"); + + if (udm_group_id) { + if (!cJSON_IsString(udm_group_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [udm_group_id]"); + goto end; + } + } + + cJSON *routing_indicator = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "routingIndicator"); + + if (routing_indicator) { + if (!cJSON_IsString(routing_indicator)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [routing_indicator]"); + goto end; + } + } + + cJSON *session_ambr = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "sessionAmbr"); + if (!session_ambr) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [session_ambr]"); + goto end; + } + + OpenAPI_ambr_t *session_ambr_local_nonprim = NULL; + + session_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(session_ambr); + + cJSON *qos_flows_list = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "qosFlowsList"); + if (!qos_flows_list) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [qos_flows_list]"); + goto end; + } + + OpenAPI_list_t *qos_flows_listList; + + cJSON *qos_flows_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_list)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [qos_flows_list]"); + goto end; + } + + qos_flows_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_list_local_nonprimitive, qos_flows_list ) { + if (!cJSON_IsObject(qos_flows_list_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [qos_flows_list]"); + goto end; + } + OpenAPI_qos_flow_setup_item_t *qos_flows_listItem = OpenAPI_qos_flow_setup_item_parseFromJSON(qos_flows_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_listList, qos_flows_listItem); + } + + cJSON *h_smf_instance_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "hSmfInstanceId"); + + if (h_smf_instance_id) { + if (!cJSON_IsString(h_smf_instance_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [h_smf_instance_id]"); + goto end; + } + } + + cJSON *smf_instance_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "smfInstanceId"); + + if (smf_instance_id) { + if (!cJSON_IsString(smf_instance_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [smf_instance_id]"); + goto end; + } + } + + cJSON *enable_pause_charging = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "enablePauseCharging"); + + if (enable_pause_charging) { + if (!cJSON_IsBool(enable_pause_charging)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [enable_pause_charging]"); + goto end; + } + } + + cJSON *ue_ipv4_address = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "ueIpv4Address"); + + if (ue_ipv4_address) { + if (!cJSON_IsString(ue_ipv4_address)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [ue_ipv4_address]"); + goto end; + } + } + + cJSON *ue_ipv6_prefix = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "ueIpv6Prefix"); + + if (ue_ipv6_prefix) { + if (!cJSON_IsString(ue_ipv6_prefix)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [ue_ipv6_prefix]"); + goto end; + } + } + + cJSON *eps_pdn_cnx_info = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "epsPdnCnxInfo"); + + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info_local_nonprim = NULL; + if (eps_pdn_cnx_info) { + eps_pdn_cnx_info_local_nonprim = OpenAPI_eps_pdn_cnx_info_parseFromJSON(eps_pdn_cnx_info); + } + + cJSON *eps_bearer_info = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "epsBearerInfo"); + + OpenAPI_list_t *eps_bearer_infoList; + if (eps_bearer_info) { + cJSON *eps_bearer_info_local_nonprimitive; + if (!cJSON_IsArray(eps_bearer_info)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [eps_bearer_info]"); + goto end; + } + + eps_bearer_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eps_bearer_info_local_nonprimitive, eps_bearer_info ) { + if (!cJSON_IsObject(eps_bearer_info_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [eps_bearer_info]"); + goto end; + } + OpenAPI_eps_bearer_info_t *eps_bearer_infoItem = OpenAPI_eps_bearer_info_parseFromJSON(eps_bearer_info_local_nonprimitive); + + OpenAPI_list_add(eps_bearer_infoList, eps_bearer_infoItem); + } + } + + cJSON *max_integrity_protected_data_rate = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "maxIntegrityProtectedDataRate"); + + OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate_local_nonprim = NULL; + if (max_integrity_protected_data_rate) { + max_integrity_protected_data_rate_local_nonprim = OpenAPI_max_integrity_protected_data_rate_parseFromJSON(max_integrity_protected_data_rate); + } + + cJSON *always_on_granted = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "alwaysOnGranted"); + + if (always_on_granted) { + if (!cJSON_IsBool(always_on_granted)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [always_on_granted]"); + goto end; + } + } + + cJSON *up_security = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "upSecurity"); + + OpenAPI_up_security_t *up_security_local_nonprim = NULL; + if (up_security) { + up_security_local_nonprim = OpenAPI_up_security_parseFromJSON(up_security); + } + + cJSON *h_smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "hSmfServiceInstanceId"); + + if (h_smf_service_instance_id) { + if (!cJSON_IsString(h_smf_service_instance_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [h_smf_service_instance_id]"); + goto end; + } + } + + cJSON *smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "smfServiceInstanceId"); + + if (smf_service_instance_id) { + if (!cJSON_IsString(smf_service_instance_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [smf_service_instance_id]"); + goto end; + } + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + cJSON *forwarding_ind = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "forwardingInd"); + + if (forwarding_ind) { + if (!cJSON_IsBool(forwarding_ind)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [forwarding_ind]"); + goto end; + } + } + + cJSON *psa_tunnel_info = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "psaTunnelInfo"); + + OpenAPI_tunnel_info_t *psa_tunnel_info_local_nonprim = NULL; + if (psa_tunnel_info) { + psa_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(psa_tunnel_info); + } + + cJSON *home_provided_charging_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "homeProvidedChargingId"); + + if (home_provided_charging_id) { + if (!cJSON_IsString(home_provided_charging_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [home_provided_charging_id]"); + goto end; + } + } + + cJSON *charging_info = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "chargingInfo"); + + OpenAPI_charging_information_t *charging_info_local_nonprim = NULL; + if (charging_info) { + charging_info_local_nonprim = OpenAPI_charging_information_parseFromJSON(charging_info); + } + + cJSON *roaming_charging_profile = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "roamingChargingProfile"); + + OpenAPI_roaming_charging_profile_t *roaming_charging_profile_local_nonprim = NULL; + if (roaming_charging_profile) { + roaming_charging_profile_local_nonprim = OpenAPI_roaming_charging_profile_parseFromJSON(roaming_charging_profile); + } + + cJSON *nef_ext_buf_support_ind = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "nefExtBufSupportInd"); + + if (nef_ext_buf_support_ind) { + if (!cJSON_IsBool(nef_ext_buf_support_ind)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [nef_ext_buf_support_ind]"); + goto end; + } + } + + sm_context_local_var = OpenAPI_sm_context_create ( + pdu_session_id->valuedouble, + ogs_strdup(dnn->valuestring), + s_nssai_local_nonprim, + hplmn_snssai ? hplmn_snssai_local_nonprim : NULL, + pdu_session_typeVariable, + gpsi ? ogs_strdup(gpsi->valuestring) : NULL, + h_smf_uri ? ogs_strdup(h_smf_uri->valuestring) : NULL, + smf_uri ? ogs_strdup(smf_uri->valuestring) : NULL, + pdu_session_ref ? ogs_strdup(pdu_session_ref->valuestring) : NULL, + pcf_id ? ogs_strdup(pcf_id->valuestring) : NULL, + pcf_group_id ? ogs_strdup(pcf_group_id->valuestring) : NULL, + pcf_set_id ? ogs_strdup(pcf_set_id->valuestring) : NULL, + sel_mode ? sel_mode_local_nonprim : NULL, + udm_group_id ? ogs_strdup(udm_group_id->valuestring) : NULL, + routing_indicator ? ogs_strdup(routing_indicator->valuestring) : NULL, + session_ambr_local_nonprim, + qos_flows_listList, + h_smf_instance_id ? ogs_strdup(h_smf_instance_id->valuestring) : NULL, + smf_instance_id ? ogs_strdup(smf_instance_id->valuestring) : NULL, + enable_pause_charging ? enable_pause_charging->valueint : 0, + ue_ipv4_address ? ogs_strdup(ue_ipv4_address->valuestring) : NULL, + ue_ipv6_prefix ? ogs_strdup(ue_ipv6_prefix->valuestring) : NULL, + eps_pdn_cnx_info ? eps_pdn_cnx_info_local_nonprim : NULL, + eps_bearer_info ? eps_bearer_infoList : NULL, + max_integrity_protected_data_rate ? max_integrity_protected_data_rate_local_nonprim : NULL, + always_on_granted ? always_on_granted->valueint : 0, + up_security ? up_security_local_nonprim : NULL, + h_smf_service_instance_id ? ogs_strdup(h_smf_service_instance_id->valuestring) : NULL, + smf_service_instance_id ? ogs_strdup(smf_service_instance_id->valuestring) : NULL, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL, + forwarding_ind ? forwarding_ind->valueint : 0, + psa_tunnel_info ? psa_tunnel_info_local_nonprim : NULL, + home_provided_charging_id ? ogs_strdup(home_provided_charging_id->valuestring) : NULL, + charging_info ? charging_info_local_nonprim : NULL, + roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, + nef_ext_buf_support_ind ? nef_ext_buf_support_ind->valueint : 0 + ); + + return sm_context_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_t *OpenAPI_sm_context_copy(OpenAPI_sm_context_t *dst, OpenAPI_sm_context_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_free(dst); + dst = OpenAPI_sm_context_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context.h b/lib/sbi/openapi/model/sm_context.h new file mode 100644 index 000000000..c8948e004 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context.h @@ -0,0 +1,120 @@ +/* + * sm_context.h + * + * + */ + +#ifndef _OpenAPI_sm_context_H_ +#define _OpenAPI_sm_context_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ambr.h" +#include "charging_information.h" +#include "dnn_selection_mode.h" +#include "eps_bearer_info.h" +#include "eps_pdn_cnx_info.h" +#include "max_integrity_protected_data_rate.h" +#include "pdu_session_type.h" +#include "qos_flow_setup_item.h" +#include "roaming_charging_profile.h" +#include "snssai.h" +#include "tunnel_info.h" +#include "up_security.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_s OpenAPI_sm_context_t; +typedef struct OpenAPI_sm_context_s { + int pdu_session_id; + char *dnn; + struct OpenAPI_snssai_s *s_nssai; + struct OpenAPI_snssai_s *hplmn_snssai; + OpenAPI_pdu_session_type_e pdu_session_type; + char *gpsi; + char *h_smf_uri; + char *smf_uri; + char *pdu_session_ref; + char *pcf_id; + char *pcf_group_id; + char *pcf_set_id; + struct OpenAPI_dnn_selection_mode_s *sel_mode; + char *udm_group_id; + char *routing_indicator; + struct OpenAPI_ambr_s *session_ambr; + OpenAPI_list_t *qos_flows_list; + char *h_smf_instance_id; + char *smf_instance_id; + int enable_pause_charging; + char *ue_ipv4_address; + char *ue_ipv6_prefix; + struct OpenAPI_eps_pdn_cnx_info_s *eps_pdn_cnx_info; + OpenAPI_list_t *eps_bearer_info; + struct OpenAPI_max_integrity_protected_data_rate_s *max_integrity_protected_data_rate; + int always_on_granted; + struct OpenAPI_up_security_s *up_security; + char *h_smf_service_instance_id; + char *smf_service_instance_id; + char *recovery_time; + int forwarding_ind; + struct OpenAPI_tunnel_info_s *psa_tunnel_info; + char *home_provided_charging_id; + struct OpenAPI_charging_information_s *charging_info; + struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; + int nef_ext_buf_support_ind; +} OpenAPI_sm_context_t; + +OpenAPI_sm_context_t *OpenAPI_sm_context_create( + int pdu_session_id, + char *dnn, + OpenAPI_snssai_t *s_nssai, + OpenAPI_snssai_t *hplmn_snssai, + OpenAPI_pdu_session_type_e pdu_session_type, + char *gpsi, + char *h_smf_uri, + char *smf_uri, + char *pdu_session_ref, + char *pcf_id, + char *pcf_group_id, + char *pcf_set_id, + OpenAPI_dnn_selection_mode_t *sel_mode, + char *udm_group_id, + char *routing_indicator, + OpenAPI_ambr_t *session_ambr, + OpenAPI_list_t *qos_flows_list, + char *h_smf_instance_id, + char *smf_instance_id, + int enable_pause_charging, + char *ue_ipv4_address, + char *ue_ipv6_prefix, + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, + OpenAPI_list_t *eps_bearer_info, + OpenAPI_max_integrity_protected_data_rate_t *max_integrity_protected_data_rate, + int always_on_granted, + OpenAPI_up_security_t *up_security, + char *h_smf_service_instance_id, + char *smf_service_instance_id, + char *recovery_time, + int forwarding_ind, + OpenAPI_tunnel_info_t *psa_tunnel_info, + char *home_provided_charging_id, + OpenAPI_charging_information_t *charging_info, + OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + int nef_ext_buf_support_ind + ); +void OpenAPI_sm_context_free(OpenAPI_sm_context_t *sm_context); +OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON); +cJSON *OpenAPI_sm_context_convertToJSON(OpenAPI_sm_context_t *sm_context); +OpenAPI_sm_context_t *OpenAPI_sm_context_copy(OpenAPI_sm_context_t *dst, OpenAPI_sm_context_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_create_data.c b/lib/sbi/openapi/model/sm_context_create_data.c new file mode 100644 index 000000000..a4b694657 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_create_data.c @@ -0,0 +1,1609 @@ + +#include +#include +#include +#include "sm_context_create_data.h" + +OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( + char *supi, + int unauthenticated_supi, + char *pei, + char *gpsi, + int pdu_session_id, + char *dnn, + OpenAPI_snssai_t *s_nssai, + OpenAPI_snssai_t *hplmn_snssai, + char *serving_nf_id, + OpenAPI_guami_t *guami, + char *service_name, + OpenAPI_plmn_id_nid_t *serving_network, + OpenAPI_request_type_t *request_type, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_access_type_e an_type, + OpenAPI_access_type_e additional_an_type, + OpenAPI_rat_type_e rat_type, + OpenAPI_presence_state_t *presence_in_ladn, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + char *sm_context_status_uri, + char *h_smf_uri, + char *smf_uri, + OpenAPI_list_t *additional_hsmf_uri, + OpenAPI_list_t *additional_smf_uri, + int old_pdu_session_id, + OpenAPI_list_t *pdu_sessions_activate_list, + char *ue_eps_pdn_connection, + OpenAPI_ho_state_t *ho_state, + char *pcf_id, + char *pcf_group_id, + char *pcf_set_id, + char *nrf_uri, + char *supported_features, + OpenAPI_dnn_selection_mode_t *sel_mode, + OpenAPI_list_t *backup_amf_info, + OpenAPI_trace_data_t *trace_data, + char *udm_group_id, + char *routing_indicator, + OpenAPI_eps_interworking_indication_t *eps_interworking_ind, + int indirect_forwarding_flag, + OpenAPI_ng_ran_target_id_t *target_id, + char *eps_bearer_ctx_status, + int cp_ciot_enabled, + int cp_only_ind, + int invoke_nef, + int ma_request_ind, + int ma_nw_upgrade_ind, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1, + OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1, + char *sm_context_ref, + OpenAPI_up_cnx_state_t *up_cnx_state, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status, + int extended_nas_sm_timer_ind, + int dl_data_waiting_ind, + OpenAPI_ddn_failure_subs_t *ddn_failure_subs, + int smf_transfer_ind, + char *old_smf_id, + char *old_sm_context_ref, + OpenAPI_w_agf_info_t *w_agf_info, + OpenAPI_tngf_info_t *tngf_info, + OpenAPI_twif_info_t *twif_info + ) +{ + OpenAPI_sm_context_create_data_t *sm_context_create_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_create_data_t)); + if (!sm_context_create_data_local_var) { + return NULL; + } + sm_context_create_data_local_var->supi = supi; + sm_context_create_data_local_var->unauthenticated_supi = unauthenticated_supi; + sm_context_create_data_local_var->pei = pei; + sm_context_create_data_local_var->gpsi = gpsi; + sm_context_create_data_local_var->pdu_session_id = pdu_session_id; + sm_context_create_data_local_var->dnn = dnn; + sm_context_create_data_local_var->s_nssai = s_nssai; + sm_context_create_data_local_var->hplmn_snssai = hplmn_snssai; + sm_context_create_data_local_var->serving_nf_id = serving_nf_id; + sm_context_create_data_local_var->guami = guami; + sm_context_create_data_local_var->service_name = service_name; + sm_context_create_data_local_var->serving_network = serving_network; + sm_context_create_data_local_var->request_type = request_type; + sm_context_create_data_local_var->n1_sm_msg = n1_sm_msg; + sm_context_create_data_local_var->an_type = an_type; + sm_context_create_data_local_var->additional_an_type = additional_an_type; + sm_context_create_data_local_var->rat_type = rat_type; + sm_context_create_data_local_var->presence_in_ladn = presence_in_ladn; + sm_context_create_data_local_var->ue_location = ue_location; + sm_context_create_data_local_var->ue_time_zone = ue_time_zone; + sm_context_create_data_local_var->add_ue_location = add_ue_location; + sm_context_create_data_local_var->sm_context_status_uri = sm_context_status_uri; + sm_context_create_data_local_var->h_smf_uri = h_smf_uri; + sm_context_create_data_local_var->smf_uri = smf_uri; + sm_context_create_data_local_var->additional_hsmf_uri = additional_hsmf_uri; + sm_context_create_data_local_var->additional_smf_uri = additional_smf_uri; + sm_context_create_data_local_var->old_pdu_session_id = old_pdu_session_id; + sm_context_create_data_local_var->pdu_sessions_activate_list = pdu_sessions_activate_list; + sm_context_create_data_local_var->ue_eps_pdn_connection = ue_eps_pdn_connection; + sm_context_create_data_local_var->ho_state = ho_state; + sm_context_create_data_local_var->pcf_id = pcf_id; + sm_context_create_data_local_var->pcf_group_id = pcf_group_id; + sm_context_create_data_local_var->pcf_set_id = pcf_set_id; + sm_context_create_data_local_var->nrf_uri = nrf_uri; + sm_context_create_data_local_var->supported_features = supported_features; + sm_context_create_data_local_var->sel_mode = sel_mode; + sm_context_create_data_local_var->backup_amf_info = backup_amf_info; + sm_context_create_data_local_var->trace_data = trace_data; + sm_context_create_data_local_var->udm_group_id = udm_group_id; + sm_context_create_data_local_var->routing_indicator = routing_indicator; + sm_context_create_data_local_var->eps_interworking_ind = eps_interworking_ind; + sm_context_create_data_local_var->indirect_forwarding_flag = indirect_forwarding_flag; + sm_context_create_data_local_var->target_id = target_id; + sm_context_create_data_local_var->eps_bearer_ctx_status = eps_bearer_ctx_status; + sm_context_create_data_local_var->cp_ciot_enabled = cp_ciot_enabled; + sm_context_create_data_local_var->cp_only_ind = cp_only_ind; + sm_context_create_data_local_var->invoke_nef = invoke_nef; + sm_context_create_data_local_var->ma_request_ind = ma_request_ind; + sm_context_create_data_local_var->ma_nw_upgrade_ind = ma_nw_upgrade_ind; + sm_context_create_data_local_var->n2_sm_info = n2_sm_info; + sm_context_create_data_local_var->n2_sm_info_type = n2_sm_info_type; + sm_context_create_data_local_var->n2_sm_info_ext1 = n2_sm_info_ext1; + sm_context_create_data_local_var->n2_sm_info_type_ext1 = n2_sm_info_type_ext1; + sm_context_create_data_local_var->sm_context_ref = sm_context_ref; + sm_context_create_data_local_var->up_cnx_state = up_cnx_state; + sm_context_create_data_local_var->small_data_rate_status = small_data_rate_status; + sm_context_create_data_local_var->apn_rate_status = apn_rate_status; + sm_context_create_data_local_var->extended_nas_sm_timer_ind = extended_nas_sm_timer_ind; + sm_context_create_data_local_var->dl_data_waiting_ind = dl_data_waiting_ind; + sm_context_create_data_local_var->ddn_failure_subs = ddn_failure_subs; + sm_context_create_data_local_var->smf_transfer_ind = smf_transfer_ind; + sm_context_create_data_local_var->old_smf_id = old_smf_id; + sm_context_create_data_local_var->old_sm_context_ref = old_sm_context_ref; + sm_context_create_data_local_var->w_agf_info = w_agf_info; + sm_context_create_data_local_var->tngf_info = tngf_info; + sm_context_create_data_local_var->twif_info = twif_info; + + return sm_context_create_data_local_var; +} + +void OpenAPI_sm_context_create_data_free(OpenAPI_sm_context_create_data_t *sm_context_create_data) +{ + if (NULL == sm_context_create_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(sm_context_create_data->supi); + ogs_free(sm_context_create_data->pei); + ogs_free(sm_context_create_data->gpsi); + ogs_free(sm_context_create_data->dnn); + OpenAPI_snssai_free(sm_context_create_data->s_nssai); + OpenAPI_snssai_free(sm_context_create_data->hplmn_snssai); + ogs_free(sm_context_create_data->serving_nf_id); + OpenAPI_guami_free(sm_context_create_data->guami); + ogs_free(sm_context_create_data->service_name); + OpenAPI_plmn_id_nid_free(sm_context_create_data->serving_network); + OpenAPI_request_type_free(sm_context_create_data->request_type); + OpenAPI_ref_to_binary_data_free(sm_context_create_data->n1_sm_msg); + OpenAPI_presence_state_free(sm_context_create_data->presence_in_ladn); + OpenAPI_user_location_free(sm_context_create_data->ue_location); + ogs_free(sm_context_create_data->ue_time_zone); + OpenAPI_user_location_free(sm_context_create_data->add_ue_location); + ogs_free(sm_context_create_data->sm_context_status_uri); + ogs_free(sm_context_create_data->h_smf_uri); + ogs_free(sm_context_create_data->smf_uri); + OpenAPI_list_for_each(sm_context_create_data->additional_hsmf_uri, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_create_data->additional_hsmf_uri); + OpenAPI_list_for_each(sm_context_create_data->additional_smf_uri, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_create_data->additional_smf_uri); + OpenAPI_list_for_each(sm_context_create_data->pdu_sessions_activate_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_create_data->pdu_sessions_activate_list); + ogs_free(sm_context_create_data->ue_eps_pdn_connection); + OpenAPI_ho_state_free(sm_context_create_data->ho_state); + ogs_free(sm_context_create_data->pcf_id); + ogs_free(sm_context_create_data->pcf_group_id); + ogs_free(sm_context_create_data->pcf_set_id); + ogs_free(sm_context_create_data->nrf_uri); + ogs_free(sm_context_create_data->supported_features); + OpenAPI_dnn_selection_mode_free(sm_context_create_data->sel_mode); + OpenAPI_list_for_each(sm_context_create_data->backup_amf_info, node) { + OpenAPI_backup_amf_info_free(node->data); + } + OpenAPI_list_free(sm_context_create_data->backup_amf_info); + OpenAPI_trace_data_free(sm_context_create_data->trace_data); + ogs_free(sm_context_create_data->udm_group_id); + ogs_free(sm_context_create_data->routing_indicator); + OpenAPI_eps_interworking_indication_free(sm_context_create_data->eps_interworking_ind); + OpenAPI_ng_ran_target_id_free(sm_context_create_data->target_id); + ogs_free(sm_context_create_data->eps_bearer_ctx_status); + OpenAPI_ref_to_binary_data_free(sm_context_create_data->n2_sm_info); + OpenAPI_ref_to_binary_data_free(sm_context_create_data->n2_sm_info_ext1); + ogs_free(sm_context_create_data->sm_context_ref); + OpenAPI_up_cnx_state_free(sm_context_create_data->up_cnx_state); + OpenAPI_small_data_rate_status_free(sm_context_create_data->small_data_rate_status); + OpenAPI_apn_rate_status_free(sm_context_create_data->apn_rate_status); + OpenAPI_ddn_failure_subs_free(sm_context_create_data->ddn_failure_subs); + ogs_free(sm_context_create_data->old_smf_id); + ogs_free(sm_context_create_data->old_sm_context_ref); + OpenAPI_w_agf_info_free(sm_context_create_data->w_agf_info); + OpenAPI_tngf_info_free(sm_context_create_data->tngf_info); + OpenAPI_twif_info_free(sm_context_create_data->twif_info); + ogs_free(sm_context_create_data); +} + +cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_data_t *sm_context_create_data) +{ + cJSON *item = NULL; + + if (sm_context_create_data == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [SmContextCreateData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sm_context_create_data->supi) { + if (cJSON_AddStringToObject(item, "supi", sm_context_create_data->supi) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [supi]"); + goto end; + } + } + + if (sm_context_create_data->unauthenticated_supi) { + if (cJSON_AddBoolToObject(item, "unauthenticatedSupi", sm_context_create_data->unauthenticated_supi) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [unauthenticated_supi]"); + goto end; + } + } + + if (sm_context_create_data->pei) { + if (cJSON_AddStringToObject(item, "pei", sm_context_create_data->pei) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pei]"); + goto end; + } + } + + if (sm_context_create_data->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", sm_context_create_data->gpsi) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (sm_context_create_data->pdu_session_id) { + if (cJSON_AddNumberToObject(item, "pduSessionId", sm_context_create_data->pdu_session_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + } + + if (sm_context_create_data->dnn) { + if (cJSON_AddStringToObject(item, "dnn", sm_context_create_data->dnn) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (sm_context_create_data->s_nssai) { + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(sm_context_create_data->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [s_nssai]"); + goto end; + } + } + + if (sm_context_create_data->hplmn_snssai) { + cJSON *hplmn_snssai_local_JSON = OpenAPI_snssai_convertToJSON(sm_context_create_data->hplmn_snssai); + if (hplmn_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [hplmn_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "hplmnSnssai", hplmn_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [hplmn_snssai]"); + goto end; + } + } + + if (!sm_context_create_data->serving_nf_id) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [serving_nf_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "servingNfId", sm_context_create_data->serving_nf_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [serving_nf_id]"); + goto end; + } + + if (sm_context_create_data->guami) { + cJSON *guami_local_JSON = OpenAPI_guami_convertToJSON(sm_context_create_data->guami); + if (guami_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [guami]"); + goto end; + } + cJSON_AddItemToObject(item, "guami", guami_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [guami]"); + goto end; + } + } + + if (sm_context_create_data->service_name) { + if (cJSON_AddStringToObject(item, "serviceName", sm_context_create_data->service_name) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [service_name]"); + goto end; + } + } + + if (!sm_context_create_data->serving_network) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [serving_network]"); + goto end; + } + cJSON *serving_network_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(sm_context_create_data->serving_network); + if (serving_network_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [serving_network]"); + goto end; + } + cJSON_AddItemToObject(item, "servingNetwork", serving_network_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [serving_network]"); + goto end; + } + + if (sm_context_create_data->request_type) { + cJSON *request_type_local_JSON = OpenAPI_request_type_convertToJSON(sm_context_create_data->request_type); + if (request_type_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [request_type]"); + goto end; + } + cJSON_AddItemToObject(item, "requestType", request_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [request_type]"); + goto end; + } + } + + if (sm_context_create_data->n1_sm_msg) { + cJSON *n1_sm_msg_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_create_data->n1_sm_msg); + if (n1_sm_msg_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmMsg", n1_sm_msg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + } + + if (!sm_context_create_data->an_type) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [an_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "anType", OpenAPI_access_type_ToString(sm_context_create_data->an_type)) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [an_type]"); + goto end; + } + + if (sm_context_create_data->additional_an_type) { + if (cJSON_AddStringToObject(item, "additionalAnType", OpenAPI_access_type_ToString(sm_context_create_data->additional_an_type)) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_an_type]"); + goto end; + } + } + + if (sm_context_create_data->rat_type) { + if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(sm_context_create_data->rat_type)) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [rat_type]"); + goto end; + } + } + + if (sm_context_create_data->presence_in_ladn) { + cJSON *presence_in_ladn_local_JSON = OpenAPI_presence_state_convertToJSON(sm_context_create_data->presence_in_ladn); + if (presence_in_ladn_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [presence_in_ladn]"); + goto end; + } + cJSON_AddItemToObject(item, "presenceInLadn", presence_in_ladn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [presence_in_ladn]"); + goto end; + } + } + + if (sm_context_create_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(sm_context_create_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + + if (sm_context_create_data->ue_time_zone) { + if (cJSON_AddStringToObject(item, "ueTimeZone", sm_context_create_data->ue_time_zone) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ue_time_zone]"); + goto end; + } + } + + if (sm_context_create_data->add_ue_location) { + cJSON *add_ue_location_local_JSON = OpenAPI_user_location_convertToJSON(sm_context_create_data->add_ue_location); + if (add_ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "addUeLocation", add_ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + } + + if (!sm_context_create_data->sm_context_status_uri) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_status_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "smContextStatusUri", sm_context_create_data->sm_context_status_uri) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_status_uri]"); + goto end; + } + + if (sm_context_create_data->h_smf_uri) { + if (cJSON_AddStringToObject(item, "hSmfUri", sm_context_create_data->h_smf_uri) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [h_smf_uri]"); + goto end; + } + } + + if (sm_context_create_data->smf_uri) { + if (cJSON_AddStringToObject(item, "smfUri", sm_context_create_data->smf_uri) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [smf_uri]"); + goto end; + } + } + + if (sm_context_create_data->additional_hsmf_uri) { + cJSON *additional_hsmf_uri = cJSON_AddArrayToObject(item, "additionalHsmfUri"); + if (additional_hsmf_uri == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_hsmf_uri]"); + goto end; + } + + OpenAPI_lnode_t *additional_hsmf_uri_node; + OpenAPI_list_for_each(sm_context_create_data->additional_hsmf_uri, additional_hsmf_uri_node) { + if (cJSON_AddStringToObject(additional_hsmf_uri, "", (char*)additional_hsmf_uri_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_hsmf_uri]"); + goto end; + } + } + } + + if (sm_context_create_data->additional_smf_uri) { + cJSON *additional_smf_uri = cJSON_AddArrayToObject(item, "additionalSmfUri"); + if (additional_smf_uri == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_smf_uri]"); + goto end; + } + + OpenAPI_lnode_t *additional_smf_uri_node; + OpenAPI_list_for_each(sm_context_create_data->additional_smf_uri, additional_smf_uri_node) { + if (cJSON_AddStringToObject(additional_smf_uri, "", (char*)additional_smf_uri_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_smf_uri]"); + goto end; + } + } + } + + if (sm_context_create_data->old_pdu_session_id) { + if (cJSON_AddNumberToObject(item, "oldPduSessionId", sm_context_create_data->old_pdu_session_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [old_pdu_session_id]"); + goto end; + } + } + + if (sm_context_create_data->pdu_sessions_activate_list) { + cJSON *pdu_sessions_activate_list = cJSON_AddArrayToObject(item, "pduSessionsActivateList"); + if (pdu_sessions_activate_list == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pdu_sessions_activate_list]"); + goto end; + } + + OpenAPI_lnode_t *pdu_sessions_activate_list_node; + OpenAPI_list_for_each(sm_context_create_data->pdu_sessions_activate_list, pdu_sessions_activate_list_node) { + if (cJSON_AddNumberToObject(pdu_sessions_activate_list, "", *(double *)pdu_sessions_activate_list_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pdu_sessions_activate_list]"); + goto end; + } + } + } + + if (sm_context_create_data->ue_eps_pdn_connection) { + if (cJSON_AddStringToObject(item, "ueEpsPdnConnection", sm_context_create_data->ue_eps_pdn_connection) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ue_eps_pdn_connection]"); + goto end; + } + } + + if (sm_context_create_data->ho_state) { + cJSON *ho_state_local_JSON = OpenAPI_ho_state_convertToJSON(sm_context_create_data->ho_state); + if (ho_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ho_state]"); + goto end; + } + cJSON_AddItemToObject(item, "hoState", ho_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ho_state]"); + goto end; + } + } + + if (sm_context_create_data->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", sm_context_create_data->pcf_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (sm_context_create_data->pcf_group_id) { + if (cJSON_AddStringToObject(item, "pcfGroupId", sm_context_create_data->pcf_group_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pcf_group_id]"); + goto end; + } + } + + if (sm_context_create_data->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", sm_context_create_data->pcf_set_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (sm_context_create_data->nrf_uri) { + if (cJSON_AddStringToObject(item, "nrfUri", sm_context_create_data->nrf_uri) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [nrf_uri]"); + goto end; + } + } + + if (sm_context_create_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sm_context_create_data->supported_features) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (sm_context_create_data->sel_mode) { + cJSON *sel_mode_local_JSON = OpenAPI_dnn_selection_mode_convertToJSON(sm_context_create_data->sel_mode); + if (sel_mode_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sel_mode]"); + goto end; + } + cJSON_AddItemToObject(item, "selMode", sel_mode_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sel_mode]"); + goto end; + } + } + + if (sm_context_create_data->backup_amf_info) { + cJSON *backup_amf_infoList = cJSON_AddArrayToObject(item, "backupAmfInfo"); + if (backup_amf_infoList == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [backup_amf_info]"); + goto end; + } + + OpenAPI_lnode_t *backup_amf_info_node; + if (sm_context_create_data->backup_amf_info) { + OpenAPI_list_for_each(sm_context_create_data->backup_amf_info, backup_amf_info_node) { + cJSON *itemLocal = OpenAPI_backup_amf_info_convertToJSON(backup_amf_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [backup_amf_info]"); + goto end; + } + cJSON_AddItemToArray(backup_amf_infoList, itemLocal); + } + } + } + + if (sm_context_create_data->trace_data) { + cJSON *trace_data_local_JSON = OpenAPI_trace_data_convertToJSON(sm_context_create_data->trace_data); + if (trace_data_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [trace_data]"); + goto end; + } + cJSON_AddItemToObject(item, "traceData", trace_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [trace_data]"); + goto end; + } + } + + if (sm_context_create_data->udm_group_id) { + if (cJSON_AddStringToObject(item, "udmGroupId", sm_context_create_data->udm_group_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [udm_group_id]"); + goto end; + } + } + + if (sm_context_create_data->routing_indicator) { + if (cJSON_AddStringToObject(item, "routingIndicator", sm_context_create_data->routing_indicator) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [routing_indicator]"); + goto end; + } + } + + if (sm_context_create_data->eps_interworking_ind) { + cJSON *eps_interworking_ind_local_JSON = OpenAPI_eps_interworking_indication_convertToJSON(sm_context_create_data->eps_interworking_ind); + if (eps_interworking_ind_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [eps_interworking_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "epsInterworkingInd", eps_interworking_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [eps_interworking_ind]"); + goto end; + } + } + + if (sm_context_create_data->indirect_forwarding_flag) { + if (cJSON_AddBoolToObject(item, "indirectForwardingFlag", sm_context_create_data->indirect_forwarding_flag) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [indirect_forwarding_flag]"); + goto end; + } + } + + if (sm_context_create_data->target_id) { + cJSON *target_id_local_JSON = OpenAPI_ng_ran_target_id_convertToJSON(sm_context_create_data->target_id); + if (target_id_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [target_id]"); + goto end; + } + cJSON_AddItemToObject(item, "targetId", target_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [target_id]"); + goto end; + } + } + + if (sm_context_create_data->eps_bearer_ctx_status) { + if (cJSON_AddStringToObject(item, "epsBearerCtxStatus", sm_context_create_data->eps_bearer_ctx_status) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [eps_bearer_ctx_status]"); + goto end; + } + } + + if (sm_context_create_data->cp_ciot_enabled) { + if (cJSON_AddBoolToObject(item, "cpCiotEnabled", sm_context_create_data->cp_ciot_enabled) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [cp_ciot_enabled]"); + goto end; + } + } + + if (sm_context_create_data->cp_only_ind) { + if (cJSON_AddBoolToObject(item, "cpOnlyInd", sm_context_create_data->cp_only_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [cp_only_ind]"); + goto end; + } + } + + if (sm_context_create_data->invoke_nef) { + if (cJSON_AddBoolToObject(item, "invokeNef", sm_context_create_data->invoke_nef) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [invoke_nef]"); + goto end; + } + } + + if (sm_context_create_data->ma_request_ind) { + if (cJSON_AddBoolToObject(item, "maRequestInd", sm_context_create_data->ma_request_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ma_request_ind]"); + goto end; + } + } + + if (sm_context_create_data->ma_nw_upgrade_ind) { + if (cJSON_AddBoolToObject(item, "maNwUpgradeInd", sm_context_create_data->ma_nw_upgrade_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ma_nw_upgrade_ind]"); + goto end; + } + } + + if (sm_context_create_data->n2_sm_info) { + cJSON *n2_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_create_data->n2_sm_info); + if (n2_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfo", n2_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + } + + if (sm_context_create_data->n2_sm_info_type) { + if (cJSON_AddStringToObject(item, "n2SmInfoType", OpenAPI_n2_sm_info_type_ToString(sm_context_create_data->n2_sm_info_type)) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [n2_sm_info_type]"); + goto end; + } + } + + if (sm_context_create_data->n2_sm_info_ext1) { + cJSON *n2_sm_info_ext1_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_create_data->n2_sm_info_ext1); + if (n2_sm_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [n2_sm_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfoExt1", n2_sm_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [n2_sm_info_ext1]"); + goto end; + } + } + + if (sm_context_create_data->n2_sm_info_type_ext1) { + if (cJSON_AddStringToObject(item, "n2SmInfoTypeExt1", OpenAPI_n2_sm_info_type_ToString(sm_context_create_data->n2_sm_info_type_ext1)) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [n2_sm_info_type_ext1]"); + goto end; + } + } + + if (sm_context_create_data->sm_context_ref) { + if (cJSON_AddStringToObject(item, "smContextRef", sm_context_create_data->sm_context_ref) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_ref]"); + goto end; + } + } + + if (sm_context_create_data->up_cnx_state) { + cJSON *up_cnx_state_local_JSON = OpenAPI_up_cnx_state_convertToJSON(sm_context_create_data->up_cnx_state); + if (up_cnx_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + cJSON_AddItemToObject(item, "upCnxState", up_cnx_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + } + + if (sm_context_create_data->small_data_rate_status) { + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(sm_context_create_data->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "smallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + } + + if (sm_context_create_data->apn_rate_status) { + cJSON *apn_rate_status_local_JSON = OpenAPI_apn_rate_status_convertToJSON(sm_context_create_data->apn_rate_status); + if (apn_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "apnRateStatus", apn_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + } + + if (sm_context_create_data->extended_nas_sm_timer_ind) { + if (cJSON_AddBoolToObject(item, "extendedNasSmTimerInd", sm_context_create_data->extended_nas_sm_timer_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [extended_nas_sm_timer_ind]"); + goto end; + } + } + + if (sm_context_create_data->dl_data_waiting_ind) { + if (cJSON_AddBoolToObject(item, "dlDataWaitingInd", sm_context_create_data->dl_data_waiting_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [dl_data_waiting_ind]"); + goto end; + } + } + + if (sm_context_create_data->ddn_failure_subs) { + cJSON *ddn_failure_subs_local_JSON = OpenAPI_ddn_failure_subs_convertToJSON(sm_context_create_data->ddn_failure_subs); + if (ddn_failure_subs_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ddn_failure_subs]"); + goto end; + } + cJSON_AddItemToObject(item, "ddnFailureSubs", ddn_failure_subs_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [ddn_failure_subs]"); + goto end; + } + } + + if (sm_context_create_data->smf_transfer_ind) { + if (cJSON_AddBoolToObject(item, "smfTransferInd", sm_context_create_data->smf_transfer_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [smf_transfer_ind]"); + goto end; + } + } + + if (sm_context_create_data->old_smf_id) { + if (cJSON_AddStringToObject(item, "oldSmfId", sm_context_create_data->old_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [old_smf_id]"); + goto end; + } + } + + if (sm_context_create_data->old_sm_context_ref) { + if (cJSON_AddStringToObject(item, "oldSmContextRef", sm_context_create_data->old_sm_context_ref) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [old_sm_context_ref]"); + goto end; + } + } + + if (sm_context_create_data->w_agf_info) { + cJSON *w_agf_info_local_JSON = OpenAPI_w_agf_info_convertToJSON(sm_context_create_data->w_agf_info); + if (w_agf_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [w_agf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "wAgfInfo", w_agf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [w_agf_info]"); + goto end; + } + } + + if (sm_context_create_data->tngf_info) { + cJSON *tngf_info_local_JSON = OpenAPI_tngf_info_convertToJSON(sm_context_create_data->tngf_info); + if (tngf_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [tngf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "tngfInfo", tngf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [tngf_info]"); + goto end; + } + } + + if (sm_context_create_data->twif_info) { + cJSON *twif_info_local_JSON = OpenAPI_twif_info_convertToJSON(sm_context_create_data->twif_info); + if (twif_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [twif_info]"); + goto end; + } + cJSON_AddItemToObject(item, "twifInfo", twif_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [twif_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(cJSON *sm_context_create_dataJSON) +{ + OpenAPI_sm_context_create_data_t *sm_context_create_data_local_var = NULL; + cJSON *supi = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "supi"); + + if (supi) { + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [supi]"); + goto end; + } + } + + cJSON *unauthenticated_supi = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "unauthenticatedSupi"); + + if (unauthenticated_supi) { + if (!cJSON_IsBool(unauthenticated_supi)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [unauthenticated_supi]"); + goto end; + } + } + + cJSON *pei = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "pei"); + + if (pei) { + if (!cJSON_IsString(pei)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pei]"); + goto end; + } + } + + cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "gpsi"); + + if (gpsi) { + if (!cJSON_IsString(gpsi)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "pduSessionId"); + + if (pdu_session_id) { + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + } + + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "dnn"); + + if (dnn) { + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [dnn]"); + goto end; + } + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "sNssai"); + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + if (s_nssai) { + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + } + + cJSON *hplmn_snssai = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "hplmnSnssai"); + + OpenAPI_snssai_t *hplmn_snssai_local_nonprim = NULL; + if (hplmn_snssai) { + hplmn_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(hplmn_snssai); + } + + cJSON *serving_nf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "servingNfId"); + if (!serving_nf_id) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [serving_nf_id]"); + goto end; + } + + + if (!cJSON_IsString(serving_nf_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [serving_nf_id]"); + goto end; + } + + cJSON *guami = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "guami"); + + OpenAPI_guami_t *guami_local_nonprim = NULL; + if (guami) { + guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami); + } + + cJSON *service_name = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "serviceName"); + + if (service_name) { + if (!cJSON_IsString(service_name)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [service_name]"); + goto end; + } + } + + cJSON *serving_network = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "servingNetwork"); + if (!serving_network) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [serving_network]"); + goto end; + } + + OpenAPI_plmn_id_nid_t *serving_network_local_nonprim = NULL; + + serving_network_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(serving_network); + + cJSON *request_type = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "requestType"); + + OpenAPI_request_type_t *request_type_local_nonprim = NULL; + if (request_type) { + request_type_local_nonprim = OpenAPI_request_type_parseFromJSON(request_type); + } + + cJSON *n1_sm_msg = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "n1SmMsg"); + + OpenAPI_ref_to_binary_data_t *n1_sm_msg_local_nonprim = NULL; + if (n1_sm_msg) { + n1_sm_msg_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_msg); + } + + cJSON *an_type = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "anType"); + if (!an_type) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [an_type]"); + goto end; + } + + OpenAPI_access_type_e an_typeVariable; + + if (!cJSON_IsString(an_type)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [an_type]"); + goto end; + } + an_typeVariable = OpenAPI_access_type_FromString(an_type->valuestring); + + cJSON *additional_an_type = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "additionalAnType"); + + OpenAPI_access_type_e additional_an_typeVariable; + if (additional_an_type) { + if (!cJSON_IsString(additional_an_type)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_an_type]"); + goto end; + } + additional_an_typeVariable = OpenAPI_access_type_FromString(additional_an_type->valuestring); + } + + cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "ratType"); + + OpenAPI_rat_type_e rat_typeVariable; + if (rat_type) { + if (!cJSON_IsString(rat_type)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [rat_type]"); + goto end; + } + rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); + } + + cJSON *presence_in_ladn = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "presenceInLadn"); + + OpenAPI_presence_state_t *presence_in_ladn_local_nonprim = NULL; + if (presence_in_ladn) { + presence_in_ladn_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_in_ladn); + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "ueTimeZone"); + + if (ue_time_zone) { + if (!cJSON_IsString(ue_time_zone)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [ue_time_zone]"); + goto end; + } + } + + cJSON *add_ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "addUeLocation"); + + OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL; + if (add_ue_location) { + add_ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(add_ue_location); + } + + cJSON *sm_context_status_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextStatusUri"); + if (!sm_context_status_uri) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_context_status_uri]"); + goto end; + } + + + if (!cJSON_IsString(sm_context_status_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_context_status_uri]"); + goto end; + } + + cJSON *h_smf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "hSmfUri"); + + if (h_smf_uri) { + if (!cJSON_IsString(h_smf_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [h_smf_uri]"); + goto end; + } + } + + cJSON *smf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smfUri"); + + if (smf_uri) { + if (!cJSON_IsString(smf_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [smf_uri]"); + goto end; + } + } + + cJSON *additional_hsmf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "additionalHsmfUri"); + + OpenAPI_list_t *additional_hsmf_uriList; + if (additional_hsmf_uri) { + cJSON *additional_hsmf_uri_local; + if (!cJSON_IsArray(additional_hsmf_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_hsmf_uri]"); + goto end; + } + additional_hsmf_uriList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_hsmf_uri_local, additional_hsmf_uri) { + if (!cJSON_IsString(additional_hsmf_uri_local)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_hsmf_uri]"); + goto end; + } + OpenAPI_list_add(additional_hsmf_uriList, ogs_strdup(additional_hsmf_uri_local->valuestring)); + } + } + + cJSON *additional_smf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "additionalSmfUri"); + + OpenAPI_list_t *additional_smf_uriList; + if (additional_smf_uri) { + cJSON *additional_smf_uri_local; + if (!cJSON_IsArray(additional_smf_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_smf_uri]"); + goto end; + } + additional_smf_uriList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_smf_uri_local, additional_smf_uri) { + if (!cJSON_IsString(additional_smf_uri_local)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_smf_uri]"); + goto end; + } + OpenAPI_list_add(additional_smf_uriList, ogs_strdup(additional_smf_uri_local->valuestring)); + } + } + + cJSON *old_pdu_session_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "oldPduSessionId"); + + if (old_pdu_session_id) { + if (!cJSON_IsNumber(old_pdu_session_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [old_pdu_session_id]"); + goto end; + } + } + + cJSON *pdu_sessions_activate_list = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "pduSessionsActivateList"); + + OpenAPI_list_t *pdu_sessions_activate_listList; + if (pdu_sessions_activate_list) { + cJSON *pdu_sessions_activate_list_local; + if (!cJSON_IsArray(pdu_sessions_activate_list)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pdu_sessions_activate_list]"); + goto end; + } + pdu_sessions_activate_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pdu_sessions_activate_list_local, pdu_sessions_activate_list) { + if (!cJSON_IsNumber(pdu_sessions_activate_list_local)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pdu_sessions_activate_list]"); + goto end; + } + OpenAPI_list_add(pdu_sessions_activate_listList, &pdu_sessions_activate_list_local->valuedouble); + } + } + + cJSON *ue_eps_pdn_connection = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "ueEpsPdnConnection"); + + if (ue_eps_pdn_connection) { + if (!cJSON_IsString(ue_eps_pdn_connection)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [ue_eps_pdn_connection]"); + goto end; + } + } + + cJSON *ho_state = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "hoState"); + + OpenAPI_ho_state_t *ho_state_local_nonprim = NULL; + if (ho_state) { + ho_state_local_nonprim = OpenAPI_ho_state_parseFromJSON(ho_state); + } + + cJSON *pcf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "pcfId"); + + if (pcf_id) { + if (!cJSON_IsString(pcf_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + cJSON *pcf_group_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "pcfGroupId"); + + if (pcf_group_id) { + if (!cJSON_IsString(pcf_group_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pcf_group_id]"); + goto end; + } + } + + cJSON *pcf_set_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "pcfSetId"); + + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + cJSON *nrf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "nrfUri"); + + if (nrf_uri) { + if (!cJSON_IsString(nrf_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [nrf_uri]"); + goto end; + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *sel_mode = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "selMode"); + + OpenAPI_dnn_selection_mode_t *sel_mode_local_nonprim = NULL; + if (sel_mode) { + sel_mode_local_nonprim = OpenAPI_dnn_selection_mode_parseFromJSON(sel_mode); + } + + cJSON *backup_amf_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "backupAmfInfo"); + + OpenAPI_list_t *backup_amf_infoList; + if (backup_amf_info) { + cJSON *backup_amf_info_local_nonprimitive; + if (!cJSON_IsArray(backup_amf_info)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [backup_amf_info]"); + goto end; + } + + backup_amf_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(backup_amf_info_local_nonprimitive, backup_amf_info ) { + if (!cJSON_IsObject(backup_amf_info_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [backup_amf_info]"); + goto end; + } + OpenAPI_backup_amf_info_t *backup_amf_infoItem = OpenAPI_backup_amf_info_parseFromJSON(backup_amf_info_local_nonprimitive); + + OpenAPI_list_add(backup_amf_infoList, backup_amf_infoItem); + } + } + + cJSON *trace_data = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "traceData"); + + OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; + if (trace_data) { + trace_data_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_data); + } + + cJSON *udm_group_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "udmGroupId"); + + if (udm_group_id) { + if (!cJSON_IsString(udm_group_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [udm_group_id]"); + goto end; + } + } + + cJSON *routing_indicator = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "routingIndicator"); + + if (routing_indicator) { + if (!cJSON_IsString(routing_indicator)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [routing_indicator]"); + goto end; + } + } + + cJSON *eps_interworking_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "epsInterworkingInd"); + + OpenAPI_eps_interworking_indication_t *eps_interworking_ind_local_nonprim = NULL; + if (eps_interworking_ind) { + eps_interworking_ind_local_nonprim = OpenAPI_eps_interworking_indication_parseFromJSON(eps_interworking_ind); + } + + cJSON *indirect_forwarding_flag = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "indirectForwardingFlag"); + + if (indirect_forwarding_flag) { + if (!cJSON_IsBool(indirect_forwarding_flag)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [indirect_forwarding_flag]"); + goto end; + } + } + + cJSON *target_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "targetId"); + + OpenAPI_ng_ran_target_id_t *target_id_local_nonprim = NULL; + if (target_id) { + target_id_local_nonprim = OpenAPI_ng_ran_target_id_parseFromJSON(target_id); + } + + cJSON *eps_bearer_ctx_status = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "epsBearerCtxStatus"); + + if (eps_bearer_ctx_status) { + if (!cJSON_IsString(eps_bearer_ctx_status)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [eps_bearer_ctx_status]"); + goto end; + } + } + + cJSON *cp_ciot_enabled = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "cpCiotEnabled"); + + if (cp_ciot_enabled) { + if (!cJSON_IsBool(cp_ciot_enabled)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [cp_ciot_enabled]"); + goto end; + } + } + + cJSON *cp_only_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "cpOnlyInd"); + + if (cp_only_ind) { + if (!cJSON_IsBool(cp_only_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [cp_only_ind]"); + goto end; + } + } + + cJSON *invoke_nef = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "invokeNef"); + + if (invoke_nef) { + if (!cJSON_IsBool(invoke_nef)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [invoke_nef]"); + goto end; + } + } + + cJSON *ma_request_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "maRequestInd"); + + if (ma_request_ind) { + if (!cJSON_IsBool(ma_request_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [ma_request_ind]"); + goto end; + } + } + + cJSON *ma_nw_upgrade_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "maNwUpgradeInd"); + + if (ma_nw_upgrade_ind) { + if (!cJSON_IsBool(ma_nw_upgrade_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [ma_nw_upgrade_ind]"); + goto end; + } + } + + cJSON *n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "n2SmInfo"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL; + if (n2_sm_info) { + n2_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info); + } + + cJSON *n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "n2SmInfoType"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable; + if (n2_sm_info_type) { + if (!cJSON_IsString(n2_sm_info_type)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [n2_sm_info_type]"); + goto end; + } + n2_sm_info_typeVariable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type->valuestring); + } + + cJSON *n2_sm_info_ext1 = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "n2SmInfoExt1"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1_local_nonprim = NULL; + if (n2_sm_info_ext1) { + n2_sm_info_ext1_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info_ext1); + } + + cJSON *n2_sm_info_type_ext1 = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "n2SmInfoTypeExt1"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1Variable; + if (n2_sm_info_type_ext1) { + if (!cJSON_IsString(n2_sm_info_type_ext1)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [n2_sm_info_type_ext1]"); + goto end; + } + n2_sm_info_type_ext1Variable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type_ext1->valuestring); + } + + cJSON *sm_context_ref = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextRef"); + + if (sm_context_ref) { + if (!cJSON_IsString(sm_context_ref)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_context_ref]"); + goto end; + } + } + + cJSON *up_cnx_state = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "upCnxState"); + + OpenAPI_up_cnx_state_t *up_cnx_state_local_nonprim = NULL; + if (up_cnx_state) { + up_cnx_state_local_nonprim = OpenAPI_up_cnx_state_parseFromJSON(up_cnx_state); + } + + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smallDataRateStatus"); + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + if (small_data_rate_status) { + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + } + + cJSON *apn_rate_status = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "apnRateStatus"); + + OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; + if (apn_rate_status) { + apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); + } + + cJSON *extended_nas_sm_timer_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "extendedNasSmTimerInd"); + + if (extended_nas_sm_timer_ind) { + if (!cJSON_IsBool(extended_nas_sm_timer_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [extended_nas_sm_timer_ind]"); + goto end; + } + } + + cJSON *dl_data_waiting_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "dlDataWaitingInd"); + + if (dl_data_waiting_ind) { + if (!cJSON_IsBool(dl_data_waiting_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [dl_data_waiting_ind]"); + goto end; + } + } + + cJSON *ddn_failure_subs = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "ddnFailureSubs"); + + OpenAPI_ddn_failure_subs_t *ddn_failure_subs_local_nonprim = NULL; + if (ddn_failure_subs) { + ddn_failure_subs_local_nonprim = OpenAPI_ddn_failure_subs_parseFromJSON(ddn_failure_subs); + } + + cJSON *smf_transfer_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smfTransferInd"); + + if (smf_transfer_ind) { + if (!cJSON_IsBool(smf_transfer_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [smf_transfer_ind]"); + goto end; + } + } + + cJSON *old_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "oldSmfId"); + + if (old_smf_id) { + if (!cJSON_IsString(old_smf_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [old_smf_id]"); + goto end; + } + } + + cJSON *old_sm_context_ref = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "oldSmContextRef"); + + if (old_sm_context_ref) { + if (!cJSON_IsString(old_sm_context_ref)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [old_sm_context_ref]"); + goto end; + } + } + + cJSON *w_agf_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "wAgfInfo"); + + OpenAPI_w_agf_info_t *w_agf_info_local_nonprim = NULL; + if (w_agf_info) { + w_agf_info_local_nonprim = OpenAPI_w_agf_info_parseFromJSON(w_agf_info); + } + + cJSON *tngf_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "tngfInfo"); + + OpenAPI_tngf_info_t *tngf_info_local_nonprim = NULL; + if (tngf_info) { + tngf_info_local_nonprim = OpenAPI_tngf_info_parseFromJSON(tngf_info); + } + + cJSON *twif_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "twifInfo"); + + OpenAPI_twif_info_t *twif_info_local_nonprim = NULL; + if (twif_info) { + twif_info_local_nonprim = OpenAPI_twif_info_parseFromJSON(twif_info); + } + + sm_context_create_data_local_var = OpenAPI_sm_context_create_data_create ( + supi ? ogs_strdup(supi->valuestring) : NULL, + unauthenticated_supi ? unauthenticated_supi->valueint : 0, + pei ? ogs_strdup(pei->valuestring) : NULL, + gpsi ? ogs_strdup(gpsi->valuestring) : NULL, + pdu_session_id ? pdu_session_id->valuedouble : 0, + dnn ? ogs_strdup(dnn->valuestring) : NULL, + s_nssai ? s_nssai_local_nonprim : NULL, + hplmn_snssai ? hplmn_snssai_local_nonprim : NULL, + ogs_strdup(serving_nf_id->valuestring), + guami ? guami_local_nonprim : NULL, + service_name ? ogs_strdup(service_name->valuestring) : NULL, + serving_network_local_nonprim, + request_type ? request_type_local_nonprim : NULL, + n1_sm_msg ? n1_sm_msg_local_nonprim : NULL, + an_typeVariable, + additional_an_type ? additional_an_typeVariable : 0, + rat_type ? rat_typeVariable : 0, + presence_in_ladn ? presence_in_ladn_local_nonprim : NULL, + ue_location ? ue_location_local_nonprim : NULL, + ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL, + add_ue_location ? add_ue_location_local_nonprim : NULL, + ogs_strdup(sm_context_status_uri->valuestring), + h_smf_uri ? ogs_strdup(h_smf_uri->valuestring) : NULL, + smf_uri ? ogs_strdup(smf_uri->valuestring) : NULL, + additional_hsmf_uri ? additional_hsmf_uriList : NULL, + additional_smf_uri ? additional_smf_uriList : NULL, + old_pdu_session_id ? old_pdu_session_id->valuedouble : 0, + pdu_sessions_activate_list ? pdu_sessions_activate_listList : NULL, + ue_eps_pdn_connection ? ogs_strdup(ue_eps_pdn_connection->valuestring) : NULL, + ho_state ? ho_state_local_nonprim : NULL, + pcf_id ? ogs_strdup(pcf_id->valuestring) : NULL, + pcf_group_id ? ogs_strdup(pcf_group_id->valuestring) : NULL, + pcf_set_id ? ogs_strdup(pcf_set_id->valuestring) : NULL, + nrf_uri ? ogs_strdup(nrf_uri->valuestring) : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + sel_mode ? sel_mode_local_nonprim : NULL, + backup_amf_info ? backup_amf_infoList : NULL, + trace_data ? trace_data_local_nonprim : NULL, + udm_group_id ? ogs_strdup(udm_group_id->valuestring) : NULL, + routing_indicator ? ogs_strdup(routing_indicator->valuestring) : NULL, + eps_interworking_ind ? eps_interworking_ind_local_nonprim : NULL, + indirect_forwarding_flag ? indirect_forwarding_flag->valueint : 0, + target_id ? target_id_local_nonprim : NULL, + eps_bearer_ctx_status ? ogs_strdup(eps_bearer_ctx_status->valuestring) : NULL, + cp_ciot_enabled ? cp_ciot_enabled->valueint : 0, + cp_only_ind ? cp_only_ind->valueint : 0, + invoke_nef ? invoke_nef->valueint : 0, + ma_request_ind ? ma_request_ind->valueint : 0, + ma_nw_upgrade_ind ? ma_nw_upgrade_ind->valueint : 0, + n2_sm_info ? n2_sm_info_local_nonprim : NULL, + n2_sm_info_type ? n2_sm_info_typeVariable : 0, + n2_sm_info_ext1 ? n2_sm_info_ext1_local_nonprim : NULL, + n2_sm_info_type_ext1 ? n2_sm_info_type_ext1Variable : 0, + sm_context_ref ? ogs_strdup(sm_context_ref->valuestring) : NULL, + up_cnx_state ? up_cnx_state_local_nonprim : NULL, + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, + apn_rate_status ? apn_rate_status_local_nonprim : NULL, + extended_nas_sm_timer_ind ? extended_nas_sm_timer_ind->valueint : 0, + dl_data_waiting_ind ? dl_data_waiting_ind->valueint : 0, + ddn_failure_subs ? ddn_failure_subs_local_nonprim : NULL, + smf_transfer_ind ? smf_transfer_ind->valueint : 0, + old_smf_id ? ogs_strdup(old_smf_id->valuestring) : NULL, + old_sm_context_ref ? ogs_strdup(old_sm_context_ref->valuestring) : NULL, + w_agf_info ? w_agf_info_local_nonprim : NULL, + tngf_info ? tngf_info_local_nonprim : NULL, + twif_info ? twif_info_local_nonprim : NULL + ); + + return sm_context_create_data_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_copy(OpenAPI_sm_context_create_data_t *dst, OpenAPI_sm_context_create_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_create_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_create_data_free(dst); + dst = OpenAPI_sm_context_create_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_create_data.h b/lib/sbi/openapi/model/sm_context_create_data.h new file mode 100644 index 000000000..e0af23197 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_create_data.h @@ -0,0 +1,191 @@ +/* + * sm_context_create_data.h + * + * + */ + +#ifndef _OpenAPI_sm_context_create_data_H_ +#define _OpenAPI_sm_context_create_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "apn_rate_status.h" +#include "backup_amf_info.h" +#include "ddn_failure_subs.h" +#include "dnn_selection_mode.h" +#include "eps_interworking_indication.h" +#include "guami.h" +#include "ho_state.h" +#include "n2_sm_info_type.h" +#include "ng_ran_target_id.h" +#include "plmn_id_nid.h" +#include "presence_state.h" +#include "rat_type.h" +#include "ref_to_binary_data.h" +#include "request_type.h" +#include "small_data_rate_status.h" +#include "snssai.h" +#include "tngf_info.h" +#include "trace_data.h" +#include "twif_info.h" +#include "up_cnx_state.h" +#include "user_location.h" +#include "w_agf_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_create_data_s OpenAPI_sm_context_create_data_t; +typedef struct OpenAPI_sm_context_create_data_s { + char *supi; + int unauthenticated_supi; + char *pei; + char *gpsi; + int pdu_session_id; + char *dnn; + struct OpenAPI_snssai_s *s_nssai; + struct OpenAPI_snssai_s *hplmn_snssai; + char *serving_nf_id; + struct OpenAPI_guami_s *guami; + char *service_name; + struct OpenAPI_plmn_id_nid_s *serving_network; + struct OpenAPI_request_type_s *request_type; + struct OpenAPI_ref_to_binary_data_s *n1_sm_msg; + OpenAPI_access_type_e an_type; + OpenAPI_access_type_e additional_an_type; + OpenAPI_rat_type_e rat_type; + struct OpenAPI_presence_state_s *presence_in_ladn; + struct OpenAPI_user_location_s *ue_location; + char *ue_time_zone; + struct OpenAPI_user_location_s *add_ue_location; + char *sm_context_status_uri; + char *h_smf_uri; + char *smf_uri; + OpenAPI_list_t *additional_hsmf_uri; + OpenAPI_list_t *additional_smf_uri; + int old_pdu_session_id; + OpenAPI_list_t *pdu_sessions_activate_list; + char *ue_eps_pdn_connection; + struct OpenAPI_ho_state_s *ho_state; + char *pcf_id; + char *pcf_group_id; + char *pcf_set_id; + char *nrf_uri; + char *supported_features; + struct OpenAPI_dnn_selection_mode_s *sel_mode; + OpenAPI_list_t *backup_amf_info; + struct OpenAPI_trace_data_s *trace_data; + char *udm_group_id; + char *routing_indicator; + struct OpenAPI_eps_interworking_indication_s *eps_interworking_ind; + int indirect_forwarding_flag; + struct OpenAPI_ng_ran_target_id_s *target_id; + char *eps_bearer_ctx_status; + int cp_ciot_enabled; + int cp_only_ind; + int invoke_nef; + int ma_request_ind; + int ma_nw_upgrade_ind; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info; + OpenAPI_n2_sm_info_type_e n2_sm_info_type; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info_ext1; + OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1; + char *sm_context_ref; + struct OpenAPI_up_cnx_state_s *up_cnx_state; + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; + struct OpenAPI_apn_rate_status_s *apn_rate_status; + int extended_nas_sm_timer_ind; + int dl_data_waiting_ind; + struct OpenAPI_ddn_failure_subs_s *ddn_failure_subs; + int smf_transfer_ind; + char *old_smf_id; + char *old_sm_context_ref; + struct OpenAPI_w_agf_info_s *w_agf_info; + struct OpenAPI_tngf_info_s *tngf_info; + struct OpenAPI_twif_info_s *twif_info; +} OpenAPI_sm_context_create_data_t; + +OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( + char *supi, + int unauthenticated_supi, + char *pei, + char *gpsi, + int pdu_session_id, + char *dnn, + OpenAPI_snssai_t *s_nssai, + OpenAPI_snssai_t *hplmn_snssai, + char *serving_nf_id, + OpenAPI_guami_t *guami, + char *service_name, + OpenAPI_plmn_id_nid_t *serving_network, + OpenAPI_request_type_t *request_type, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_access_type_e an_type, + OpenAPI_access_type_e additional_an_type, + OpenAPI_rat_type_e rat_type, + OpenAPI_presence_state_t *presence_in_ladn, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + char *sm_context_status_uri, + char *h_smf_uri, + char *smf_uri, + OpenAPI_list_t *additional_hsmf_uri, + OpenAPI_list_t *additional_smf_uri, + int old_pdu_session_id, + OpenAPI_list_t *pdu_sessions_activate_list, + char *ue_eps_pdn_connection, + OpenAPI_ho_state_t *ho_state, + char *pcf_id, + char *pcf_group_id, + char *pcf_set_id, + char *nrf_uri, + char *supported_features, + OpenAPI_dnn_selection_mode_t *sel_mode, + OpenAPI_list_t *backup_amf_info, + OpenAPI_trace_data_t *trace_data, + char *udm_group_id, + char *routing_indicator, + OpenAPI_eps_interworking_indication_t *eps_interworking_ind, + int indirect_forwarding_flag, + OpenAPI_ng_ran_target_id_t *target_id, + char *eps_bearer_ctx_status, + int cp_ciot_enabled, + int cp_only_ind, + int invoke_nef, + int ma_request_ind, + int ma_nw_upgrade_ind, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1, + OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1, + char *sm_context_ref, + OpenAPI_up_cnx_state_t *up_cnx_state, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status, + int extended_nas_sm_timer_ind, + int dl_data_waiting_ind, + OpenAPI_ddn_failure_subs_t *ddn_failure_subs, + int smf_transfer_ind, + char *old_smf_id, + char *old_sm_context_ref, + OpenAPI_w_agf_info_t *w_agf_info, + OpenAPI_tngf_info_t *tngf_info, + OpenAPI_twif_info_t *twif_info + ); +void OpenAPI_sm_context_create_data_free(OpenAPI_sm_context_create_data_t *sm_context_create_data); +OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(cJSON *sm_context_create_dataJSON); +cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_data_t *sm_context_create_data); +OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_copy(OpenAPI_sm_context_create_data_t *dst, OpenAPI_sm_context_create_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_create_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_create_error.c b/lib/sbi/openapi/model/sm_context_create_error.c new file mode 100644 index 000000000..a35550d48 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_create_error.c @@ -0,0 +1,158 @@ + +#include +#include +#include +#include "sm_context_create_error.h" + +OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + char *recovery_time + ) +{ + OpenAPI_sm_context_create_error_t *sm_context_create_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_create_error_t)); + if (!sm_context_create_error_local_var) { + return NULL; + } + sm_context_create_error_local_var->error = error; + sm_context_create_error_local_var->n1_sm_msg = n1_sm_msg; + sm_context_create_error_local_var->recovery_time = recovery_time; + + return sm_context_create_error_local_var; +} + +void OpenAPI_sm_context_create_error_free(OpenAPI_sm_context_create_error_t *sm_context_create_error) +{ + if (NULL == sm_context_create_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(sm_context_create_error->error); + OpenAPI_ref_to_binary_data_free(sm_context_create_error->n1_sm_msg); + ogs_free(sm_context_create_error->recovery_time); + ogs_free(sm_context_create_error); +} + +cJSON *OpenAPI_sm_context_create_error_convertToJSON(OpenAPI_sm_context_create_error_t *sm_context_create_error) +{ + cJSON *item = NULL; + + if (sm_context_create_error == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [SmContextCreateError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sm_context_create_error->error) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(sm_context_create_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [error]"); + goto end; + } + + if (sm_context_create_error->n1_sm_msg) { + cJSON *n1_sm_msg_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_create_error->n1_sm_msg); + if (n1_sm_msg_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmMsg", n1_sm_msg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + } + + if (sm_context_create_error->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", sm_context_create_error->recovery_time) == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [recovery_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_parseFromJSON(cJSON *sm_context_create_errorJSON) +{ + OpenAPI_sm_context_create_error_t *sm_context_create_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(sm_context_create_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_sm_context_create_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *n1_sm_msg = cJSON_GetObjectItemCaseSensitive(sm_context_create_errorJSON, "n1SmMsg"); + + OpenAPI_ref_to_binary_data_t *n1_sm_msg_local_nonprim = NULL; + if (n1_sm_msg) { + n1_sm_msg_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_msg); + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(sm_context_create_errorJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_sm_context_create_error_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + sm_context_create_error_local_var = OpenAPI_sm_context_create_error_create ( + error_local_nonprim, + n1_sm_msg ? n1_sm_msg_local_nonprim : NULL, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL + ); + + return sm_context_create_error_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_copy(OpenAPI_sm_context_create_error_t *dst, OpenAPI_sm_context_create_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_create_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_create_error_free(dst); + dst = OpenAPI_sm_context_create_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_create_error.h b/lib/sbi/openapi/model/sm_context_create_error.h new file mode 100644 index 000000000..37cb47ab0 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_create_error.h @@ -0,0 +1,44 @@ +/* + * sm_context_create_error.h + * + * + */ + +#ifndef _OpenAPI_sm_context_create_error_H_ +#define _OpenAPI_sm_context_create_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "problem_details.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_create_error_s OpenAPI_sm_context_create_error_t; +typedef struct OpenAPI_sm_context_create_error_s { + struct OpenAPI_problem_details_s *error; + struct OpenAPI_ref_to_binary_data_s *n1_sm_msg; + char *recovery_time; +} OpenAPI_sm_context_create_error_t; + +OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + char *recovery_time + ); +void OpenAPI_sm_context_create_error_free(OpenAPI_sm_context_create_error_t *sm_context_create_error); +OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_parseFromJSON(cJSON *sm_context_create_errorJSON); +cJSON *OpenAPI_sm_context_create_error_convertToJSON(OpenAPI_sm_context_create_error_t *sm_context_create_error); +OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_copy(OpenAPI_sm_context_create_error_t *dst, OpenAPI_sm_context_create_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_create_error_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_created_data.c b/lib/sbi/openapi/model/sm_context_created_data.c new file mode 100644 index 000000000..fd2c85dce --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_created_data.c @@ -0,0 +1,391 @@ + +#include +#include +#include +#include "sm_context_created_data.h" + +OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( + char *h_smf_uri, + char *smf_uri, + int pdu_session_id, + OpenAPI_snssai_t *s_nssai, + OpenAPI_up_cnx_state_t *up_cnx_state, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_list_t *allocated_ebi_list, + OpenAPI_ho_state_t *ho_state, + char *gpsi, + char *smf_service_instance_id, + char *recovery_time, + char *supported_features + ) +{ + OpenAPI_sm_context_created_data_t *sm_context_created_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_created_data_t)); + if (!sm_context_created_data_local_var) { + return NULL; + } + sm_context_created_data_local_var->h_smf_uri = h_smf_uri; + sm_context_created_data_local_var->smf_uri = smf_uri; + sm_context_created_data_local_var->pdu_session_id = pdu_session_id; + sm_context_created_data_local_var->s_nssai = s_nssai; + sm_context_created_data_local_var->up_cnx_state = up_cnx_state; + sm_context_created_data_local_var->n2_sm_info = n2_sm_info; + sm_context_created_data_local_var->n2_sm_info_type = n2_sm_info_type; + sm_context_created_data_local_var->allocated_ebi_list = allocated_ebi_list; + sm_context_created_data_local_var->ho_state = ho_state; + sm_context_created_data_local_var->gpsi = gpsi; + sm_context_created_data_local_var->smf_service_instance_id = smf_service_instance_id; + sm_context_created_data_local_var->recovery_time = recovery_time; + sm_context_created_data_local_var->supported_features = supported_features; + + return sm_context_created_data_local_var; +} + +void OpenAPI_sm_context_created_data_free(OpenAPI_sm_context_created_data_t *sm_context_created_data) +{ + if (NULL == sm_context_created_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(sm_context_created_data->h_smf_uri); + ogs_free(sm_context_created_data->smf_uri); + OpenAPI_snssai_free(sm_context_created_data->s_nssai); + OpenAPI_up_cnx_state_free(sm_context_created_data->up_cnx_state); + OpenAPI_ref_to_binary_data_free(sm_context_created_data->n2_sm_info); + OpenAPI_list_for_each(sm_context_created_data->allocated_ebi_list, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(sm_context_created_data->allocated_ebi_list); + OpenAPI_ho_state_free(sm_context_created_data->ho_state); + ogs_free(sm_context_created_data->gpsi); + ogs_free(sm_context_created_data->smf_service_instance_id); + ogs_free(sm_context_created_data->recovery_time); + ogs_free(sm_context_created_data->supported_features); + ogs_free(sm_context_created_data); +} + +cJSON *OpenAPI_sm_context_created_data_convertToJSON(OpenAPI_sm_context_created_data_t *sm_context_created_data) +{ + cJSON *item = NULL; + + if (sm_context_created_data == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [SmContextCreatedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sm_context_created_data->h_smf_uri) { + if (cJSON_AddStringToObject(item, "hSmfUri", sm_context_created_data->h_smf_uri) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [h_smf_uri]"); + goto end; + } + } + + if (sm_context_created_data->smf_uri) { + if (cJSON_AddStringToObject(item, "smfUri", sm_context_created_data->smf_uri) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [smf_uri]"); + goto end; + } + } + + if (sm_context_created_data->pdu_session_id) { + if (cJSON_AddNumberToObject(item, "pduSessionId", sm_context_created_data->pdu_session_id) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [pdu_session_id]"); + goto end; + } + } + + if (sm_context_created_data->s_nssai) { + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(sm_context_created_data->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [s_nssai]"); + goto end; + } + } + + if (sm_context_created_data->up_cnx_state) { + cJSON *up_cnx_state_local_JSON = OpenAPI_up_cnx_state_convertToJSON(sm_context_created_data->up_cnx_state); + if (up_cnx_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + cJSON_AddItemToObject(item, "upCnxState", up_cnx_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + } + + if (sm_context_created_data->n2_sm_info) { + cJSON *n2_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_created_data->n2_sm_info); + if (n2_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfo", n2_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + } + + if (sm_context_created_data->n2_sm_info_type) { + if (cJSON_AddStringToObject(item, "n2SmInfoType", OpenAPI_n2_sm_info_type_ToString(sm_context_created_data->n2_sm_info_type)) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [n2_sm_info_type]"); + goto end; + } + } + + if (sm_context_created_data->allocated_ebi_list) { + cJSON *allocated_ebi_listList = cJSON_AddArrayToObject(item, "allocatedEbiList"); + if (allocated_ebi_listList == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [allocated_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *allocated_ebi_list_node; + if (sm_context_created_data->allocated_ebi_list) { + OpenAPI_list_for_each(sm_context_created_data->allocated_ebi_list, allocated_ebi_list_node) { + cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(allocated_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [allocated_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(allocated_ebi_listList, itemLocal); + } + } + } + + if (sm_context_created_data->ho_state) { + cJSON *ho_state_local_JSON = OpenAPI_ho_state_convertToJSON(sm_context_created_data->ho_state); + if (ho_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [ho_state]"); + goto end; + } + cJSON_AddItemToObject(item, "hoState", ho_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [ho_state]"); + goto end; + } + } + + if (sm_context_created_data->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", sm_context_created_data->gpsi) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (sm_context_created_data->smf_service_instance_id) { + if (cJSON_AddStringToObject(item, "smfServiceInstanceId", sm_context_created_data->smf_service_instance_id) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [smf_service_instance_id]"); + goto end; + } + } + + if (sm_context_created_data->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", sm_context_created_data->recovery_time) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (sm_context_created_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sm_context_created_data->supported_features) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON(cJSON *sm_context_created_dataJSON) +{ + OpenAPI_sm_context_created_data_t *sm_context_created_data_local_var = NULL; + cJSON *h_smf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "hSmfUri"); + + if (h_smf_uri) { + if (!cJSON_IsString(h_smf_uri)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [h_smf_uri]"); + goto end; + } + } + + cJSON *smf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "smfUri"); + + if (smf_uri) { + if (!cJSON_IsString(smf_uri)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [smf_uri]"); + goto end; + } + } + + cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "pduSessionId"); + + if (pdu_session_id) { + if (!cJSON_IsNumber(pdu_session_id)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [pdu_session_id]"); + goto end; + } + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "sNssai"); + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + if (s_nssai) { + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + } + + cJSON *up_cnx_state = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "upCnxState"); + + OpenAPI_up_cnx_state_t *up_cnx_state_local_nonprim = NULL; + if (up_cnx_state) { + up_cnx_state_local_nonprim = OpenAPI_up_cnx_state_parseFromJSON(up_cnx_state); + } + + cJSON *n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "n2SmInfo"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL; + if (n2_sm_info) { + n2_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info); + } + + cJSON *n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "n2SmInfoType"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable; + if (n2_sm_info_type) { + if (!cJSON_IsString(n2_sm_info_type)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [n2_sm_info_type]"); + goto end; + } + n2_sm_info_typeVariable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type->valuestring); + } + + cJSON *allocated_ebi_list = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "allocatedEbiList"); + + OpenAPI_list_t *allocated_ebi_listList; + if (allocated_ebi_list) { + cJSON *allocated_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(allocated_ebi_list)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [allocated_ebi_list]"); + goto end; + } + + allocated_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allocated_ebi_list_local_nonprimitive, allocated_ebi_list ) { + if (!cJSON_IsObject(allocated_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [allocated_ebi_list]"); + goto end; + } + OpenAPI_ebi_arp_mapping_t *allocated_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(allocated_ebi_list_local_nonprimitive); + + OpenAPI_list_add(allocated_ebi_listList, allocated_ebi_listItem); + } + } + + cJSON *ho_state = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "hoState"); + + OpenAPI_ho_state_t *ho_state_local_nonprim = NULL; + if (ho_state) { + ho_state_local_nonprim = OpenAPI_ho_state_parseFromJSON(ho_state); + } + + cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "gpsi"); + + if (gpsi) { + if (!cJSON_IsString(gpsi)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + cJSON *smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "smfServiceInstanceId"); + + if (smf_service_instance_id) { + if (!cJSON_IsString(smf_service_instance_id)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [smf_service_instance_id]"); + goto end; + } + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + sm_context_created_data_local_var = OpenAPI_sm_context_created_data_create ( + h_smf_uri ? ogs_strdup(h_smf_uri->valuestring) : NULL, + smf_uri ? ogs_strdup(smf_uri->valuestring) : NULL, + pdu_session_id ? pdu_session_id->valuedouble : 0, + s_nssai ? s_nssai_local_nonprim : NULL, + up_cnx_state ? up_cnx_state_local_nonprim : NULL, + n2_sm_info ? n2_sm_info_local_nonprim : NULL, + n2_sm_info_type ? n2_sm_info_typeVariable : 0, + allocated_ebi_list ? allocated_ebi_listList : NULL, + ho_state ? ho_state_local_nonprim : NULL, + gpsi ? ogs_strdup(gpsi->valuestring) : NULL, + smf_service_instance_id ? ogs_strdup(smf_service_instance_id->valuestring) : NULL, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return sm_context_created_data_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_copy(OpenAPI_sm_context_created_data_t *dst, OpenAPI_sm_context_created_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_created_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_created_data_free(dst); + dst = OpenAPI_sm_context_created_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_created_data.h b/lib/sbi/openapi/model/sm_context_created_data.h new file mode 100644 index 000000000..169f7fae6 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_created_data.h @@ -0,0 +1,68 @@ +/* + * sm_context_created_data.h + * + * + */ + +#ifndef _OpenAPI_sm_context_created_data_H_ +#define _OpenAPI_sm_context_created_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ebi_arp_mapping.h" +#include "ho_state.h" +#include "n2_sm_info_type.h" +#include "ref_to_binary_data.h" +#include "snssai.h" +#include "up_cnx_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_created_data_s OpenAPI_sm_context_created_data_t; +typedef struct OpenAPI_sm_context_created_data_s { + char *h_smf_uri; + char *smf_uri; + int pdu_session_id; + struct OpenAPI_snssai_s *s_nssai; + struct OpenAPI_up_cnx_state_s *up_cnx_state; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info; + OpenAPI_n2_sm_info_type_e n2_sm_info_type; + OpenAPI_list_t *allocated_ebi_list; + struct OpenAPI_ho_state_s *ho_state; + char *gpsi; + char *smf_service_instance_id; + char *recovery_time; + char *supported_features; +} OpenAPI_sm_context_created_data_t; + +OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( + char *h_smf_uri, + char *smf_uri, + int pdu_session_id, + OpenAPI_snssai_t *s_nssai, + OpenAPI_up_cnx_state_t *up_cnx_state, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_list_t *allocated_ebi_list, + OpenAPI_ho_state_t *ho_state, + char *gpsi, + char *smf_service_instance_id, + char *recovery_time, + char *supported_features + ); +void OpenAPI_sm_context_created_data_free(OpenAPI_sm_context_created_data_t *sm_context_created_data); +OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON(cJSON *sm_context_created_dataJSON); +cJSON *OpenAPI_sm_context_created_data_convertToJSON(OpenAPI_sm_context_created_data_t *sm_context_created_data); +OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_copy(OpenAPI_sm_context_created_data_t *dst, OpenAPI_sm_context_created_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_created_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_release_data.c b/lib/sbi/openapi/model/sm_context_release_data.c new file mode 100644 index 000000000..f8a0bba8d --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_release_data.c @@ -0,0 +1,303 @@ + +#include +#include +#include +#include "sm_context_release_data.h" + +OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_create( + OpenAPI_cause_t *cause, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + int vsmf_release_only, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + int ismf_release_only + ) +{ + OpenAPI_sm_context_release_data_t *sm_context_release_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_release_data_t)); + if (!sm_context_release_data_local_var) { + return NULL; + } + sm_context_release_data_local_var->cause = cause; + sm_context_release_data_local_var->ng_ap_cause = ng_ap_cause; + sm_context_release_data_local_var->_5g_mm_cause_value = _5g_mm_cause_value; + sm_context_release_data_local_var->ue_location = ue_location; + sm_context_release_data_local_var->ue_time_zone = ue_time_zone; + sm_context_release_data_local_var->add_ue_location = add_ue_location; + sm_context_release_data_local_var->vsmf_release_only = vsmf_release_only; + sm_context_release_data_local_var->n2_sm_info = n2_sm_info; + sm_context_release_data_local_var->n2_sm_info_type = n2_sm_info_type; + sm_context_release_data_local_var->ismf_release_only = ismf_release_only; + + return sm_context_release_data_local_var; +} + +void OpenAPI_sm_context_release_data_free(OpenAPI_sm_context_release_data_t *sm_context_release_data) +{ + if (NULL == sm_context_release_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_cause_free(sm_context_release_data->cause); + OpenAPI_ng_ap_cause_free(sm_context_release_data->ng_ap_cause); + OpenAPI_user_location_free(sm_context_release_data->ue_location); + ogs_free(sm_context_release_data->ue_time_zone); + OpenAPI_user_location_free(sm_context_release_data->add_ue_location); + OpenAPI_ref_to_binary_data_free(sm_context_release_data->n2_sm_info); + ogs_free(sm_context_release_data); +} + +cJSON *OpenAPI_sm_context_release_data_convertToJSON(OpenAPI_sm_context_release_data_t *sm_context_release_data) +{ + cJSON *item = NULL; + + if (sm_context_release_data == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [SmContextReleaseData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sm_context_release_data->cause) { + cJSON *cause_local_JSON = OpenAPI_cause_convertToJSON(sm_context_release_data->cause); + if (cause_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [cause]"); + goto end; + } + cJSON_AddItemToObject(item, "cause", cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [cause]"); + goto end; + } + } + + if (sm_context_release_data->ng_ap_cause) { + cJSON *ng_ap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(sm_context_release_data->ng_ap_cause); + if (ng_ap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngApCause", ng_ap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + } + + if (sm_context_release_data->_5g_mm_cause_value) { + if (cJSON_AddNumberToObject(item, "5gMmCauseValue", sm_context_release_data->_5g_mm_cause_value) == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + if (sm_context_release_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(sm_context_release_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + + if (sm_context_release_data->ue_time_zone) { + if (cJSON_AddStringToObject(item, "ueTimeZone", sm_context_release_data->ue_time_zone) == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [ue_time_zone]"); + goto end; + } + } + + if (sm_context_release_data->add_ue_location) { + cJSON *add_ue_location_local_JSON = OpenAPI_user_location_convertToJSON(sm_context_release_data->add_ue_location); + if (add_ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "addUeLocation", add_ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + } + + if (sm_context_release_data->vsmf_release_only) { + if (cJSON_AddBoolToObject(item, "vsmfReleaseOnly", sm_context_release_data->vsmf_release_only) == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [vsmf_release_only]"); + goto end; + } + } + + if (sm_context_release_data->n2_sm_info) { + cJSON *n2_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_release_data->n2_sm_info); + if (n2_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfo", n2_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + } + + if (sm_context_release_data->n2_sm_info_type) { + if (cJSON_AddStringToObject(item, "n2SmInfoType", OpenAPI_n2_sm_info_type_ToString(sm_context_release_data->n2_sm_info_type)) == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [n2_sm_info_type]"); + goto end; + } + } + + if (sm_context_release_data->ismf_release_only) { + if (cJSON_AddBoolToObject(item, "ismfReleaseOnly", sm_context_release_data->ismf_release_only) == NULL) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [ismf_release_only]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON(cJSON *sm_context_release_dataJSON) +{ + OpenAPI_sm_context_release_data_t *sm_context_release_data_local_var = NULL; + cJSON *cause = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "cause"); + + OpenAPI_cause_t *cause_local_nonprim = NULL; + if (cause) { + cause_local_nonprim = OpenAPI_cause_parseFromJSON(cause); + } + + cJSON *ng_ap_cause = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ngApCause"); + + OpenAPI_ng_ap_cause_t *ng_ap_cause_local_nonprim = NULL; + if (ng_ap_cause) { + ng_ap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ng_ap_cause); + } + + cJSON *_5g_mm_cause_value = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "5gMmCauseValue"); + + if (_5g_mm_cause_value) { + if (!cJSON_IsNumber(_5g_mm_cause_value)) { + ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ueTimeZone"); + + if (ue_time_zone) { + if (!cJSON_IsString(ue_time_zone)) { + ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [ue_time_zone]"); + goto end; + } + } + + cJSON *add_ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "addUeLocation"); + + OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL; + if (add_ue_location) { + add_ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(add_ue_location); + } + + cJSON *vsmf_release_only = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "vsmfReleaseOnly"); + + if (vsmf_release_only) { + if (!cJSON_IsBool(vsmf_release_only)) { + ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [vsmf_release_only]"); + goto end; + } + } + + cJSON *n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "n2SmInfo"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL; + if (n2_sm_info) { + n2_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info); + } + + cJSON *n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "n2SmInfoType"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable; + if (n2_sm_info_type) { + if (!cJSON_IsString(n2_sm_info_type)) { + ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [n2_sm_info_type]"); + goto end; + } + n2_sm_info_typeVariable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type->valuestring); + } + + cJSON *ismf_release_only = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ismfReleaseOnly"); + + if (ismf_release_only) { + if (!cJSON_IsBool(ismf_release_only)) { + ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [ismf_release_only]"); + goto end; + } + } + + sm_context_release_data_local_var = OpenAPI_sm_context_release_data_create ( + cause ? cause_local_nonprim : NULL, + ng_ap_cause ? ng_ap_cause_local_nonprim : NULL, + _5g_mm_cause_value ? _5g_mm_cause_value->valuedouble : 0, + ue_location ? ue_location_local_nonprim : NULL, + ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL, + add_ue_location ? add_ue_location_local_nonprim : NULL, + vsmf_release_only ? vsmf_release_only->valueint : 0, + n2_sm_info ? n2_sm_info_local_nonprim : NULL, + n2_sm_info_type ? n2_sm_info_typeVariable : 0, + ismf_release_only ? ismf_release_only->valueint : 0 + ); + + return sm_context_release_data_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_copy(OpenAPI_sm_context_release_data_t *dst, OpenAPI_sm_context_release_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_release_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_release_data_free(dst); + dst = OpenAPI_sm_context_release_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_release_data.h b/lib/sbi/openapi/model/sm_context_release_data.h new file mode 100644 index 000000000..f605d1b32 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_release_data.h @@ -0,0 +1,61 @@ +/* + * sm_context_release_data.h + * + * + */ + +#ifndef _OpenAPI_sm_context_release_data_H_ +#define _OpenAPI_sm_context_release_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "cause.h" +#include "n2_sm_info_type.h" +#include "ng_ap_cause.h" +#include "ref_to_binary_data.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_release_data_s OpenAPI_sm_context_release_data_t; +typedef struct OpenAPI_sm_context_release_data_s { + struct OpenAPI_cause_s *cause; + struct OpenAPI_ng_ap_cause_s *ng_ap_cause; + int _5g_mm_cause_value; + struct OpenAPI_user_location_s *ue_location; + char *ue_time_zone; + struct OpenAPI_user_location_s *add_ue_location; + int vsmf_release_only; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info; + OpenAPI_n2_sm_info_type_e n2_sm_info_type; + int ismf_release_only; +} OpenAPI_sm_context_release_data_t; + +OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_create( + OpenAPI_cause_t *cause, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + int vsmf_release_only, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + int ismf_release_only + ); +void OpenAPI_sm_context_release_data_free(OpenAPI_sm_context_release_data_t *sm_context_release_data); +OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON(cJSON *sm_context_release_dataJSON); +cJSON *OpenAPI_sm_context_release_data_convertToJSON(OpenAPI_sm_context_release_data_t *sm_context_release_data); +OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_copy(OpenAPI_sm_context_release_data_t *dst, OpenAPI_sm_context_release_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_release_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_released_data.c b/lib/sbi/openapi/model/sm_context_released_data.c new file mode 100644 index 000000000..46278722c --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_released_data.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "sm_context_released_data.h" + +OpenAPI_sm_context_released_data_t *OpenAPI_sm_context_released_data_create( + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status + ) +{ + OpenAPI_sm_context_released_data_t *sm_context_released_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_released_data_t)); + if (!sm_context_released_data_local_var) { + return NULL; + } + sm_context_released_data_local_var->small_data_rate_status = small_data_rate_status; + sm_context_released_data_local_var->apn_rate_status = apn_rate_status; + + return sm_context_released_data_local_var; +} + +void OpenAPI_sm_context_released_data_free(OpenAPI_sm_context_released_data_t *sm_context_released_data) +{ + if (NULL == sm_context_released_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_small_data_rate_status_free(sm_context_released_data->small_data_rate_status); + OpenAPI_apn_rate_status_free(sm_context_released_data->apn_rate_status); + ogs_free(sm_context_released_data); +} + +cJSON *OpenAPI_sm_context_released_data_convertToJSON(OpenAPI_sm_context_released_data_t *sm_context_released_data) +{ + cJSON *item = NULL; + + if (sm_context_released_data == NULL) { + ogs_error("OpenAPI_sm_context_released_data_convertToJSON() failed [SmContextReleasedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sm_context_released_data->small_data_rate_status) { + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(sm_context_released_data->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_released_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "smallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_released_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + } + + if (sm_context_released_data->apn_rate_status) { + cJSON *apn_rate_status_local_JSON = OpenAPI_apn_rate_status_convertToJSON(sm_context_released_data->apn_rate_status); + if (apn_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_released_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "apnRateStatus", apn_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_released_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_released_data_t *OpenAPI_sm_context_released_data_parseFromJSON(cJSON *sm_context_released_dataJSON) +{ + OpenAPI_sm_context_released_data_t *sm_context_released_data_local_var = NULL; + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(sm_context_released_dataJSON, "smallDataRateStatus"); + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + if (small_data_rate_status) { + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + } + + cJSON *apn_rate_status = cJSON_GetObjectItemCaseSensitive(sm_context_released_dataJSON, "apnRateStatus"); + + OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; + if (apn_rate_status) { + apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); + } + + sm_context_released_data_local_var = OpenAPI_sm_context_released_data_create ( + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, + apn_rate_status ? apn_rate_status_local_nonprim : NULL + ); + + return sm_context_released_data_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_released_data_t *OpenAPI_sm_context_released_data_copy(OpenAPI_sm_context_released_data_t *dst, OpenAPI_sm_context_released_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_released_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_released_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_released_data_free(dst); + dst = OpenAPI_sm_context_released_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_released_data.h b/lib/sbi/openapi/model/sm_context_released_data.h new file mode 100644 index 000000000..1394d72cc --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_released_data.h @@ -0,0 +1,42 @@ +/* + * sm_context_released_data.h + * + * + */ + +#ifndef _OpenAPI_sm_context_released_data_H_ +#define _OpenAPI_sm_context_released_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "apn_rate_status.h" +#include "small_data_rate_status.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_released_data_s OpenAPI_sm_context_released_data_t; +typedef struct OpenAPI_sm_context_released_data_s { + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; + struct OpenAPI_apn_rate_status_s *apn_rate_status; +} OpenAPI_sm_context_released_data_t; + +OpenAPI_sm_context_released_data_t *OpenAPI_sm_context_released_data_create( + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status + ); +void OpenAPI_sm_context_released_data_free(OpenAPI_sm_context_released_data_t *sm_context_released_data); +OpenAPI_sm_context_released_data_t *OpenAPI_sm_context_released_data_parseFromJSON(cJSON *sm_context_released_dataJSON); +cJSON *OpenAPI_sm_context_released_data_convertToJSON(OpenAPI_sm_context_released_data_t *sm_context_released_data); +OpenAPI_sm_context_released_data_t *OpenAPI_sm_context_released_data_copy(OpenAPI_sm_context_released_data_t *dst, OpenAPI_sm_context_released_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_released_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_retrieve_data.c b/lib/sbi/openapi/model/sm_context_retrieve_data.c new file mode 100644 index 000000000..500e30657 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_retrieve_data.c @@ -0,0 +1,200 @@ + +#include +#include +#include +#include "sm_context_retrieve_data.h" + +OpenAPI_sm_context_retrieve_data_t *OpenAPI_sm_context_retrieve_data_create( + OpenAPI_mme_capabilities_t *target_mme_cap, + OpenAPI_sm_context_type_t *sm_context_type, + OpenAPI_plmn_id_t *serving_network, + OpenAPI_list_t *not_to_transfer_ebi_list + ) +{ + OpenAPI_sm_context_retrieve_data_t *sm_context_retrieve_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_retrieve_data_t)); + if (!sm_context_retrieve_data_local_var) { + return NULL; + } + sm_context_retrieve_data_local_var->target_mme_cap = target_mme_cap; + sm_context_retrieve_data_local_var->sm_context_type = sm_context_type; + sm_context_retrieve_data_local_var->serving_network = serving_network; + sm_context_retrieve_data_local_var->not_to_transfer_ebi_list = not_to_transfer_ebi_list; + + return sm_context_retrieve_data_local_var; +} + +void OpenAPI_sm_context_retrieve_data_free(OpenAPI_sm_context_retrieve_data_t *sm_context_retrieve_data) +{ + if (NULL == sm_context_retrieve_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_mme_capabilities_free(sm_context_retrieve_data->target_mme_cap); + OpenAPI_sm_context_type_free(sm_context_retrieve_data->sm_context_type); + OpenAPI_plmn_id_free(sm_context_retrieve_data->serving_network); + OpenAPI_list_for_each(sm_context_retrieve_data->not_to_transfer_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_retrieve_data->not_to_transfer_ebi_list); + ogs_free(sm_context_retrieve_data); +} + +cJSON *OpenAPI_sm_context_retrieve_data_convertToJSON(OpenAPI_sm_context_retrieve_data_t *sm_context_retrieve_data) +{ + cJSON *item = NULL; + + if (sm_context_retrieve_data == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [SmContextRetrieveData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sm_context_retrieve_data->target_mme_cap) { + cJSON *target_mme_cap_local_JSON = OpenAPI_mme_capabilities_convertToJSON(sm_context_retrieve_data->target_mme_cap); + if (target_mme_cap_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [target_mme_cap]"); + goto end; + } + cJSON_AddItemToObject(item, "targetMmeCap", target_mme_cap_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [target_mme_cap]"); + goto end; + } + } + + if (sm_context_retrieve_data->sm_context_type) { + cJSON *sm_context_type_local_JSON = OpenAPI_sm_context_type_convertToJSON(sm_context_retrieve_data->sm_context_type); + if (sm_context_type_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [sm_context_type]"); + goto end; + } + cJSON_AddItemToObject(item, "smContextType", sm_context_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [sm_context_type]"); + goto end; + } + } + + if (sm_context_retrieve_data->serving_network) { + cJSON *serving_network_local_JSON = OpenAPI_plmn_id_convertToJSON(sm_context_retrieve_data->serving_network); + if (serving_network_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [serving_network]"); + goto end; + } + cJSON_AddItemToObject(item, "servingNetwork", serving_network_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [serving_network]"); + goto end; + } + } + + if (sm_context_retrieve_data->not_to_transfer_ebi_list) { + cJSON *not_to_transfer_ebi_list = cJSON_AddArrayToObject(item, "notToTransferEbiList"); + if (not_to_transfer_ebi_list == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [not_to_transfer_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *not_to_transfer_ebi_list_node; + OpenAPI_list_for_each(sm_context_retrieve_data->not_to_transfer_ebi_list, not_to_transfer_ebi_list_node) { + if (cJSON_AddNumberToObject(not_to_transfer_ebi_list, "", *(double *)not_to_transfer_ebi_list_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed [not_to_transfer_ebi_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_sm_context_retrieve_data_t *OpenAPI_sm_context_retrieve_data_parseFromJSON(cJSON *sm_context_retrieve_dataJSON) +{ + OpenAPI_sm_context_retrieve_data_t *sm_context_retrieve_data_local_var = NULL; + cJSON *target_mme_cap = cJSON_GetObjectItemCaseSensitive(sm_context_retrieve_dataJSON, "targetMmeCap"); + + OpenAPI_mme_capabilities_t *target_mme_cap_local_nonprim = NULL; + if (target_mme_cap) { + target_mme_cap_local_nonprim = OpenAPI_mme_capabilities_parseFromJSON(target_mme_cap); + } + + cJSON *sm_context_type = cJSON_GetObjectItemCaseSensitive(sm_context_retrieve_dataJSON, "smContextType"); + + OpenAPI_sm_context_type_t *sm_context_type_local_nonprim = NULL; + if (sm_context_type) { + sm_context_type_local_nonprim = OpenAPI_sm_context_type_parseFromJSON(sm_context_type); + } + + cJSON *serving_network = cJSON_GetObjectItemCaseSensitive(sm_context_retrieve_dataJSON, "servingNetwork"); + + OpenAPI_plmn_id_t *serving_network_local_nonprim = NULL; + if (serving_network) { + serving_network_local_nonprim = OpenAPI_plmn_id_parseFromJSON(serving_network); + } + + cJSON *not_to_transfer_ebi_list = cJSON_GetObjectItemCaseSensitive(sm_context_retrieve_dataJSON, "notToTransferEbiList"); + + OpenAPI_list_t *not_to_transfer_ebi_listList; + if (not_to_transfer_ebi_list) { + cJSON *not_to_transfer_ebi_list_local; + if (!cJSON_IsArray(not_to_transfer_ebi_list)) { + ogs_error("OpenAPI_sm_context_retrieve_data_parseFromJSON() failed [not_to_transfer_ebi_list]"); + goto end; + } + not_to_transfer_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(not_to_transfer_ebi_list_local, not_to_transfer_ebi_list) { + if (!cJSON_IsNumber(not_to_transfer_ebi_list_local)) { + ogs_error("OpenAPI_sm_context_retrieve_data_parseFromJSON() failed [not_to_transfer_ebi_list]"); + goto end; + } + OpenAPI_list_add(not_to_transfer_ebi_listList, ¬_to_transfer_ebi_list_local->valuedouble); + } + } + + sm_context_retrieve_data_local_var = OpenAPI_sm_context_retrieve_data_create ( + target_mme_cap ? target_mme_cap_local_nonprim : NULL, + sm_context_type ? sm_context_type_local_nonprim : NULL, + serving_network ? serving_network_local_nonprim : NULL, + not_to_transfer_ebi_list ? not_to_transfer_ebi_listList : NULL + ); + + return sm_context_retrieve_data_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_retrieve_data_t *OpenAPI_sm_context_retrieve_data_copy(OpenAPI_sm_context_retrieve_data_t *dst, OpenAPI_sm_context_retrieve_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_retrieve_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_retrieve_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_retrieve_data_free(dst); + dst = OpenAPI_sm_context_retrieve_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_retrieve_data.h b/lib/sbi/openapi/model/sm_context_retrieve_data.h new file mode 100644 index 000000000..da652e1ee --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_retrieve_data.h @@ -0,0 +1,47 @@ +/* + * sm_context_retrieve_data.h + * + * + */ + +#ifndef _OpenAPI_sm_context_retrieve_data_H_ +#define _OpenAPI_sm_context_retrieve_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mme_capabilities.h" +#include "plmn_id.h" +#include "sm_context_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_retrieve_data_s OpenAPI_sm_context_retrieve_data_t; +typedef struct OpenAPI_sm_context_retrieve_data_s { + struct OpenAPI_mme_capabilities_s *target_mme_cap; + struct OpenAPI_sm_context_type_s *sm_context_type; + struct OpenAPI_plmn_id_s *serving_network; + OpenAPI_list_t *not_to_transfer_ebi_list; +} OpenAPI_sm_context_retrieve_data_t; + +OpenAPI_sm_context_retrieve_data_t *OpenAPI_sm_context_retrieve_data_create( + OpenAPI_mme_capabilities_t *target_mme_cap, + OpenAPI_sm_context_type_t *sm_context_type, + OpenAPI_plmn_id_t *serving_network, + OpenAPI_list_t *not_to_transfer_ebi_list + ); +void OpenAPI_sm_context_retrieve_data_free(OpenAPI_sm_context_retrieve_data_t *sm_context_retrieve_data); +OpenAPI_sm_context_retrieve_data_t *OpenAPI_sm_context_retrieve_data_parseFromJSON(cJSON *sm_context_retrieve_dataJSON); +cJSON *OpenAPI_sm_context_retrieve_data_convertToJSON(OpenAPI_sm_context_retrieve_data_t *sm_context_retrieve_data); +OpenAPI_sm_context_retrieve_data_t *OpenAPI_sm_context_retrieve_data_copy(OpenAPI_sm_context_retrieve_data_t *dst, OpenAPI_sm_context_retrieve_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_retrieve_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_retrieved_data.c b/lib/sbi/openapi/model/sm_context_retrieved_data.c new file mode 100644 index 000000000..1d7d888eb --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_retrieved_data.c @@ -0,0 +1,201 @@ + +#include +#include +#include +#include "sm_context_retrieved_data.h" + +OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_create( + char *ue_eps_pdn_connection, + OpenAPI_sm_context_t *sm_context, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status, + int dl_data_waiting_ind + ) +{ + OpenAPI_sm_context_retrieved_data_t *sm_context_retrieved_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_retrieved_data_t)); + if (!sm_context_retrieved_data_local_var) { + return NULL; + } + sm_context_retrieved_data_local_var->ue_eps_pdn_connection = ue_eps_pdn_connection; + sm_context_retrieved_data_local_var->sm_context = sm_context; + sm_context_retrieved_data_local_var->small_data_rate_status = small_data_rate_status; + sm_context_retrieved_data_local_var->apn_rate_status = apn_rate_status; + sm_context_retrieved_data_local_var->dl_data_waiting_ind = dl_data_waiting_ind; + + return sm_context_retrieved_data_local_var; +} + +void OpenAPI_sm_context_retrieved_data_free(OpenAPI_sm_context_retrieved_data_t *sm_context_retrieved_data) +{ + if (NULL == sm_context_retrieved_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(sm_context_retrieved_data->ue_eps_pdn_connection); + OpenAPI_sm_context_free(sm_context_retrieved_data->sm_context); + OpenAPI_small_data_rate_status_free(sm_context_retrieved_data->small_data_rate_status); + OpenAPI_apn_rate_status_free(sm_context_retrieved_data->apn_rate_status); + ogs_free(sm_context_retrieved_data); +} + +cJSON *OpenAPI_sm_context_retrieved_data_convertToJSON(OpenAPI_sm_context_retrieved_data_t *sm_context_retrieved_data) +{ + cJSON *item = NULL; + + if (sm_context_retrieved_data == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [SmContextRetrievedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sm_context_retrieved_data->ue_eps_pdn_connection) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [ue_eps_pdn_connection]"); + goto end; + } + if (cJSON_AddStringToObject(item, "ueEpsPdnConnection", sm_context_retrieved_data->ue_eps_pdn_connection) == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [ue_eps_pdn_connection]"); + goto end; + } + + if (sm_context_retrieved_data->sm_context) { + cJSON *sm_context_local_JSON = OpenAPI_sm_context_convertToJSON(sm_context_retrieved_data->sm_context); + if (sm_context_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [sm_context]"); + goto end; + } + cJSON_AddItemToObject(item, "smContext", sm_context_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [sm_context]"); + goto end; + } + } + + if (sm_context_retrieved_data->small_data_rate_status) { + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(sm_context_retrieved_data->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "smallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + } + + if (sm_context_retrieved_data->apn_rate_status) { + cJSON *apn_rate_status_local_JSON = OpenAPI_apn_rate_status_convertToJSON(sm_context_retrieved_data->apn_rate_status); + if (apn_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "apnRateStatus", apn_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [apn_rate_status]"); + goto end; + } + } + + if (sm_context_retrieved_data->dl_data_waiting_ind) { + if (cJSON_AddBoolToObject(item, "dlDataWaitingInd", sm_context_retrieved_data->dl_data_waiting_ind) == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [dl_data_waiting_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_parseFromJSON(cJSON *sm_context_retrieved_dataJSON) +{ + OpenAPI_sm_context_retrieved_data_t *sm_context_retrieved_data_local_var = NULL; + cJSON *ue_eps_pdn_connection = cJSON_GetObjectItemCaseSensitive(sm_context_retrieved_dataJSON, "ueEpsPdnConnection"); + if (!ue_eps_pdn_connection) { + ogs_error("OpenAPI_sm_context_retrieved_data_parseFromJSON() failed [ue_eps_pdn_connection]"); + goto end; + } + + + if (!cJSON_IsString(ue_eps_pdn_connection)) { + ogs_error("OpenAPI_sm_context_retrieved_data_parseFromJSON() failed [ue_eps_pdn_connection]"); + goto end; + } + + cJSON *sm_context = cJSON_GetObjectItemCaseSensitive(sm_context_retrieved_dataJSON, "smContext"); + + OpenAPI_sm_context_t *sm_context_local_nonprim = NULL; + if (sm_context) { + sm_context_local_nonprim = OpenAPI_sm_context_parseFromJSON(sm_context); + } + + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(sm_context_retrieved_dataJSON, "smallDataRateStatus"); + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + if (small_data_rate_status) { + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + } + + cJSON *apn_rate_status = cJSON_GetObjectItemCaseSensitive(sm_context_retrieved_dataJSON, "apnRateStatus"); + + OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; + if (apn_rate_status) { + apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); + } + + cJSON *dl_data_waiting_ind = cJSON_GetObjectItemCaseSensitive(sm_context_retrieved_dataJSON, "dlDataWaitingInd"); + + if (dl_data_waiting_ind) { + if (!cJSON_IsBool(dl_data_waiting_ind)) { + ogs_error("OpenAPI_sm_context_retrieved_data_parseFromJSON() failed [dl_data_waiting_ind]"); + goto end; + } + } + + sm_context_retrieved_data_local_var = OpenAPI_sm_context_retrieved_data_create ( + ogs_strdup(ue_eps_pdn_connection->valuestring), + sm_context ? sm_context_local_nonprim : NULL, + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, + apn_rate_status ? apn_rate_status_local_nonprim : NULL, + dl_data_waiting_ind ? dl_data_waiting_ind->valueint : 0 + ); + + return sm_context_retrieved_data_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_copy(OpenAPI_sm_context_retrieved_data_t *dst, OpenAPI_sm_context_retrieved_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_retrieved_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_retrieved_data_free(dst); + dst = OpenAPI_sm_context_retrieved_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_retrieved_data.h b/lib/sbi/openapi/model/sm_context_retrieved_data.h new file mode 100644 index 000000000..914a2c15a --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_retrieved_data.h @@ -0,0 +1,49 @@ +/* + * sm_context_retrieved_data.h + * + * + */ + +#ifndef _OpenAPI_sm_context_retrieved_data_H_ +#define _OpenAPI_sm_context_retrieved_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "apn_rate_status.h" +#include "sm_context.h" +#include "small_data_rate_status.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_retrieved_data_s OpenAPI_sm_context_retrieved_data_t; +typedef struct OpenAPI_sm_context_retrieved_data_s { + char *ue_eps_pdn_connection; + struct OpenAPI_sm_context_s *sm_context; + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; + struct OpenAPI_apn_rate_status_s *apn_rate_status; + int dl_data_waiting_ind; +} OpenAPI_sm_context_retrieved_data_t; + +OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_create( + char *ue_eps_pdn_connection, + OpenAPI_sm_context_t *sm_context, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status, + int dl_data_waiting_ind + ); +void OpenAPI_sm_context_retrieved_data_free(OpenAPI_sm_context_retrieved_data_t *sm_context_retrieved_data); +OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_parseFromJSON(cJSON *sm_context_retrieved_dataJSON); +cJSON *OpenAPI_sm_context_retrieved_data_convertToJSON(OpenAPI_sm_context_retrieved_data_t *sm_context_retrieved_data); +OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_copy(OpenAPI_sm_context_retrieved_data_t *dst, OpenAPI_sm_context_retrieved_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_retrieved_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_status_notification.c b/lib/sbi/openapi/model/sm_context_status_notification.c new file mode 100644 index 000000000..75545748e --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_status_notification.c @@ -0,0 +1,261 @@ + +#include +#include +#include +#include "sm_context_status_notification.h" + +OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification_create( + OpenAPI_status_info_t *status_info, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status, + int ddn_failure_status, + char *new_smf_id, + char *new_smf_set_id, + char *old_smf_id, + char *old_sm_context_ref + ) +{ + OpenAPI_sm_context_status_notification_t *sm_context_status_notification_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_status_notification_t)); + if (!sm_context_status_notification_local_var) { + return NULL; + } + sm_context_status_notification_local_var->status_info = status_info; + sm_context_status_notification_local_var->small_data_rate_status = small_data_rate_status; + sm_context_status_notification_local_var->apn_rate_status = apn_rate_status; + sm_context_status_notification_local_var->ddn_failure_status = ddn_failure_status; + sm_context_status_notification_local_var->new_smf_id = new_smf_id; + sm_context_status_notification_local_var->new_smf_set_id = new_smf_set_id; + sm_context_status_notification_local_var->old_smf_id = old_smf_id; + sm_context_status_notification_local_var->old_sm_context_ref = old_sm_context_ref; + + return sm_context_status_notification_local_var; +} + +void OpenAPI_sm_context_status_notification_free(OpenAPI_sm_context_status_notification_t *sm_context_status_notification) +{ + if (NULL == sm_context_status_notification) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_status_info_free(sm_context_status_notification->status_info); + OpenAPI_small_data_rate_status_free(sm_context_status_notification->small_data_rate_status); + OpenAPI_apn_rate_status_free(sm_context_status_notification->apn_rate_status); + ogs_free(sm_context_status_notification->new_smf_id); + ogs_free(sm_context_status_notification->new_smf_set_id); + ogs_free(sm_context_status_notification->old_smf_id); + ogs_free(sm_context_status_notification->old_sm_context_ref); + ogs_free(sm_context_status_notification); +} + +cJSON *OpenAPI_sm_context_status_notification_convertToJSON(OpenAPI_sm_context_status_notification_t *sm_context_status_notification) +{ + cJSON *item = NULL; + + if (sm_context_status_notification == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [SmContextStatusNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sm_context_status_notification->status_info) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [status_info]"); + goto end; + } + cJSON *status_info_local_JSON = OpenAPI_status_info_convertToJSON(sm_context_status_notification->status_info); + if (status_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [status_info]"); + goto end; + } + cJSON_AddItemToObject(item, "statusInfo", status_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [status_info]"); + goto end; + } + + if (sm_context_status_notification->small_data_rate_status) { + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(sm_context_status_notification->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "smallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + } + + if (sm_context_status_notification->apn_rate_status) { + cJSON *apn_rate_status_local_JSON = OpenAPI_apn_rate_status_convertToJSON(sm_context_status_notification->apn_rate_status); + if (apn_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [apn_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "apnRateStatus", apn_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [apn_rate_status]"); + goto end; + } + } + + if (sm_context_status_notification->ddn_failure_status) { + if (cJSON_AddBoolToObject(item, "ddnFailureStatus", sm_context_status_notification->ddn_failure_status) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [ddn_failure_status]"); + goto end; + } + } + + if (sm_context_status_notification->new_smf_id) { + if (cJSON_AddStringToObject(item, "newSmfId", sm_context_status_notification->new_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [new_smf_id]"); + goto end; + } + } + + if (sm_context_status_notification->new_smf_set_id) { + if (cJSON_AddStringToObject(item, "newSmfSetId", sm_context_status_notification->new_smf_set_id) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [new_smf_set_id]"); + goto end; + } + } + + if (sm_context_status_notification->old_smf_id) { + if (cJSON_AddStringToObject(item, "oldSmfId", sm_context_status_notification->old_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [old_smf_id]"); + goto end; + } + } + + if (sm_context_status_notification->old_sm_context_ref) { + if (cJSON_AddStringToObject(item, "oldSmContextRef", sm_context_status_notification->old_sm_context_ref) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [old_sm_context_ref]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification_parseFromJSON(cJSON *sm_context_status_notificationJSON) +{ + OpenAPI_sm_context_status_notification_t *sm_context_status_notification_local_var = NULL; + cJSON *status_info = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "statusInfo"); + if (!status_info) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [status_info]"); + goto end; + } + + OpenAPI_status_info_t *status_info_local_nonprim = NULL; + + status_info_local_nonprim = OpenAPI_status_info_parseFromJSON(status_info); + + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "smallDataRateStatus"); + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + if (small_data_rate_status) { + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + } + + cJSON *apn_rate_status = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "apnRateStatus"); + + OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; + if (apn_rate_status) { + apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); + } + + cJSON *ddn_failure_status = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "ddnFailureStatus"); + + if (ddn_failure_status) { + if (!cJSON_IsBool(ddn_failure_status)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [ddn_failure_status]"); + goto end; + } + } + + cJSON *new_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "newSmfId"); + + if (new_smf_id) { + if (!cJSON_IsString(new_smf_id)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [new_smf_id]"); + goto end; + } + } + + cJSON *new_smf_set_id = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "newSmfSetId"); + + if (new_smf_set_id) { + if (!cJSON_IsString(new_smf_set_id)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [new_smf_set_id]"); + goto end; + } + } + + cJSON *old_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "oldSmfId"); + + if (old_smf_id) { + if (!cJSON_IsString(old_smf_id)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [old_smf_id]"); + goto end; + } + } + + cJSON *old_sm_context_ref = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "oldSmContextRef"); + + if (old_sm_context_ref) { + if (!cJSON_IsString(old_sm_context_ref)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [old_sm_context_ref]"); + goto end; + } + } + + sm_context_status_notification_local_var = OpenAPI_sm_context_status_notification_create ( + status_info_local_nonprim, + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, + apn_rate_status ? apn_rate_status_local_nonprim : NULL, + ddn_failure_status ? ddn_failure_status->valueint : 0, + new_smf_id ? ogs_strdup(new_smf_id->valuestring) : NULL, + new_smf_set_id ? ogs_strdup(new_smf_set_id->valuestring) : NULL, + old_smf_id ? ogs_strdup(old_smf_id->valuestring) : NULL, + old_sm_context_ref ? ogs_strdup(old_sm_context_ref->valuestring) : NULL + ); + + return sm_context_status_notification_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification_copy(OpenAPI_sm_context_status_notification_t *dst, OpenAPI_sm_context_status_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_status_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_status_notification_free(dst); + dst = OpenAPI_sm_context_status_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_status_notification.h b/lib/sbi/openapi/model/sm_context_status_notification.h new file mode 100644 index 000000000..e925a23b1 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_status_notification.h @@ -0,0 +1,55 @@ +/* + * sm_context_status_notification.h + * + * + */ + +#ifndef _OpenAPI_sm_context_status_notification_H_ +#define _OpenAPI_sm_context_status_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "apn_rate_status.h" +#include "small_data_rate_status.h" +#include "status_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_status_notification_s OpenAPI_sm_context_status_notification_t; +typedef struct OpenAPI_sm_context_status_notification_s { + struct OpenAPI_status_info_s *status_info; + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; + struct OpenAPI_apn_rate_status_s *apn_rate_status; + int ddn_failure_status; + char *new_smf_id; + char *new_smf_set_id; + char *old_smf_id; + char *old_sm_context_ref; +} OpenAPI_sm_context_status_notification_t; + +OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification_create( + OpenAPI_status_info_t *status_info, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status, + int ddn_failure_status, + char *new_smf_id, + char *new_smf_set_id, + char *old_smf_id, + char *old_sm_context_ref + ); +void OpenAPI_sm_context_status_notification_free(OpenAPI_sm_context_status_notification_t *sm_context_status_notification); +OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification_parseFromJSON(cJSON *sm_context_status_notificationJSON); +cJSON *OpenAPI_sm_context_status_notification_convertToJSON(OpenAPI_sm_context_status_notification_t *sm_context_status_notification); +OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification_copy(OpenAPI_sm_context_status_notification_t *dst, OpenAPI_sm_context_status_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_status_notification_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_type.c b/lib/sbi/openapi/model/sm_context_type.c new file mode 100644 index 000000000..9bf8e8bed --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_type.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "sm_context_type.h" + +OpenAPI_sm_context_type_t *OpenAPI_sm_context_type_create( + ) +{ + OpenAPI_sm_context_type_t *sm_context_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_type_t)); + if (!sm_context_type_local_var) { + return NULL; + } + + return sm_context_type_local_var; +} + +void OpenAPI_sm_context_type_free(OpenAPI_sm_context_type_t *sm_context_type) +{ + if (NULL == sm_context_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(sm_context_type); +} + +cJSON *OpenAPI_sm_context_type_convertToJSON(OpenAPI_sm_context_type_t *sm_context_type) +{ + cJSON *item = NULL; + + if (sm_context_type == NULL) { + ogs_error("OpenAPI_sm_context_type_convertToJSON() failed [SmContextType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_sm_context_type_t *OpenAPI_sm_context_type_parseFromJSON(cJSON *sm_context_typeJSON) +{ + OpenAPI_sm_context_type_t *sm_context_type_local_var = NULL; + sm_context_type_local_var = OpenAPI_sm_context_type_create ( + ); + + return sm_context_type_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_type_t *OpenAPI_sm_context_type_copy(OpenAPI_sm_context_type_t *dst, OpenAPI_sm_context_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_type_free(dst); + dst = OpenAPI_sm_context_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_type.h b/lib/sbi/openapi/model/sm_context_type.h new file mode 100644 index 000000000..34a638c8f --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_type.h @@ -0,0 +1,36 @@ +/* + * sm_context_type.h + * + * Possible values are - EPS_PDN_CONNECTION - SM_CONTEXT + */ + +#ifndef _OpenAPI_sm_context_type_H_ +#define _OpenAPI_sm_context_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_type_s OpenAPI_sm_context_type_t; +typedef struct OpenAPI_sm_context_type_s { +} OpenAPI_sm_context_type_t; + +OpenAPI_sm_context_type_t *OpenAPI_sm_context_type_create( + ); +void OpenAPI_sm_context_type_free(OpenAPI_sm_context_type_t *sm_context_type); +OpenAPI_sm_context_type_t *OpenAPI_sm_context_type_parseFromJSON(cJSON *sm_context_typeJSON); +cJSON *OpenAPI_sm_context_type_convertToJSON(OpenAPI_sm_context_type_t *sm_context_type); +OpenAPI_sm_context_type_t *OpenAPI_sm_context_type_copy(OpenAPI_sm_context_type_t *dst, OpenAPI_sm_context_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_type_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_update_data.c b/lib/sbi/openapi/model/sm_context_update_data.c new file mode 100644 index 000000000..46e8550db --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_update_data.c @@ -0,0 +1,1307 @@ + +#include +#include +#include +#include "sm_context_update_data.h" + +OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( + char *pei, + char *serving_nf_id, + OpenAPI_guami_t *guami, + OpenAPI_plmn_id_nid_t *serving_network, + OpenAPI_list_t *backup_amf_info, + OpenAPI_access_type_e an_type, + OpenAPI_access_type_e additional_an_type, + OpenAPI_rat_type_e rat_type, + OpenAPI_presence_state_t *presence_in_ladn, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + OpenAPI_up_cnx_state_t *up_cnx_state, + OpenAPI_ho_state_t *ho_state, + int to_be_switched, + int failed_to_be_switched, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_ng_ran_target_id_t *target_id, + char *target_serving_nf_id, + char *sm_context_status_uri, + int data_forwarding, + OpenAPI_tunnel_info_t *n9_forwarding_tunnel, + OpenAPI_list_t *n9_dl_forwarding_tnl_list, + OpenAPI_list_t *n9_ul_forwarding_tnl_list, + OpenAPI_list_t *eps_bearer_setup, + OpenAPI_list_t *revoke_ebi_list, + int release, + OpenAPI_cause_t *cause, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + OpenAPI_snssai_t *s_nssai, + OpenAPI_trace_data_t *trace_data, + OpenAPI_eps_interworking_indication_t *eps_interworking_ind, + int an_type_can_be_changed, + OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1, + OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1, + OpenAPI_ma_release_indication_t *ma_release_ind, + int ma_nw_upgrade_ind, + int ma_request_ind, + OpenAPI_exemption_ind_t *exemption_ind, + char *supported_features, + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, + int extended_nas_sm_timer_ind, + char forwarding_f_teid, + OpenAPI_list_t *forwarding_bearer_contexts, + OpenAPI_ddn_failure_subs_t *ddn_failure_subs + ) +{ + OpenAPI_sm_context_update_data_t *sm_context_update_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_update_data_t)); + if (!sm_context_update_data_local_var) { + return NULL; + } + sm_context_update_data_local_var->pei = pei; + sm_context_update_data_local_var->serving_nf_id = serving_nf_id; + sm_context_update_data_local_var->guami = guami; + sm_context_update_data_local_var->serving_network = serving_network; + sm_context_update_data_local_var->backup_amf_info = backup_amf_info; + sm_context_update_data_local_var->an_type = an_type; + sm_context_update_data_local_var->additional_an_type = additional_an_type; + sm_context_update_data_local_var->rat_type = rat_type; + sm_context_update_data_local_var->presence_in_ladn = presence_in_ladn; + sm_context_update_data_local_var->ue_location = ue_location; + sm_context_update_data_local_var->ue_time_zone = ue_time_zone; + sm_context_update_data_local_var->add_ue_location = add_ue_location; + sm_context_update_data_local_var->up_cnx_state = up_cnx_state; + sm_context_update_data_local_var->ho_state = ho_state; + sm_context_update_data_local_var->to_be_switched = to_be_switched; + sm_context_update_data_local_var->failed_to_be_switched = failed_to_be_switched; + sm_context_update_data_local_var->n1_sm_msg = n1_sm_msg; + sm_context_update_data_local_var->n2_sm_info = n2_sm_info; + sm_context_update_data_local_var->n2_sm_info_type = n2_sm_info_type; + sm_context_update_data_local_var->target_id = target_id; + sm_context_update_data_local_var->target_serving_nf_id = target_serving_nf_id; + sm_context_update_data_local_var->sm_context_status_uri = sm_context_status_uri; + sm_context_update_data_local_var->data_forwarding = data_forwarding; + sm_context_update_data_local_var->n9_forwarding_tunnel = n9_forwarding_tunnel; + sm_context_update_data_local_var->n9_dl_forwarding_tnl_list = n9_dl_forwarding_tnl_list; + sm_context_update_data_local_var->n9_ul_forwarding_tnl_list = n9_ul_forwarding_tnl_list; + sm_context_update_data_local_var->eps_bearer_setup = eps_bearer_setup; + sm_context_update_data_local_var->revoke_ebi_list = revoke_ebi_list; + sm_context_update_data_local_var->release = release; + sm_context_update_data_local_var->cause = cause; + sm_context_update_data_local_var->ng_ap_cause = ng_ap_cause; + sm_context_update_data_local_var->_5g_mm_cause_value = _5g_mm_cause_value; + sm_context_update_data_local_var->s_nssai = s_nssai; + sm_context_update_data_local_var->trace_data = trace_data; + sm_context_update_data_local_var->eps_interworking_ind = eps_interworking_ind; + sm_context_update_data_local_var->an_type_can_be_changed = an_type_can_be_changed; + sm_context_update_data_local_var->n2_sm_info_ext1 = n2_sm_info_ext1; + sm_context_update_data_local_var->n2_sm_info_type_ext1 = n2_sm_info_type_ext1; + sm_context_update_data_local_var->ma_release_ind = ma_release_ind; + sm_context_update_data_local_var->ma_nw_upgrade_ind = ma_nw_upgrade_ind; + sm_context_update_data_local_var->ma_request_ind = ma_request_ind; + sm_context_update_data_local_var->exemption_ind = exemption_ind; + sm_context_update_data_local_var->supported_features = supported_features; + sm_context_update_data_local_var->mo_exp_data_ind = mo_exp_data_ind; + sm_context_update_data_local_var->mo_exp_data_counter = mo_exp_data_counter; + sm_context_update_data_local_var->extended_nas_sm_timer_ind = extended_nas_sm_timer_ind; + sm_context_update_data_local_var->forwarding_f_teid = forwarding_f_teid; + sm_context_update_data_local_var->forwarding_bearer_contexts = forwarding_bearer_contexts; + sm_context_update_data_local_var->ddn_failure_subs = ddn_failure_subs; + + return sm_context_update_data_local_var; +} + +void OpenAPI_sm_context_update_data_free(OpenAPI_sm_context_update_data_t *sm_context_update_data) +{ + if (NULL == sm_context_update_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(sm_context_update_data->pei); + ogs_free(sm_context_update_data->serving_nf_id); + OpenAPI_guami_free(sm_context_update_data->guami); + OpenAPI_plmn_id_nid_free(sm_context_update_data->serving_network); + OpenAPI_list_for_each(sm_context_update_data->backup_amf_info, node) { + OpenAPI_backup_amf_info_free(node->data); + } + OpenAPI_list_free(sm_context_update_data->backup_amf_info); + OpenAPI_presence_state_free(sm_context_update_data->presence_in_ladn); + OpenAPI_user_location_free(sm_context_update_data->ue_location); + ogs_free(sm_context_update_data->ue_time_zone); + OpenAPI_user_location_free(sm_context_update_data->add_ue_location); + OpenAPI_up_cnx_state_free(sm_context_update_data->up_cnx_state); + OpenAPI_ho_state_free(sm_context_update_data->ho_state); + OpenAPI_ref_to_binary_data_free(sm_context_update_data->n1_sm_msg); + OpenAPI_ref_to_binary_data_free(sm_context_update_data->n2_sm_info); + OpenAPI_ng_ran_target_id_free(sm_context_update_data->target_id); + ogs_free(sm_context_update_data->target_serving_nf_id); + ogs_free(sm_context_update_data->sm_context_status_uri); + OpenAPI_tunnel_info_free(sm_context_update_data->n9_forwarding_tunnel); + OpenAPI_list_for_each(sm_context_update_data->n9_dl_forwarding_tnl_list, node) { + OpenAPI_indirect_data_forwarding_tunnel_info_free(node->data); + } + OpenAPI_list_free(sm_context_update_data->n9_dl_forwarding_tnl_list); + OpenAPI_list_for_each(sm_context_update_data->n9_ul_forwarding_tnl_list, node) { + OpenAPI_indirect_data_forwarding_tunnel_info_free(node->data); + } + OpenAPI_list_free(sm_context_update_data->n9_ul_forwarding_tnl_list); + OpenAPI_list_for_each(sm_context_update_data->eps_bearer_setup, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_update_data->eps_bearer_setup); + OpenAPI_list_for_each(sm_context_update_data->revoke_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_update_data->revoke_ebi_list); + OpenAPI_cause_free(sm_context_update_data->cause); + OpenAPI_ng_ap_cause_free(sm_context_update_data->ng_ap_cause); + OpenAPI_snssai_free(sm_context_update_data->s_nssai); + OpenAPI_trace_data_free(sm_context_update_data->trace_data); + OpenAPI_eps_interworking_indication_free(sm_context_update_data->eps_interworking_ind); + OpenAPI_ref_to_binary_data_free(sm_context_update_data->n2_sm_info_ext1); + OpenAPI_ma_release_indication_free(sm_context_update_data->ma_release_ind); + OpenAPI_exemption_ind_free(sm_context_update_data->exemption_ind); + ogs_free(sm_context_update_data->supported_features); + OpenAPI_mo_exception_data_flag_free(sm_context_update_data->mo_exp_data_ind); + OpenAPI_mo_exp_data_counter_free(sm_context_update_data->mo_exp_data_counter); + OpenAPI_list_for_each(sm_context_update_data->forwarding_bearer_contexts, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_update_data->forwarding_bearer_contexts); + OpenAPI_ddn_failure_subs_free(sm_context_update_data->ddn_failure_subs); + ogs_free(sm_context_update_data); +} + +cJSON *OpenAPI_sm_context_update_data_convertToJSON(OpenAPI_sm_context_update_data_t *sm_context_update_data) +{ + cJSON *item = NULL; + + if (sm_context_update_data == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [SmContextUpdateData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sm_context_update_data->pei) { + if (cJSON_AddStringToObject(item, "pei", sm_context_update_data->pei) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [pei]"); + goto end; + } + } + + if (sm_context_update_data->serving_nf_id) { + if (cJSON_AddStringToObject(item, "servingNfId", sm_context_update_data->serving_nf_id) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [serving_nf_id]"); + goto end; + } + } + + if (sm_context_update_data->guami) { + cJSON *guami_local_JSON = OpenAPI_guami_convertToJSON(sm_context_update_data->guami); + if (guami_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [guami]"); + goto end; + } + cJSON_AddItemToObject(item, "guami", guami_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [guami]"); + goto end; + } + } + + if (sm_context_update_data->serving_network) { + cJSON *serving_network_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(sm_context_update_data->serving_network); + if (serving_network_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [serving_network]"); + goto end; + } + cJSON_AddItemToObject(item, "servingNetwork", serving_network_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [serving_network]"); + goto end; + } + } + + if (sm_context_update_data->backup_amf_info) { + cJSON *backup_amf_infoList = cJSON_AddArrayToObject(item, "backupAmfInfo"); + if (backup_amf_infoList == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [backup_amf_info]"); + goto end; + } + + OpenAPI_lnode_t *backup_amf_info_node; + if (sm_context_update_data->backup_amf_info) { + OpenAPI_list_for_each(sm_context_update_data->backup_amf_info, backup_amf_info_node) { + cJSON *itemLocal = OpenAPI_backup_amf_info_convertToJSON(backup_amf_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [backup_amf_info]"); + goto end; + } + cJSON_AddItemToArray(backup_amf_infoList, itemLocal); + } + } + } + + if (sm_context_update_data->an_type) { + if (cJSON_AddStringToObject(item, "anType", OpenAPI_access_type_ToString(sm_context_update_data->an_type)) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [an_type]"); + goto end; + } + } + + if (sm_context_update_data->additional_an_type) { + if (cJSON_AddStringToObject(item, "additionalAnType", OpenAPI_access_type_ToString(sm_context_update_data->additional_an_type)) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [additional_an_type]"); + goto end; + } + } + + if (sm_context_update_data->rat_type) { + if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(sm_context_update_data->rat_type)) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [rat_type]"); + goto end; + } + } + + if (sm_context_update_data->presence_in_ladn) { + cJSON *presence_in_ladn_local_JSON = OpenAPI_presence_state_convertToJSON(sm_context_update_data->presence_in_ladn); + if (presence_in_ladn_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [presence_in_ladn]"); + goto end; + } + cJSON_AddItemToObject(item, "presenceInLadn", presence_in_ladn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [presence_in_ladn]"); + goto end; + } + } + + if (sm_context_update_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(sm_context_update_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + + if (sm_context_update_data->ue_time_zone) { + if (cJSON_AddStringToObject(item, "ueTimeZone", sm_context_update_data->ue_time_zone) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ue_time_zone]"); + goto end; + } + } + + if (sm_context_update_data->add_ue_location) { + cJSON *add_ue_location_local_JSON = OpenAPI_user_location_convertToJSON(sm_context_update_data->add_ue_location); + if (add_ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "addUeLocation", add_ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + } + + if (sm_context_update_data->up_cnx_state) { + cJSON *up_cnx_state_local_JSON = OpenAPI_up_cnx_state_convertToJSON(sm_context_update_data->up_cnx_state); + if (up_cnx_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + cJSON_AddItemToObject(item, "upCnxState", up_cnx_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + } + + if (sm_context_update_data->ho_state) { + cJSON *ho_state_local_JSON = OpenAPI_ho_state_convertToJSON(sm_context_update_data->ho_state); + if (ho_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ho_state]"); + goto end; + } + cJSON_AddItemToObject(item, "hoState", ho_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ho_state]"); + goto end; + } + } + + if (sm_context_update_data->to_be_switched) { + if (cJSON_AddBoolToObject(item, "toBeSwitched", sm_context_update_data->to_be_switched) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [to_be_switched]"); + goto end; + } + } + + if (sm_context_update_data->failed_to_be_switched) { + if (cJSON_AddBoolToObject(item, "failedToBeSwitched", sm_context_update_data->failed_to_be_switched) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [failed_to_be_switched]"); + goto end; + } + } + + if (sm_context_update_data->n1_sm_msg) { + cJSON *n1_sm_msg_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_update_data->n1_sm_msg); + if (n1_sm_msg_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmMsg", n1_sm_msg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + } + + if (sm_context_update_data->n2_sm_info) { + cJSON *n2_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_update_data->n2_sm_info); + if (n2_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfo", n2_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + } + + if (sm_context_update_data->n2_sm_info_type) { + if (cJSON_AddStringToObject(item, "n2SmInfoType", OpenAPI_n2_sm_info_type_ToString(sm_context_update_data->n2_sm_info_type)) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n2_sm_info_type]"); + goto end; + } + } + + if (sm_context_update_data->target_id) { + cJSON *target_id_local_JSON = OpenAPI_ng_ran_target_id_convertToJSON(sm_context_update_data->target_id); + if (target_id_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [target_id]"); + goto end; + } + cJSON_AddItemToObject(item, "targetId", target_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [target_id]"); + goto end; + } + } + + if (sm_context_update_data->target_serving_nf_id) { + if (cJSON_AddStringToObject(item, "targetServingNfId", sm_context_update_data->target_serving_nf_id) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [target_serving_nf_id]"); + goto end; + } + } + + if (sm_context_update_data->sm_context_status_uri) { + if (cJSON_AddStringToObject(item, "smContextStatusUri", sm_context_update_data->sm_context_status_uri) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [sm_context_status_uri]"); + goto end; + } + } + + if (sm_context_update_data->data_forwarding) { + if (cJSON_AddBoolToObject(item, "dataForwarding", sm_context_update_data->data_forwarding) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [data_forwarding]"); + goto end; + } + } + + if (sm_context_update_data->n9_forwarding_tunnel) { + cJSON *n9_forwarding_tunnel_local_JSON = OpenAPI_tunnel_info_convertToJSON(sm_context_update_data->n9_forwarding_tunnel); + if (n9_forwarding_tunnel_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_forwarding_tunnel]"); + goto end; + } + cJSON_AddItemToObject(item, "n9ForwardingTunnel", n9_forwarding_tunnel_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_forwarding_tunnel]"); + goto end; + } + } + + if (sm_context_update_data->n9_dl_forwarding_tnl_list) { + cJSON *n9_dl_forwarding_tnl_listList = cJSON_AddArrayToObject(item, "n9DlForwardingTnlList"); + if (n9_dl_forwarding_tnl_listList == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_dl_forwarding_tnl_list]"); + goto end; + } + + OpenAPI_lnode_t *n9_dl_forwarding_tnl_list_node; + if (sm_context_update_data->n9_dl_forwarding_tnl_list) { + OpenAPI_list_for_each(sm_context_update_data->n9_dl_forwarding_tnl_list, n9_dl_forwarding_tnl_list_node) { + cJSON *itemLocal = OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON(n9_dl_forwarding_tnl_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_dl_forwarding_tnl_list]"); + goto end; + } + cJSON_AddItemToArray(n9_dl_forwarding_tnl_listList, itemLocal); + } + } + } + + if (sm_context_update_data->n9_ul_forwarding_tnl_list) { + cJSON *n9_ul_forwarding_tnl_listList = cJSON_AddArrayToObject(item, "n9UlForwardingTnlList"); + if (n9_ul_forwarding_tnl_listList == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_ul_forwarding_tnl_list]"); + goto end; + } + + OpenAPI_lnode_t *n9_ul_forwarding_tnl_list_node; + if (sm_context_update_data->n9_ul_forwarding_tnl_list) { + OpenAPI_list_for_each(sm_context_update_data->n9_ul_forwarding_tnl_list, n9_ul_forwarding_tnl_list_node) { + cJSON *itemLocal = OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON(n9_ul_forwarding_tnl_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_ul_forwarding_tnl_list]"); + goto end; + } + cJSON_AddItemToArray(n9_ul_forwarding_tnl_listList, itemLocal); + } + } + } + + if (sm_context_update_data->eps_bearer_setup) { + cJSON *eps_bearer_setup = cJSON_AddArrayToObject(item, "epsBearerSetup"); + if (eps_bearer_setup == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [eps_bearer_setup]"); + goto end; + } + + OpenAPI_lnode_t *eps_bearer_setup_node; + OpenAPI_list_for_each(sm_context_update_data->eps_bearer_setup, eps_bearer_setup_node) { + if (cJSON_AddStringToObject(eps_bearer_setup, "", (char*)eps_bearer_setup_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [eps_bearer_setup]"); + goto end; + } + } + } + + if (sm_context_update_data->revoke_ebi_list) { + cJSON *revoke_ebi_list = cJSON_AddArrayToObject(item, "revokeEbiList"); + if (revoke_ebi_list == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [revoke_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *revoke_ebi_list_node; + OpenAPI_list_for_each(sm_context_update_data->revoke_ebi_list, revoke_ebi_list_node) { + if (cJSON_AddNumberToObject(revoke_ebi_list, "", *(double *)revoke_ebi_list_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [revoke_ebi_list]"); + goto end; + } + } + } + + if (sm_context_update_data->release) { + if (cJSON_AddBoolToObject(item, "release", sm_context_update_data->release) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [release]"); + goto end; + } + } + + if (sm_context_update_data->cause) { + cJSON *cause_local_JSON = OpenAPI_cause_convertToJSON(sm_context_update_data->cause); + if (cause_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [cause]"); + goto end; + } + cJSON_AddItemToObject(item, "cause", cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [cause]"); + goto end; + } + } + + if (sm_context_update_data->ng_ap_cause) { + cJSON *ng_ap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(sm_context_update_data->ng_ap_cause); + if (ng_ap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngApCause", ng_ap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + } + + if (sm_context_update_data->_5g_mm_cause_value) { + if (cJSON_AddNumberToObject(item, "5gMmCauseValue", sm_context_update_data->_5g_mm_cause_value) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + if (sm_context_update_data->s_nssai) { + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(sm_context_update_data->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [s_nssai]"); + goto end; + } + } + + if (sm_context_update_data->trace_data) { + cJSON *trace_data_local_JSON = OpenAPI_trace_data_convertToJSON(sm_context_update_data->trace_data); + if (trace_data_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [trace_data]"); + goto end; + } + cJSON_AddItemToObject(item, "traceData", trace_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [trace_data]"); + goto end; + } + } + + if (sm_context_update_data->eps_interworking_ind) { + cJSON *eps_interworking_ind_local_JSON = OpenAPI_eps_interworking_indication_convertToJSON(sm_context_update_data->eps_interworking_ind); + if (eps_interworking_ind_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [eps_interworking_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "epsInterworkingInd", eps_interworking_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [eps_interworking_ind]"); + goto end; + } + } + + if (sm_context_update_data->an_type_can_be_changed) { + if (cJSON_AddBoolToObject(item, "anTypeCanBeChanged", sm_context_update_data->an_type_can_be_changed) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [an_type_can_be_changed]"); + goto end; + } + } + + if (sm_context_update_data->n2_sm_info_ext1) { + cJSON *n2_sm_info_ext1_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_update_data->n2_sm_info_ext1); + if (n2_sm_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n2_sm_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfoExt1", n2_sm_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n2_sm_info_ext1]"); + goto end; + } + } + + if (sm_context_update_data->n2_sm_info_type_ext1) { + if (cJSON_AddStringToObject(item, "n2SmInfoTypeExt1", OpenAPI_n2_sm_info_type_ToString(sm_context_update_data->n2_sm_info_type_ext1)) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n2_sm_info_type_ext1]"); + goto end; + } + } + + if (sm_context_update_data->ma_release_ind) { + cJSON *ma_release_ind_local_JSON = OpenAPI_ma_release_indication_convertToJSON(sm_context_update_data->ma_release_ind); + if (ma_release_ind_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ma_release_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "maReleaseInd", ma_release_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ma_release_ind]"); + goto end; + } + } + + if (sm_context_update_data->ma_nw_upgrade_ind) { + if (cJSON_AddBoolToObject(item, "maNwUpgradeInd", sm_context_update_data->ma_nw_upgrade_ind) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ma_nw_upgrade_ind]"); + goto end; + } + } + + if (sm_context_update_data->ma_request_ind) { + if (cJSON_AddBoolToObject(item, "maRequestInd", sm_context_update_data->ma_request_ind) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ma_request_ind]"); + goto end; + } + } + + if (sm_context_update_data->exemption_ind) { + cJSON *exemption_ind_local_JSON = OpenAPI_exemption_ind_convertToJSON(sm_context_update_data->exemption_ind); + if (exemption_ind_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [exemption_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "exemptionInd", exemption_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [exemption_ind]"); + goto end; + } + } + + if (sm_context_update_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sm_context_update_data->supported_features) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (sm_context_update_data->mo_exp_data_ind) { + cJSON *mo_exp_data_ind_local_JSON = OpenAPI_mo_exception_data_flag_convertToJSON(sm_context_update_data->mo_exp_data_ind); + if (mo_exp_data_ind_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [mo_exp_data_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataInd", mo_exp_data_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [mo_exp_data_ind]"); + goto end; + } + } + + if (sm_context_update_data->mo_exp_data_counter) { + cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(sm_context_update_data->mo_exp_data_counter); + if (mo_exp_data_counter_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataCounter", mo_exp_data_counter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + } + + if (sm_context_update_data->extended_nas_sm_timer_ind) { + if (cJSON_AddBoolToObject(item, "extendedNasSmTimerInd", sm_context_update_data->extended_nas_sm_timer_ind) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [extended_nas_sm_timer_ind]"); + goto end; + } + } + + if (sm_context_update_data->forwarding_f_teid) { + if (cJSON_AddNumberToObject(item, "forwardingFTeid", sm_context_update_data->forwarding_f_teid) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [forwarding_f_teid]"); + goto end; + } + } + + if (sm_context_update_data->forwarding_bearer_contexts) { + cJSON *forwarding_bearer_contexts = cJSON_AddArrayToObject(item, "forwardingBearerContexts"); + if (forwarding_bearer_contexts == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [forwarding_bearer_contexts]"); + goto end; + } + + OpenAPI_lnode_t *forwarding_bearer_contexts_node; + OpenAPI_list_for_each(sm_context_update_data->forwarding_bearer_contexts, forwarding_bearer_contexts_node) { + if (cJSON_AddStringToObject(forwarding_bearer_contexts, "", (char*)forwarding_bearer_contexts_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [forwarding_bearer_contexts]"); + goto end; + } + } + } + + if (sm_context_update_data->ddn_failure_subs) { + cJSON *ddn_failure_subs_local_JSON = OpenAPI_ddn_failure_subs_convertToJSON(sm_context_update_data->ddn_failure_subs); + if (ddn_failure_subs_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ddn_failure_subs]"); + goto end; + } + cJSON_AddItemToObject(item, "ddnFailureSubs", ddn_failure_subs_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [ddn_failure_subs]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(cJSON *sm_context_update_dataJSON) +{ + OpenAPI_sm_context_update_data_t *sm_context_update_data_local_var = NULL; + cJSON *pei = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "pei"); + + if (pei) { + if (!cJSON_IsString(pei)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [pei]"); + goto end; + } + } + + cJSON *serving_nf_id = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "servingNfId"); + + if (serving_nf_id) { + if (!cJSON_IsString(serving_nf_id)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [serving_nf_id]"); + goto end; + } + } + + cJSON *guami = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "guami"); + + OpenAPI_guami_t *guami_local_nonprim = NULL; + if (guami) { + guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami); + } + + cJSON *serving_network = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "servingNetwork"); + + OpenAPI_plmn_id_nid_t *serving_network_local_nonprim = NULL; + if (serving_network) { + serving_network_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(serving_network); + } + + cJSON *backup_amf_info = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "backupAmfInfo"); + + OpenAPI_list_t *backup_amf_infoList; + if (backup_amf_info) { + cJSON *backup_amf_info_local_nonprimitive; + if (!cJSON_IsArray(backup_amf_info)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [backup_amf_info]"); + goto end; + } + + backup_amf_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(backup_amf_info_local_nonprimitive, backup_amf_info ) { + if (!cJSON_IsObject(backup_amf_info_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [backup_amf_info]"); + goto end; + } + OpenAPI_backup_amf_info_t *backup_amf_infoItem = OpenAPI_backup_amf_info_parseFromJSON(backup_amf_info_local_nonprimitive); + + OpenAPI_list_add(backup_amf_infoList, backup_amf_infoItem); + } + } + + cJSON *an_type = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "anType"); + + OpenAPI_access_type_e an_typeVariable; + if (an_type) { + if (!cJSON_IsString(an_type)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [an_type]"); + goto end; + } + an_typeVariable = OpenAPI_access_type_FromString(an_type->valuestring); + } + + cJSON *additional_an_type = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "additionalAnType"); + + OpenAPI_access_type_e additional_an_typeVariable; + if (additional_an_type) { + if (!cJSON_IsString(additional_an_type)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [additional_an_type]"); + goto end; + } + additional_an_typeVariable = OpenAPI_access_type_FromString(additional_an_type->valuestring); + } + + cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "ratType"); + + OpenAPI_rat_type_e rat_typeVariable; + if (rat_type) { + if (!cJSON_IsString(rat_type)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [rat_type]"); + goto end; + } + rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); + } + + cJSON *presence_in_ladn = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "presenceInLadn"); + + OpenAPI_presence_state_t *presence_in_ladn_local_nonprim = NULL; + if (presence_in_ladn) { + presence_in_ladn_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_in_ladn); + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "ueTimeZone"); + + if (ue_time_zone) { + if (!cJSON_IsString(ue_time_zone)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [ue_time_zone]"); + goto end; + } + } + + cJSON *add_ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "addUeLocation"); + + OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL; + if (add_ue_location) { + add_ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(add_ue_location); + } + + cJSON *up_cnx_state = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "upCnxState"); + + OpenAPI_up_cnx_state_t *up_cnx_state_local_nonprim = NULL; + if (up_cnx_state) { + up_cnx_state_local_nonprim = OpenAPI_up_cnx_state_parseFromJSON(up_cnx_state); + } + + cJSON *ho_state = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "hoState"); + + OpenAPI_ho_state_t *ho_state_local_nonprim = NULL; + if (ho_state) { + ho_state_local_nonprim = OpenAPI_ho_state_parseFromJSON(ho_state); + } + + cJSON *to_be_switched = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "toBeSwitched"); + + if (to_be_switched) { + if (!cJSON_IsBool(to_be_switched)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [to_be_switched]"); + goto end; + } + } + + cJSON *failed_to_be_switched = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "failedToBeSwitched"); + + if (failed_to_be_switched) { + if (!cJSON_IsBool(failed_to_be_switched)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [failed_to_be_switched]"); + goto end; + } + } + + cJSON *n1_sm_msg = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n1SmMsg"); + + OpenAPI_ref_to_binary_data_t *n1_sm_msg_local_nonprim = NULL; + if (n1_sm_msg) { + n1_sm_msg_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_msg); + } + + cJSON *n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n2SmInfo"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL; + if (n2_sm_info) { + n2_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info); + } + + cJSON *n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n2SmInfoType"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable; + if (n2_sm_info_type) { + if (!cJSON_IsString(n2_sm_info_type)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [n2_sm_info_type]"); + goto end; + } + n2_sm_info_typeVariable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type->valuestring); + } + + cJSON *target_id = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "targetId"); + + OpenAPI_ng_ran_target_id_t *target_id_local_nonprim = NULL; + if (target_id) { + target_id_local_nonprim = OpenAPI_ng_ran_target_id_parseFromJSON(target_id); + } + + cJSON *target_serving_nf_id = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "targetServingNfId"); + + if (target_serving_nf_id) { + if (!cJSON_IsString(target_serving_nf_id)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [target_serving_nf_id]"); + goto end; + } + } + + cJSON *sm_context_status_uri = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "smContextStatusUri"); + + if (sm_context_status_uri) { + if (!cJSON_IsString(sm_context_status_uri)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [sm_context_status_uri]"); + goto end; + } + } + + cJSON *data_forwarding = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "dataForwarding"); + + if (data_forwarding) { + if (!cJSON_IsBool(data_forwarding)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [data_forwarding]"); + goto end; + } + } + + cJSON *n9_forwarding_tunnel = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n9ForwardingTunnel"); + + OpenAPI_tunnel_info_t *n9_forwarding_tunnel_local_nonprim = NULL; + if (n9_forwarding_tunnel) { + n9_forwarding_tunnel_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(n9_forwarding_tunnel); + } + + cJSON *n9_dl_forwarding_tnl_list = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n9DlForwardingTnlList"); + + OpenAPI_list_t *n9_dl_forwarding_tnl_listList; + if (n9_dl_forwarding_tnl_list) { + cJSON *n9_dl_forwarding_tnl_list_local_nonprimitive; + if (!cJSON_IsArray(n9_dl_forwarding_tnl_list)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [n9_dl_forwarding_tnl_list]"); + goto end; + } + + n9_dl_forwarding_tnl_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(n9_dl_forwarding_tnl_list_local_nonprimitive, n9_dl_forwarding_tnl_list ) { + if (!cJSON_IsObject(n9_dl_forwarding_tnl_list_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [n9_dl_forwarding_tnl_list]"); + goto end; + } + OpenAPI_indirect_data_forwarding_tunnel_info_t *n9_dl_forwarding_tnl_listItem = OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON(n9_dl_forwarding_tnl_list_local_nonprimitive); + + OpenAPI_list_add(n9_dl_forwarding_tnl_listList, n9_dl_forwarding_tnl_listItem); + } + } + + cJSON *n9_ul_forwarding_tnl_list = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n9UlForwardingTnlList"); + + OpenAPI_list_t *n9_ul_forwarding_tnl_listList; + if (n9_ul_forwarding_tnl_list) { + cJSON *n9_ul_forwarding_tnl_list_local_nonprimitive; + if (!cJSON_IsArray(n9_ul_forwarding_tnl_list)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [n9_ul_forwarding_tnl_list]"); + goto end; + } + + n9_ul_forwarding_tnl_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(n9_ul_forwarding_tnl_list_local_nonprimitive, n9_ul_forwarding_tnl_list ) { + if (!cJSON_IsObject(n9_ul_forwarding_tnl_list_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [n9_ul_forwarding_tnl_list]"); + goto end; + } + OpenAPI_indirect_data_forwarding_tunnel_info_t *n9_ul_forwarding_tnl_listItem = OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON(n9_ul_forwarding_tnl_list_local_nonprimitive); + + OpenAPI_list_add(n9_ul_forwarding_tnl_listList, n9_ul_forwarding_tnl_listItem); + } + } + + cJSON *eps_bearer_setup = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "epsBearerSetup"); + + OpenAPI_list_t *eps_bearer_setupList; + if (eps_bearer_setup) { + cJSON *eps_bearer_setup_local; + if (!cJSON_IsArray(eps_bearer_setup)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [eps_bearer_setup]"); + goto end; + } + eps_bearer_setupList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eps_bearer_setup_local, eps_bearer_setup) { + if (!cJSON_IsString(eps_bearer_setup_local)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [eps_bearer_setup]"); + goto end; + } + OpenAPI_list_add(eps_bearer_setupList, ogs_strdup(eps_bearer_setup_local->valuestring)); + } + } + + cJSON *revoke_ebi_list = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "revokeEbiList"); + + OpenAPI_list_t *revoke_ebi_listList; + if (revoke_ebi_list) { + cJSON *revoke_ebi_list_local; + if (!cJSON_IsArray(revoke_ebi_list)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [revoke_ebi_list]"); + goto end; + } + revoke_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(revoke_ebi_list_local, revoke_ebi_list) { + if (!cJSON_IsNumber(revoke_ebi_list_local)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [revoke_ebi_list]"); + goto end; + } + OpenAPI_list_add(revoke_ebi_listList, &revoke_ebi_list_local->valuedouble); + } + } + + cJSON *release = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "release"); + + if (release) { + if (!cJSON_IsBool(release)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [release]"); + goto end; + } + } + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "cause"); + + OpenAPI_cause_t *cause_local_nonprim = NULL; + if (cause) { + cause_local_nonprim = OpenAPI_cause_parseFromJSON(cause); + } + + cJSON *ng_ap_cause = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "ngApCause"); + + OpenAPI_ng_ap_cause_t *ng_ap_cause_local_nonprim = NULL; + if (ng_ap_cause) { + ng_ap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ng_ap_cause); + } + + cJSON *_5g_mm_cause_value = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "5gMmCauseValue"); + + if (_5g_mm_cause_value) { + if (!cJSON_IsNumber(_5g_mm_cause_value)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "sNssai"); + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + if (s_nssai) { + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + } + + cJSON *trace_data = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "traceData"); + + OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; + if (trace_data) { + trace_data_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_data); + } + + cJSON *eps_interworking_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "epsInterworkingInd"); + + OpenAPI_eps_interworking_indication_t *eps_interworking_ind_local_nonprim = NULL; + if (eps_interworking_ind) { + eps_interworking_ind_local_nonprim = OpenAPI_eps_interworking_indication_parseFromJSON(eps_interworking_ind); + } + + cJSON *an_type_can_be_changed = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "anTypeCanBeChanged"); + + if (an_type_can_be_changed) { + if (!cJSON_IsBool(an_type_can_be_changed)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [an_type_can_be_changed]"); + goto end; + } + } + + cJSON *n2_sm_info_ext1 = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n2SmInfoExt1"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1_local_nonprim = NULL; + if (n2_sm_info_ext1) { + n2_sm_info_ext1_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info_ext1); + } + + cJSON *n2_sm_info_type_ext1 = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n2SmInfoTypeExt1"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1Variable; + if (n2_sm_info_type_ext1) { + if (!cJSON_IsString(n2_sm_info_type_ext1)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [n2_sm_info_type_ext1]"); + goto end; + } + n2_sm_info_type_ext1Variable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type_ext1->valuestring); + } + + cJSON *ma_release_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "maReleaseInd"); + + OpenAPI_ma_release_indication_t *ma_release_ind_local_nonprim = NULL; + if (ma_release_ind) { + ma_release_ind_local_nonprim = OpenAPI_ma_release_indication_parseFromJSON(ma_release_ind); + } + + cJSON *ma_nw_upgrade_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "maNwUpgradeInd"); + + if (ma_nw_upgrade_ind) { + if (!cJSON_IsBool(ma_nw_upgrade_ind)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [ma_nw_upgrade_ind]"); + goto end; + } + } + + cJSON *ma_request_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "maRequestInd"); + + if (ma_request_ind) { + if (!cJSON_IsBool(ma_request_ind)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [ma_request_ind]"); + goto end; + } + } + + cJSON *exemption_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "exemptionInd"); + + OpenAPI_exemption_ind_t *exemption_ind_local_nonprim = NULL; + if (exemption_ind) { + exemption_ind_local_nonprim = OpenAPI_exemption_ind_parseFromJSON(exemption_ind); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *mo_exp_data_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "moExpDataInd"); + + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind_local_nonprim = NULL; + if (mo_exp_data_ind) { + mo_exp_data_ind_local_nonprim = OpenAPI_mo_exception_data_flag_parseFromJSON(mo_exp_data_ind); + } + + cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "moExpDataCounter"); + + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; + if (mo_exp_data_counter) { + mo_exp_data_counter_local_nonprim = OpenAPI_mo_exp_data_counter_parseFromJSON(mo_exp_data_counter); + } + + cJSON *extended_nas_sm_timer_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "extendedNasSmTimerInd"); + + if (extended_nas_sm_timer_ind) { + if (!cJSON_IsBool(extended_nas_sm_timer_ind)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [extended_nas_sm_timer_ind]"); + goto end; + } + } + + cJSON *forwarding_f_teid = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "forwardingFTeid"); + + if (forwarding_f_teid) { + if (!cJSON_IsNumber(forwarding_f_teid)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [forwarding_f_teid]"); + goto end; + } + } + + cJSON *forwarding_bearer_contexts = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "forwardingBearerContexts"); + + OpenAPI_list_t *forwarding_bearer_contextsList; + if (forwarding_bearer_contexts) { + cJSON *forwarding_bearer_contexts_local; + if (!cJSON_IsArray(forwarding_bearer_contexts)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [forwarding_bearer_contexts]"); + goto end; + } + forwarding_bearer_contextsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(forwarding_bearer_contexts_local, forwarding_bearer_contexts) { + if (!cJSON_IsString(forwarding_bearer_contexts_local)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [forwarding_bearer_contexts]"); + goto end; + } + OpenAPI_list_add(forwarding_bearer_contextsList, ogs_strdup(forwarding_bearer_contexts_local->valuestring)); + } + } + + cJSON *ddn_failure_subs = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "ddnFailureSubs"); + + OpenAPI_ddn_failure_subs_t *ddn_failure_subs_local_nonprim = NULL; + if (ddn_failure_subs) { + ddn_failure_subs_local_nonprim = OpenAPI_ddn_failure_subs_parseFromJSON(ddn_failure_subs); + } + + sm_context_update_data_local_var = OpenAPI_sm_context_update_data_create ( + pei ? ogs_strdup(pei->valuestring) : NULL, + serving_nf_id ? ogs_strdup(serving_nf_id->valuestring) : NULL, + guami ? guami_local_nonprim : NULL, + serving_network ? serving_network_local_nonprim : NULL, + backup_amf_info ? backup_amf_infoList : NULL, + an_type ? an_typeVariable : 0, + additional_an_type ? additional_an_typeVariable : 0, + rat_type ? rat_typeVariable : 0, + presence_in_ladn ? presence_in_ladn_local_nonprim : NULL, + ue_location ? ue_location_local_nonprim : NULL, + ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL, + add_ue_location ? add_ue_location_local_nonprim : NULL, + up_cnx_state ? up_cnx_state_local_nonprim : NULL, + ho_state ? ho_state_local_nonprim : NULL, + to_be_switched ? to_be_switched->valueint : 0, + failed_to_be_switched ? failed_to_be_switched->valueint : 0, + n1_sm_msg ? n1_sm_msg_local_nonprim : NULL, + n2_sm_info ? n2_sm_info_local_nonprim : NULL, + n2_sm_info_type ? n2_sm_info_typeVariable : 0, + target_id ? target_id_local_nonprim : NULL, + target_serving_nf_id ? ogs_strdup(target_serving_nf_id->valuestring) : NULL, + sm_context_status_uri ? ogs_strdup(sm_context_status_uri->valuestring) : NULL, + data_forwarding ? data_forwarding->valueint : 0, + n9_forwarding_tunnel ? n9_forwarding_tunnel_local_nonprim : NULL, + n9_dl_forwarding_tnl_list ? n9_dl_forwarding_tnl_listList : NULL, + n9_ul_forwarding_tnl_list ? n9_ul_forwarding_tnl_listList : NULL, + eps_bearer_setup ? eps_bearer_setupList : NULL, + revoke_ebi_list ? revoke_ebi_listList : NULL, + release ? release->valueint : 0, + cause ? cause_local_nonprim : NULL, + ng_ap_cause ? ng_ap_cause_local_nonprim : NULL, + _5g_mm_cause_value ? _5g_mm_cause_value->valuedouble : 0, + s_nssai ? s_nssai_local_nonprim : NULL, + trace_data ? trace_data_local_nonprim : NULL, + eps_interworking_ind ? eps_interworking_ind_local_nonprim : NULL, + an_type_can_be_changed ? an_type_can_be_changed->valueint : 0, + n2_sm_info_ext1 ? n2_sm_info_ext1_local_nonprim : NULL, + n2_sm_info_type_ext1 ? n2_sm_info_type_ext1Variable : 0, + ma_release_ind ? ma_release_ind_local_nonprim : NULL, + ma_nw_upgrade_ind ? ma_nw_upgrade_ind->valueint : 0, + ma_request_ind ? ma_request_ind->valueint : 0, + exemption_ind ? exemption_ind_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + mo_exp_data_ind ? mo_exp_data_ind_local_nonprim : NULL, + mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, + extended_nas_sm_timer_ind ? extended_nas_sm_timer_ind->valueint : 0, + forwarding_f_teid ? forwarding_f_teid->valueint : 0, + forwarding_bearer_contexts ? forwarding_bearer_contextsList : NULL, + ddn_failure_subs ? ddn_failure_subs_local_nonprim : NULL + ); + + return sm_context_update_data_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_copy(OpenAPI_sm_context_update_data_t *dst, OpenAPI_sm_context_update_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_update_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_update_data_free(dst); + dst = OpenAPI_sm_context_update_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_update_data.h b/lib/sbi/openapi/model/sm_context_update_data.h new file mode 100644 index 000000000..609d29716 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_update_data.h @@ -0,0 +1,158 @@ +/* + * sm_context_update_data.h + * + * + */ + +#ifndef _OpenAPI_sm_context_update_data_H_ +#define _OpenAPI_sm_context_update_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "backup_amf_info.h" +#include "cause.h" +#include "ddn_failure_subs.h" +#include "eps_interworking_indication.h" +#include "exemption_ind.h" +#include "guami.h" +#include "ho_state.h" +#include "indirect_data_forwarding_tunnel_info.h" +#include "ma_release_indication.h" +#include "mo_exception_data_flag.h" +#include "mo_exp_data_counter.h" +#include "n2_sm_info_type.h" +#include "ng_ap_cause.h" +#include "ng_ran_target_id.h" +#include "plmn_id_nid.h" +#include "presence_state.h" +#include "rat_type.h" +#include "ref_to_binary_data.h" +#include "snssai.h" +#include "trace_data.h" +#include "tunnel_info.h" +#include "up_cnx_state.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_update_data_s OpenAPI_sm_context_update_data_t; +typedef struct OpenAPI_sm_context_update_data_s { + char *pei; + char *serving_nf_id; + struct OpenAPI_guami_s *guami; + struct OpenAPI_plmn_id_nid_s *serving_network; + OpenAPI_list_t *backup_amf_info; + OpenAPI_access_type_e an_type; + OpenAPI_access_type_e additional_an_type; + OpenAPI_rat_type_e rat_type; + struct OpenAPI_presence_state_s *presence_in_ladn; + struct OpenAPI_user_location_s *ue_location; + char *ue_time_zone; + struct OpenAPI_user_location_s *add_ue_location; + struct OpenAPI_up_cnx_state_s *up_cnx_state; + struct OpenAPI_ho_state_s *ho_state; + int to_be_switched; + int failed_to_be_switched; + struct OpenAPI_ref_to_binary_data_s *n1_sm_msg; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info; + OpenAPI_n2_sm_info_type_e n2_sm_info_type; + struct OpenAPI_ng_ran_target_id_s *target_id; + char *target_serving_nf_id; + char *sm_context_status_uri; + int data_forwarding; + struct OpenAPI_tunnel_info_s *n9_forwarding_tunnel; + OpenAPI_list_t *n9_dl_forwarding_tnl_list; + OpenAPI_list_t *n9_ul_forwarding_tnl_list; + OpenAPI_list_t *eps_bearer_setup; + OpenAPI_list_t *revoke_ebi_list; + int release; + struct OpenAPI_cause_s *cause; + struct OpenAPI_ng_ap_cause_s *ng_ap_cause; + int _5g_mm_cause_value; + struct OpenAPI_snssai_s *s_nssai; + struct OpenAPI_trace_data_s *trace_data; + struct OpenAPI_eps_interworking_indication_s *eps_interworking_ind; + int an_type_can_be_changed; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info_ext1; + OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1; + struct OpenAPI_ma_release_indication_s *ma_release_ind; + int ma_nw_upgrade_ind; + int ma_request_ind; + struct OpenAPI_exemption_ind_s *exemption_ind; + char *supported_features; + struct OpenAPI_mo_exception_data_flag_s *mo_exp_data_ind; + struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; + int extended_nas_sm_timer_ind; + char forwarding_f_teid; + OpenAPI_list_t *forwarding_bearer_contexts; + struct OpenAPI_ddn_failure_subs_s *ddn_failure_subs; +} OpenAPI_sm_context_update_data_t; + +OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( + char *pei, + char *serving_nf_id, + OpenAPI_guami_t *guami, + OpenAPI_plmn_id_nid_t *serving_network, + OpenAPI_list_t *backup_amf_info, + OpenAPI_access_type_e an_type, + OpenAPI_access_type_e additional_an_type, + OpenAPI_rat_type_e rat_type, + OpenAPI_presence_state_t *presence_in_ladn, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + OpenAPI_up_cnx_state_t *up_cnx_state, + OpenAPI_ho_state_t *ho_state, + int to_be_switched, + int failed_to_be_switched, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_ng_ran_target_id_t *target_id, + char *target_serving_nf_id, + char *sm_context_status_uri, + int data_forwarding, + OpenAPI_tunnel_info_t *n9_forwarding_tunnel, + OpenAPI_list_t *n9_dl_forwarding_tnl_list, + OpenAPI_list_t *n9_ul_forwarding_tnl_list, + OpenAPI_list_t *eps_bearer_setup, + OpenAPI_list_t *revoke_ebi_list, + int release, + OpenAPI_cause_t *cause, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + OpenAPI_snssai_t *s_nssai, + OpenAPI_trace_data_t *trace_data, + OpenAPI_eps_interworking_indication_t *eps_interworking_ind, + int an_type_can_be_changed, + OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1, + OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1, + OpenAPI_ma_release_indication_t *ma_release_ind, + int ma_nw_upgrade_ind, + int ma_request_ind, + OpenAPI_exemption_ind_t *exemption_ind, + char *supported_features, + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, + int extended_nas_sm_timer_ind, + char forwarding_f_teid, + OpenAPI_list_t *forwarding_bearer_contexts, + OpenAPI_ddn_failure_subs_t *ddn_failure_subs + ); +void OpenAPI_sm_context_update_data_free(OpenAPI_sm_context_update_data_t *sm_context_update_data); +OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(cJSON *sm_context_update_dataJSON); +cJSON *OpenAPI_sm_context_update_data_convertToJSON(OpenAPI_sm_context_update_data_t *sm_context_update_data); +OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_copy(OpenAPI_sm_context_update_data_t *dst, OpenAPI_sm_context_update_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_update_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_update_error.c b/lib/sbi/openapi/model/sm_context_update_error.c new file mode 100644 index 000000000..cdab853a6 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_update_error.c @@ -0,0 +1,227 @@ + +#include +#include +#include +#include "sm_context_update_error.h" + +OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_up_cnx_state_t *up_cnx_state, + char *recovery_time + ) +{ + OpenAPI_sm_context_update_error_t *sm_context_update_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_update_error_t)); + if (!sm_context_update_error_local_var) { + return NULL; + } + sm_context_update_error_local_var->error = error; + sm_context_update_error_local_var->n1_sm_msg = n1_sm_msg; + sm_context_update_error_local_var->n2_sm_info = n2_sm_info; + sm_context_update_error_local_var->n2_sm_info_type = n2_sm_info_type; + sm_context_update_error_local_var->up_cnx_state = up_cnx_state; + sm_context_update_error_local_var->recovery_time = recovery_time; + + return sm_context_update_error_local_var; +} + +void OpenAPI_sm_context_update_error_free(OpenAPI_sm_context_update_error_t *sm_context_update_error) +{ + if (NULL == sm_context_update_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(sm_context_update_error->error); + OpenAPI_ref_to_binary_data_free(sm_context_update_error->n1_sm_msg); + OpenAPI_ref_to_binary_data_free(sm_context_update_error->n2_sm_info); + OpenAPI_up_cnx_state_free(sm_context_update_error->up_cnx_state); + ogs_free(sm_context_update_error->recovery_time); + ogs_free(sm_context_update_error); +} + +cJSON *OpenAPI_sm_context_update_error_convertToJSON(OpenAPI_sm_context_update_error_t *sm_context_update_error) +{ + cJSON *item = NULL; + + if (sm_context_update_error == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [SmContextUpdateError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sm_context_update_error->error) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(sm_context_update_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [error]"); + goto end; + } + + if (sm_context_update_error->n1_sm_msg) { + cJSON *n1_sm_msg_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_update_error->n1_sm_msg); + if (n1_sm_msg_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmMsg", n1_sm_msg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + } + + if (sm_context_update_error->n2_sm_info) { + cJSON *n2_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_update_error->n2_sm_info); + if (n2_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [n2_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfo", n2_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [n2_sm_info]"); + goto end; + } + } + + if (sm_context_update_error->n2_sm_info_type) { + if (cJSON_AddStringToObject(item, "n2SmInfoType", OpenAPI_n2_sm_info_type_ToString(sm_context_update_error->n2_sm_info_type)) == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [n2_sm_info_type]"); + goto end; + } + } + + if (sm_context_update_error->up_cnx_state) { + cJSON *up_cnx_state_local_JSON = OpenAPI_up_cnx_state_convertToJSON(sm_context_update_error->up_cnx_state); + if (up_cnx_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [up_cnx_state]"); + goto end; + } + cJSON_AddItemToObject(item, "upCnxState", up_cnx_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [up_cnx_state]"); + goto end; + } + } + + if (sm_context_update_error->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", sm_context_update_error->recovery_time) == NULL) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [recovery_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_parseFromJSON(cJSON *sm_context_update_errorJSON) +{ + OpenAPI_sm_context_update_error_t *sm_context_update_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(sm_context_update_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_sm_context_update_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *n1_sm_msg = cJSON_GetObjectItemCaseSensitive(sm_context_update_errorJSON, "n1SmMsg"); + + OpenAPI_ref_to_binary_data_t *n1_sm_msg_local_nonprim = NULL; + if (n1_sm_msg) { + n1_sm_msg_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_msg); + } + + cJSON *n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_update_errorJSON, "n2SmInfo"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL; + if (n2_sm_info) { + n2_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info); + } + + cJSON *n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_update_errorJSON, "n2SmInfoType"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable; + if (n2_sm_info_type) { + if (!cJSON_IsString(n2_sm_info_type)) { + ogs_error("OpenAPI_sm_context_update_error_parseFromJSON() failed [n2_sm_info_type]"); + goto end; + } + n2_sm_info_typeVariable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type->valuestring); + } + + cJSON *up_cnx_state = cJSON_GetObjectItemCaseSensitive(sm_context_update_errorJSON, "upCnxState"); + + OpenAPI_up_cnx_state_t *up_cnx_state_local_nonprim = NULL; + if (up_cnx_state) { + up_cnx_state_local_nonprim = OpenAPI_up_cnx_state_parseFromJSON(up_cnx_state); + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(sm_context_update_errorJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_sm_context_update_error_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + sm_context_update_error_local_var = OpenAPI_sm_context_update_error_create ( + error_local_nonprim, + n1_sm_msg ? n1_sm_msg_local_nonprim : NULL, + n2_sm_info ? n2_sm_info_local_nonprim : NULL, + n2_sm_info_type ? n2_sm_info_typeVariable : 0, + up_cnx_state ? up_cnx_state_local_nonprim : NULL, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL + ); + + return sm_context_update_error_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_copy(OpenAPI_sm_context_update_error_t *dst, OpenAPI_sm_context_update_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_update_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_update_error_free(dst); + dst = OpenAPI_sm_context_update_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_update_error.h b/lib/sbi/openapi/model/sm_context_update_error.h new file mode 100644 index 000000000..072d0ceb7 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_update_error.h @@ -0,0 +1,52 @@ +/* + * sm_context_update_error.h + * + * + */ + +#ifndef _OpenAPI_sm_context_update_error_H_ +#define _OpenAPI_sm_context_update_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_sm_info_type.h" +#include "problem_details.h" +#include "ref_to_binary_data.h" +#include "up_cnx_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_update_error_s OpenAPI_sm_context_update_error_t; +typedef struct OpenAPI_sm_context_update_error_s { + struct OpenAPI_problem_details_s *error; + struct OpenAPI_ref_to_binary_data_s *n1_sm_msg; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info; + OpenAPI_n2_sm_info_type_e n2_sm_info_type; + struct OpenAPI_up_cnx_state_s *up_cnx_state; + char *recovery_time; +} OpenAPI_sm_context_update_error_t; + +OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_up_cnx_state_t *up_cnx_state, + char *recovery_time + ); +void OpenAPI_sm_context_update_error_free(OpenAPI_sm_context_update_error_t *sm_context_update_error); +OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_parseFromJSON(cJSON *sm_context_update_errorJSON); +cJSON *OpenAPI_sm_context_update_error_convertToJSON(OpenAPI_sm_context_update_error_t *sm_context_update_error); +OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_copy(OpenAPI_sm_context_update_error_t *dst, OpenAPI_sm_context_update_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_update_error_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context_updated_data.c b/lib/sbi/openapi/model/sm_context_updated_data.c new file mode 100644 index 000000000..915dce745 --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_updated_data.c @@ -0,0 +1,632 @@ + +#include +#include +#include +#include "sm_context_updated_data.h" + +OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( + OpenAPI_up_cnx_state_t *up_cnx_state, + OpenAPI_ho_state_t *ho_state, + OpenAPI_list_t *release_ebi_list, + OpenAPI_list_t *allocated_ebi_list, + OpenAPI_list_t *modified_ebi_list, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_list_t *eps_bearer_setup, + int data_forwarding, + OpenAPI_list_t *n3_dl_forwarding_tnl_list, + OpenAPI_list_t *n3_ul_forwarding_tnl_list, + OpenAPI_cause_t *cause, + int ma_accepted_ind, + char *supported_features, + char forwarding_f_teid, + OpenAPI_list_t *forwarding_bearer_contexts + ) +{ + OpenAPI_sm_context_updated_data_t *sm_context_updated_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_updated_data_t)); + if (!sm_context_updated_data_local_var) { + return NULL; + } + sm_context_updated_data_local_var->up_cnx_state = up_cnx_state; + sm_context_updated_data_local_var->ho_state = ho_state; + sm_context_updated_data_local_var->release_ebi_list = release_ebi_list; + sm_context_updated_data_local_var->allocated_ebi_list = allocated_ebi_list; + sm_context_updated_data_local_var->modified_ebi_list = modified_ebi_list; + sm_context_updated_data_local_var->n1_sm_msg = n1_sm_msg; + sm_context_updated_data_local_var->n2_sm_info = n2_sm_info; + sm_context_updated_data_local_var->n2_sm_info_type = n2_sm_info_type; + sm_context_updated_data_local_var->eps_bearer_setup = eps_bearer_setup; + sm_context_updated_data_local_var->data_forwarding = data_forwarding; + sm_context_updated_data_local_var->n3_dl_forwarding_tnl_list = n3_dl_forwarding_tnl_list; + sm_context_updated_data_local_var->n3_ul_forwarding_tnl_list = n3_ul_forwarding_tnl_list; + sm_context_updated_data_local_var->cause = cause; + sm_context_updated_data_local_var->ma_accepted_ind = ma_accepted_ind; + sm_context_updated_data_local_var->supported_features = supported_features; + sm_context_updated_data_local_var->forwarding_f_teid = forwarding_f_teid; + sm_context_updated_data_local_var->forwarding_bearer_contexts = forwarding_bearer_contexts; + + return sm_context_updated_data_local_var; +} + +void OpenAPI_sm_context_updated_data_free(OpenAPI_sm_context_updated_data_t *sm_context_updated_data) +{ + if (NULL == sm_context_updated_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_up_cnx_state_free(sm_context_updated_data->up_cnx_state); + OpenAPI_ho_state_free(sm_context_updated_data->ho_state); + OpenAPI_list_for_each(sm_context_updated_data->release_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_updated_data->release_ebi_list); + OpenAPI_list_for_each(sm_context_updated_data->allocated_ebi_list, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(sm_context_updated_data->allocated_ebi_list); + OpenAPI_list_for_each(sm_context_updated_data->modified_ebi_list, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(sm_context_updated_data->modified_ebi_list); + OpenAPI_ref_to_binary_data_free(sm_context_updated_data->n1_sm_msg); + OpenAPI_ref_to_binary_data_free(sm_context_updated_data->n2_sm_info); + OpenAPI_list_for_each(sm_context_updated_data->eps_bearer_setup, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_updated_data->eps_bearer_setup); + OpenAPI_list_for_each(sm_context_updated_data->n3_dl_forwarding_tnl_list, node) { + OpenAPI_indirect_data_forwarding_tunnel_info_free(node->data); + } + OpenAPI_list_free(sm_context_updated_data->n3_dl_forwarding_tnl_list); + OpenAPI_list_for_each(sm_context_updated_data->n3_ul_forwarding_tnl_list, node) { + OpenAPI_indirect_data_forwarding_tunnel_info_free(node->data); + } + OpenAPI_list_free(sm_context_updated_data->n3_ul_forwarding_tnl_list); + OpenAPI_cause_free(sm_context_updated_data->cause); + ogs_free(sm_context_updated_data->supported_features); + OpenAPI_list_for_each(sm_context_updated_data->forwarding_bearer_contexts, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_updated_data->forwarding_bearer_contexts); + ogs_free(sm_context_updated_data); +} + +cJSON *OpenAPI_sm_context_updated_data_convertToJSON(OpenAPI_sm_context_updated_data_t *sm_context_updated_data) +{ + cJSON *item = NULL; + + if (sm_context_updated_data == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [SmContextUpdatedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sm_context_updated_data->up_cnx_state) { + cJSON *up_cnx_state_local_JSON = OpenAPI_up_cnx_state_convertToJSON(sm_context_updated_data->up_cnx_state); + if (up_cnx_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + cJSON_AddItemToObject(item, "upCnxState", up_cnx_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + } + + if (sm_context_updated_data->ho_state) { + cJSON *ho_state_local_JSON = OpenAPI_ho_state_convertToJSON(sm_context_updated_data->ho_state); + if (ho_state_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [ho_state]"); + goto end; + } + cJSON_AddItemToObject(item, "hoState", ho_state_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [ho_state]"); + goto end; + } + } + + if (sm_context_updated_data->release_ebi_list) { + cJSON *release_ebi_list = cJSON_AddArrayToObject(item, "releaseEbiList"); + if (release_ebi_list == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [release_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *release_ebi_list_node; + OpenAPI_list_for_each(sm_context_updated_data->release_ebi_list, release_ebi_list_node) { + if (cJSON_AddNumberToObject(release_ebi_list, "", *(double *)release_ebi_list_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [release_ebi_list]"); + goto end; + } + } + } + + if (sm_context_updated_data->allocated_ebi_list) { + cJSON *allocated_ebi_listList = cJSON_AddArrayToObject(item, "allocatedEbiList"); + if (allocated_ebi_listList == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [allocated_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *allocated_ebi_list_node; + if (sm_context_updated_data->allocated_ebi_list) { + OpenAPI_list_for_each(sm_context_updated_data->allocated_ebi_list, allocated_ebi_list_node) { + cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(allocated_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [allocated_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(allocated_ebi_listList, itemLocal); + } + } + } + + if (sm_context_updated_data->modified_ebi_list) { + cJSON *modified_ebi_listList = cJSON_AddArrayToObject(item, "modifiedEbiList"); + if (modified_ebi_listList == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [modified_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *modified_ebi_list_node; + if (sm_context_updated_data->modified_ebi_list) { + OpenAPI_list_for_each(sm_context_updated_data->modified_ebi_list, modified_ebi_list_node) { + cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(modified_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [modified_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(modified_ebi_listList, itemLocal); + } + } + } + + if (sm_context_updated_data->n1_sm_msg) { + cJSON *n1_sm_msg_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_updated_data->n1_sm_msg); + if (n1_sm_msg_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmMsg", n1_sm_msg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n1_sm_msg]"); + goto end; + } + } + + if (sm_context_updated_data->n2_sm_info) { + cJSON *n2_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_updated_data->n2_sm_info); + if (n2_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfo", n2_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n2_sm_info]"); + goto end; + } + } + + if (sm_context_updated_data->n2_sm_info_type) { + if (cJSON_AddStringToObject(item, "n2SmInfoType", OpenAPI_n2_sm_info_type_ToString(sm_context_updated_data->n2_sm_info_type)) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n2_sm_info_type]"); + goto end; + } + } + + if (sm_context_updated_data->eps_bearer_setup) { + cJSON *eps_bearer_setup = cJSON_AddArrayToObject(item, "epsBearerSetup"); + if (eps_bearer_setup == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [eps_bearer_setup]"); + goto end; + } + + OpenAPI_lnode_t *eps_bearer_setup_node; + OpenAPI_list_for_each(sm_context_updated_data->eps_bearer_setup, eps_bearer_setup_node) { + if (cJSON_AddStringToObject(eps_bearer_setup, "", (char*)eps_bearer_setup_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [eps_bearer_setup]"); + goto end; + } + } + } + + if (sm_context_updated_data->data_forwarding) { + if (cJSON_AddBoolToObject(item, "dataForwarding", sm_context_updated_data->data_forwarding) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [data_forwarding]"); + goto end; + } + } + + if (sm_context_updated_data->n3_dl_forwarding_tnl_list) { + cJSON *n3_dl_forwarding_tnl_listList = cJSON_AddArrayToObject(item, "n3DlForwardingTnlList"); + if (n3_dl_forwarding_tnl_listList == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n3_dl_forwarding_tnl_list]"); + goto end; + } + + OpenAPI_lnode_t *n3_dl_forwarding_tnl_list_node; + if (sm_context_updated_data->n3_dl_forwarding_tnl_list) { + OpenAPI_list_for_each(sm_context_updated_data->n3_dl_forwarding_tnl_list, n3_dl_forwarding_tnl_list_node) { + cJSON *itemLocal = OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON(n3_dl_forwarding_tnl_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n3_dl_forwarding_tnl_list]"); + goto end; + } + cJSON_AddItemToArray(n3_dl_forwarding_tnl_listList, itemLocal); + } + } + } + + if (sm_context_updated_data->n3_ul_forwarding_tnl_list) { + cJSON *n3_ul_forwarding_tnl_listList = cJSON_AddArrayToObject(item, "n3UlForwardingTnlList"); + if (n3_ul_forwarding_tnl_listList == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n3_ul_forwarding_tnl_list]"); + goto end; + } + + OpenAPI_lnode_t *n3_ul_forwarding_tnl_list_node; + if (sm_context_updated_data->n3_ul_forwarding_tnl_list) { + OpenAPI_list_for_each(sm_context_updated_data->n3_ul_forwarding_tnl_list, n3_ul_forwarding_tnl_list_node) { + cJSON *itemLocal = OpenAPI_indirect_data_forwarding_tunnel_info_convertToJSON(n3_ul_forwarding_tnl_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n3_ul_forwarding_tnl_list]"); + goto end; + } + cJSON_AddItemToArray(n3_ul_forwarding_tnl_listList, itemLocal); + } + } + } + + if (sm_context_updated_data->cause) { + cJSON *cause_local_JSON = OpenAPI_cause_convertToJSON(sm_context_updated_data->cause); + if (cause_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [cause]"); + goto end; + } + cJSON_AddItemToObject(item, "cause", cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [cause]"); + goto end; + } + } + + if (sm_context_updated_data->ma_accepted_ind) { + if (cJSON_AddBoolToObject(item, "maAcceptedInd", sm_context_updated_data->ma_accepted_ind) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [ma_accepted_ind]"); + goto end; + } + } + + if (sm_context_updated_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sm_context_updated_data->supported_features) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (sm_context_updated_data->forwarding_f_teid) { + if (cJSON_AddNumberToObject(item, "forwardingFTeid", sm_context_updated_data->forwarding_f_teid) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [forwarding_f_teid]"); + goto end; + } + } + + if (sm_context_updated_data->forwarding_bearer_contexts) { + cJSON *forwarding_bearer_contexts = cJSON_AddArrayToObject(item, "forwardingBearerContexts"); + if (forwarding_bearer_contexts == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [forwarding_bearer_contexts]"); + goto end; + } + + OpenAPI_lnode_t *forwarding_bearer_contexts_node; + OpenAPI_list_for_each(sm_context_updated_data->forwarding_bearer_contexts, forwarding_bearer_contexts_node) { + if (cJSON_AddStringToObject(forwarding_bearer_contexts, "", (char*)forwarding_bearer_contexts_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [forwarding_bearer_contexts]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON(cJSON *sm_context_updated_dataJSON) +{ + OpenAPI_sm_context_updated_data_t *sm_context_updated_data_local_var = NULL; + cJSON *up_cnx_state = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "upCnxState"); + + OpenAPI_up_cnx_state_t *up_cnx_state_local_nonprim = NULL; + if (up_cnx_state) { + up_cnx_state_local_nonprim = OpenAPI_up_cnx_state_parseFromJSON(up_cnx_state); + } + + cJSON *ho_state = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "hoState"); + + OpenAPI_ho_state_t *ho_state_local_nonprim = NULL; + if (ho_state) { + ho_state_local_nonprim = OpenAPI_ho_state_parseFromJSON(ho_state); + } + + cJSON *release_ebi_list = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "releaseEbiList"); + + OpenAPI_list_t *release_ebi_listList; + if (release_ebi_list) { + cJSON *release_ebi_list_local; + if (!cJSON_IsArray(release_ebi_list)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [release_ebi_list]"); + goto end; + } + release_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(release_ebi_list_local, release_ebi_list) { + if (!cJSON_IsNumber(release_ebi_list_local)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [release_ebi_list]"); + goto end; + } + OpenAPI_list_add(release_ebi_listList, &release_ebi_list_local->valuedouble); + } + } + + cJSON *allocated_ebi_list = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "allocatedEbiList"); + + OpenAPI_list_t *allocated_ebi_listList; + if (allocated_ebi_list) { + cJSON *allocated_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(allocated_ebi_list)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [allocated_ebi_list]"); + goto end; + } + + allocated_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allocated_ebi_list_local_nonprimitive, allocated_ebi_list ) { + if (!cJSON_IsObject(allocated_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [allocated_ebi_list]"); + goto end; + } + OpenAPI_ebi_arp_mapping_t *allocated_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(allocated_ebi_list_local_nonprimitive); + + OpenAPI_list_add(allocated_ebi_listList, allocated_ebi_listItem); + } + } + + cJSON *modified_ebi_list = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "modifiedEbiList"); + + OpenAPI_list_t *modified_ebi_listList; + if (modified_ebi_list) { + cJSON *modified_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(modified_ebi_list)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + + modified_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(modified_ebi_list_local_nonprimitive, modified_ebi_list ) { + if (!cJSON_IsObject(modified_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + OpenAPI_ebi_arp_mapping_t *modified_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(modified_ebi_list_local_nonprimitive); + + OpenAPI_list_add(modified_ebi_listList, modified_ebi_listItem); + } + } + + cJSON *n1_sm_msg = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "n1SmMsg"); + + OpenAPI_ref_to_binary_data_t *n1_sm_msg_local_nonprim = NULL; + if (n1_sm_msg) { + n1_sm_msg_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_msg); + } + + cJSON *n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "n2SmInfo"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL; + if (n2_sm_info) { + n2_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info); + } + + cJSON *n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "n2SmInfoType"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable; + if (n2_sm_info_type) { + if (!cJSON_IsString(n2_sm_info_type)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [n2_sm_info_type]"); + goto end; + } + n2_sm_info_typeVariable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type->valuestring); + } + + cJSON *eps_bearer_setup = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "epsBearerSetup"); + + OpenAPI_list_t *eps_bearer_setupList; + if (eps_bearer_setup) { + cJSON *eps_bearer_setup_local; + if (!cJSON_IsArray(eps_bearer_setup)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [eps_bearer_setup]"); + goto end; + } + eps_bearer_setupList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eps_bearer_setup_local, eps_bearer_setup) { + if (!cJSON_IsString(eps_bearer_setup_local)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [eps_bearer_setup]"); + goto end; + } + OpenAPI_list_add(eps_bearer_setupList, ogs_strdup(eps_bearer_setup_local->valuestring)); + } + } + + cJSON *data_forwarding = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "dataForwarding"); + + if (data_forwarding) { + if (!cJSON_IsBool(data_forwarding)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [data_forwarding]"); + goto end; + } + } + + cJSON *n3_dl_forwarding_tnl_list = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "n3DlForwardingTnlList"); + + OpenAPI_list_t *n3_dl_forwarding_tnl_listList; + if (n3_dl_forwarding_tnl_list) { + cJSON *n3_dl_forwarding_tnl_list_local_nonprimitive; + if (!cJSON_IsArray(n3_dl_forwarding_tnl_list)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [n3_dl_forwarding_tnl_list]"); + goto end; + } + + n3_dl_forwarding_tnl_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(n3_dl_forwarding_tnl_list_local_nonprimitive, n3_dl_forwarding_tnl_list ) { + if (!cJSON_IsObject(n3_dl_forwarding_tnl_list_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [n3_dl_forwarding_tnl_list]"); + goto end; + } + OpenAPI_indirect_data_forwarding_tunnel_info_t *n3_dl_forwarding_tnl_listItem = OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON(n3_dl_forwarding_tnl_list_local_nonprimitive); + + OpenAPI_list_add(n3_dl_forwarding_tnl_listList, n3_dl_forwarding_tnl_listItem); + } + } + + cJSON *n3_ul_forwarding_tnl_list = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "n3UlForwardingTnlList"); + + OpenAPI_list_t *n3_ul_forwarding_tnl_listList; + if (n3_ul_forwarding_tnl_list) { + cJSON *n3_ul_forwarding_tnl_list_local_nonprimitive; + if (!cJSON_IsArray(n3_ul_forwarding_tnl_list)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [n3_ul_forwarding_tnl_list]"); + goto end; + } + + n3_ul_forwarding_tnl_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(n3_ul_forwarding_tnl_list_local_nonprimitive, n3_ul_forwarding_tnl_list ) { + if (!cJSON_IsObject(n3_ul_forwarding_tnl_list_local_nonprimitive)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [n3_ul_forwarding_tnl_list]"); + goto end; + } + OpenAPI_indirect_data_forwarding_tunnel_info_t *n3_ul_forwarding_tnl_listItem = OpenAPI_indirect_data_forwarding_tunnel_info_parseFromJSON(n3_ul_forwarding_tnl_list_local_nonprimitive); + + OpenAPI_list_add(n3_ul_forwarding_tnl_listList, n3_ul_forwarding_tnl_listItem); + } + } + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "cause"); + + OpenAPI_cause_t *cause_local_nonprim = NULL; + if (cause) { + cause_local_nonprim = OpenAPI_cause_parseFromJSON(cause); + } + + cJSON *ma_accepted_ind = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "maAcceptedInd"); + + if (ma_accepted_ind) { + if (!cJSON_IsBool(ma_accepted_ind)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [ma_accepted_ind]"); + goto end; + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *forwarding_f_teid = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "forwardingFTeid"); + + if (forwarding_f_teid) { + if (!cJSON_IsNumber(forwarding_f_teid)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [forwarding_f_teid]"); + goto end; + } + } + + cJSON *forwarding_bearer_contexts = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "forwardingBearerContexts"); + + OpenAPI_list_t *forwarding_bearer_contextsList; + if (forwarding_bearer_contexts) { + cJSON *forwarding_bearer_contexts_local; + if (!cJSON_IsArray(forwarding_bearer_contexts)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [forwarding_bearer_contexts]"); + goto end; + } + forwarding_bearer_contextsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(forwarding_bearer_contexts_local, forwarding_bearer_contexts) { + if (!cJSON_IsString(forwarding_bearer_contexts_local)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [forwarding_bearer_contexts]"); + goto end; + } + OpenAPI_list_add(forwarding_bearer_contextsList, ogs_strdup(forwarding_bearer_contexts_local->valuestring)); + } + } + + sm_context_updated_data_local_var = OpenAPI_sm_context_updated_data_create ( + up_cnx_state ? up_cnx_state_local_nonprim : NULL, + ho_state ? ho_state_local_nonprim : NULL, + release_ebi_list ? release_ebi_listList : NULL, + allocated_ebi_list ? allocated_ebi_listList : NULL, + modified_ebi_list ? modified_ebi_listList : NULL, + n1_sm_msg ? n1_sm_msg_local_nonprim : NULL, + n2_sm_info ? n2_sm_info_local_nonprim : NULL, + n2_sm_info_type ? n2_sm_info_typeVariable : 0, + eps_bearer_setup ? eps_bearer_setupList : NULL, + data_forwarding ? data_forwarding->valueint : 0, + n3_dl_forwarding_tnl_list ? n3_dl_forwarding_tnl_listList : NULL, + n3_ul_forwarding_tnl_list ? n3_ul_forwarding_tnl_listList : NULL, + cause ? cause_local_nonprim : NULL, + ma_accepted_ind ? ma_accepted_ind->valueint : 0, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + forwarding_f_teid ? forwarding_f_teid->valueint : 0, + forwarding_bearer_contexts ? forwarding_bearer_contextsList : NULL + ); + + return sm_context_updated_data_local_var; +end: + return NULL; +} + +OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_copy(OpenAPI_sm_context_updated_data_t *dst, OpenAPI_sm_context_updated_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_context_updated_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_context_updated_data_free(dst); + dst = OpenAPI_sm_context_updated_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_context_updated_data.h b/lib/sbi/openapi/model/sm_context_updated_data.h new file mode 100644 index 000000000..1dcd003fa --- /dev/null +++ b/lib/sbi/openapi/model/sm_context_updated_data.h @@ -0,0 +1,77 @@ +/* + * sm_context_updated_data.h + * + * + */ + +#ifndef _OpenAPI_sm_context_updated_data_H_ +#define _OpenAPI_sm_context_updated_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "cause.h" +#include "ebi_arp_mapping.h" +#include "ho_state.h" +#include "indirect_data_forwarding_tunnel_info.h" +#include "n2_sm_info_type.h" +#include "ref_to_binary_data.h" +#include "up_cnx_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_context_updated_data_s OpenAPI_sm_context_updated_data_t; +typedef struct OpenAPI_sm_context_updated_data_s { + struct OpenAPI_up_cnx_state_s *up_cnx_state; + struct OpenAPI_ho_state_s *ho_state; + OpenAPI_list_t *release_ebi_list; + OpenAPI_list_t *allocated_ebi_list; + OpenAPI_list_t *modified_ebi_list; + struct OpenAPI_ref_to_binary_data_s *n1_sm_msg; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info; + OpenAPI_n2_sm_info_type_e n2_sm_info_type; + OpenAPI_list_t *eps_bearer_setup; + int data_forwarding; + OpenAPI_list_t *n3_dl_forwarding_tnl_list; + OpenAPI_list_t *n3_ul_forwarding_tnl_list; + struct OpenAPI_cause_s *cause; + int ma_accepted_ind; + char *supported_features; + char forwarding_f_teid; + OpenAPI_list_t *forwarding_bearer_contexts; +} OpenAPI_sm_context_updated_data_t; + +OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( + OpenAPI_up_cnx_state_t *up_cnx_state, + OpenAPI_ho_state_t *ho_state, + OpenAPI_list_t *release_ebi_list, + OpenAPI_list_t *allocated_ebi_list, + OpenAPI_list_t *modified_ebi_list, + OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, + OpenAPI_list_t *eps_bearer_setup, + int data_forwarding, + OpenAPI_list_t *n3_dl_forwarding_tnl_list, + OpenAPI_list_t *n3_ul_forwarding_tnl_list, + OpenAPI_cause_t *cause, + int ma_accepted_ind, + char *supported_features, + char forwarding_f_teid, + OpenAPI_list_t *forwarding_bearer_contexts + ); +void OpenAPI_sm_context_updated_data_free(OpenAPI_sm_context_updated_data_t *sm_context_updated_data); +OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON(cJSON *sm_context_updated_dataJSON); +cJSON *OpenAPI_sm_context_updated_data_convertToJSON(OpenAPI_sm_context_updated_data_t *sm_context_updated_data); +OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_copy(OpenAPI_sm_context_updated_data_t *dst, OpenAPI_sm_context_updated_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_context_updated_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_policy_data.c b/lib/sbi/openapi/model/sm_policy_data.c index 6d7b4058f..d231c9ee0 100644 --- a/lib/sbi/openapi/model/sm_policy_data.c +++ b/lib/sbi/openapi/model/sm_policy_data.c @@ -233,3 +233,37 @@ end: return NULL; } +OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_copy(OpenAPI_sm_policy_data_t *dst, OpenAPI_sm_policy_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_policy_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_policy_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_policy_data_free(dst); + dst = OpenAPI_sm_policy_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_policy_data.h b/lib/sbi/openapi/model/sm_policy_data.h index 7ffe2d8ca..31859e367 100644 --- a/lib/sbi/openapi/model/sm_policy_data.h +++ b/lib/sbi/openapi/model/sm_policy_data.h @@ -37,6 +37,7 @@ OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_create( void OpenAPI_sm_policy_data_free(OpenAPI_sm_policy_data_t *sm_policy_data); OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_parseFromJSON(cJSON *sm_policy_dataJSON); cJSON *OpenAPI_sm_policy_data_convertToJSON(OpenAPI_sm_policy_data_t *sm_policy_data); +OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_copy(OpenAPI_sm_policy_data_t *dst, OpenAPI_sm_policy_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sm_policy_data_patch.c b/lib/sbi/openapi/model/sm_policy_data_patch.c index e6f6e6251..1e2048a70 100644 --- a/lib/sbi/openapi/model/sm_policy_data_patch.c +++ b/lib/sbi/openapi/model/sm_policy_data_patch.c @@ -155,3 +155,37 @@ end: return NULL; } +OpenAPI_sm_policy_data_patch_t *OpenAPI_sm_policy_data_patch_copy(OpenAPI_sm_policy_data_patch_t *dst, OpenAPI_sm_policy_data_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_policy_data_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_policy_data_patch_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_policy_data_patch_free(dst); + dst = OpenAPI_sm_policy_data_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_policy_data_patch.h b/lib/sbi/openapi/model/sm_policy_data_patch.h index bf9b70b8f..e6be46f5a 100644 --- a/lib/sbi/openapi/model/sm_policy_data_patch.h +++ b/lib/sbi/openapi/model/sm_policy_data_patch.h @@ -32,6 +32,7 @@ OpenAPI_sm_policy_data_patch_t *OpenAPI_sm_policy_data_patch_create( void OpenAPI_sm_policy_data_patch_free(OpenAPI_sm_policy_data_patch_t *sm_policy_data_patch); OpenAPI_sm_policy_data_patch_t *OpenAPI_sm_policy_data_patch_parseFromJSON(cJSON *sm_policy_data_patchJSON); cJSON *OpenAPI_sm_policy_data_patch_convertToJSON(OpenAPI_sm_policy_data_patch_t *sm_policy_data_patch); +OpenAPI_sm_policy_data_patch_t *OpenAPI_sm_policy_data_patch_copy(OpenAPI_sm_policy_data_patch_t *dst, OpenAPI_sm_policy_data_patch_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sm_policy_dnn_data.c b/lib/sbi/openapi/model/sm_policy_dnn_data.c index b7ff7aacc..8ff7f96a8 100644 --- a/lib/sbi/openapi/model/sm_policy_dnn_data.c +++ b/lib/sbi/openapi/model/sm_policy_dnn_data.c @@ -159,14 +159,14 @@ cJSON *OpenAPI_sm_policy_dnn_data_convertToJSON(OpenAPI_sm_policy_dnn_data_t *sm } } - if (sm_policy_dnn_data->adc_support >= 0) { + if (sm_policy_dnn_data->adc_support) { if (cJSON_AddBoolToObject(item, "adcSupport", sm_policy_dnn_data->adc_support) == NULL) { ogs_error("OpenAPI_sm_policy_dnn_data_convertToJSON() failed [adc_support]"); goto end; } } - if (sm_policy_dnn_data->subsc_spending_limits >= 0) { + if (sm_policy_dnn_data->subsc_spending_limits) { if (cJSON_AddBoolToObject(item, "subscSpendingLimits", sm_policy_dnn_data->subsc_spending_limits) == NULL) { ogs_error("OpenAPI_sm_policy_dnn_data_convertToJSON() failed [subsc_spending_limits]"); goto end; @@ -187,14 +187,14 @@ cJSON *OpenAPI_sm_policy_dnn_data_convertToJSON(OpenAPI_sm_policy_dnn_data_t *sm } } - if (sm_policy_dnn_data->offline >= 0) { + if (sm_policy_dnn_data->offline) { if (cJSON_AddBoolToObject(item, "offline", sm_policy_dnn_data->offline) == NULL) { ogs_error("OpenAPI_sm_policy_dnn_data_convertToJSON() failed [offline]"); goto end; } } - if (sm_policy_dnn_data->online >= 0) { + if (sm_policy_dnn_data->online) { if (cJSON_AddBoolToObject(item, "online", sm_policy_dnn_data->online) == NULL) { ogs_error("OpenAPI_sm_policy_dnn_data_convertToJSON() failed [online]"); goto end; @@ -235,21 +235,21 @@ cJSON *OpenAPI_sm_policy_dnn_data_convertToJSON(OpenAPI_sm_policy_dnn_data_t *sm } } - if (sm_policy_dnn_data->mps_priority >= 0) { + if (sm_policy_dnn_data->mps_priority) { if (cJSON_AddBoolToObject(item, "mpsPriority", sm_policy_dnn_data->mps_priority) == NULL) { ogs_error("OpenAPI_sm_policy_dnn_data_convertToJSON() failed [mps_priority]"); goto end; } } - if (sm_policy_dnn_data->mcs_priority >= 0) { + if (sm_policy_dnn_data->mcs_priority) { if (cJSON_AddBoolToObject(item, "mcsPriority", sm_policy_dnn_data->mcs_priority) == NULL) { ogs_error("OpenAPI_sm_policy_dnn_data_convertToJSON() failed [mcs_priority]"); goto end; } } - if (sm_policy_dnn_data->ims_signalling_prio >= 0) { + if (sm_policy_dnn_data->ims_signalling_prio) { if (cJSON_AddBoolToObject(item, "imsSignallingPrio", sm_policy_dnn_data->ims_signalling_prio) == NULL) { ogs_error("OpenAPI_sm_policy_dnn_data_convertToJSON() failed [ims_signalling_prio]"); goto end; @@ -580,3 +580,37 @@ end: return NULL; } +OpenAPI_sm_policy_dnn_data_t *OpenAPI_sm_policy_dnn_data_copy(OpenAPI_sm_policy_dnn_data_t *dst, OpenAPI_sm_policy_dnn_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_policy_dnn_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_policy_dnn_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_policy_dnn_data_free(dst); + dst = OpenAPI_sm_policy_dnn_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_policy_dnn_data.h b/lib/sbi/openapi/model/sm_policy_dnn_data.h index 4bbb2ff5e..a95769d0e 100644 --- a/lib/sbi/openapi/model/sm_policy_dnn_data.h +++ b/lib/sbi/openapi/model/sm_policy_dnn_data.h @@ -69,6 +69,7 @@ OpenAPI_sm_policy_dnn_data_t *OpenAPI_sm_policy_dnn_data_create( void OpenAPI_sm_policy_dnn_data_free(OpenAPI_sm_policy_dnn_data_t *sm_policy_dnn_data); OpenAPI_sm_policy_dnn_data_t *OpenAPI_sm_policy_dnn_data_parseFromJSON(cJSON *sm_policy_dnn_dataJSON); cJSON *OpenAPI_sm_policy_dnn_data_convertToJSON(OpenAPI_sm_policy_dnn_data_t *sm_policy_dnn_data); +OpenAPI_sm_policy_dnn_data_t *OpenAPI_sm_policy_dnn_data_copy(OpenAPI_sm_policy_dnn_data_t *dst, OpenAPI_sm_policy_dnn_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sm_policy_dnn_data_patch.c b/lib/sbi/openapi/model/sm_policy_dnn_data_patch.c index 028c54827..bc04e15f1 100644 --- a/lib/sbi/openapi/model/sm_policy_dnn_data_patch.c +++ b/lib/sbi/openapi/model/sm_policy_dnn_data_patch.c @@ -115,3 +115,37 @@ end: return NULL; } +OpenAPI_sm_policy_dnn_data_patch_t *OpenAPI_sm_policy_dnn_data_patch_copy(OpenAPI_sm_policy_dnn_data_patch_t *dst, OpenAPI_sm_policy_dnn_data_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_policy_dnn_data_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_policy_dnn_data_patch_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_policy_dnn_data_patch_free(dst); + dst = OpenAPI_sm_policy_dnn_data_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_policy_dnn_data_patch.h b/lib/sbi/openapi/model/sm_policy_dnn_data_patch.h index f27c7a38d..7b81097cb 100644 --- a/lib/sbi/openapi/model/sm_policy_dnn_data_patch.h +++ b/lib/sbi/openapi/model/sm_policy_dnn_data_patch.h @@ -30,6 +30,7 @@ OpenAPI_sm_policy_dnn_data_patch_t *OpenAPI_sm_policy_dnn_data_patch_create( void OpenAPI_sm_policy_dnn_data_patch_free(OpenAPI_sm_policy_dnn_data_patch_t *sm_policy_dnn_data_patch); OpenAPI_sm_policy_dnn_data_patch_t *OpenAPI_sm_policy_dnn_data_patch_parseFromJSON(cJSON *sm_policy_dnn_data_patchJSON); cJSON *OpenAPI_sm_policy_dnn_data_patch_convertToJSON(OpenAPI_sm_policy_dnn_data_patch_t *sm_policy_dnn_data_patch); +OpenAPI_sm_policy_dnn_data_patch_t *OpenAPI_sm_policy_dnn_data_patch_copy(OpenAPI_sm_policy_dnn_data_patch_t *dst, OpenAPI_sm_policy_dnn_data_patch_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sm_policy_snssai_data.c b/lib/sbi/openapi/model/sm_policy_snssai_data.c index 8e71c795e..1f4402496 100644 --- a/lib/sbi/openapi/model/sm_policy_snssai_data.c +++ b/lib/sbi/openapi/model/sm_policy_snssai_data.c @@ -131,3 +131,37 @@ end: return NULL; } +OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_copy(OpenAPI_sm_policy_snssai_data_t *dst, OpenAPI_sm_policy_snssai_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_policy_snssai_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_policy_snssai_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_policy_snssai_data_free(dst); + dst = OpenAPI_sm_policy_snssai_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_policy_snssai_data.h b/lib/sbi/openapi/model/sm_policy_snssai_data.h index aca968fd2..c71dbada4 100644 --- a/lib/sbi/openapi/model/sm_policy_snssai_data.h +++ b/lib/sbi/openapi/model/sm_policy_snssai_data.h @@ -32,6 +32,7 @@ OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_create( void OpenAPI_sm_policy_snssai_data_free(OpenAPI_sm_policy_snssai_data_t *sm_policy_snssai_data); OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_parseFromJSON(cJSON *sm_policy_snssai_dataJSON); cJSON *OpenAPI_sm_policy_snssai_data_convertToJSON(OpenAPI_sm_policy_snssai_data_t *sm_policy_snssai_data); +OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_copy(OpenAPI_sm_policy_snssai_data_t *dst, OpenAPI_sm_policy_snssai_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sm_policy_snssai_data_patch.c b/lib/sbi/openapi/model/sm_policy_snssai_data_patch.c index a8b50c62d..fbd046072 100644 --- a/lib/sbi/openapi/model/sm_policy_snssai_data_patch.c +++ b/lib/sbi/openapi/model/sm_policy_snssai_data_patch.c @@ -131,3 +131,37 @@ end: return NULL; } +OpenAPI_sm_policy_snssai_data_patch_t *OpenAPI_sm_policy_snssai_data_patch_copy(OpenAPI_sm_policy_snssai_data_patch_t *dst, OpenAPI_sm_policy_snssai_data_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_policy_snssai_data_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_policy_snssai_data_patch_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sm_policy_snssai_data_patch_free(dst); + dst = OpenAPI_sm_policy_snssai_data_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_policy_snssai_data_patch.h b/lib/sbi/openapi/model/sm_policy_snssai_data_patch.h index e605f037b..e786f04fc 100644 --- a/lib/sbi/openapi/model/sm_policy_snssai_data_patch.h +++ b/lib/sbi/openapi/model/sm_policy_snssai_data_patch.h @@ -32,6 +32,7 @@ OpenAPI_sm_policy_snssai_data_patch_t *OpenAPI_sm_policy_snssai_data_patch_creat void OpenAPI_sm_policy_snssai_data_patch_free(OpenAPI_sm_policy_snssai_data_patch_t *sm_policy_snssai_data_patch); OpenAPI_sm_policy_snssai_data_patch_t *OpenAPI_sm_policy_snssai_data_patch_parseFromJSON(cJSON *sm_policy_snssai_data_patchJSON); cJSON *OpenAPI_sm_policy_snssai_data_patch_convertToJSON(OpenAPI_sm_policy_snssai_data_patch_t *sm_policy_snssai_data_patch); +OpenAPI_sm_policy_snssai_data_patch_t *OpenAPI_sm_policy_snssai_data_patch_copy(OpenAPI_sm_policy_snssai_data_patch_t *dst, OpenAPI_sm_policy_snssai_data_patch_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/small_data_rate_status.c b/lib/sbi/openapi/model/small_data_rate_status.c new file mode 100644 index 000000000..c5f897806 --- /dev/null +++ b/lib/sbi/openapi/model/small_data_rate_status.c @@ -0,0 +1,181 @@ + +#include +#include +#include +#include "small_data_rate_status.h" + +OpenAPI_small_data_rate_status_t *OpenAPI_small_data_rate_status_create( + int remain_packets_ul, + int remain_packets_dl, + char *validity_time, + int remain_ex_reports_ul, + int remain_ex_reports_dl + ) +{ + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_small_data_rate_status_t)); + if (!small_data_rate_status_local_var) { + return NULL; + } + small_data_rate_status_local_var->remain_packets_ul = remain_packets_ul; + small_data_rate_status_local_var->remain_packets_dl = remain_packets_dl; + small_data_rate_status_local_var->validity_time = validity_time; + small_data_rate_status_local_var->remain_ex_reports_ul = remain_ex_reports_ul; + small_data_rate_status_local_var->remain_ex_reports_dl = remain_ex_reports_dl; + + return small_data_rate_status_local_var; +} + +void OpenAPI_small_data_rate_status_free(OpenAPI_small_data_rate_status_t *small_data_rate_status) +{ + if (NULL == small_data_rate_status) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(small_data_rate_status->validity_time); + ogs_free(small_data_rate_status); +} + +cJSON *OpenAPI_small_data_rate_status_convertToJSON(OpenAPI_small_data_rate_status_t *small_data_rate_status) +{ + cJSON *item = NULL; + + if (small_data_rate_status == NULL) { + ogs_error("OpenAPI_small_data_rate_status_convertToJSON() failed [SmallDataRateStatus]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (small_data_rate_status->remain_packets_ul) { + if (cJSON_AddNumberToObject(item, "remainPacketsUl", small_data_rate_status->remain_packets_ul) == NULL) { + ogs_error("OpenAPI_small_data_rate_status_convertToJSON() failed [remain_packets_ul]"); + goto end; + } + } + + if (small_data_rate_status->remain_packets_dl) { + if (cJSON_AddNumberToObject(item, "remainPacketsDl", small_data_rate_status->remain_packets_dl) == NULL) { + ogs_error("OpenAPI_small_data_rate_status_convertToJSON() failed [remain_packets_dl]"); + goto end; + } + } + + if (small_data_rate_status->validity_time) { + if (cJSON_AddStringToObject(item, "validityTime", small_data_rate_status->validity_time) == NULL) { + ogs_error("OpenAPI_small_data_rate_status_convertToJSON() failed [validity_time]"); + goto end; + } + } + + if (small_data_rate_status->remain_ex_reports_ul) { + if (cJSON_AddNumberToObject(item, "remainExReportsUl", small_data_rate_status->remain_ex_reports_ul) == NULL) { + ogs_error("OpenAPI_small_data_rate_status_convertToJSON() failed [remain_ex_reports_ul]"); + goto end; + } + } + + if (small_data_rate_status->remain_ex_reports_dl) { + if (cJSON_AddNumberToObject(item, "remainExReportsDl", small_data_rate_status->remain_ex_reports_dl) == NULL) { + ogs_error("OpenAPI_small_data_rate_status_convertToJSON() failed [remain_ex_reports_dl]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_small_data_rate_status_t *OpenAPI_small_data_rate_status_parseFromJSON(cJSON *small_data_rate_statusJSON) +{ + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_var = NULL; + cJSON *remain_packets_ul = cJSON_GetObjectItemCaseSensitive(small_data_rate_statusJSON, "remainPacketsUl"); + + if (remain_packets_ul) { + if (!cJSON_IsNumber(remain_packets_ul)) { + ogs_error("OpenAPI_small_data_rate_status_parseFromJSON() failed [remain_packets_ul]"); + goto end; + } + } + + cJSON *remain_packets_dl = cJSON_GetObjectItemCaseSensitive(small_data_rate_statusJSON, "remainPacketsDl"); + + if (remain_packets_dl) { + if (!cJSON_IsNumber(remain_packets_dl)) { + ogs_error("OpenAPI_small_data_rate_status_parseFromJSON() failed [remain_packets_dl]"); + goto end; + } + } + + cJSON *validity_time = cJSON_GetObjectItemCaseSensitive(small_data_rate_statusJSON, "validityTime"); + + if (validity_time) { + if (!cJSON_IsString(validity_time)) { + ogs_error("OpenAPI_small_data_rate_status_parseFromJSON() failed [validity_time]"); + goto end; + } + } + + cJSON *remain_ex_reports_ul = cJSON_GetObjectItemCaseSensitive(small_data_rate_statusJSON, "remainExReportsUl"); + + if (remain_ex_reports_ul) { + if (!cJSON_IsNumber(remain_ex_reports_ul)) { + ogs_error("OpenAPI_small_data_rate_status_parseFromJSON() failed [remain_ex_reports_ul]"); + goto end; + } + } + + cJSON *remain_ex_reports_dl = cJSON_GetObjectItemCaseSensitive(small_data_rate_statusJSON, "remainExReportsDl"); + + if (remain_ex_reports_dl) { + if (!cJSON_IsNumber(remain_ex_reports_dl)) { + ogs_error("OpenAPI_small_data_rate_status_parseFromJSON() failed [remain_ex_reports_dl]"); + goto end; + } + } + + small_data_rate_status_local_var = OpenAPI_small_data_rate_status_create ( + remain_packets_ul ? remain_packets_ul->valuedouble : 0, + remain_packets_dl ? remain_packets_dl->valuedouble : 0, + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + remain_ex_reports_ul ? remain_ex_reports_ul->valuedouble : 0, + remain_ex_reports_dl ? remain_ex_reports_dl->valuedouble : 0 + ); + + return small_data_rate_status_local_var; +end: + return NULL; +} + +OpenAPI_small_data_rate_status_t *OpenAPI_small_data_rate_status_copy(OpenAPI_small_data_rate_status_t *dst, OpenAPI_small_data_rate_status_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_small_data_rate_status_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_small_data_rate_status_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_small_data_rate_status_free(dst); + dst = OpenAPI_small_data_rate_status_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/small_data_rate_status.h b/lib/sbi/openapi/model/small_data_rate_status.h new file mode 100644 index 000000000..8a410556d --- /dev/null +++ b/lib/sbi/openapi/model/small_data_rate_status.h @@ -0,0 +1,46 @@ +/* + * small_data_rate_status.h + * + * + */ + +#ifndef _OpenAPI_small_data_rate_status_H_ +#define _OpenAPI_small_data_rate_status_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_small_data_rate_status_s OpenAPI_small_data_rate_status_t; +typedef struct OpenAPI_small_data_rate_status_s { + int remain_packets_ul; + int remain_packets_dl; + char *validity_time; + int remain_ex_reports_ul; + int remain_ex_reports_dl; +} OpenAPI_small_data_rate_status_t; + +OpenAPI_small_data_rate_status_t *OpenAPI_small_data_rate_status_create( + int remain_packets_ul, + int remain_packets_dl, + char *validity_time, + int remain_ex_reports_ul, + int remain_ex_reports_dl + ); +void OpenAPI_small_data_rate_status_free(OpenAPI_small_data_rate_status_t *small_data_rate_status); +OpenAPI_small_data_rate_status_t *OpenAPI_small_data_rate_status_parseFromJSON(cJSON *small_data_rate_statusJSON); +cJSON *OpenAPI_small_data_rate_status_convertToJSON(OpenAPI_small_data_rate_status_t *small_data_rate_status); +OpenAPI_small_data_rate_status_t *OpenAPI_small_data_rate_status_copy(OpenAPI_small_data_rate_status_t *dst, OpenAPI_small_data_rate_status_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_small_data_rate_status_H_ */ + diff --git a/lib/sbi/openapi/model/small_data_rate_status_info.c b/lib/sbi/openapi/model/small_data_rate_status_info.c new file mode 100644 index 000000000..397c4b4ec --- /dev/null +++ b/lib/sbi/openapi/model/small_data_rate_status_info.c @@ -0,0 +1,168 @@ + +#include +#include +#include +#include "small_data_rate_status_info.h" + +OpenAPI_small_data_rate_status_info_t *OpenAPI_small_data_rate_status_info_create( + OpenAPI_snssai_t *snssai, + char *dnn, + OpenAPI_small_data_rate_status_t *small_data_rate_status + ) +{ + OpenAPI_small_data_rate_status_info_t *small_data_rate_status_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_small_data_rate_status_info_t)); + if (!small_data_rate_status_info_local_var) { + return NULL; + } + small_data_rate_status_info_local_var->snssai = snssai; + small_data_rate_status_info_local_var->dnn = dnn; + small_data_rate_status_info_local_var->small_data_rate_status = small_data_rate_status; + + return small_data_rate_status_info_local_var; +} + +void OpenAPI_small_data_rate_status_info_free(OpenAPI_small_data_rate_status_info_t *small_data_rate_status_info) +{ + if (NULL == small_data_rate_status_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_snssai_free(small_data_rate_status_info->snssai); + ogs_free(small_data_rate_status_info->dnn); + OpenAPI_small_data_rate_status_free(small_data_rate_status_info->small_data_rate_status); + ogs_free(small_data_rate_status_info); +} + +cJSON *OpenAPI_small_data_rate_status_info_convertToJSON(OpenAPI_small_data_rate_status_info_t *small_data_rate_status_info) +{ + cJSON *item = NULL; + + if (small_data_rate_status_info == NULL) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [SmallDataRateStatusInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!small_data_rate_status_info->snssai) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(small_data_rate_status_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "Snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [snssai]"); + goto end; + } + + if (!small_data_rate_status_info->dnn) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [dnn]"); + goto end; + } + if (cJSON_AddStringToObject(item, "Dnn", small_data_rate_status_info->dnn) == NULL) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [dnn]"); + goto end; + } + + if (!small_data_rate_status_info->small_data_rate_status) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(small_data_rate_status_info->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "SmallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_small_data_rate_status_info_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + +end: + return item; +} + +OpenAPI_small_data_rate_status_info_t *OpenAPI_small_data_rate_status_info_parseFromJSON(cJSON *small_data_rate_status_infoJSON) +{ + OpenAPI_small_data_rate_status_info_t *small_data_rate_status_info_local_var = NULL; + cJSON *snssai = cJSON_GetObjectItemCaseSensitive(small_data_rate_status_infoJSON, "Snssai"); + if (!snssai) { + ogs_error("OpenAPI_small_data_rate_status_info_parseFromJSON() failed [snssai]"); + goto end; + } + + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(small_data_rate_status_infoJSON, "Dnn"); + if (!dnn) { + ogs_error("OpenAPI_small_data_rate_status_info_parseFromJSON() failed [dnn]"); + goto end; + } + + + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_small_data_rate_status_info_parseFromJSON() failed [dnn]"); + goto end; + } + + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(small_data_rate_status_infoJSON, "SmallDataRateStatus"); + if (!small_data_rate_status) { + ogs_error("OpenAPI_small_data_rate_status_info_parseFromJSON() failed [small_data_rate_status]"); + goto end; + } + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + + small_data_rate_status_info_local_var = OpenAPI_small_data_rate_status_info_create ( + snssai_local_nonprim, + ogs_strdup(dnn->valuestring), + small_data_rate_status_local_nonprim + ); + + return small_data_rate_status_info_local_var; +end: + return NULL; +} + +OpenAPI_small_data_rate_status_info_t *OpenAPI_small_data_rate_status_info_copy(OpenAPI_small_data_rate_status_info_t *dst, OpenAPI_small_data_rate_status_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_small_data_rate_status_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_small_data_rate_status_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_small_data_rate_status_info_free(dst); + dst = OpenAPI_small_data_rate_status_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/small_data_rate_status_info.h b/lib/sbi/openapi/model/small_data_rate_status_info.h new file mode 100644 index 000000000..ccb6cad2e --- /dev/null +++ b/lib/sbi/openapi/model/small_data_rate_status_info.h @@ -0,0 +1,44 @@ +/* + * small_data_rate_status_info.h + * + * + */ + +#ifndef _OpenAPI_small_data_rate_status_info_H_ +#define _OpenAPI_small_data_rate_status_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "small_data_rate_status.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_small_data_rate_status_info_s OpenAPI_small_data_rate_status_info_t; +typedef struct OpenAPI_small_data_rate_status_info_s { + struct OpenAPI_snssai_s *snssai; + char *dnn; + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; +} OpenAPI_small_data_rate_status_info_t; + +OpenAPI_small_data_rate_status_info_t *OpenAPI_small_data_rate_status_info_create( + OpenAPI_snssai_t *snssai, + char *dnn, + OpenAPI_small_data_rate_status_t *small_data_rate_status + ); +void OpenAPI_small_data_rate_status_info_free(OpenAPI_small_data_rate_status_info_t *small_data_rate_status_info); +OpenAPI_small_data_rate_status_info_t *OpenAPI_small_data_rate_status_info_parseFromJSON(cJSON *small_data_rate_status_infoJSON); +cJSON *OpenAPI_small_data_rate_status_info_convertToJSON(OpenAPI_small_data_rate_status_info_t *small_data_rate_status_info); +OpenAPI_small_data_rate_status_info_t *OpenAPI_small_data_rate_status_info_copy(OpenAPI_small_data_rate_status_info_t *dst, OpenAPI_small_data_rate_status_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_small_data_rate_status_info_H_ */ + diff --git a/lib/sbi/openapi/model/smf_change_indication.c b/lib/sbi/openapi/model/smf_change_indication.c new file mode 100644 index 000000000..dbc401f9d --- /dev/null +++ b/lib/sbi/openapi/model/smf_change_indication.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "smf_change_indication.h" + +char* OpenAPI_smf_change_indication_ToString(OpenAPI_smf_change_indication_e smf_change_indication) +{ + const char *smf_change_indicationArray[] = { "NULL", "CHANGED", "REMOVED" }; + size_t sizeofArray = sizeof(smf_change_indicationArray) / sizeof(smf_change_indicationArray[0]); + if (smf_change_indication < sizeofArray) + return (char *)smf_change_indicationArray[smf_change_indication]; + else + return (char *)"Unknown"; +} + +OpenAPI_smf_change_indication_e OpenAPI_smf_change_indication_FromString(char* smf_change_indication) +{ + int stringToReturn = 0; + const char *smf_change_indicationArray[] = { "NULL", "CHANGED", "REMOVED" }; + size_t sizeofArray = sizeof(smf_change_indicationArray) / sizeof(smf_change_indicationArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(smf_change_indication, smf_change_indicationArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/smf_change_indication.h b/lib/sbi/openapi/model/smf_change_indication.h new file mode 100644 index 000000000..0c5954a8b --- /dev/null +++ b/lib/sbi/openapi/model/smf_change_indication.h @@ -0,0 +1,31 @@ +/* + * smf_change_indication.h + * + * + */ + +#ifndef _OpenAPI_smf_change_indication_H_ +#define _OpenAPI_smf_change_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_smf_change_indication_NULL = 0, OpenAPI_smf_change_indication_CHANGED, OpenAPI_smf_change_indication_REMOVED } OpenAPI_smf_change_indication_e; + +char* OpenAPI_smf_change_indication_ToString(OpenAPI_smf_change_indication_e smf_change_indication); + +OpenAPI_smf_change_indication_e OpenAPI_smf_change_indication_FromString(char* smf_change_indication); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_smf_change_indication_H_ */ + diff --git a/lib/sbi/openapi/model/smf_change_info.c b/lib/sbi/openapi/model/smf_change_info.c new file mode 100644 index 000000000..8b7eca7db --- /dev/null +++ b/lib/sbi/openapi/model/smf_change_info.c @@ -0,0 +1,159 @@ + +#include +#include +#include +#include "smf_change_info.h" + +OpenAPI_smf_change_info_t *OpenAPI_smf_change_info_create( + OpenAPI_list_t *pdu_session_id_list, + OpenAPI_smf_change_indication_e smf_change_ind + ) +{ + OpenAPI_smf_change_info_t *smf_change_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_smf_change_info_t)); + if (!smf_change_info_local_var) { + return NULL; + } + smf_change_info_local_var->pdu_session_id_list = pdu_session_id_list; + smf_change_info_local_var->smf_change_ind = smf_change_ind; + + return smf_change_info_local_var; +} + +void OpenAPI_smf_change_info_free(OpenAPI_smf_change_info_t *smf_change_info) +{ + if (NULL == smf_change_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(smf_change_info->pdu_session_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smf_change_info->pdu_session_id_list); + ogs_free(smf_change_info); +} + +cJSON *OpenAPI_smf_change_info_convertToJSON(OpenAPI_smf_change_info_t *smf_change_info) +{ + cJSON *item = NULL; + + if (smf_change_info == NULL) { + ogs_error("OpenAPI_smf_change_info_convertToJSON() failed [SmfChangeInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!smf_change_info->pdu_session_id_list) { + ogs_error("OpenAPI_smf_change_info_convertToJSON() failed [pdu_session_id_list]"); + goto end; + } + cJSON *pdu_session_id_list = cJSON_AddArrayToObject(item, "pduSessionIdList"); + if (pdu_session_id_list == NULL) { + ogs_error("OpenAPI_smf_change_info_convertToJSON() failed [pdu_session_id_list]"); + goto end; + } + + OpenAPI_lnode_t *pdu_session_id_list_node; + OpenAPI_list_for_each(smf_change_info->pdu_session_id_list, pdu_session_id_list_node) { + if (cJSON_AddNumberToObject(pdu_session_id_list, "", *(double *)pdu_session_id_list_node->data) == NULL) { + ogs_error("OpenAPI_smf_change_info_convertToJSON() failed [pdu_session_id_list]"); + goto end; + } + } + + if (!smf_change_info->smf_change_ind) { + ogs_error("OpenAPI_smf_change_info_convertToJSON() failed [smf_change_ind]"); + goto end; + } + if (cJSON_AddStringToObject(item, "smfChangeInd", OpenAPI_smf_change_indication_ToString(smf_change_info->smf_change_ind)) == NULL) { + ogs_error("OpenAPI_smf_change_info_convertToJSON() failed [smf_change_ind]"); + goto end; + } + +end: + return item; +} + +OpenAPI_smf_change_info_t *OpenAPI_smf_change_info_parseFromJSON(cJSON *smf_change_infoJSON) +{ + OpenAPI_smf_change_info_t *smf_change_info_local_var = NULL; + cJSON *pdu_session_id_list = cJSON_GetObjectItemCaseSensitive(smf_change_infoJSON, "pduSessionIdList"); + if (!pdu_session_id_list) { + ogs_error("OpenAPI_smf_change_info_parseFromJSON() failed [pdu_session_id_list]"); + goto end; + } + + OpenAPI_list_t *pdu_session_id_listList; + + cJSON *pdu_session_id_list_local; + if (!cJSON_IsArray(pdu_session_id_list)) { + ogs_error("OpenAPI_smf_change_info_parseFromJSON() failed [pdu_session_id_list]"); + goto end; + } + pdu_session_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pdu_session_id_list_local, pdu_session_id_list) { + if (!cJSON_IsNumber(pdu_session_id_list_local)) { + ogs_error("OpenAPI_smf_change_info_parseFromJSON() failed [pdu_session_id_list]"); + goto end; + } + OpenAPI_list_add(pdu_session_id_listList, &pdu_session_id_list_local->valuedouble); + } + + cJSON *smf_change_ind = cJSON_GetObjectItemCaseSensitive(smf_change_infoJSON, "smfChangeInd"); + if (!smf_change_ind) { + ogs_error("OpenAPI_smf_change_info_parseFromJSON() failed [smf_change_ind]"); + goto end; + } + + OpenAPI_smf_change_indication_e smf_change_indVariable; + + if (!cJSON_IsString(smf_change_ind)) { + ogs_error("OpenAPI_smf_change_info_parseFromJSON() failed [smf_change_ind]"); + goto end; + } + smf_change_indVariable = OpenAPI_smf_change_indication_FromString(smf_change_ind->valuestring); + + smf_change_info_local_var = OpenAPI_smf_change_info_create ( + pdu_session_id_listList, + smf_change_indVariable + ); + + return smf_change_info_local_var; +end: + return NULL; +} + +OpenAPI_smf_change_info_t *OpenAPI_smf_change_info_copy(OpenAPI_smf_change_info_t *dst, OpenAPI_smf_change_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smf_change_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smf_change_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_smf_change_info_free(dst); + dst = OpenAPI_smf_change_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smf_change_info.h b/lib/sbi/openapi/model/smf_change_info.h new file mode 100644 index 000000000..9ecccbf6b --- /dev/null +++ b/lib/sbi/openapi/model/smf_change_info.h @@ -0,0 +1,41 @@ +/* + * smf_change_info.h + * + * + */ + +#ifndef _OpenAPI_smf_change_info_H_ +#define _OpenAPI_smf_change_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "smf_change_indication.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_smf_change_info_s OpenAPI_smf_change_info_t; +typedef struct OpenAPI_smf_change_info_s { + OpenAPI_list_t *pdu_session_id_list; + OpenAPI_smf_change_indication_e smf_change_ind; +} OpenAPI_smf_change_info_t; + +OpenAPI_smf_change_info_t *OpenAPI_smf_change_info_create( + OpenAPI_list_t *pdu_session_id_list, + OpenAPI_smf_change_indication_e smf_change_ind + ); +void OpenAPI_smf_change_info_free(OpenAPI_smf_change_info_t *smf_change_info); +OpenAPI_smf_change_info_t *OpenAPI_smf_change_info_parseFromJSON(cJSON *smf_change_infoJSON); +cJSON *OpenAPI_smf_change_info_convertToJSON(OpenAPI_smf_change_info_t *smf_change_info); +OpenAPI_smf_change_info_t *OpenAPI_smf_change_info_copy(OpenAPI_smf_change_info_t *dst, OpenAPI_smf_change_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_smf_change_info_H_ */ + diff --git a/lib/sbi/openapi/model/smf_info.c b/lib/sbi/openapi/model/smf_info.c index 85ae1864f..c56f2d7c6 100644 --- a/lib/sbi/openapi/model/smf_info.c +++ b/lib/sbi/openapi/model/smf_info.c @@ -284,3 +284,37 @@ end: return NULL; } +OpenAPI_smf_info_t *OpenAPI_smf_info_copy(OpenAPI_smf_info_t *dst, OpenAPI_smf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_smf_info_free(dst); + dst = OpenAPI_smf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smf_info.h b/lib/sbi/openapi/model/smf_info.h index ad6db49d5..bb87b649c 100644 --- a/lib/sbi/openapi/model/smf_info.h +++ b/lib/sbi/openapi/model/smf_info.h @@ -42,6 +42,7 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_create( void OpenAPI_smf_info_free(OpenAPI_smf_info_t *smf_info); OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON); cJSON *OpenAPI_smf_info_convertToJSON(OpenAPI_smf_info_t *smf_info); +OpenAPI_smf_info_t *OpenAPI_smf_info_copy(OpenAPI_smf_info_t *dst, OpenAPI_smf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/smf_registration.c b/lib/sbi/openapi/model/smf_registration.c index ea2858232..a63ba54b5 100644 --- a/lib/sbi/openapi/model/smf_registration.c +++ b/lib/sbi/openapi/model/smf_registration.c @@ -127,7 +127,7 @@ cJSON *OpenAPI_smf_registration_convertToJSON(OpenAPI_smf_registration_t *smf_re } } - if (smf_registration->emergency_services >= 0) { + if (smf_registration->emergency_services) { if (cJSON_AddBoolToObject(item, "emergencyServices", smf_registration->emergency_services) == NULL) { ogs_error("OpenAPI_smf_registration_convertToJSON() failed [emergency_services]"); goto end; @@ -163,7 +163,7 @@ cJSON *OpenAPI_smf_registration_convertToJSON(OpenAPI_smf_registration_t *smf_re } } - if (smf_registration->epdg_ind >= 0) { + if (smf_registration->epdg_ind) { if (cJSON_AddBoolToObject(item, "epdgInd", smf_registration->epdg_ind) == NULL) { ogs_error("OpenAPI_smf_registration_convertToJSON() failed [epdg_ind]"); goto end; @@ -358,3 +358,37 @@ end: return NULL; } +OpenAPI_smf_registration_t *OpenAPI_smf_registration_copy(OpenAPI_smf_registration_t *dst, OpenAPI_smf_registration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smf_registration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_smf_registration_free(dst); + dst = OpenAPI_smf_registration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smf_registration.h b/lib/sbi/openapi/model/smf_registration.h index 0ea957442..a4e8a2686 100644 --- a/lib/sbi/openapi/model/smf_registration.h +++ b/lib/sbi/openapi/model/smf_registration.h @@ -57,6 +57,7 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( void OpenAPI_smf_registration_free(OpenAPI_smf_registration_t *smf_registration); OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_registrationJSON); cJSON *OpenAPI_smf_registration_convertToJSON(OpenAPI_smf_registration_t *smf_registration); +OpenAPI_smf_registration_t *OpenAPI_smf_registration_copy(OpenAPI_smf_registration_t *dst, OpenAPI_smf_registration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/smf_registration_info.c b/lib/sbi/openapi/model/smf_registration_info.c index 436d2a672..1ee911c54 100644 --- a/lib/sbi/openapi/model/smf_registration_info.c +++ b/lib/sbi/openapi/model/smf_registration_info.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_smf_registration_info_t *OpenAPI_smf_registration_info_copy(OpenAPI_smf_registration_info_t *dst, OpenAPI_smf_registration_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smf_registration_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smf_registration_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_smf_registration_info_free(dst); + dst = OpenAPI_smf_registration_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smf_registration_info.h b/lib/sbi/openapi/model/smf_registration_info.h index f784d6b41..75db415c7 100644 --- a/lib/sbi/openapi/model/smf_registration_info.h +++ b/lib/sbi/openapi/model/smf_registration_info.h @@ -29,6 +29,7 @@ OpenAPI_smf_registration_info_t *OpenAPI_smf_registration_info_create( void OpenAPI_smf_registration_info_free(OpenAPI_smf_registration_info_t *smf_registration_info); OpenAPI_smf_registration_info_t *OpenAPI_smf_registration_info_parseFromJSON(cJSON *smf_registration_infoJSON); cJSON *OpenAPI_smf_registration_info_convertToJSON(OpenAPI_smf_registration_info_t *smf_registration_info); +OpenAPI_smf_registration_info_t *OpenAPI_smf_registration_info_copy(OpenAPI_smf_registration_info_t *dst, OpenAPI_smf_registration_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/smf_selection_subscription_data.c b/lib/sbi/openapi/model/smf_selection_subscription_data.c index e8f69aed0..d0db529e9 100644 --- a/lib/sbi/openapi/model/smf_selection_subscription_data.c +++ b/lib/sbi/openapi/model/smf_selection_subscription_data.c @@ -142,3 +142,37 @@ end: return NULL; } +OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_data_copy(OpenAPI_smf_selection_subscription_data_t *dst, OpenAPI_smf_selection_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smf_selection_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smf_selection_subscription_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_smf_selection_subscription_data_free(dst); + dst = OpenAPI_smf_selection_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smf_selection_subscription_data.h b/lib/sbi/openapi/model/smf_selection_subscription_data.h index a43a59385..05325c350 100644 --- a/lib/sbi/openapi/model/smf_selection_subscription_data.h +++ b/lib/sbi/openapi/model/smf_selection_subscription_data.h @@ -33,6 +33,7 @@ OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_da void OpenAPI_smf_selection_subscription_data_free(OpenAPI_smf_selection_subscription_data_t *smf_selection_subscription_data); OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_data_parseFromJSON(cJSON *smf_selection_subscription_dataJSON); cJSON *OpenAPI_smf_selection_subscription_data_convertToJSON(OpenAPI_smf_selection_subscription_data_t *smf_selection_subscription_data); +OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_data_copy(OpenAPI_smf_selection_subscription_data_t *dst, OpenAPI_smf_selection_subscription_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sms_management_subscription_data.c b/lib/sbi/openapi/model/sms_management_subscription_data.c index cb719d17a..595debf12 100644 --- a/lib/sbi/openapi/model/sms_management_subscription_data.c +++ b/lib/sbi/openapi/model/sms_management_subscription_data.c @@ -65,42 +65,42 @@ cJSON *OpenAPI_sms_management_subscription_data_convertToJSON(OpenAPI_sms_manage } } - if (sms_management_subscription_data->mt_sms_subscribed >= 0) { + if (sms_management_subscription_data->mt_sms_subscribed) { if (cJSON_AddBoolToObject(item, "mtSmsSubscribed", sms_management_subscription_data->mt_sms_subscribed) == NULL) { ogs_error("OpenAPI_sms_management_subscription_data_convertToJSON() failed [mt_sms_subscribed]"); goto end; } } - if (sms_management_subscription_data->mt_sms_barring_all >= 0) { + if (sms_management_subscription_data->mt_sms_barring_all) { if (cJSON_AddBoolToObject(item, "mtSmsBarringAll", sms_management_subscription_data->mt_sms_barring_all) == NULL) { ogs_error("OpenAPI_sms_management_subscription_data_convertToJSON() failed [mt_sms_barring_all]"); goto end; } } - if (sms_management_subscription_data->mt_sms_barring_roaming >= 0) { + if (sms_management_subscription_data->mt_sms_barring_roaming) { if (cJSON_AddBoolToObject(item, "mtSmsBarringRoaming", sms_management_subscription_data->mt_sms_barring_roaming) == NULL) { ogs_error("OpenAPI_sms_management_subscription_data_convertToJSON() failed [mt_sms_barring_roaming]"); goto end; } } - if (sms_management_subscription_data->mo_sms_subscribed >= 0) { + if (sms_management_subscription_data->mo_sms_subscribed) { if (cJSON_AddBoolToObject(item, "moSmsSubscribed", sms_management_subscription_data->mo_sms_subscribed) == NULL) { ogs_error("OpenAPI_sms_management_subscription_data_convertToJSON() failed [mo_sms_subscribed]"); goto end; } } - if (sms_management_subscription_data->mo_sms_barring_all >= 0) { + if (sms_management_subscription_data->mo_sms_barring_all) { if (cJSON_AddBoolToObject(item, "moSmsBarringAll", sms_management_subscription_data->mo_sms_barring_all) == NULL) { ogs_error("OpenAPI_sms_management_subscription_data_convertToJSON() failed [mo_sms_barring_all]"); goto end; } } - if (sms_management_subscription_data->mo_sms_barring_roaming >= 0) { + if (sms_management_subscription_data->mo_sms_barring_roaming) { if (cJSON_AddBoolToObject(item, "moSmsBarringRoaming", sms_management_subscription_data->mo_sms_barring_roaming) == NULL) { ogs_error("OpenAPI_sms_management_subscription_data_convertToJSON() failed [mo_sms_barring_roaming]"); goto end; @@ -250,3 +250,37 @@ end: return NULL; } +OpenAPI_sms_management_subscription_data_t *OpenAPI_sms_management_subscription_data_copy(OpenAPI_sms_management_subscription_data_t *dst, OpenAPI_sms_management_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sms_management_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sms_management_subscription_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sms_management_subscription_data_free(dst); + dst = OpenAPI_sms_management_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sms_management_subscription_data.h b/lib/sbi/openapi/model/sms_management_subscription_data.h index af48fce32..e291d5560 100644 --- a/lib/sbi/openapi/model/sms_management_subscription_data.h +++ b/lib/sbi/openapi/model/sms_management_subscription_data.h @@ -45,6 +45,7 @@ OpenAPI_sms_management_subscription_data_t *OpenAPI_sms_management_subscription_ void OpenAPI_sms_management_subscription_data_free(OpenAPI_sms_management_subscription_data_t *sms_management_subscription_data); OpenAPI_sms_management_subscription_data_t *OpenAPI_sms_management_subscription_data_parseFromJSON(cJSON *sms_management_subscription_dataJSON); cJSON *OpenAPI_sms_management_subscription_data_convertToJSON(OpenAPI_sms_management_subscription_data_t *sms_management_subscription_data); +OpenAPI_sms_management_subscription_data_t *OpenAPI_sms_management_subscription_data_copy(OpenAPI_sms_management_subscription_data_t *dst, OpenAPI_sms_management_subscription_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sms_subscription_data.c b/lib/sbi/openapi/model/sms_subscription_data.c index 2ec729157..7c3270a63 100644 --- a/lib/sbi/openapi/model/sms_subscription_data.c +++ b/lib/sbi/openapi/model/sms_subscription_data.c @@ -39,7 +39,7 @@ cJSON *OpenAPI_sms_subscription_data_convertToJSON(OpenAPI_sms_subscription_data } item = cJSON_CreateObject(); - if (sms_subscription_data->sms_subscribed >= 0) { + if (sms_subscription_data->sms_subscribed) { if (cJSON_AddBoolToObject(item, "smsSubscribed", sms_subscription_data->sms_subscribed) == NULL) { ogs_error("OpenAPI_sms_subscription_data_convertToJSON() failed [sms_subscribed]"); goto end; @@ -88,3 +88,37 @@ end: return NULL; } +OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_copy(OpenAPI_sms_subscription_data_t *dst, OpenAPI_sms_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sms_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sms_subscription_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_sms_subscription_data_free(dst); + dst = OpenAPI_sms_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sms_subscription_data.h b/lib/sbi/openapi/model/sms_subscription_data.h index c7d7680f9..e6a72f0e7 100644 --- a/lib/sbi/openapi/model/sms_subscription_data.h +++ b/lib/sbi/openapi/model/sms_subscription_data.h @@ -30,6 +30,7 @@ OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_create( void OpenAPI_sms_subscription_data_free(OpenAPI_sms_subscription_data_t *sms_subscription_data); OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_parseFromJSON(cJSON *sms_subscription_dataJSON); cJSON *OpenAPI_sms_subscription_data_convertToJSON(OpenAPI_sms_subscription_data_t *sms_subscription_data); +OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_copy(OpenAPI_sms_subscription_data_t *dst, OpenAPI_sms_subscription_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sms_support.c b/lib/sbi/openapi/model/sms_support.c index 8cd62620d..a4c63aa5d 100644 --- a/lib/sbi/openapi/model/sms_support.c +++ b/lib/sbi/openapi/model/sms_support.c @@ -4,48 +4,27 @@ #include #include "sms_support.h" -OpenAPI_sms_support_t *OpenAPI_sms_support_create( - ) +char* OpenAPI_sms_support_ToString(OpenAPI_sms_support_e sms_support) { - OpenAPI_sms_support_t *sms_support_local_var = OpenAPI_malloc(sizeof(OpenAPI_sms_support_t)); - if (!sms_support_local_var) { - return NULL; + const char *sms_supportArray[] = { "NULL", "_3GPP", "NON_3GPP", "BOTH", "NONE" }; + size_t sizeofArray = sizeof(sms_supportArray) / sizeof(sms_supportArray[0]); + if (sms_support < sizeofArray) + return (char *)sms_supportArray[sms_support]; + else + return (char *)"Unknown"; +} + +OpenAPI_sms_support_e OpenAPI_sms_support_FromString(char* sms_support) +{ + int stringToReturn = 0; + const char *sms_supportArray[] = { "NULL", "_3GPP", "NON_3GPP", "BOTH", "NONE" }; + size_t sizeofArray = sizeof(sms_supportArray) / sizeof(sms_supportArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(sms_support, sms_supportArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - - return sms_support_local_var; -} - -void OpenAPI_sms_support_free(OpenAPI_sms_support_t *sms_support) -{ - if (NULL == sms_support) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(sms_support); -} - -cJSON *OpenAPI_sms_support_convertToJSON(OpenAPI_sms_support_t *sms_support) -{ - cJSON *item = NULL; - - if (sms_support == NULL) { - ogs_error("OpenAPI_sms_support_convertToJSON() failed [SmsSupport]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_sms_support_t *OpenAPI_sms_support_parseFromJSON(cJSON *sms_supportJSON) -{ - OpenAPI_sms_support_t *sms_support_local_var = NULL; - sms_support_local_var = OpenAPI_sms_support_create ( - ); - - return sms_support_local_var; -end: - return NULL; + return 0; } diff --git a/lib/sbi/openapi/model/sms_support.h b/lib/sbi/openapi/model/sms_support.h index 65429787c..ebd02c34e 100644 --- a/lib/sbi/openapi/model/sms_support.h +++ b/lib/sbi/openapi/model/sms_support.h @@ -17,15 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_sms_support_s OpenAPI_sms_support_t; -typedef struct OpenAPI_sms_support_s { -} OpenAPI_sms_support_t; +typedef enum { OpenAPI_sms_support_NULL = 0, OpenAPI_sms_support__3GPP, OpenAPI_sms_support_NON_3GPP, OpenAPI_sms_support_BOTH, OpenAPI_sms_support_NONE } OpenAPI_sms_support_e; -OpenAPI_sms_support_t *OpenAPI_sms_support_create( - ); -void OpenAPI_sms_support_free(OpenAPI_sms_support_t *sms_support); -OpenAPI_sms_support_t *OpenAPI_sms_support_parseFromJSON(cJSON *sms_supportJSON); -cJSON *OpenAPI_sms_support_convertToJSON(OpenAPI_sms_support_t *sms_support); +char* OpenAPI_sms_support_ToString(OpenAPI_sms_support_e sms_support); + +OpenAPI_sms_support_e OpenAPI_sms_support_FromString(char* sms_support); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/smsf_info.c b/lib/sbi/openapi/model/smsf_info.c index 4137c2bce..71138c0b9 100644 --- a/lib/sbi/openapi/model/smsf_info.c +++ b/lib/sbi/openapi/model/smsf_info.c @@ -103,3 +103,37 @@ end: return NULL; } +OpenAPI_smsf_info_t *OpenAPI_smsf_info_copy(OpenAPI_smsf_info_t *dst, OpenAPI_smsf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smsf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smsf_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_smsf_info_free(dst); + dst = OpenAPI_smsf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smsf_info.h b/lib/sbi/openapi/model/smsf_info.h index d20e72c2e..744c7120c 100644 --- a/lib/sbi/openapi/model/smsf_info.h +++ b/lib/sbi/openapi/model/smsf_info.h @@ -31,6 +31,7 @@ OpenAPI_smsf_info_t *OpenAPI_smsf_info_create( void OpenAPI_smsf_info_free(OpenAPI_smsf_info_t *smsf_info); OpenAPI_smsf_info_t *OpenAPI_smsf_info_parseFromJSON(cJSON *smsf_infoJSON); cJSON *OpenAPI_smsf_info_convertToJSON(OpenAPI_smsf_info_t *smsf_info); +OpenAPI_smsf_info_t *OpenAPI_smsf_info_copy(OpenAPI_smsf_info_t *dst, OpenAPI_smsf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/smsf_registration.c b/lib/sbi/openapi/model/smsf_registration.c index bc28ae50f..52bcd686e 100644 --- a/lib/sbi/openapi/model/smsf_registration.c +++ b/lib/sbi/openapi/model/smsf_registration.c @@ -207,3 +207,37 @@ end: return NULL; } +OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_copy(OpenAPI_smsf_registration_t *dst, OpenAPI_smsf_registration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smsf_registration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_smsf_registration_free(dst); + dst = OpenAPI_smsf_registration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smsf_registration.h b/lib/sbi/openapi/model/smsf_registration.h index bf9d91ea3..95764e807 100644 --- a/lib/sbi/openapi/model/smsf_registration.h +++ b/lib/sbi/openapi/model/smsf_registration.h @@ -42,6 +42,7 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( void OpenAPI_smsf_registration_free(OpenAPI_smsf_registration_t *smsf_registration); OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_parseFromJSON(cJSON *smsf_registrationJSON); cJSON *OpenAPI_smsf_registration_convertToJSON(OpenAPI_smsf_registration_t *smsf_registration); +OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_copy(OpenAPI_smsf_registration_t *dst, OpenAPI_smsf_registration_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/snssai.c b/lib/sbi/openapi/model/snssai.c index 296e6ef74..8f21260ce 100644 --- a/lib/sbi/openapi/model/snssai.c +++ b/lib/sbi/openapi/model/snssai.c @@ -93,3 +93,37 @@ end: return NULL; } +OpenAPI_snssai_t *OpenAPI_snssai_copy(OpenAPI_snssai_t *dst, OpenAPI_snssai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_snssai_free(dst); + dst = OpenAPI_snssai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai.h b/lib/sbi/openapi/model/snssai.h index 72e6da199..afe263fe8 100644 --- a/lib/sbi/openapi/model/snssai.h +++ b/lib/sbi/openapi/model/snssai.h @@ -30,6 +30,7 @@ OpenAPI_snssai_t *OpenAPI_snssai_create( void OpenAPI_snssai_free(OpenAPI_snssai_t *snssai); OpenAPI_snssai_t *OpenAPI_snssai_parseFromJSON(cJSON *snssaiJSON); cJSON *OpenAPI_snssai_convertToJSON(OpenAPI_snssai_t *snssai); +OpenAPI_snssai_t *OpenAPI_snssai_copy(OpenAPI_snssai_t *dst, OpenAPI_snssai_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/snssai_info.c b/lib/sbi/openapi/model/snssai_info.c index aab894dde..5435c3916 100644 --- a/lib/sbi/openapi/model/snssai_info.c +++ b/lib/sbi/openapi/model/snssai_info.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_snssai_info_t *OpenAPI_snssai_info_copy(OpenAPI_snssai_info_t *dst, OpenAPI_snssai_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_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_snssai_info_free(dst); + dst = OpenAPI_snssai_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_info.h b/lib/sbi/openapi/model/snssai_info.h index cea31d3ac..f4237e3d3 100644 --- a/lib/sbi/openapi/model/snssai_info.h +++ b/lib/sbi/openapi/model/snssai_info.h @@ -29,6 +29,7 @@ OpenAPI_snssai_info_t *OpenAPI_snssai_info_create( void OpenAPI_snssai_info_free(OpenAPI_snssai_info_t *snssai_info); OpenAPI_snssai_info_t *OpenAPI_snssai_info_parseFromJSON(cJSON *snssai_infoJSON); cJSON *OpenAPI_snssai_info_convertToJSON(OpenAPI_snssai_info_t *snssai_info); +OpenAPI_snssai_info_t *OpenAPI_snssai_info_copy(OpenAPI_snssai_info_t *dst, OpenAPI_snssai_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/snssai_route_selection_descriptor.c b/lib/sbi/openapi/model/snssai_route_selection_descriptor.c index 10b1025bc..612d21bfb 100644 --- a/lib/sbi/openapi/model/snssai_route_selection_descriptor.c +++ b/lib/sbi/openapi/model/snssai_route_selection_descriptor.c @@ -128,3 +128,37 @@ end: return NULL; } +OpenAPI_snssai_route_selection_descriptor_t *OpenAPI_snssai_route_selection_descriptor_copy(OpenAPI_snssai_route_selection_descriptor_t *dst, OpenAPI_snssai_route_selection_descriptor_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_route_selection_descriptor_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_route_selection_descriptor_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_snssai_route_selection_descriptor_free(dst); + dst = OpenAPI_snssai_route_selection_descriptor_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_route_selection_descriptor.h b/lib/sbi/openapi/model/snssai_route_selection_descriptor.h index 41f204b81..867e7a11d 100644 --- a/lib/sbi/openapi/model/snssai_route_selection_descriptor.h +++ b/lib/sbi/openapi/model/snssai_route_selection_descriptor.h @@ -32,6 +32,7 @@ OpenAPI_snssai_route_selection_descriptor_t *OpenAPI_snssai_route_selection_desc void OpenAPI_snssai_route_selection_descriptor_free(OpenAPI_snssai_route_selection_descriptor_t *snssai_route_selection_descriptor); OpenAPI_snssai_route_selection_descriptor_t *OpenAPI_snssai_route_selection_descriptor_parseFromJSON(cJSON *snssai_route_selection_descriptorJSON); cJSON *OpenAPI_snssai_route_selection_descriptor_convertToJSON(OpenAPI_snssai_route_selection_descriptor_t *snssai_route_selection_descriptor); +OpenAPI_snssai_route_selection_descriptor_t *OpenAPI_snssai_route_selection_descriptor_copy(OpenAPI_snssai_route_selection_descriptor_t *dst, OpenAPI_snssai_route_selection_descriptor_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/snssai_smf_info_item.c b/lib/sbi/openapi/model/snssai_smf_info_item.c index 6af09046f..e498f0b71 100644 --- a/lib/sbi/openapi/model/snssai_smf_info_item.c +++ b/lib/sbi/openapi/model/snssai_smf_info_item.c @@ -133,3 +133,37 @@ end: return NULL; } +OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_copy(OpenAPI_snssai_smf_info_item_t *dst, OpenAPI_snssai_smf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_smf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_snssai_smf_info_item_free(dst); + dst = OpenAPI_snssai_smf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_smf_info_item.h b/lib/sbi/openapi/model/snssai_smf_info_item.h index 2a20a17a9..1ded7ebf2 100644 --- a/lib/sbi/openapi/model/snssai_smf_info_item.h +++ b/lib/sbi/openapi/model/snssai_smf_info_item.h @@ -32,6 +32,7 @@ OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_create( void OpenAPI_snssai_smf_info_item_free(OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item); OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_parseFromJSON(cJSON *snssai_smf_info_itemJSON); cJSON *OpenAPI_snssai_smf_info_item_convertToJSON(OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item); +OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_copy(OpenAPI_snssai_smf_info_item_t *dst, OpenAPI_snssai_smf_info_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/snssai_upf_info_item.c b/lib/sbi/openapi/model/snssai_upf_info_item.c index ddaf5d76f..83bab3f3f 100644 --- a/lib/sbi/openapi/model/snssai_upf_info_item.c +++ b/lib/sbi/openapi/model/snssai_upf_info_item.c @@ -82,7 +82,7 @@ cJSON *OpenAPI_snssai_upf_info_item_convertToJSON(OpenAPI_snssai_upf_info_item_t } } - if (snssai_upf_info_item->redundant_transport >= 0) { + if (snssai_upf_info_item->redundant_transport) { if (cJSON_AddBoolToObject(item, "redundantTransport", snssai_upf_info_item->redundant_transport) == NULL) { ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [redundant_transport]"); goto end; @@ -152,3 +152,37 @@ end: return NULL; } +OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_copy(OpenAPI_snssai_upf_info_item_t *dst, OpenAPI_snssai_upf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_upf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_snssai_upf_info_item_free(dst); + dst = OpenAPI_snssai_upf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_upf_info_item.h b/lib/sbi/openapi/model/snssai_upf_info_item.h index 533a62fb0..a30f1a454 100644 --- a/lib/sbi/openapi/model/snssai_upf_info_item.h +++ b/lib/sbi/openapi/model/snssai_upf_info_item.h @@ -34,6 +34,7 @@ OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_create( void OpenAPI_snssai_upf_info_item_free(OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item); OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_parseFromJSON(cJSON *snssai_upf_info_itemJSON); cJSON *OpenAPI_snssai_upf_info_item_convertToJSON(OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item); +OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_copy(OpenAPI_snssai_upf_info_item_t *dst, OpenAPI_snssai_upf_info_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sor_data.c b/lib/sbi/openapi/model/sor_data.c index e134ee8f8..e721f87c7 100644 --- a/lib/sbi/openapi/model/sor_data.c +++ b/lib/sbi/openapi/model/sor_data.c @@ -140,3 +140,37 @@ end: return NULL; } +OpenAPI_sor_data_t *OpenAPI_sor_data_copy(OpenAPI_sor_data_t *dst, OpenAPI_sor_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sor_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sor_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_sor_data_free(dst); + dst = OpenAPI_sor_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sor_data.h b/lib/sbi/openapi/model/sor_data.h index 061167305..56bdc7013 100644 --- a/lib/sbi/openapi/model/sor_data.h +++ b/lib/sbi/openapi/model/sor_data.h @@ -35,6 +35,7 @@ OpenAPI_sor_data_t *OpenAPI_sor_data_create( void OpenAPI_sor_data_free(OpenAPI_sor_data_t *sor_data); OpenAPI_sor_data_t *OpenAPI_sor_data_parseFromJSON(cJSON *sor_dataJSON); cJSON *OpenAPI_sor_data_convertToJSON(OpenAPI_sor_data_t *sor_data); +OpenAPI_sor_data_t *OpenAPI_sor_data_copy(OpenAPI_sor_data_t *dst, OpenAPI_sor_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sor_info.c b/lib/sbi/openapi/model/sor_info.c index f87a3d1b2..7b0ffcbad 100644 --- a/lib/sbi/openapi/model/sor_info.c +++ b/lib/sbi/openapi/model/sor_info.c @@ -158,3 +158,37 @@ end: return NULL; } +OpenAPI_sor_info_t *OpenAPI_sor_info_copy(OpenAPI_sor_info_t *dst, OpenAPI_sor_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sor_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sor_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_sor_info_free(dst); + dst = OpenAPI_sor_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sor_info.h b/lib/sbi/openapi/model/sor_info.h index 825bf08c1..7f612f53a 100644 --- a/lib/sbi/openapi/model/sor_info.h +++ b/lib/sbi/openapi/model/sor_info.h @@ -37,6 +37,7 @@ OpenAPI_sor_info_t *OpenAPI_sor_info_create( void OpenAPI_sor_info_free(OpenAPI_sor_info_t *sor_info); OpenAPI_sor_info_t *OpenAPI_sor_info_parseFromJSON(cJSON *sor_infoJSON); cJSON *OpenAPI_sor_info_convertToJSON(OpenAPI_sor_info_t *sor_info); +OpenAPI_sor_info_t *OpenAPI_sor_info_copy(OpenAPI_sor_info_t *dst, OpenAPI_sor_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sor_update_info.c b/lib/sbi/openapi/model/sor_update_info.c index 7e31faf89..137254e52 100644 --- a/lib/sbi/openapi/model/sor_update_info.c +++ b/lib/sbi/openapi/model/sor_update_info.c @@ -78,3 +78,37 @@ end: return NULL; } +OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_copy(OpenAPI_sor_update_info_t *dst, OpenAPI_sor_update_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sor_update_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sor_update_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_sor_update_info_free(dst); + dst = OpenAPI_sor_update_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sor_update_info.h b/lib/sbi/openapi/model/sor_update_info.h index 45be44e4f..6b58dded7 100644 --- a/lib/sbi/openapi/model/sor_update_info.h +++ b/lib/sbi/openapi/model/sor_update_info.h @@ -29,6 +29,7 @@ OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_create( void OpenAPI_sor_update_info_free(OpenAPI_sor_update_info_t *sor_update_info); OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_parseFromJSON(cJSON *sor_update_infoJSON); cJSON *OpenAPI_sor_update_info_convertToJSON(OpenAPI_sor_update_info_t *sor_update_info); +OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_copy(OpenAPI_sor_update_info_t *dst, OpenAPI_sor_update_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/sponsor_connectivity_data.c b/lib/sbi/openapi/model/sponsor_connectivity_data.c index 81e5682ba..f7cadca4c 100644 --- a/lib/sbi/openapi/model/sponsor_connectivity_data.c +++ b/lib/sbi/openapi/model/sponsor_connectivity_data.c @@ -97,3 +97,37 @@ end: return NULL; } +OpenAPI_sponsor_connectivity_data_t *OpenAPI_sponsor_connectivity_data_copy(OpenAPI_sponsor_connectivity_data_t *dst, OpenAPI_sponsor_connectivity_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sponsor_connectivity_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sponsor_connectivity_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_sponsor_connectivity_data_free(dst); + dst = OpenAPI_sponsor_connectivity_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sponsor_connectivity_data.h b/lib/sbi/openapi/model/sponsor_connectivity_data.h index ce191f33f..58bb779d2 100644 --- a/lib/sbi/openapi/model/sponsor_connectivity_data.h +++ b/lib/sbi/openapi/model/sponsor_connectivity_data.h @@ -28,6 +28,7 @@ OpenAPI_sponsor_connectivity_data_t *OpenAPI_sponsor_connectivity_data_create( void OpenAPI_sponsor_connectivity_data_free(OpenAPI_sponsor_connectivity_data_t *sponsor_connectivity_data); OpenAPI_sponsor_connectivity_data_t *OpenAPI_sponsor_connectivity_data_parseFromJSON(cJSON *sponsor_connectivity_dataJSON); cJSON *OpenAPI_sponsor_connectivity_data_convertToJSON(OpenAPI_sponsor_connectivity_data_t *sponsor_connectivity_data); +OpenAPI_sponsor_connectivity_data_t *OpenAPI_sponsor_connectivity_data_copy(OpenAPI_sponsor_connectivity_data_t *dst, OpenAPI_sponsor_connectivity_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ssc_mode.c b/lib/sbi/openapi/model/ssc_mode.c index bc3d113b4..56e842678 100644 --- a/lib/sbi/openapi/model/ssc_mode.c +++ b/lib/sbi/openapi/model/ssc_mode.c @@ -4,48 +4,27 @@ #include #include "ssc_mode.h" -OpenAPI_ssc_mode_t *OpenAPI_ssc_mode_create( - ) +char* OpenAPI_ssc_mode_ToString(OpenAPI_ssc_mode_e ssc_mode) { - OpenAPI_ssc_mode_t *ssc_mode_local_var = OpenAPI_malloc(sizeof(OpenAPI_ssc_mode_t)); - if (!ssc_mode_local_var) { - return NULL; + const char *ssc_modeArray[] = { "NULL", "SSC_MODE_1", "SSC_MODE_2", "SSC_MODE_3" }; + size_t sizeofArray = sizeof(ssc_modeArray) / sizeof(ssc_modeArray[0]); + if (ssc_mode < sizeofArray) + return (char *)ssc_modeArray[ssc_mode]; + else + return (char *)"Unknown"; +} + +OpenAPI_ssc_mode_e OpenAPI_ssc_mode_FromString(char* ssc_mode) +{ + int stringToReturn = 0; + const char *ssc_modeArray[] = { "NULL", "SSC_MODE_1", "SSC_MODE_2", "SSC_MODE_3" }; + size_t sizeofArray = sizeof(ssc_modeArray) / sizeof(ssc_modeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ssc_mode, ssc_modeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - - return ssc_mode_local_var; -} - -void OpenAPI_ssc_mode_free(OpenAPI_ssc_mode_t *ssc_mode) -{ - if (NULL == ssc_mode) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(ssc_mode); -} - -cJSON *OpenAPI_ssc_mode_convertToJSON(OpenAPI_ssc_mode_t *ssc_mode) -{ - cJSON *item = NULL; - - if (ssc_mode == NULL) { - ogs_error("OpenAPI_ssc_mode_convertToJSON() failed [SscMode]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_ssc_mode_t *OpenAPI_ssc_mode_parseFromJSON(cJSON *ssc_modeJSON) -{ - OpenAPI_ssc_mode_t *ssc_mode_local_var = NULL; - ssc_mode_local_var = OpenAPI_ssc_mode_create ( - ); - - return ssc_mode_local_var; -end: - return NULL; + return 0; } diff --git a/lib/sbi/openapi/model/ssc_mode.h b/lib/sbi/openapi/model/ssc_mode.h index 1baac93b8..859b61b6e 100644 --- a/lib/sbi/openapi/model/ssc_mode.h +++ b/lib/sbi/openapi/model/ssc_mode.h @@ -17,15 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_ssc_mode_s OpenAPI_ssc_mode_t; -typedef struct OpenAPI_ssc_mode_s { -} OpenAPI_ssc_mode_t; +typedef enum { OpenAPI_ssc_mode_NULL = 0, OpenAPI_ssc_mode_SSC_MODE_1, OpenAPI_ssc_mode_SSC_MODE_2, OpenAPI_ssc_mode_SSC_MODE_3 } OpenAPI_ssc_mode_e; -OpenAPI_ssc_mode_t *OpenAPI_ssc_mode_create( - ); -void OpenAPI_ssc_mode_free(OpenAPI_ssc_mode_t *ssc_mode); -OpenAPI_ssc_mode_t *OpenAPI_ssc_mode_parseFromJSON(cJSON *ssc_modeJSON); -cJSON *OpenAPI_ssc_mode_convertToJSON(OpenAPI_ssc_mode_t *ssc_mode); +char* OpenAPI_ssc_mode_ToString(OpenAPI_ssc_mode_e ssc_mode); + +OpenAPI_ssc_mode_e OpenAPI_ssc_mode_FromString(char* ssc_mode); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ssc_modes.c b/lib/sbi/openapi/model/ssc_modes.c index c3cece155..ef904134c 100644 --- a/lib/sbi/openapi/model/ssc_modes.c +++ b/lib/sbi/openapi/model/ssc_modes.c @@ -5,7 +5,7 @@ #include "ssc_modes.h" OpenAPI_ssc_modes_t *OpenAPI_ssc_modes_create( - OpenAPI_ssc_mode_t *default_ssc_mode, + OpenAPI_ssc_mode_e default_ssc_mode, OpenAPI_list_t *allowed_ssc_modes ) { @@ -25,10 +25,6 @@ void OpenAPI_ssc_modes_free(OpenAPI_ssc_modes_t *ssc_modes) return; } OpenAPI_lnode_t *node; - OpenAPI_ssc_mode_free(ssc_modes->default_ssc_mode); - OpenAPI_list_for_each(ssc_modes->allowed_ssc_modes, node) { - OpenAPI_ssc_mode_free(node->data); - } OpenAPI_list_free(ssc_modes->allowed_ssc_modes); ogs_free(ssc_modes); } @@ -47,33 +43,22 @@ cJSON *OpenAPI_ssc_modes_convertToJSON(OpenAPI_ssc_modes_t *ssc_modes) ogs_error("OpenAPI_ssc_modes_convertToJSON() failed [default_ssc_mode]"); goto end; } - cJSON *default_ssc_mode_local_JSON = OpenAPI_ssc_mode_convertToJSON(ssc_modes->default_ssc_mode); - if (default_ssc_mode_local_JSON == NULL) { - ogs_error("OpenAPI_ssc_modes_convertToJSON() failed [default_ssc_mode]"); - goto end; - } - cJSON_AddItemToObject(item, "defaultSscMode", default_ssc_mode_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "defaultSscMode", OpenAPI_ssc_mode_ToString(ssc_modes->default_ssc_mode)) == NULL) { ogs_error("OpenAPI_ssc_modes_convertToJSON() failed [default_ssc_mode]"); goto end; } if (ssc_modes->allowed_ssc_modes) { - cJSON *allowed_ssc_modesList = cJSON_AddArrayToObject(item, "allowedSscModes"); - if (allowed_ssc_modesList == NULL) { + cJSON *allowed_ssc_modes = cJSON_AddArrayToObject(item, "allowedSscModes"); + if (allowed_ssc_modes == NULL) { ogs_error("OpenAPI_ssc_modes_convertToJSON() failed [allowed_ssc_modes]"); goto end; } - OpenAPI_lnode_t *allowed_ssc_modes_node; - if (ssc_modes->allowed_ssc_modes) { - OpenAPI_list_for_each(ssc_modes->allowed_ssc_modes, allowed_ssc_modes_node) { - cJSON *itemLocal = OpenAPI_ssc_mode_convertToJSON(allowed_ssc_modes_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_ssc_modes_convertToJSON() failed [allowed_ssc_modes]"); - goto end; - } - cJSON_AddItemToArray(allowed_ssc_modesList, itemLocal); + OpenAPI_list_for_each(ssc_modes->allowed_ssc_modes, allowed_ssc_modes_node) { + if (cJSON_AddStringToObject(allowed_ssc_modes, "", OpenAPI_ssc_mode_ToString((OpenAPI_ssc_mode_e)allowed_ssc_modes_node->data)) == NULL) { + ogs_error("OpenAPI_ssc_modes_convertToJSON() failed [allowed_ssc_modes]"); + goto end; } } } @@ -91,9 +76,13 @@ OpenAPI_ssc_modes_t *OpenAPI_ssc_modes_parseFromJSON(cJSON *ssc_modesJSON) goto end; } - OpenAPI_ssc_mode_t *default_ssc_mode_local_nonprim = NULL; + OpenAPI_ssc_mode_e default_ssc_modeVariable; - default_ssc_mode_local_nonprim = OpenAPI_ssc_mode_parseFromJSON(default_ssc_mode); + if (!cJSON_IsString(default_ssc_mode)) { + ogs_error("OpenAPI_ssc_modes_parseFromJSON() failed [default_ssc_mode]"); + goto end; + } + default_ssc_modeVariable = OpenAPI_ssc_mode_FromString(default_ssc_mode->valuestring); cJSON *allowed_ssc_modes = cJSON_GetObjectItemCaseSensitive(ssc_modesJSON, "allowedSscModes"); @@ -108,18 +97,17 @@ OpenAPI_ssc_modes_t *OpenAPI_ssc_modes_parseFromJSON(cJSON *ssc_modesJSON) allowed_ssc_modesList = OpenAPI_list_create(); cJSON_ArrayForEach(allowed_ssc_modes_local_nonprimitive, allowed_ssc_modes ) { - if (!cJSON_IsObject(allowed_ssc_modes_local_nonprimitive)) { + if (!cJSON_IsString(allowed_ssc_modes_local_nonprimitive)) { ogs_error("OpenAPI_ssc_modes_parseFromJSON() failed [allowed_ssc_modes]"); goto end; } - OpenAPI_ssc_mode_t *allowed_ssc_modesItem = OpenAPI_ssc_mode_parseFromJSON(allowed_ssc_modes_local_nonprimitive); - OpenAPI_list_add(allowed_ssc_modesList, allowed_ssc_modesItem); + OpenAPI_list_add(allowed_ssc_modesList, (void *)OpenAPI_ssc_mode_FromString(allowed_ssc_modes_local_nonprimitive->valuestring)); } } ssc_modes_local_var = OpenAPI_ssc_modes_create ( - default_ssc_mode_local_nonprim, + default_ssc_modeVariable, allowed_ssc_modes ? allowed_ssc_modesList : NULL ); @@ -128,3 +116,37 @@ end: return NULL; } +OpenAPI_ssc_modes_t *OpenAPI_ssc_modes_copy(OpenAPI_ssc_modes_t *dst, OpenAPI_ssc_modes_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ssc_modes_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ssc_modes_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ssc_modes_free(dst); + dst = OpenAPI_ssc_modes_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ssc_modes.h b/lib/sbi/openapi/model/ssc_modes.h index 4fe565af0..381157050 100644 --- a/lib/sbi/openapi/model/ssc_modes.h +++ b/lib/sbi/openapi/model/ssc_modes.h @@ -20,17 +20,18 @@ extern "C" { typedef struct OpenAPI_ssc_modes_s OpenAPI_ssc_modes_t; typedef struct OpenAPI_ssc_modes_s { - struct OpenAPI_ssc_mode_s *default_ssc_mode; + OpenAPI_ssc_mode_e default_ssc_mode; OpenAPI_list_t *allowed_ssc_modes; } OpenAPI_ssc_modes_t; OpenAPI_ssc_modes_t *OpenAPI_ssc_modes_create( - OpenAPI_ssc_mode_t *default_ssc_mode, + OpenAPI_ssc_mode_e default_ssc_mode, OpenAPI_list_t *allowed_ssc_modes ); void OpenAPI_ssc_modes_free(OpenAPI_ssc_modes_t *ssc_modes); OpenAPI_ssc_modes_t *OpenAPI_ssc_modes_parseFromJSON(cJSON *ssc_modesJSON); cJSON *OpenAPI_ssc_modes_convertToJSON(OpenAPI_ssc_modes_t *ssc_modes); +OpenAPI_ssc_modes_t *OpenAPI_ssc_modes_copy(OpenAPI_ssc_modes_t *dst, OpenAPI_ssc_modes_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/stationary_indication.c b/lib/sbi/openapi/model/stationary_indication.c index f84dbc2d0..db6a091fa 100644 --- a/lib/sbi/openapi/model/stationary_indication.c +++ b/lib/sbi/openapi/model/stationary_indication.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_stationary_indication_t *OpenAPI_stationary_indication_copy(OpenAPI_stationary_indication_t *dst, OpenAPI_stationary_indication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_stationary_indication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_stationary_indication_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_stationary_indication_free(dst); + dst = OpenAPI_stationary_indication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/stationary_indication.h b/lib/sbi/openapi/model/stationary_indication.h index f442d04d0..6987d2e4f 100644 --- a/lib/sbi/openapi/model/stationary_indication.h +++ b/lib/sbi/openapi/model/stationary_indication.h @@ -26,6 +26,7 @@ OpenAPI_stationary_indication_t *OpenAPI_stationary_indication_create( void OpenAPI_stationary_indication_free(OpenAPI_stationary_indication_t *stationary_indication); OpenAPI_stationary_indication_t *OpenAPI_stationary_indication_parseFromJSON(cJSON *stationary_indicationJSON); cJSON *OpenAPI_stationary_indication_convertToJSON(OpenAPI_stationary_indication_t *stationary_indication); +OpenAPI_stationary_indication_t *OpenAPI_stationary_indication_copy(OpenAPI_stationary_indication_t *dst, OpenAPI_stationary_indication_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/stationary_indication_rm.c b/lib/sbi/openapi/model/stationary_indication_rm.c index e72217536..8fdb0d2da 100644 --- a/lib/sbi/openapi/model/stationary_indication_rm.c +++ b/lib/sbi/openapi/model/stationary_indication_rm.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_stationary_indication_rm_t *OpenAPI_stationary_indication_rm_copy(OpenAPI_stationary_indication_rm_t *dst, OpenAPI_stationary_indication_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_stationary_indication_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_stationary_indication_rm_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_stationary_indication_rm_free(dst); + dst = OpenAPI_stationary_indication_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/stationary_indication_rm.h b/lib/sbi/openapi/model/stationary_indication_rm.h index 71c3cc42b..5f5fa26fc 100644 --- a/lib/sbi/openapi/model/stationary_indication_rm.h +++ b/lib/sbi/openapi/model/stationary_indication_rm.h @@ -28,6 +28,7 @@ OpenAPI_stationary_indication_rm_t *OpenAPI_stationary_indication_rm_create( void OpenAPI_stationary_indication_rm_free(OpenAPI_stationary_indication_rm_t *stationary_indication_rm); OpenAPI_stationary_indication_rm_t *OpenAPI_stationary_indication_rm_parseFromJSON(cJSON *stationary_indication_rmJSON); cJSON *OpenAPI_stationary_indication_rm_convertToJSON(OpenAPI_stationary_indication_rm_t *stationary_indication_rm); +OpenAPI_stationary_indication_rm_t *OpenAPI_stationary_indication_rm_copy(OpenAPI_stationary_indication_rm_t *dst, OpenAPI_stationary_indication_rm_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/status_change.c b/lib/sbi/openapi/model/status_change.c new file mode 100644 index 000000000..82c6e4478 --- /dev/null +++ b/lib/sbi/openapi/model/status_change.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "status_change.h" + +char* OpenAPI_status_change_ToString(OpenAPI_status_change_e status_change) +{ + const char *status_changeArray[] = { "NULL", "AMF_UNAVAILABLE", "AMF_AVAILABLE" }; + size_t sizeofArray = sizeof(status_changeArray) / sizeof(status_changeArray[0]); + if (status_change < sizeofArray) + return (char *)status_changeArray[status_change]; + else + return (char *)"Unknown"; +} + +OpenAPI_status_change_e OpenAPI_status_change_FromString(char* status_change) +{ + int stringToReturn = 0; + const char *status_changeArray[] = { "NULL", "AMF_UNAVAILABLE", "AMF_AVAILABLE" }; + size_t sizeofArray = sizeof(status_changeArray) / sizeof(status_changeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(status_change, status_changeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/status_change.h b/lib/sbi/openapi/model/status_change.h new file mode 100644 index 000000000..dfd646434 --- /dev/null +++ b/lib/sbi/openapi/model/status_change.h @@ -0,0 +1,31 @@ +/* + * status_change.h + * + * + */ + +#ifndef _OpenAPI_status_change_H_ +#define _OpenAPI_status_change_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_status_change_NULL = 0, OpenAPI_status_change_AMF_UNAVAILABLE, OpenAPI_status_change_AMF_AVAILABLE } OpenAPI_status_change_e; + +char* OpenAPI_status_change_ToString(OpenAPI_status_change_e status_change); + +OpenAPI_status_change_e OpenAPI_status_change_FromString(char* status_change); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_status_change_H_ */ + diff --git a/lib/sbi/openapi/model/status_info.c b/lib/sbi/openapi/model/status_info.c new file mode 100644 index 000000000..ccf9594cf --- /dev/null +++ b/lib/sbi/openapi/model/status_info.c @@ -0,0 +1,183 @@ + +#include +#include +#include +#include "status_info.h" + +OpenAPI_status_info_t *OpenAPI_status_info_create( + OpenAPI_resource_status_t *resource_status, + OpenAPI_cause_t *cause, + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para, + OpenAPI_access_type_e an_type + ) +{ + OpenAPI_status_info_t *status_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_status_info_t)); + if (!status_info_local_var) { + return NULL; + } + status_info_local_var->resource_status = resource_status; + status_info_local_var->cause = cause; + status_info_local_var->cn_assisted_ran_para = cn_assisted_ran_para; + status_info_local_var->an_type = an_type; + + return status_info_local_var; +} + +void OpenAPI_status_info_free(OpenAPI_status_info_t *status_info) +{ + if (NULL == status_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_resource_status_free(status_info->resource_status); + OpenAPI_cause_free(status_info->cause); + OpenAPI_cn_assisted_ran_para_free(status_info->cn_assisted_ran_para); + ogs_free(status_info); +} + +cJSON *OpenAPI_status_info_convertToJSON(OpenAPI_status_info_t *status_info) +{ + cJSON *item = NULL; + + if (status_info == NULL) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [StatusInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!status_info->resource_status) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [resource_status]"); + goto end; + } + cJSON *resource_status_local_JSON = OpenAPI_resource_status_convertToJSON(status_info->resource_status); + if (resource_status_local_JSON == NULL) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [resource_status]"); + goto end; + } + cJSON_AddItemToObject(item, "resourceStatus", resource_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [resource_status]"); + goto end; + } + + if (status_info->cause) { + cJSON *cause_local_JSON = OpenAPI_cause_convertToJSON(status_info->cause); + if (cause_local_JSON == NULL) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [cause]"); + goto end; + } + cJSON_AddItemToObject(item, "cause", cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [cause]"); + goto end; + } + } + + if (status_info->cn_assisted_ran_para) { + cJSON *cn_assisted_ran_para_local_JSON = OpenAPI_cn_assisted_ran_para_convertToJSON(status_info->cn_assisted_ran_para); + if (cn_assisted_ran_para_local_JSON == NULL) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [cn_assisted_ran_para]"); + goto end; + } + cJSON_AddItemToObject(item, "cnAssistedRanPara", cn_assisted_ran_para_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [cn_assisted_ran_para]"); + goto end; + } + } + + if (status_info->an_type) { + if (cJSON_AddStringToObject(item, "anType", OpenAPI_access_type_ToString(status_info->an_type)) == NULL) { + ogs_error("OpenAPI_status_info_convertToJSON() failed [an_type]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_status_info_t *OpenAPI_status_info_parseFromJSON(cJSON *status_infoJSON) +{ + OpenAPI_status_info_t *status_info_local_var = NULL; + cJSON *resource_status = cJSON_GetObjectItemCaseSensitive(status_infoJSON, "resourceStatus"); + if (!resource_status) { + ogs_error("OpenAPI_status_info_parseFromJSON() failed [resource_status]"); + goto end; + } + + OpenAPI_resource_status_t *resource_status_local_nonprim = NULL; + + resource_status_local_nonprim = OpenAPI_resource_status_parseFromJSON(resource_status); + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(status_infoJSON, "cause"); + + OpenAPI_cause_t *cause_local_nonprim = NULL; + if (cause) { + cause_local_nonprim = OpenAPI_cause_parseFromJSON(cause); + } + + cJSON *cn_assisted_ran_para = cJSON_GetObjectItemCaseSensitive(status_infoJSON, "cnAssistedRanPara"); + + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_nonprim = NULL; + if (cn_assisted_ran_para) { + cn_assisted_ran_para_local_nonprim = OpenAPI_cn_assisted_ran_para_parseFromJSON(cn_assisted_ran_para); + } + + cJSON *an_type = cJSON_GetObjectItemCaseSensitive(status_infoJSON, "anType"); + + OpenAPI_access_type_e an_typeVariable; + if (an_type) { + if (!cJSON_IsString(an_type)) { + ogs_error("OpenAPI_status_info_parseFromJSON() failed [an_type]"); + goto end; + } + an_typeVariable = OpenAPI_access_type_FromString(an_type->valuestring); + } + + status_info_local_var = OpenAPI_status_info_create ( + resource_status_local_nonprim, + cause ? cause_local_nonprim : NULL, + cn_assisted_ran_para ? cn_assisted_ran_para_local_nonprim : NULL, + an_type ? an_typeVariable : 0 + ); + + return status_info_local_var; +end: + return NULL; +} + +OpenAPI_status_info_t *OpenAPI_status_info_copy(OpenAPI_status_info_t *dst, OpenAPI_status_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_status_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_status_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_status_info_free(dst); + dst = OpenAPI_status_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/status_info.h b/lib/sbi/openapi/model/status_info.h new file mode 100644 index 000000000..5b42f6c98 --- /dev/null +++ b/lib/sbi/openapi/model/status_info.h @@ -0,0 +1,48 @@ +/* + * status_info.h + * + * + */ + +#ifndef _OpenAPI_status_info_H_ +#define _OpenAPI_status_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "cause.h" +#include "cn_assisted_ran_para.h" +#include "resource_status.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_status_info_s OpenAPI_status_info_t; +typedef struct OpenAPI_status_info_s { + struct OpenAPI_resource_status_s *resource_status; + struct OpenAPI_cause_s *cause; + struct OpenAPI_cn_assisted_ran_para_s *cn_assisted_ran_para; + OpenAPI_access_type_e an_type; +} OpenAPI_status_info_t; + +OpenAPI_status_info_t *OpenAPI_status_info_create( + OpenAPI_resource_status_t *resource_status, + OpenAPI_cause_t *cause, + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para, + OpenAPI_access_type_e an_type + ); +void OpenAPI_status_info_free(OpenAPI_status_info_t *status_info); +OpenAPI_status_info_t *OpenAPI_status_info_parseFromJSON(cJSON *status_infoJSON); +cJSON *OpenAPI_status_info_convertToJSON(OpenAPI_status_info_t *status_info); +OpenAPI_status_info_t *OpenAPI_status_info_copy(OpenAPI_status_info_t *dst, OpenAPI_status_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_status_info_H_ */ + diff --git a/lib/sbi/openapi/model/status_notification.c b/lib/sbi/openapi/model/status_notification.c new file mode 100644 index 000000000..f3282df08 --- /dev/null +++ b/lib/sbi/openapi/model/status_notification.c @@ -0,0 +1,162 @@ + +#include +#include +#include +#include "status_notification.h" + +OpenAPI_status_notification_t *OpenAPI_status_notification_create( + OpenAPI_status_info_t *status_info, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status + ) +{ + OpenAPI_status_notification_t *status_notification_local_var = OpenAPI_malloc(sizeof(OpenAPI_status_notification_t)); + if (!status_notification_local_var) { + return NULL; + } + status_notification_local_var->status_info = status_info; + status_notification_local_var->small_data_rate_status = small_data_rate_status; + status_notification_local_var->apn_rate_status = apn_rate_status; + + return status_notification_local_var; +} + +void OpenAPI_status_notification_free(OpenAPI_status_notification_t *status_notification) +{ + if (NULL == status_notification) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_status_info_free(status_notification->status_info); + OpenAPI_small_data_rate_status_free(status_notification->small_data_rate_status); + OpenAPI_apn_rate_status_free(status_notification->apn_rate_status); + ogs_free(status_notification); +} + +cJSON *OpenAPI_status_notification_convertToJSON(OpenAPI_status_notification_t *status_notification) +{ + cJSON *item = NULL; + + if (status_notification == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [StatusNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!status_notification->status_info) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [status_info]"); + goto end; + } + cJSON *status_info_local_JSON = OpenAPI_status_info_convertToJSON(status_notification->status_info); + if (status_info_local_JSON == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [status_info]"); + goto end; + } + cJSON_AddItemToObject(item, "statusInfo", status_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [status_info]"); + goto end; + } + + if (status_notification->small_data_rate_status) { + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(status_notification->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "smallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + } + + if (status_notification->apn_rate_status) { + cJSON *apn_rate_status_local_JSON = OpenAPI_apn_rate_status_convertToJSON(status_notification->apn_rate_status); + if (apn_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [apn_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "apnRateStatus", apn_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [apn_rate_status]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_status_notification_t *OpenAPI_status_notification_parseFromJSON(cJSON *status_notificationJSON) +{ + OpenAPI_status_notification_t *status_notification_local_var = NULL; + cJSON *status_info = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "statusInfo"); + if (!status_info) { + ogs_error("OpenAPI_status_notification_parseFromJSON() failed [status_info]"); + goto end; + } + + OpenAPI_status_info_t *status_info_local_nonprim = NULL; + + status_info_local_nonprim = OpenAPI_status_info_parseFromJSON(status_info); + + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "smallDataRateStatus"); + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + if (small_data_rate_status) { + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + } + + cJSON *apn_rate_status = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "apnRateStatus"); + + OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; + if (apn_rate_status) { + apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); + } + + status_notification_local_var = OpenAPI_status_notification_create ( + status_info_local_nonprim, + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, + apn_rate_status ? apn_rate_status_local_nonprim : NULL + ); + + return status_notification_local_var; +end: + return NULL; +} + +OpenAPI_status_notification_t *OpenAPI_status_notification_copy(OpenAPI_status_notification_t *dst, OpenAPI_status_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_status_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_status_notification_free(dst); + dst = OpenAPI_status_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/status_notification.h b/lib/sbi/openapi/model/status_notification.h new file mode 100644 index 000000000..c3fcc814a --- /dev/null +++ b/lib/sbi/openapi/model/status_notification.h @@ -0,0 +1,45 @@ +/* + * status_notification.h + * + * + */ + +#ifndef _OpenAPI_status_notification_H_ +#define _OpenAPI_status_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "apn_rate_status.h" +#include "small_data_rate_status.h" +#include "status_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_status_notification_s OpenAPI_status_notification_t; +typedef struct OpenAPI_status_notification_s { + struct OpenAPI_status_info_s *status_info; + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; + struct OpenAPI_apn_rate_status_s *apn_rate_status; +} OpenAPI_status_notification_t; + +OpenAPI_status_notification_t *OpenAPI_status_notification_create( + OpenAPI_status_info_t *status_info, + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_apn_rate_status_t *apn_rate_status + ); +void OpenAPI_status_notification_free(OpenAPI_status_notification_t *status_notification); +OpenAPI_status_notification_t *OpenAPI_status_notification_parseFromJSON(cJSON *status_notificationJSON); +cJSON *OpenAPI_status_notification_convertToJSON(OpenAPI_status_notification_t *status_notification); +OpenAPI_status_notification_t *OpenAPI_status_notification_copy(OpenAPI_status_notification_t *dst, OpenAPI_status_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_status_notification_H_ */ + diff --git a/lib/sbi/openapi/model/steering_container.c b/lib/sbi/openapi/model/steering_container.c index b27a35d1a..9d84913c5 100644 --- a/lib/sbi/openapi/model/steering_container.c +++ b/lib/sbi/openapi/model/steering_container.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_steering_container_t *OpenAPI_steering_container_copy(OpenAPI_steering_container_t *dst, OpenAPI_steering_container_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_steering_container_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_steering_container_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_steering_container_free(dst); + dst = OpenAPI_steering_container_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/steering_container.h b/lib/sbi/openapi/model/steering_container.h index f4e4bbc9f..b32f891af 100644 --- a/lib/sbi/openapi/model/steering_container.h +++ b/lib/sbi/openapi/model/steering_container.h @@ -26,6 +26,7 @@ OpenAPI_steering_container_t *OpenAPI_steering_container_create( void OpenAPI_steering_container_free(OpenAPI_steering_container_t *steering_container); OpenAPI_steering_container_t *OpenAPI_steering_container_parseFromJSON(cJSON *steering_containerJSON); cJSON *OpenAPI_steering_container_convertToJSON(OpenAPI_steering_container_t *steering_container); +OpenAPI_steering_container_t *OpenAPI_steering_container_copy(OpenAPI_steering_container_t *dst, OpenAPI_steering_container_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/steering_info.c b/lib/sbi/openapi/model/steering_info.c index 4b3891d6f..1b47c3460 100644 --- a/lib/sbi/openapi/model/steering_info.c +++ b/lib/sbi/openapi/model/steering_info.c @@ -128,3 +128,37 @@ end: return NULL; } +OpenAPI_steering_info_t *OpenAPI_steering_info_copy(OpenAPI_steering_info_t *dst, OpenAPI_steering_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_steering_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_steering_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_steering_info_free(dst); + dst = OpenAPI_steering_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/steering_info.h b/lib/sbi/openapi/model/steering_info.h index 4c444489f..06d5e99aa 100644 --- a/lib/sbi/openapi/model/steering_info.h +++ b/lib/sbi/openapi/model/steering_info.h @@ -32,6 +32,7 @@ OpenAPI_steering_info_t *OpenAPI_steering_info_create( void OpenAPI_steering_info_free(OpenAPI_steering_info_t *steering_info); OpenAPI_steering_info_t *OpenAPI_steering_info_parseFromJSON(cJSON *steering_infoJSON); cJSON *OpenAPI_steering_info_convertToJSON(OpenAPI_steering_info_t *steering_info); +OpenAPI_steering_info_t *OpenAPI_steering_info_copy(OpenAPI_steering_info_t *dst, OpenAPI_steering_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/stored_search_result.c b/lib/sbi/openapi/model/stored_search_result.c index 44555c475..be01200ff 100644 --- a/lib/sbi/openapi/model/stored_search_result.c +++ b/lib/sbi/openapi/model/stored_search_result.c @@ -104,3 +104,37 @@ end: return NULL; } +OpenAPI_stored_search_result_t *OpenAPI_stored_search_result_copy(OpenAPI_stored_search_result_t *dst, OpenAPI_stored_search_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_stored_search_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_stored_search_result_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_stored_search_result_free(dst); + dst = OpenAPI_stored_search_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/stored_search_result.h b/lib/sbi/openapi/model/stored_search_result.h index fc1c7b11d..9e9589a14 100644 --- a/lib/sbi/openapi/model/stored_search_result.h +++ b/lib/sbi/openapi/model/stored_search_result.h @@ -29,6 +29,7 @@ OpenAPI_stored_search_result_t *OpenAPI_stored_search_result_create( void OpenAPI_stored_search_result_free(OpenAPI_stored_search_result_t *stored_search_result); OpenAPI_stored_search_result_t *OpenAPI_stored_search_result_parseFromJSON(cJSON *stored_search_resultJSON); cJSON *OpenAPI_stored_search_result_convertToJSON(OpenAPI_stored_search_result_t *stored_search_result); +OpenAPI_stored_search_result_t *OpenAPI_stored_search_result_copy(OpenAPI_stored_search_result_t *dst, OpenAPI_stored_search_result_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/subscribed_default_qos.c b/lib/sbi/openapi/model/subscribed_default_qos.c index 6f5434010..6872a62a1 100644 --- a/lib/sbi/openapi/model/subscribed_default_qos.c +++ b/lib/sbi/openapi/model/subscribed_default_qos.c @@ -121,3 +121,37 @@ end: return NULL; } +OpenAPI_subscribed_default_qos_t *OpenAPI_subscribed_default_qos_copy(OpenAPI_subscribed_default_qos_t *dst, OpenAPI_subscribed_default_qos_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_subscribed_default_qos_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_subscribed_default_qos_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_subscribed_default_qos_free(dst); + dst = OpenAPI_subscribed_default_qos_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/subscribed_default_qos.h b/lib/sbi/openapi/model/subscribed_default_qos.h index 76944a4d1..eb6e3580c 100644 --- a/lib/sbi/openapi/model/subscribed_default_qos.h +++ b/lib/sbi/openapi/model/subscribed_default_qos.h @@ -33,6 +33,7 @@ OpenAPI_subscribed_default_qos_t *OpenAPI_subscribed_default_qos_create( void OpenAPI_subscribed_default_qos_free(OpenAPI_subscribed_default_qos_t *subscribed_default_qos); OpenAPI_subscribed_default_qos_t *OpenAPI_subscribed_default_qos_parseFromJSON(cJSON *subscribed_default_qosJSON); cJSON *OpenAPI_subscribed_default_qos_convertToJSON(OpenAPI_subscribed_default_qos_t *subscribed_default_qos); +OpenAPI_subscribed_default_qos_t *OpenAPI_subscribed_default_qos_copy(OpenAPI_subscribed_default_qos_t *dst, OpenAPI_subscribed_default_qos_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/subscribed_event.c b/lib/sbi/openapi/model/subscribed_event.c index 04d4fe772..2cd4f8e21 100644 --- a/lib/sbi/openapi/model/subscribed_event.c +++ b/lib/sbi/openapi/model/subscribed_event.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_subscribed_event_t *OpenAPI_subscribed_event_copy(OpenAPI_subscribed_event_t *dst, OpenAPI_subscribed_event_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_subscribed_event_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_subscribed_event_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_subscribed_event_free(dst); + dst = OpenAPI_subscribed_event_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/subscribed_event.h b/lib/sbi/openapi/model/subscribed_event.h index a36da7cf0..2721546b4 100644 --- a/lib/sbi/openapi/model/subscribed_event.h +++ b/lib/sbi/openapi/model/subscribed_event.h @@ -26,6 +26,7 @@ OpenAPI_subscribed_event_t *OpenAPI_subscribed_event_create( void OpenAPI_subscribed_event_free(OpenAPI_subscribed_event_t *subscribed_event); OpenAPI_subscribed_event_t *OpenAPI_subscribed_event_parseFromJSON(cJSON *subscribed_eventJSON); cJSON *OpenAPI_subscribed_event_convertToJSON(OpenAPI_subscribed_event_t *subscribed_event); +OpenAPI_subscribed_event_t *OpenAPI_subscribed_event_copy(OpenAPI_subscribed_event_t *dst, OpenAPI_subscribed_event_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/subscription_data.c b/lib/sbi/openapi/model/subscription_data.c index 92685bebb..834386414 100644 --- a/lib/sbi/openapi/model/subscription_data.c +++ b/lib/sbi/openapi/model/subscription_data.c @@ -384,3 +384,37 @@ end: return NULL; } +OpenAPI_subscription_data_t *OpenAPI_subscription_data_copy(OpenAPI_subscription_data_t *dst, OpenAPI_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_subscription_data_free(dst); + dst = OpenAPI_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/subscription_data.h b/lib/sbi/openapi/model/subscription_data.h index 6c9181845..6b011c1b3 100644 --- a/lib/sbi/openapi/model/subscription_data.h +++ b/lib/sbi/openapi/model/subscription_data.h @@ -55,6 +55,7 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_data); OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subscription_dataJSON); cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subscription_data); +OpenAPI_subscription_data_t *OpenAPI_subscription_data_copy(OpenAPI_subscription_data_t *dst, OpenAPI_subscription_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/subscription_data_sets.c b/lib/sbi/openapi/model/subscription_data_sets.c index 3ffeb7f2e..d794b49b6 100644 --- a/lib/sbi/openapi/model/subscription_data_sets.c +++ b/lib/sbi/openapi/model/subscription_data_sets.c @@ -315,3 +315,37 @@ end: return NULL; } +OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_copy(OpenAPI_subscription_data_sets_t *dst, OpenAPI_subscription_data_sets_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_subscription_data_sets_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_subscription_data_sets_free(dst); + dst = OpenAPI_subscription_data_sets_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/subscription_data_sets.h b/lib/sbi/openapi/model/subscription_data_sets.h index 3d2cca04a..82df1d1d9 100644 --- a/lib/sbi/openapi/model/subscription_data_sets.h +++ b/lib/sbi/openapi/model/subscription_data_sets.h @@ -56,6 +56,7 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( void OpenAPI_subscription_data_sets_free(OpenAPI_subscription_data_sets_t *subscription_data_sets); OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(cJSON *subscription_data_setsJSON); cJSON *OpenAPI_subscription_data_sets_convertToJSON(OpenAPI_subscription_data_sets_t *subscription_data_sets); +OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_copy(OpenAPI_subscription_data_sets_t *dst, OpenAPI_subscription_data_sets_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/subscription_data_subscriptions.c b/lib/sbi/openapi/model/subscription_data_subscriptions.c index 55670622b..7928ff38a 100644 --- a/lib/sbi/openapi/model/subscription_data_subscriptions.c +++ b/lib/sbi/openapi/model/subscription_data_subscriptions.c @@ -246,3 +246,37 @@ end: return NULL; } +OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptions_copy(OpenAPI_subscription_data_subscriptions_t *dst, OpenAPI_subscription_data_subscriptions_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_subscription_data_subscriptions_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_subscription_data_subscriptions_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_subscription_data_subscriptions_free(dst); + dst = OpenAPI_subscription_data_subscriptions_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/subscription_data_subscriptions.h b/lib/sbi/openapi/model/subscription_data_subscriptions.h index 3bbf84969..1aedf5b28 100644 --- a/lib/sbi/openapi/model/subscription_data_subscriptions.h +++ b/lib/sbi/openapi/model/subscription_data_subscriptions.h @@ -43,6 +43,7 @@ OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptio void OpenAPI_subscription_data_subscriptions_free(OpenAPI_subscription_data_subscriptions_t *subscription_data_subscriptions); OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptions_parseFromJSON(cJSON *subscription_data_subscriptionsJSON); cJSON *OpenAPI_subscription_data_subscriptions_convertToJSON(OpenAPI_subscription_data_subscriptions_t *subscription_data_subscriptions); +OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptions_copy(OpenAPI_subscription_data_subscriptions_t *dst, OpenAPI_subscription_data_subscriptions_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/suggested_packet_num_dl.c b/lib/sbi/openapi/model/suggested_packet_num_dl.c index 32f0190ff..9f696a73f 100644 --- a/lib/sbi/openapi/model/suggested_packet_num_dl.c +++ b/lib/sbi/openapi/model/suggested_packet_num_dl.c @@ -93,3 +93,37 @@ end: return NULL; } +OpenAPI_suggested_packet_num_dl_t *OpenAPI_suggested_packet_num_dl_copy(OpenAPI_suggested_packet_num_dl_t *dst, OpenAPI_suggested_packet_num_dl_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_suggested_packet_num_dl_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_suggested_packet_num_dl_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_suggested_packet_num_dl_free(dst); + dst = OpenAPI_suggested_packet_num_dl_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/suggested_packet_num_dl.h b/lib/sbi/openapi/model/suggested_packet_num_dl.h index 9134fbdec..9f8e3199e 100644 --- a/lib/sbi/openapi/model/suggested_packet_num_dl.h +++ b/lib/sbi/openapi/model/suggested_packet_num_dl.h @@ -30,6 +30,7 @@ OpenAPI_suggested_packet_num_dl_t *OpenAPI_suggested_packet_num_dl_create( void OpenAPI_suggested_packet_num_dl_free(OpenAPI_suggested_packet_num_dl_t *suggested_packet_num_dl); OpenAPI_suggested_packet_num_dl_t *OpenAPI_suggested_packet_num_dl_parseFromJSON(cJSON *suggested_packet_num_dlJSON); cJSON *OpenAPI_suggested_packet_num_dl_convertToJSON(OpenAPI_suggested_packet_num_dl_t *suggested_packet_num_dl); +OpenAPI_suggested_packet_num_dl_t *OpenAPI_suggested_packet_num_dl_copy(OpenAPI_suggested_packet_num_dl_t *dst, OpenAPI_suggested_packet_num_dl_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/supi_range.c b/lib/sbi/openapi/model/supi_range.c index e6594ee9a..adff33704 100644 --- a/lib/sbi/openapi/model/supi_range.c +++ b/lib/sbi/openapi/model/supi_range.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_supi_range_t *OpenAPI_supi_range_copy(OpenAPI_supi_range_t *dst, OpenAPI_supi_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_supi_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_supi_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_supi_range_free(dst); + dst = OpenAPI_supi_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/supi_range.h b/lib/sbi/openapi/model/supi_range.h index e49b894bf..927dca4a0 100644 --- a/lib/sbi/openapi/model/supi_range.h +++ b/lib/sbi/openapi/model/supi_range.h @@ -32,6 +32,7 @@ OpenAPI_supi_range_t *OpenAPI_supi_range_create( void OpenAPI_supi_range_free(OpenAPI_supi_range_t *supi_range); OpenAPI_supi_range_t *OpenAPI_supi_range_parseFromJSON(cJSON *supi_rangeJSON); cJSON *OpenAPI_supi_range_convertToJSON(OpenAPI_supi_range_t *supi_range); +OpenAPI_supi_range_t *OpenAPI_supi_range_copy(OpenAPI_supi_range_t *dst, OpenAPI_supi_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/supported_gad_shapes.c b/lib/sbi/openapi/model/supported_gad_shapes.c index dd1f23911..e2b151ac1 100644 --- a/lib/sbi/openapi/model/supported_gad_shapes.c +++ b/lib/sbi/openapi/model/supported_gad_shapes.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_supported_gad_shapes_t *OpenAPI_supported_gad_shapes_copy(OpenAPI_supported_gad_shapes_t *dst, OpenAPI_supported_gad_shapes_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_supported_gad_shapes_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_supported_gad_shapes_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_supported_gad_shapes_free(dst); + dst = OpenAPI_supported_gad_shapes_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/supported_gad_shapes.h b/lib/sbi/openapi/model/supported_gad_shapes.h index 848b64559..fdbc5dace 100644 --- a/lib/sbi/openapi/model/supported_gad_shapes.h +++ b/lib/sbi/openapi/model/supported_gad_shapes.h @@ -26,6 +26,7 @@ OpenAPI_supported_gad_shapes_t *OpenAPI_supported_gad_shapes_create( void OpenAPI_supported_gad_shapes_free(OpenAPI_supported_gad_shapes_t *supported_gad_shapes); OpenAPI_supported_gad_shapes_t *OpenAPI_supported_gad_shapes_parseFromJSON(cJSON *supported_gad_shapesJSON); cJSON *OpenAPI_supported_gad_shapes_convertToJSON(OpenAPI_supported_gad_shapes_t *supported_gad_shapes); +OpenAPI_supported_gad_shapes_t *OpenAPI_supported_gad_shapes_copy(OpenAPI_supported_gad_shapes_t *dst, OpenAPI_supported_gad_shapes_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/tac_range.c b/lib/sbi/openapi/model/tac_range.c index e83017c52..c4a07d15c 100644 --- a/lib/sbi/openapi/model/tac_range.c +++ b/lib/sbi/openapi/model/tac_range.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_tac_range_t *OpenAPI_tac_range_copy(OpenAPI_tac_range_t *dst, OpenAPI_tac_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tac_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tac_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_tac_range_free(dst); + dst = OpenAPI_tac_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tac_range.h b/lib/sbi/openapi/model/tac_range.h index 993f6cea4..481477e12 100644 --- a/lib/sbi/openapi/model/tac_range.h +++ b/lib/sbi/openapi/model/tac_range.h @@ -32,6 +32,7 @@ OpenAPI_tac_range_t *OpenAPI_tac_range_create( void OpenAPI_tac_range_free(OpenAPI_tac_range_t *tac_range); OpenAPI_tac_range_t *OpenAPI_tac_range_parseFromJSON(cJSON *tac_rangeJSON); cJSON *OpenAPI_tac_range_convertToJSON(OpenAPI_tac_range_t *tac_range); +OpenAPI_tac_range_t *OpenAPI_tac_range_copy(OpenAPI_tac_range_t *dst, OpenAPI_tac_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/tai.c b/lib/sbi/openapi/model/tai.c index 672545e13..803241442 100644 --- a/lib/sbi/openapi/model/tai.c +++ b/lib/sbi/openapi/model/tai.c @@ -123,3 +123,37 @@ end: return NULL; } +OpenAPI_tai_t *OpenAPI_tai_copy(OpenAPI_tai_t *dst, OpenAPI_tai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tai_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_tai_free(dst); + dst = OpenAPI_tai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tai.h b/lib/sbi/openapi/model/tai.h index 8e39c6bcd..9ddbb0c26 100644 --- a/lib/sbi/openapi/model/tai.h +++ b/lib/sbi/openapi/model/tai.h @@ -33,6 +33,7 @@ OpenAPI_tai_t *OpenAPI_tai_create( void OpenAPI_tai_free(OpenAPI_tai_t *tai); OpenAPI_tai_t *OpenAPI_tai_parseFromJSON(cJSON *taiJSON); cJSON *OpenAPI_tai_convertToJSON(OpenAPI_tai_t *tai); +OpenAPI_tai_t *OpenAPI_tai_copy(OpenAPI_tai_t *dst, OpenAPI_tai_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/tai_range.c b/lib/sbi/openapi/model/tai_range.c index 75cc6df54..1cecc1db2 100644 --- a/lib/sbi/openapi/model/tai_range.c +++ b/lib/sbi/openapi/model/tai_range.c @@ -153,3 +153,37 @@ end: return NULL; } +OpenAPI_tai_range_t *OpenAPI_tai_range_copy(OpenAPI_tai_range_t *dst, OpenAPI_tai_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tai_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tai_range_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_tai_range_free(dst); + dst = OpenAPI_tai_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tai_range.h b/lib/sbi/openapi/model/tai_range.h index dc9dc4aea..d184f630a 100644 --- a/lib/sbi/openapi/model/tai_range.h +++ b/lib/sbi/openapi/model/tai_range.h @@ -34,6 +34,7 @@ OpenAPI_tai_range_t *OpenAPI_tai_range_create( void OpenAPI_tai_range_free(OpenAPI_tai_range_t *tai_range); OpenAPI_tai_range_t *OpenAPI_tai_range_parseFromJSON(cJSON *tai_rangeJSON); cJSON *OpenAPI_tai_range_convertToJSON(OpenAPI_tai_range_t *tai_range); +OpenAPI_tai_range_t *OpenAPI_tai_range_copy(OpenAPI_tai_range_t *dst, OpenAPI_tai_range_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/temporal_validity.c b/lib/sbi/openapi/model/temporal_validity.c index 4013da1e6..5b0e8abdf 100644 --- a/lib/sbi/openapi/model/temporal_validity.c +++ b/lib/sbi/openapi/model/temporal_validity.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_temporal_validity_t *OpenAPI_temporal_validity_copy(OpenAPI_temporal_validity_t *dst, OpenAPI_temporal_validity_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_temporal_validity_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_temporal_validity_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_temporal_validity_free(dst); + dst = OpenAPI_temporal_validity_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/temporal_validity.h b/lib/sbi/openapi/model/temporal_validity.h index 3132788ae..6bc3f718e 100644 --- a/lib/sbi/openapi/model/temporal_validity.h +++ b/lib/sbi/openapi/model/temporal_validity.h @@ -30,6 +30,7 @@ OpenAPI_temporal_validity_t *OpenAPI_temporal_validity_create( void OpenAPI_temporal_validity_free(OpenAPI_temporal_validity_t *temporal_validity); OpenAPI_temporal_validity_t *OpenAPI_temporal_validity_parseFromJSON(cJSON *temporal_validityJSON); cJSON *OpenAPI_temporal_validity_convertToJSON(OpenAPI_temporal_validity_t *temporal_validity); +OpenAPI_temporal_validity_t *OpenAPI_temporal_validity_copy(OpenAPI_temporal_validity_t *dst, OpenAPI_temporal_validity_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/time_period.c b/lib/sbi/openapi/model/time_period.c index 6d9ada6a6..415dd56e3 100644 --- a/lib/sbi/openapi/model/time_period.c +++ b/lib/sbi/openapi/model/time_period.c @@ -97,3 +97,37 @@ end: return NULL; } +OpenAPI_time_period_t *OpenAPI_time_period_copy(OpenAPI_time_period_t *dst, OpenAPI_time_period_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_time_period_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_time_period_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_time_period_free(dst); + dst = OpenAPI_time_period_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/time_period.h b/lib/sbi/openapi/model/time_period.h index 590d9eddf..5f2189692 100644 --- a/lib/sbi/openapi/model/time_period.h +++ b/lib/sbi/openapi/model/time_period.h @@ -31,6 +31,7 @@ OpenAPI_time_period_t *OpenAPI_time_period_create( void OpenAPI_time_period_free(OpenAPI_time_period_t *time_period); OpenAPI_time_period_t *OpenAPI_time_period_parseFromJSON(cJSON *time_periodJSON); cJSON *OpenAPI_time_period_convertToJSON(OpenAPI_time_period_t *time_period); +OpenAPI_time_period_t *OpenAPI_time_period_copy(OpenAPI_time_period_t *dst, OpenAPI_time_period_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/time_window.c b/lib/sbi/openapi/model/time_window.c index ca975b71f..a6fe3f0c4 100644 --- a/lib/sbi/openapi/model/time_window.c +++ b/lib/sbi/openapi/model/time_window.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_time_window_t *OpenAPI_time_window_copy(OpenAPI_time_window_t *dst, OpenAPI_time_window_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_time_window_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_time_window_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_time_window_free(dst); + dst = OpenAPI_time_window_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/time_window.h b/lib/sbi/openapi/model/time_window.h index f71f32e2c..1a2ebd84f 100644 --- a/lib/sbi/openapi/model/time_window.h +++ b/lib/sbi/openapi/model/time_window.h @@ -30,6 +30,7 @@ OpenAPI_time_window_t *OpenAPI_time_window_create( void OpenAPI_time_window_free(OpenAPI_time_window_t *time_window); OpenAPI_time_window_t *OpenAPI_time_window_parseFromJSON(cJSON *time_windowJSON); cJSON *OpenAPI_time_window_convertToJSON(OpenAPI_time_window_t *time_window); +OpenAPI_time_window_t *OpenAPI_time_window_copy(OpenAPI_time_window_t *dst, OpenAPI_time_window_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/tmbr.c b/lib/sbi/openapi/model/tmbr.c index 7a235bc09..d17414060 100644 --- a/lib/sbi/openapi/model/tmbr.c +++ b/lib/sbi/openapi/model/tmbr.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_tmbr_t *OpenAPI_tmbr_copy(OpenAPI_tmbr_t *dst, OpenAPI_tmbr_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tmbr_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tmbr_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_tmbr_free(dst); + dst = OpenAPI_tmbr_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tmbr.h b/lib/sbi/openapi/model/tmbr.h index 8e272502f..65bc1b901 100644 --- a/lib/sbi/openapi/model/tmbr.h +++ b/lib/sbi/openapi/model/tmbr.h @@ -30,6 +30,7 @@ OpenAPI_tmbr_t *OpenAPI_tmbr_create( void OpenAPI_tmbr_free(OpenAPI_tmbr_t *tmbr); OpenAPI_tmbr_t *OpenAPI_tmbr_parseFromJSON(cJSON *tmbrJSON); cJSON *OpenAPI_tmbr_convertToJSON(OpenAPI_tmbr_t *tmbr); +OpenAPI_tmbr_t *OpenAPI_tmbr_copy(OpenAPI_tmbr_t *dst, OpenAPI_tmbr_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/tngf_info.c b/lib/sbi/openapi/model/tngf_info.c index b4f95c75d..beedd18c3 100644 --- a/lib/sbi/openapi/model/tngf_info.c +++ b/lib/sbi/openapi/model/tngf_info.c @@ -155,3 +155,37 @@ end: return NULL; } +OpenAPI_tngf_info_t *OpenAPI_tngf_info_copy(OpenAPI_tngf_info_t *dst, OpenAPI_tngf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tngf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tngf_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_tngf_info_free(dst); + dst = OpenAPI_tngf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tngf_info.h b/lib/sbi/openapi/model/tngf_info.h index 080201a44..f4b0490d4 100644 --- a/lib/sbi/openapi/model/tngf_info.h +++ b/lib/sbi/openapi/model/tngf_info.h @@ -32,6 +32,7 @@ OpenAPI_tngf_info_t *OpenAPI_tngf_info_create( void OpenAPI_tngf_info_free(OpenAPI_tngf_info_t *tngf_info); OpenAPI_tngf_info_t *OpenAPI_tngf_info_parseFromJSON(cJSON *tngf_infoJSON); cJSON *OpenAPI_tngf_info_convertToJSON(OpenAPI_tngf_info_t *tngf_info); +OpenAPI_tngf_info_t *OpenAPI_tngf_info_copy(OpenAPI_tngf_info_t *dst, OpenAPI_tngf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/trace_data.c b/lib/sbi/openapi/model/trace_data.c index dbdd1a6f7..bce0f908c 100644 --- a/lib/sbi/openapi/model/trace_data.c +++ b/lib/sbi/openapi/model/trace_data.c @@ -213,3 +213,37 @@ end: return NULL; } +OpenAPI_trace_data_t *OpenAPI_trace_data_copy(OpenAPI_trace_data_t *dst, OpenAPI_trace_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_trace_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_trace_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_trace_data_free(dst); + dst = OpenAPI_trace_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/trace_data.h b/lib/sbi/openapi/model/trace_data.h index caab89297..c9d1c35d0 100644 --- a/lib/sbi/openapi/model/trace_data.h +++ b/lib/sbi/openapi/model/trace_data.h @@ -41,6 +41,7 @@ OpenAPI_trace_data_t *OpenAPI_trace_data_create( void OpenAPI_trace_data_free(OpenAPI_trace_data_t *trace_data); OpenAPI_trace_data_t *OpenAPI_trace_data_parseFromJSON(cJSON *trace_dataJSON); cJSON *OpenAPI_trace_data_convertToJSON(OpenAPI_trace_data_t *trace_data); +OpenAPI_trace_data_t *OpenAPI_trace_data_copy(OpenAPI_trace_data_t *dst, OpenAPI_trace_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/trace_data_response.c b/lib/sbi/openapi/model/trace_data_response.c index 57430336d..02493e251 100644 --- a/lib/sbi/openapi/model/trace_data_response.c +++ b/lib/sbi/openapi/model/trace_data_response.c @@ -93,3 +93,37 @@ end: return NULL; } +OpenAPI_trace_data_response_t *OpenAPI_trace_data_response_copy(OpenAPI_trace_data_response_t *dst, OpenAPI_trace_data_response_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_trace_data_response_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_trace_data_response_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_trace_data_response_free(dst); + dst = OpenAPI_trace_data_response_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/trace_data_response.h b/lib/sbi/openapi/model/trace_data_response.h index c53b8918e..d1f086398 100644 --- a/lib/sbi/openapi/model/trace_data_response.h +++ b/lib/sbi/openapi/model/trace_data_response.h @@ -31,6 +31,7 @@ OpenAPI_trace_data_response_t *OpenAPI_trace_data_response_create( void OpenAPI_trace_data_response_free(OpenAPI_trace_data_response_t *trace_data_response); OpenAPI_trace_data_response_t *OpenAPI_trace_data_response_parseFromJSON(cJSON *trace_data_responseJSON); cJSON *OpenAPI_trace_data_response_convertToJSON(OpenAPI_trace_data_response_t *trace_data_response); +OpenAPI_trace_data_response_t *OpenAPI_trace_data_response_copy(OpenAPI_trace_data_response_t *dst, OpenAPI_trace_data_response_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/trace_depth.c b/lib/sbi/openapi/model/trace_depth.c index d9eaaf842..e0d78de12 100644 --- a/lib/sbi/openapi/model/trace_depth.c +++ b/lib/sbi/openapi/model/trace_depth.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_trace_depth_t *OpenAPI_trace_depth_copy(OpenAPI_trace_depth_t *dst, OpenAPI_trace_depth_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_trace_depth_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_trace_depth_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_trace_depth_free(dst); + dst = OpenAPI_trace_depth_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/trace_depth.h b/lib/sbi/openapi/model/trace_depth.h index f35bf5d29..23d5c687f 100644 --- a/lib/sbi/openapi/model/trace_depth.h +++ b/lib/sbi/openapi/model/trace_depth.h @@ -26,6 +26,7 @@ OpenAPI_trace_depth_t *OpenAPI_trace_depth_create( void OpenAPI_trace_depth_free(OpenAPI_trace_depth_t *trace_depth); OpenAPI_trace_depth_t *OpenAPI_trace_depth_parseFromJSON(cJSON *trace_depthJSON); cJSON *OpenAPI_trace_depth_convertToJSON(OpenAPI_trace_depth_t *trace_depth); +OpenAPI_trace_depth_t *OpenAPI_trace_depth_copy(OpenAPI_trace_depth_t *dst, OpenAPI_trace_depth_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/traffic_descriptor.c b/lib/sbi/openapi/model/traffic_descriptor.c new file mode 100644 index 000000000..df338f448 --- /dev/null +++ b/lib/sbi/openapi/model/traffic_descriptor.c @@ -0,0 +1,179 @@ + +#include +#include +#include +#include "traffic_descriptor.h" + +OpenAPI_traffic_descriptor_t *OpenAPI_traffic_descriptor_create( + char *dnn, + OpenAPI_snssai_t *s_nssai, + OpenAPI_list_t *ddd_traffic_descriptor_list + ) +{ + OpenAPI_traffic_descriptor_t *traffic_descriptor_local_var = OpenAPI_malloc(sizeof(OpenAPI_traffic_descriptor_t)); + if (!traffic_descriptor_local_var) { + return NULL; + } + traffic_descriptor_local_var->dnn = dnn; + traffic_descriptor_local_var->s_nssai = s_nssai; + traffic_descriptor_local_var->ddd_traffic_descriptor_list = ddd_traffic_descriptor_list; + + return traffic_descriptor_local_var; +} + +void OpenAPI_traffic_descriptor_free(OpenAPI_traffic_descriptor_t *traffic_descriptor) +{ + if (NULL == traffic_descriptor) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(traffic_descriptor->dnn); + OpenAPI_snssai_free(traffic_descriptor->s_nssai); + OpenAPI_list_for_each(traffic_descriptor->ddd_traffic_descriptor_list, node) { + OpenAPI_ddd_traffic_descriptor_free(node->data); + } + OpenAPI_list_free(traffic_descriptor->ddd_traffic_descriptor_list); + ogs_free(traffic_descriptor); +} + +cJSON *OpenAPI_traffic_descriptor_convertToJSON(OpenAPI_traffic_descriptor_t *traffic_descriptor) +{ + cJSON *item = NULL; + + if (traffic_descriptor == NULL) { + ogs_error("OpenAPI_traffic_descriptor_convertToJSON() failed [TrafficDescriptor]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (traffic_descriptor->dnn) { + if (cJSON_AddStringToObject(item, "dnn", traffic_descriptor->dnn) == NULL) { + ogs_error("OpenAPI_traffic_descriptor_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (traffic_descriptor->s_nssai) { + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(traffic_descriptor->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_traffic_descriptor_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_traffic_descriptor_convertToJSON() failed [s_nssai]"); + goto end; + } + } + + if (traffic_descriptor->ddd_traffic_descriptor_list) { + cJSON *ddd_traffic_descriptor_listList = cJSON_AddArrayToObject(item, "dddTrafficDescriptorList"); + if (ddd_traffic_descriptor_listList == NULL) { + ogs_error("OpenAPI_traffic_descriptor_convertToJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + + OpenAPI_lnode_t *ddd_traffic_descriptor_list_node; + if (traffic_descriptor->ddd_traffic_descriptor_list) { + OpenAPI_list_for_each(traffic_descriptor->ddd_traffic_descriptor_list, ddd_traffic_descriptor_list_node) { + cJSON *itemLocal = OpenAPI_ddd_traffic_descriptor_convertToJSON(ddd_traffic_descriptor_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_traffic_descriptor_convertToJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + cJSON_AddItemToArray(ddd_traffic_descriptor_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_traffic_descriptor_t *OpenAPI_traffic_descriptor_parseFromJSON(cJSON *traffic_descriptorJSON) +{ + OpenAPI_traffic_descriptor_t *traffic_descriptor_local_var = NULL; + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(traffic_descriptorJSON, "dnn"); + + if (dnn) { + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_traffic_descriptor_parseFromJSON() failed [dnn]"); + goto end; + } + } + + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(traffic_descriptorJSON, "sNssai"); + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + if (s_nssai) { + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + } + + cJSON *ddd_traffic_descriptor_list = cJSON_GetObjectItemCaseSensitive(traffic_descriptorJSON, "dddTrafficDescriptorList"); + + OpenAPI_list_t *ddd_traffic_descriptor_listList; + if (ddd_traffic_descriptor_list) { + cJSON *ddd_traffic_descriptor_list_local_nonprimitive; + if (!cJSON_IsArray(ddd_traffic_descriptor_list)) { + ogs_error("OpenAPI_traffic_descriptor_parseFromJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + + ddd_traffic_descriptor_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ddd_traffic_descriptor_list_local_nonprimitive, ddd_traffic_descriptor_list ) { + if (!cJSON_IsObject(ddd_traffic_descriptor_list_local_nonprimitive)) { + ogs_error("OpenAPI_traffic_descriptor_parseFromJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + OpenAPI_ddd_traffic_descriptor_t *ddd_traffic_descriptor_listItem = OpenAPI_ddd_traffic_descriptor_parseFromJSON(ddd_traffic_descriptor_list_local_nonprimitive); + + OpenAPI_list_add(ddd_traffic_descriptor_listList, ddd_traffic_descriptor_listItem); + } + } + + traffic_descriptor_local_var = OpenAPI_traffic_descriptor_create ( + dnn ? ogs_strdup(dnn->valuestring) : NULL, + s_nssai ? s_nssai_local_nonprim : NULL, + ddd_traffic_descriptor_list ? ddd_traffic_descriptor_listList : NULL + ); + + return traffic_descriptor_local_var; +end: + return NULL; +} + +OpenAPI_traffic_descriptor_t *OpenAPI_traffic_descriptor_copy(OpenAPI_traffic_descriptor_t *dst, OpenAPI_traffic_descriptor_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_descriptor_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_descriptor_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_traffic_descriptor_free(dst); + dst = OpenAPI_traffic_descriptor_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_descriptor.h b/lib/sbi/openapi/model/traffic_descriptor.h new file mode 100644 index 000000000..7f6c2a09e --- /dev/null +++ b/lib/sbi/openapi/model/traffic_descriptor.h @@ -0,0 +1,44 @@ +/* + * traffic_descriptor.h + * + * + */ + +#ifndef _OpenAPI_traffic_descriptor_H_ +#define _OpenAPI_traffic_descriptor_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ddd_traffic_descriptor.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_traffic_descriptor_s OpenAPI_traffic_descriptor_t; +typedef struct OpenAPI_traffic_descriptor_s { + char *dnn; + struct OpenAPI_snssai_s *s_nssai; + OpenAPI_list_t *ddd_traffic_descriptor_list; +} OpenAPI_traffic_descriptor_t; + +OpenAPI_traffic_descriptor_t *OpenAPI_traffic_descriptor_create( + char *dnn, + OpenAPI_snssai_t *s_nssai, + OpenAPI_list_t *ddd_traffic_descriptor_list + ); +void OpenAPI_traffic_descriptor_free(OpenAPI_traffic_descriptor_t *traffic_descriptor); +OpenAPI_traffic_descriptor_t *OpenAPI_traffic_descriptor_parseFromJSON(cJSON *traffic_descriptorJSON); +cJSON *OpenAPI_traffic_descriptor_convertToJSON(OpenAPI_traffic_descriptor_t *traffic_descriptor); +OpenAPI_traffic_descriptor_t *OpenAPI_traffic_descriptor_copy(OpenAPI_traffic_descriptor_t *dst, OpenAPI_traffic_descriptor_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_traffic_descriptor_H_ */ + diff --git a/lib/sbi/openapi/model/traffic_influ_data.c b/lib/sbi/openapi/model/traffic_influ_data.c index 53f602688..22cce92cb 100644 --- a/lib/sbi/openapi/model/traffic_influ_data.c +++ b/lib/sbi/openapi/model/traffic_influ_data.c @@ -115,7 +115,7 @@ cJSON *OpenAPI_traffic_influ_data_convertToJSON(OpenAPI_traffic_influ_data_t *tr } } - if (traffic_influ_data->app_relo_ind >= 0) { + if (traffic_influ_data->app_relo_ind) { if (cJSON_AddBoolToObject(item, "appReloInd", traffic_influ_data->app_relo_ind) == NULL) { ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [app_relo_ind]"); goto end; @@ -223,7 +223,7 @@ cJSON *OpenAPI_traffic_influ_data_convertToJSON(OpenAPI_traffic_influ_data_t *tr } } - if (traffic_influ_data->traff_corre_ind >= 0) { + if (traffic_influ_data->traff_corre_ind) { if (cJSON_AddBoolToObject(item, "traffCorreInd", traffic_influ_data->traff_corre_ind) == NULL) { ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [traff_corre_ind]"); goto end; @@ -317,14 +317,14 @@ cJSON *OpenAPI_traffic_influ_data_convertToJSON(OpenAPI_traffic_influ_data_t *tr } } - if (traffic_influ_data->af_ack_ind >= 0) { + if (traffic_influ_data->af_ack_ind) { if (cJSON_AddBoolToObject(item, "afAckInd", traffic_influ_data->af_ack_ind) == NULL) { ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [af_ack_ind]"); goto end; } } - if (traffic_influ_data->addr_preser_ind >= 0) { + if (traffic_influ_data->addr_preser_ind) { if (cJSON_AddBoolToObject(item, "addrPreserInd", traffic_influ_data->addr_preser_ind) == NULL) { ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [addr_preser_ind]"); goto end; @@ -627,3 +627,37 @@ end: return NULL; } +OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_copy(OpenAPI_traffic_influ_data_t *dst, OpenAPI_traffic_influ_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_influ_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_traffic_influ_data_free(dst); + dst = OpenAPI_traffic_influ_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_influ_data.h b/lib/sbi/openapi/model/traffic_influ_data.h index e14e5e1ee..4cc7d0d46 100644 --- a/lib/sbi/openapi/model/traffic_influ_data.h +++ b/lib/sbi/openapi/model/traffic_influ_data.h @@ -76,6 +76,7 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_create( void OpenAPI_traffic_influ_data_free(OpenAPI_traffic_influ_data_t *traffic_influ_data); OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_parseFromJSON(cJSON *traffic_influ_dataJSON); cJSON *OpenAPI_traffic_influ_data_convertToJSON(OpenAPI_traffic_influ_data_t *traffic_influ_data); +OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_copy(OpenAPI_traffic_influ_data_t *dst, OpenAPI_traffic_influ_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/traffic_influ_data_notif.c b/lib/sbi/openapi/model/traffic_influ_data_notif.c index 4a5d53ee2..4aedde6ce 100644 --- a/lib/sbi/openapi/model/traffic_influ_data_notif.c +++ b/lib/sbi/openapi/model/traffic_influ_data_notif.c @@ -93,3 +93,37 @@ end: return NULL; } +OpenAPI_traffic_influ_data_notif_t *OpenAPI_traffic_influ_data_notif_copy(OpenAPI_traffic_influ_data_notif_t *dst, OpenAPI_traffic_influ_data_notif_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_influ_data_notif_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_influ_data_notif_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_traffic_influ_data_notif_free(dst); + dst = OpenAPI_traffic_influ_data_notif_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_influ_data_notif.h b/lib/sbi/openapi/model/traffic_influ_data_notif.h index e00fd8e7c..ba810b5b9 100644 --- a/lib/sbi/openapi/model/traffic_influ_data_notif.h +++ b/lib/sbi/openapi/model/traffic_influ_data_notif.h @@ -31,6 +31,7 @@ OpenAPI_traffic_influ_data_notif_t *OpenAPI_traffic_influ_data_notif_create( void OpenAPI_traffic_influ_data_notif_free(OpenAPI_traffic_influ_data_notif_t *traffic_influ_data_notif); OpenAPI_traffic_influ_data_notif_t *OpenAPI_traffic_influ_data_notif_parseFromJSON(cJSON *traffic_influ_data_notifJSON); cJSON *OpenAPI_traffic_influ_data_notif_convertToJSON(OpenAPI_traffic_influ_data_notif_t *traffic_influ_data_notif); +OpenAPI_traffic_influ_data_notif_t *OpenAPI_traffic_influ_data_notif_copy(OpenAPI_traffic_influ_data_notif_t *dst, OpenAPI_traffic_influ_data_notif_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/traffic_influ_data_patch.c b/lib/sbi/openapi/model/traffic_influ_data_patch.c index 2be3398d0..2a335b5df 100644 --- a/lib/sbi/openapi/model/traffic_influ_data_patch.c +++ b/lib/sbi/openapi/model/traffic_influ_data_patch.c @@ -100,7 +100,7 @@ cJSON *OpenAPI_traffic_influ_data_patch_convertToJSON(OpenAPI_traffic_influ_data } } - if (traffic_influ_data_patch->app_relo_ind >= 0) { + if (traffic_influ_data_patch->app_relo_ind) { if (cJSON_AddBoolToObject(item, "appReloInd", traffic_influ_data_patch->app_relo_ind) == NULL) { ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [app_relo_ind]"); goto end; @@ -201,7 +201,7 @@ cJSON *OpenAPI_traffic_influ_data_patch_convertToJSON(OpenAPI_traffic_influ_data } } - if (traffic_influ_data_patch->traff_corre_ind >= 0) { + if (traffic_influ_data_patch->traff_corre_ind) { if (cJSON_AddBoolToObject(item, "traffCorreInd", traffic_influ_data_patch->traff_corre_ind) == NULL) { ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [traff_corre_ind]"); goto end; @@ -262,14 +262,14 @@ cJSON *OpenAPI_traffic_influ_data_patch_convertToJSON(OpenAPI_traffic_influ_data } } - if (traffic_influ_data_patch->af_ack_ind >= 0) { + if (traffic_influ_data_patch->af_ack_ind) { if (cJSON_AddBoolToObject(item, "afAckInd", traffic_influ_data_patch->af_ack_ind) == NULL) { ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [af_ack_ind]"); goto end; } } - if (traffic_influ_data_patch->addr_preser_ind >= 0) { + if (traffic_influ_data_patch->addr_preser_ind) { if (cJSON_AddBoolToObject(item, "addrPreserInd", traffic_influ_data_patch->addr_preser_ind) == NULL) { ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [addr_preser_ind]"); goto end; @@ -513,3 +513,37 @@ end: return NULL; } +OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_copy(OpenAPI_traffic_influ_data_patch_t *dst, OpenAPI_traffic_influ_data_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_influ_data_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_traffic_influ_data_patch_free(dst); + dst = OpenAPI_traffic_influ_data_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_influ_data_patch.h b/lib/sbi/openapi/model/traffic_influ_data_patch.h index 397474c86..3b4654ab4 100644 --- a/lib/sbi/openapi/model/traffic_influ_data_patch.h +++ b/lib/sbi/openapi/model/traffic_influ_data_patch.h @@ -66,6 +66,7 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_create( void OpenAPI_traffic_influ_data_patch_free(OpenAPI_traffic_influ_data_patch_t *traffic_influ_data_patch); OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJSON(cJSON *traffic_influ_data_patchJSON); cJSON *OpenAPI_traffic_influ_data_patch_convertToJSON(OpenAPI_traffic_influ_data_patch_t *traffic_influ_data_patch); +OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_copy(OpenAPI_traffic_influ_data_patch_t *dst, OpenAPI_traffic_influ_data_patch_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/traffic_influ_sub.c b/lib/sbi/openapi/model/traffic_influ_sub.c index 96b867c19..cdad3241e 100644 --- a/lib/sbi/openapi/model/traffic_influ_sub.c +++ b/lib/sbi/openapi/model/traffic_influ_sub.c @@ -293,3 +293,37 @@ end: return NULL; } +OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_copy(OpenAPI_traffic_influ_sub_t *dst, OpenAPI_traffic_influ_sub_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_influ_sub_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_influ_sub_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_traffic_influ_sub_free(dst); + dst = OpenAPI_traffic_influ_sub_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_influ_sub.h b/lib/sbi/openapi/model/traffic_influ_sub.h index 5496e2134..700616adb 100644 --- a/lib/sbi/openapi/model/traffic_influ_sub.h +++ b/lib/sbi/openapi/model/traffic_influ_sub.h @@ -41,6 +41,7 @@ OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_create( void OpenAPI_traffic_influ_sub_free(OpenAPI_traffic_influ_sub_t *traffic_influ_sub); OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_parseFromJSON(cJSON *traffic_influ_subJSON); cJSON *OpenAPI_traffic_influ_sub_convertToJSON(OpenAPI_traffic_influ_sub_t *traffic_influ_sub); +OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_copy(OpenAPI_traffic_influ_sub_t *dst, OpenAPI_traffic_influ_sub_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/traffic_profile.c b/lib/sbi/openapi/model/traffic_profile.c index 32ac540e2..01b541836 100644 --- a/lib/sbi/openapi/model/traffic_profile.c +++ b/lib/sbi/openapi/model/traffic_profile.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_traffic_profile_t *OpenAPI_traffic_profile_copy(OpenAPI_traffic_profile_t *dst, OpenAPI_traffic_profile_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_profile_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_profile_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_traffic_profile_free(dst); + dst = OpenAPI_traffic_profile_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_profile.h b/lib/sbi/openapi/model/traffic_profile.h index 62f0528dc..b559def14 100644 --- a/lib/sbi/openapi/model/traffic_profile.h +++ b/lib/sbi/openapi/model/traffic_profile.h @@ -26,6 +26,7 @@ OpenAPI_traffic_profile_t *OpenAPI_traffic_profile_create( void OpenAPI_traffic_profile_free(OpenAPI_traffic_profile_t *traffic_profile); OpenAPI_traffic_profile_t *OpenAPI_traffic_profile_parseFromJSON(cJSON *traffic_profileJSON); cJSON *OpenAPI_traffic_profile_convertToJSON(OpenAPI_traffic_profile_t *traffic_profile); +OpenAPI_traffic_profile_t *OpenAPI_traffic_profile_copy(OpenAPI_traffic_profile_t *dst, OpenAPI_traffic_profile_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/traffic_profile_rm.c b/lib/sbi/openapi/model/traffic_profile_rm.c index 929d108d2..391d885a4 100644 --- a/lib/sbi/openapi/model/traffic_profile_rm.c +++ b/lib/sbi/openapi/model/traffic_profile_rm.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_traffic_profile_rm_t *OpenAPI_traffic_profile_rm_copy(OpenAPI_traffic_profile_rm_t *dst, OpenAPI_traffic_profile_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_profile_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_profile_rm_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_traffic_profile_rm_free(dst); + dst = OpenAPI_traffic_profile_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_profile_rm.h b/lib/sbi/openapi/model/traffic_profile_rm.h index efddf8b30..595d004e1 100644 --- a/lib/sbi/openapi/model/traffic_profile_rm.h +++ b/lib/sbi/openapi/model/traffic_profile_rm.h @@ -28,6 +28,7 @@ OpenAPI_traffic_profile_rm_t *OpenAPI_traffic_profile_rm_create( void OpenAPI_traffic_profile_rm_free(OpenAPI_traffic_profile_rm_t *traffic_profile_rm); OpenAPI_traffic_profile_rm_t *OpenAPI_traffic_profile_rm_parseFromJSON(cJSON *traffic_profile_rmJSON); cJSON *OpenAPI_traffic_profile_rm_convertToJSON(OpenAPI_traffic_profile_rm_t *traffic_profile_rm); +OpenAPI_traffic_profile_rm_t *OpenAPI_traffic_profile_rm_copy(OpenAPI_traffic_profile_rm_t *dst, OpenAPI_traffic_profile_rm_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/transfer_mo_data_req_data.c b/lib/sbi/openapi/model/transfer_mo_data_req_data.c new file mode 100644 index 000000000..ecd814fa9 --- /dev/null +++ b/lib/sbi/openapi/model/transfer_mo_data_req_data.c @@ -0,0 +1,186 @@ + +#include +#include +#include +#include "transfer_mo_data_req_data.h" + +OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_create( + OpenAPI_ref_to_binary_data_t *mo_data, + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, + OpenAPI_user_location_t *ue_location + ) +{ + OpenAPI_transfer_mo_data_req_data_t *transfer_mo_data_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_transfer_mo_data_req_data_t)); + if (!transfer_mo_data_req_data_local_var) { + return NULL; + } + transfer_mo_data_req_data_local_var->mo_data = mo_data; + transfer_mo_data_req_data_local_var->mo_exp_data_ind = mo_exp_data_ind; + transfer_mo_data_req_data_local_var->mo_exp_data_counter = mo_exp_data_counter; + transfer_mo_data_req_data_local_var->ue_location = ue_location; + + return transfer_mo_data_req_data_local_var; +} + +void OpenAPI_transfer_mo_data_req_data_free(OpenAPI_transfer_mo_data_req_data_t *transfer_mo_data_req_data) +{ + if (NULL == transfer_mo_data_req_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ref_to_binary_data_free(transfer_mo_data_req_data->mo_data); + OpenAPI_mo_exception_data_flag_free(transfer_mo_data_req_data->mo_exp_data_ind); + OpenAPI_mo_exp_data_counter_free(transfer_mo_data_req_data->mo_exp_data_counter); + OpenAPI_user_location_free(transfer_mo_data_req_data->ue_location); + ogs_free(transfer_mo_data_req_data); +} + +cJSON *OpenAPI_transfer_mo_data_req_data_convertToJSON(OpenAPI_transfer_mo_data_req_data_t *transfer_mo_data_req_data) +{ + cJSON *item = NULL; + + if (transfer_mo_data_req_data == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [TransferMoDataReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!transfer_mo_data_req_data->mo_data) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_data]"); + goto end; + } + cJSON *mo_data_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(transfer_mo_data_req_data->mo_data); + if (mo_data_local_JSON == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_data]"); + goto end; + } + cJSON_AddItemToObject(item, "moData", mo_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_data]"); + goto end; + } + + if (transfer_mo_data_req_data->mo_exp_data_ind) { + cJSON *mo_exp_data_ind_local_JSON = OpenAPI_mo_exception_data_flag_convertToJSON(transfer_mo_data_req_data->mo_exp_data_ind); + if (mo_exp_data_ind_local_JSON == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_exp_data_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataInd", mo_exp_data_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_exp_data_ind]"); + goto end; + } + } + + if (transfer_mo_data_req_data->mo_exp_data_counter) { + cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(transfer_mo_data_req_data->mo_exp_data_counter); + if (mo_exp_data_counter_local_JSON == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataCounter", mo_exp_data_counter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + } + + if (transfer_mo_data_req_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(transfer_mo_data_req_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_parseFromJSON(cJSON *transfer_mo_data_req_dataJSON) +{ + OpenAPI_transfer_mo_data_req_data_t *transfer_mo_data_req_data_local_var = NULL; + cJSON *mo_data = cJSON_GetObjectItemCaseSensitive(transfer_mo_data_req_dataJSON, "moData"); + if (!mo_data) { + ogs_error("OpenAPI_transfer_mo_data_req_data_parseFromJSON() failed [mo_data]"); + goto end; + } + + OpenAPI_ref_to_binary_data_t *mo_data_local_nonprim = NULL; + + mo_data_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(mo_data); + + cJSON *mo_exp_data_ind = cJSON_GetObjectItemCaseSensitive(transfer_mo_data_req_dataJSON, "moExpDataInd"); + + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind_local_nonprim = NULL; + if (mo_exp_data_ind) { + mo_exp_data_ind_local_nonprim = OpenAPI_mo_exception_data_flag_parseFromJSON(mo_exp_data_ind); + } + + cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(transfer_mo_data_req_dataJSON, "moExpDataCounter"); + + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; + if (mo_exp_data_counter) { + mo_exp_data_counter_local_nonprim = OpenAPI_mo_exp_data_counter_parseFromJSON(mo_exp_data_counter); + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(transfer_mo_data_req_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + transfer_mo_data_req_data_local_var = OpenAPI_transfer_mo_data_req_data_create ( + mo_data_local_nonprim, + mo_exp_data_ind ? mo_exp_data_ind_local_nonprim : NULL, + mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, + ue_location ? ue_location_local_nonprim : NULL + ); + + return transfer_mo_data_req_data_local_var; +end: + return NULL; +} + +OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_copy(OpenAPI_transfer_mo_data_req_data_t *dst, OpenAPI_transfer_mo_data_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_transfer_mo_data_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_transfer_mo_data_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_transfer_mo_data_req_data_free(dst); + dst = OpenAPI_transfer_mo_data_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/transfer_mo_data_req_data.h b/lib/sbi/openapi/model/transfer_mo_data_req_data.h new file mode 100644 index 000000000..0d9d08053 --- /dev/null +++ b/lib/sbi/openapi/model/transfer_mo_data_req_data.h @@ -0,0 +1,48 @@ +/* + * transfer_mo_data_req_data.h + * + * + */ + +#ifndef _OpenAPI_transfer_mo_data_req_data_H_ +#define _OpenAPI_transfer_mo_data_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mo_exception_data_flag.h" +#include "mo_exp_data_counter.h" +#include "ref_to_binary_data.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_transfer_mo_data_req_data_s OpenAPI_transfer_mo_data_req_data_t; +typedef struct OpenAPI_transfer_mo_data_req_data_s { + struct OpenAPI_ref_to_binary_data_s *mo_data; + struct OpenAPI_mo_exception_data_flag_s *mo_exp_data_ind; + struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; + struct OpenAPI_user_location_s *ue_location; +} OpenAPI_transfer_mo_data_req_data_t; + +OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_create( + OpenAPI_ref_to_binary_data_t *mo_data, + OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, + OpenAPI_user_location_t *ue_location + ); +void OpenAPI_transfer_mo_data_req_data_free(OpenAPI_transfer_mo_data_req_data_t *transfer_mo_data_req_data); +OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_parseFromJSON(cJSON *transfer_mo_data_req_dataJSON); +cJSON *OpenAPI_transfer_mo_data_req_data_convertToJSON(OpenAPI_transfer_mo_data_req_data_t *transfer_mo_data_req_data); +OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_copy(OpenAPI_transfer_mo_data_req_data_t *dst, OpenAPI_transfer_mo_data_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_transfer_mo_data_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/transfer_mt_data_add_info.c b/lib/sbi/openapi/model/transfer_mt_data_add_info.c new file mode 100644 index 000000000..e21c72acd --- /dev/null +++ b/lib/sbi/openapi/model/transfer_mt_data_add_info.c @@ -0,0 +1,104 @@ + +#include +#include +#include +#include "transfer_mt_data_add_info.h" + +OpenAPI_transfer_mt_data_add_info_t *OpenAPI_transfer_mt_data_add_info_create( + int max_waiting_time + ) +{ + OpenAPI_transfer_mt_data_add_info_t *transfer_mt_data_add_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_transfer_mt_data_add_info_t)); + if (!transfer_mt_data_add_info_local_var) { + return NULL; + } + transfer_mt_data_add_info_local_var->max_waiting_time = max_waiting_time; + + return transfer_mt_data_add_info_local_var; +} + +void OpenAPI_transfer_mt_data_add_info_free(OpenAPI_transfer_mt_data_add_info_t *transfer_mt_data_add_info) +{ + if (NULL == transfer_mt_data_add_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(transfer_mt_data_add_info); +} + +cJSON *OpenAPI_transfer_mt_data_add_info_convertToJSON(OpenAPI_transfer_mt_data_add_info_t *transfer_mt_data_add_info) +{ + cJSON *item = NULL; + + if (transfer_mt_data_add_info == NULL) { + ogs_error("OpenAPI_transfer_mt_data_add_info_convertToJSON() failed [TransferMtDataAddInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (transfer_mt_data_add_info->max_waiting_time) { + if (cJSON_AddNumberToObject(item, "maxWaitingTime", transfer_mt_data_add_info->max_waiting_time) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_add_info_convertToJSON() failed [max_waiting_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_transfer_mt_data_add_info_t *OpenAPI_transfer_mt_data_add_info_parseFromJSON(cJSON *transfer_mt_data_add_infoJSON) +{ + OpenAPI_transfer_mt_data_add_info_t *transfer_mt_data_add_info_local_var = NULL; + cJSON *max_waiting_time = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_add_infoJSON, "maxWaitingTime"); + + if (max_waiting_time) { + if (!cJSON_IsNumber(max_waiting_time)) { + ogs_error("OpenAPI_transfer_mt_data_add_info_parseFromJSON() failed [max_waiting_time]"); + goto end; + } + } + + transfer_mt_data_add_info_local_var = OpenAPI_transfer_mt_data_add_info_create ( + max_waiting_time ? max_waiting_time->valuedouble : 0 + ); + + return transfer_mt_data_add_info_local_var; +end: + return NULL; +} + +OpenAPI_transfer_mt_data_add_info_t *OpenAPI_transfer_mt_data_add_info_copy(OpenAPI_transfer_mt_data_add_info_t *dst, OpenAPI_transfer_mt_data_add_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_transfer_mt_data_add_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_transfer_mt_data_add_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_transfer_mt_data_add_info_free(dst); + dst = OpenAPI_transfer_mt_data_add_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/transfer_mt_data_add_info.h b/lib/sbi/openapi/model/transfer_mt_data_add_info.h new file mode 100644 index 000000000..8327359ca --- /dev/null +++ b/lib/sbi/openapi/model/transfer_mt_data_add_info.h @@ -0,0 +1,38 @@ +/* + * transfer_mt_data_add_info.h + * + * + */ + +#ifndef _OpenAPI_transfer_mt_data_add_info_H_ +#define _OpenAPI_transfer_mt_data_add_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_transfer_mt_data_add_info_s OpenAPI_transfer_mt_data_add_info_t; +typedef struct OpenAPI_transfer_mt_data_add_info_s { + int max_waiting_time; +} OpenAPI_transfer_mt_data_add_info_t; + +OpenAPI_transfer_mt_data_add_info_t *OpenAPI_transfer_mt_data_add_info_create( + int max_waiting_time + ); +void OpenAPI_transfer_mt_data_add_info_free(OpenAPI_transfer_mt_data_add_info_t *transfer_mt_data_add_info); +OpenAPI_transfer_mt_data_add_info_t *OpenAPI_transfer_mt_data_add_info_parseFromJSON(cJSON *transfer_mt_data_add_infoJSON); +cJSON *OpenAPI_transfer_mt_data_add_info_convertToJSON(OpenAPI_transfer_mt_data_add_info_t *transfer_mt_data_add_info); +OpenAPI_transfer_mt_data_add_info_t *OpenAPI_transfer_mt_data_add_info_copy(OpenAPI_transfer_mt_data_add_info_t *dst, OpenAPI_transfer_mt_data_add_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_transfer_mt_data_add_info_H_ */ + diff --git a/lib/sbi/openapi/model/transfer_mt_data_error.c b/lib/sbi/openapi/model/transfer_mt_data_error.c new file mode 100644 index 000000000..79f8f1d32 --- /dev/null +++ b/lib/sbi/openapi/model/transfer_mt_data_error.c @@ -0,0 +1,293 @@ + +#include +#include +#include +#include "transfer_mt_data_error.h" + +OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_create( + char *type, + char *title, + int status, + char *detail, + char *instance, + char *cause, + OpenAPI_list_t *invalid_params, + char *supported_features, + int max_waiting_time + ) +{ + OpenAPI_transfer_mt_data_error_t *transfer_mt_data_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_transfer_mt_data_error_t)); + if (!transfer_mt_data_error_local_var) { + return NULL; + } + transfer_mt_data_error_local_var->type = type; + transfer_mt_data_error_local_var->title = title; + transfer_mt_data_error_local_var->status = status; + transfer_mt_data_error_local_var->detail = detail; + transfer_mt_data_error_local_var->instance = instance; + transfer_mt_data_error_local_var->cause = cause; + transfer_mt_data_error_local_var->invalid_params = invalid_params; + transfer_mt_data_error_local_var->supported_features = supported_features; + transfer_mt_data_error_local_var->max_waiting_time = max_waiting_time; + + return transfer_mt_data_error_local_var; +} + +void OpenAPI_transfer_mt_data_error_free(OpenAPI_transfer_mt_data_error_t *transfer_mt_data_error) +{ + if (NULL == transfer_mt_data_error) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(transfer_mt_data_error->type); + ogs_free(transfer_mt_data_error->title); + ogs_free(transfer_mt_data_error->detail); + ogs_free(transfer_mt_data_error->instance); + ogs_free(transfer_mt_data_error->cause); + OpenAPI_list_for_each(transfer_mt_data_error->invalid_params, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(transfer_mt_data_error->invalid_params); + ogs_free(transfer_mt_data_error->supported_features); + ogs_free(transfer_mt_data_error); +} + +cJSON *OpenAPI_transfer_mt_data_error_convertToJSON(OpenAPI_transfer_mt_data_error_t *transfer_mt_data_error) +{ + cJSON *item = NULL; + + if (transfer_mt_data_error == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [TransferMtDataError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (transfer_mt_data_error->type) { + if (cJSON_AddStringToObject(item, "type", transfer_mt_data_error->type) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [type]"); + goto end; + } + } + + if (transfer_mt_data_error->title) { + if (cJSON_AddStringToObject(item, "title", transfer_mt_data_error->title) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [title]"); + goto end; + } + } + + if (transfer_mt_data_error->status) { + if (cJSON_AddNumberToObject(item, "status", transfer_mt_data_error->status) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [status]"); + goto end; + } + } + + if (transfer_mt_data_error->detail) { + if (cJSON_AddStringToObject(item, "detail", transfer_mt_data_error->detail) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [detail]"); + goto end; + } + } + + if (transfer_mt_data_error->instance) { + if (cJSON_AddStringToObject(item, "instance", transfer_mt_data_error->instance) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [instance]"); + goto end; + } + } + + if (transfer_mt_data_error->cause) { + if (cJSON_AddStringToObject(item, "cause", transfer_mt_data_error->cause) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [cause]"); + goto end; + } + } + + if (transfer_mt_data_error->invalid_params) { + cJSON *invalid_paramsList = cJSON_AddArrayToObject(item, "invalidParams"); + if (invalid_paramsList == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [invalid_params]"); + goto end; + } + + OpenAPI_lnode_t *invalid_params_node; + if (transfer_mt_data_error->invalid_params) { + OpenAPI_list_for_each(transfer_mt_data_error->invalid_params, invalid_params_node) { + cJSON *itemLocal = OpenAPI_invalid_param_convertToJSON(invalid_params_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [invalid_params]"); + goto end; + } + cJSON_AddItemToArray(invalid_paramsList, itemLocal); + } + } + } + + if (transfer_mt_data_error->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", transfer_mt_data_error->supported_features) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (transfer_mt_data_error->max_waiting_time) { + if (cJSON_AddNumberToObject(item, "maxWaitingTime", transfer_mt_data_error->max_waiting_time) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [max_waiting_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_parseFromJSON(cJSON *transfer_mt_data_errorJSON) +{ + OpenAPI_transfer_mt_data_error_t *transfer_mt_data_error_local_var = NULL; + cJSON *type = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "type"); + + if (type) { + if (!cJSON_IsString(type)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [type]"); + goto end; + } + } + + cJSON *title = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "title"); + + if (title) { + if (!cJSON_IsString(title)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [title]"); + goto end; + } + } + + cJSON *status = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "status"); + + if (status) { + if (!cJSON_IsNumber(status)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [status]"); + goto end; + } + } + + cJSON *detail = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "detail"); + + if (detail) { + if (!cJSON_IsString(detail)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [detail]"); + goto end; + } + } + + cJSON *instance = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "instance"); + + if (instance) { + if (!cJSON_IsString(instance)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [instance]"); + goto end; + } + } + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "cause"); + + if (cause) { + if (!cJSON_IsString(cause)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [cause]"); + goto end; + } + } + + cJSON *invalid_params = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "invalidParams"); + + OpenAPI_list_t *invalid_paramsList; + if (invalid_params) { + cJSON *invalid_params_local_nonprimitive; + if (!cJSON_IsArray(invalid_params)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [invalid_params]"); + goto end; + } + + invalid_paramsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(invalid_params_local_nonprimitive, invalid_params ) { + if (!cJSON_IsObject(invalid_params_local_nonprimitive)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [invalid_params]"); + goto end; + } + OpenAPI_invalid_param_t *invalid_paramsItem = OpenAPI_invalid_param_parseFromJSON(invalid_params_local_nonprimitive); + + OpenAPI_list_add(invalid_paramsList, invalid_paramsItem); + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *max_waiting_time = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "maxWaitingTime"); + + if (max_waiting_time) { + if (!cJSON_IsNumber(max_waiting_time)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [max_waiting_time]"); + goto end; + } + } + + transfer_mt_data_error_local_var = OpenAPI_transfer_mt_data_error_create ( + type ? ogs_strdup(type->valuestring) : NULL, + title ? ogs_strdup(title->valuestring) : NULL, + status ? status->valuedouble : 0, + detail ? ogs_strdup(detail->valuestring) : NULL, + instance ? ogs_strdup(instance->valuestring) : NULL, + cause ? ogs_strdup(cause->valuestring) : NULL, + invalid_params ? invalid_paramsList : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + max_waiting_time ? max_waiting_time->valuedouble : 0 + ); + + return transfer_mt_data_error_local_var; +end: + return NULL; +} + +OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_copy(OpenAPI_transfer_mt_data_error_t *dst, OpenAPI_transfer_mt_data_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_transfer_mt_data_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_transfer_mt_data_error_free(dst); + dst = OpenAPI_transfer_mt_data_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/transfer_mt_data_error.h b/lib/sbi/openapi/model/transfer_mt_data_error.h new file mode 100644 index 000000000..251f24174 --- /dev/null +++ b/lib/sbi/openapi/model/transfer_mt_data_error.h @@ -0,0 +1,57 @@ +/* + * transfer_mt_data_error.h + * + * + */ + +#ifndef _OpenAPI_transfer_mt_data_error_H_ +#define _OpenAPI_transfer_mt_data_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "invalid_param.h" +#include "problem_details.h" +#include "transfer_mt_data_add_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_transfer_mt_data_error_s OpenAPI_transfer_mt_data_error_t; +typedef struct OpenAPI_transfer_mt_data_error_s { + char *type; + char *title; + int status; + char *detail; + char *instance; + char *cause; + OpenAPI_list_t *invalid_params; + char *supported_features; + int max_waiting_time; +} OpenAPI_transfer_mt_data_error_t; + +OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_create( + char *type, + char *title, + int status, + char *detail, + char *instance, + char *cause, + OpenAPI_list_t *invalid_params, + char *supported_features, + int max_waiting_time + ); +void OpenAPI_transfer_mt_data_error_free(OpenAPI_transfer_mt_data_error_t *transfer_mt_data_error); +OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_parseFromJSON(cJSON *transfer_mt_data_errorJSON); +cJSON *OpenAPI_transfer_mt_data_error_convertToJSON(OpenAPI_transfer_mt_data_error_t *transfer_mt_data_error); +OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_copy(OpenAPI_transfer_mt_data_error_t *dst, OpenAPI_transfer_mt_data_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_transfer_mt_data_error_H_ */ + diff --git a/lib/sbi/openapi/model/transfer_mt_data_req_data.c b/lib/sbi/openapi/model/transfer_mt_data_req_data.c new file mode 100644 index 000000000..6738ecbd1 --- /dev/null +++ b/lib/sbi/openapi/model/transfer_mt_data_req_data.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "transfer_mt_data_req_data.h" + +OpenAPI_transfer_mt_data_req_data_t *OpenAPI_transfer_mt_data_req_data_create( + OpenAPI_ref_to_binary_data_t *mt_data + ) +{ + OpenAPI_transfer_mt_data_req_data_t *transfer_mt_data_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_transfer_mt_data_req_data_t)); + if (!transfer_mt_data_req_data_local_var) { + return NULL; + } + transfer_mt_data_req_data_local_var->mt_data = mt_data; + + return transfer_mt_data_req_data_local_var; +} + +void OpenAPI_transfer_mt_data_req_data_free(OpenAPI_transfer_mt_data_req_data_t *transfer_mt_data_req_data) +{ + if (NULL == transfer_mt_data_req_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ref_to_binary_data_free(transfer_mt_data_req_data->mt_data); + ogs_free(transfer_mt_data_req_data); +} + +cJSON *OpenAPI_transfer_mt_data_req_data_convertToJSON(OpenAPI_transfer_mt_data_req_data_t *transfer_mt_data_req_data) +{ + cJSON *item = NULL; + + if (transfer_mt_data_req_data == NULL) { + ogs_error("OpenAPI_transfer_mt_data_req_data_convertToJSON() failed [TransferMtDataReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!transfer_mt_data_req_data->mt_data) { + ogs_error("OpenAPI_transfer_mt_data_req_data_convertToJSON() failed [mt_data]"); + goto end; + } + cJSON *mt_data_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(transfer_mt_data_req_data->mt_data); + if (mt_data_local_JSON == NULL) { + ogs_error("OpenAPI_transfer_mt_data_req_data_convertToJSON() failed [mt_data]"); + goto end; + } + cJSON_AddItemToObject(item, "mtData", mt_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_transfer_mt_data_req_data_convertToJSON() failed [mt_data]"); + goto end; + } + +end: + return item; +} + +OpenAPI_transfer_mt_data_req_data_t *OpenAPI_transfer_mt_data_req_data_parseFromJSON(cJSON *transfer_mt_data_req_dataJSON) +{ + OpenAPI_transfer_mt_data_req_data_t *transfer_mt_data_req_data_local_var = NULL; + cJSON *mt_data = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_req_dataJSON, "mtData"); + if (!mt_data) { + ogs_error("OpenAPI_transfer_mt_data_req_data_parseFromJSON() failed [mt_data]"); + goto end; + } + + OpenAPI_ref_to_binary_data_t *mt_data_local_nonprim = NULL; + + mt_data_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(mt_data); + + transfer_mt_data_req_data_local_var = OpenAPI_transfer_mt_data_req_data_create ( + mt_data_local_nonprim + ); + + return transfer_mt_data_req_data_local_var; +end: + return NULL; +} + +OpenAPI_transfer_mt_data_req_data_t *OpenAPI_transfer_mt_data_req_data_copy(OpenAPI_transfer_mt_data_req_data_t *dst, OpenAPI_transfer_mt_data_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_transfer_mt_data_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_transfer_mt_data_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_transfer_mt_data_req_data_free(dst); + dst = OpenAPI_transfer_mt_data_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/transfer_mt_data_req_data.h b/lib/sbi/openapi/model/transfer_mt_data_req_data.h new file mode 100644 index 000000000..7b60b6b96 --- /dev/null +++ b/lib/sbi/openapi/model/transfer_mt_data_req_data.h @@ -0,0 +1,39 @@ +/* + * transfer_mt_data_req_data.h + * + * + */ + +#ifndef _OpenAPI_transfer_mt_data_req_data_H_ +#define _OpenAPI_transfer_mt_data_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_transfer_mt_data_req_data_s OpenAPI_transfer_mt_data_req_data_t; +typedef struct OpenAPI_transfer_mt_data_req_data_s { + struct OpenAPI_ref_to_binary_data_s *mt_data; +} OpenAPI_transfer_mt_data_req_data_t; + +OpenAPI_transfer_mt_data_req_data_t *OpenAPI_transfer_mt_data_req_data_create( + OpenAPI_ref_to_binary_data_t *mt_data + ); +void OpenAPI_transfer_mt_data_req_data_free(OpenAPI_transfer_mt_data_req_data_t *transfer_mt_data_req_data); +OpenAPI_transfer_mt_data_req_data_t *OpenAPI_transfer_mt_data_req_data_parseFromJSON(cJSON *transfer_mt_data_req_dataJSON); +cJSON *OpenAPI_transfer_mt_data_req_data_convertToJSON(OpenAPI_transfer_mt_data_req_data_t *transfer_mt_data_req_data); +OpenAPI_transfer_mt_data_req_data_t *OpenAPI_transfer_mt_data_req_data_copy(OpenAPI_transfer_mt_data_req_data_t *dst, OpenAPI_transfer_mt_data_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_transfer_mt_data_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/transfer_policy.c b/lib/sbi/openapi/model/transfer_policy.c index 4c7d6ce78..edfac379a 100644 --- a/lib/sbi/openapi/model/transfer_policy.c +++ b/lib/sbi/openapi/model/transfer_policy.c @@ -166,3 +166,37 @@ end: return NULL; } +OpenAPI_transfer_policy_t *OpenAPI_transfer_policy_copy(OpenAPI_transfer_policy_t *dst, OpenAPI_transfer_policy_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_transfer_policy_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_transfer_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_transfer_policy_free(dst); + dst = OpenAPI_transfer_policy_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/transfer_policy.h b/lib/sbi/openapi/model/transfer_policy.h index d357b4816..5f5a5172f 100644 --- a/lib/sbi/openapi/model/transfer_policy.h +++ b/lib/sbi/openapi/model/transfer_policy.h @@ -37,6 +37,7 @@ OpenAPI_transfer_policy_t *OpenAPI_transfer_policy_create( void OpenAPI_transfer_policy_free(OpenAPI_transfer_policy_t *transfer_policy); OpenAPI_transfer_policy_t *OpenAPI_transfer_policy_parseFromJSON(cJSON *transfer_policyJSON); cJSON *OpenAPI_transfer_policy_convertToJSON(OpenAPI_transfer_policy_t *transfer_policy); +OpenAPI_transfer_policy_t *OpenAPI_transfer_policy_copy(OpenAPI_transfer_policy_t *dst, OpenAPI_transfer_policy_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/transfer_reason.c b/lib/sbi/openapi/model/transfer_reason.c new file mode 100644 index 000000000..3f086534c --- /dev/null +++ b/lib/sbi/openapi/model/transfer_reason.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "transfer_reason.h" + +char* OpenAPI_transfer_reason_ToString(OpenAPI_transfer_reason_e transfer_reason) +{ + const char *transfer_reasonArray[] = { "NULL", "INIT_REG", "MOBI_REG", "MOBI_REG_UE_VALIDATED" }; + size_t sizeofArray = sizeof(transfer_reasonArray) / sizeof(transfer_reasonArray[0]); + if (transfer_reason < sizeofArray) + return (char *)transfer_reasonArray[transfer_reason]; + else + return (char *)"Unknown"; +} + +OpenAPI_transfer_reason_e OpenAPI_transfer_reason_FromString(char* transfer_reason) +{ + int stringToReturn = 0; + const char *transfer_reasonArray[] = { "NULL", "INIT_REG", "MOBI_REG", "MOBI_REG_UE_VALIDATED" }; + size_t sizeofArray = sizeof(transfer_reasonArray) / sizeof(transfer_reasonArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(transfer_reason, transfer_reasonArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/transfer_reason.h b/lib/sbi/openapi/model/transfer_reason.h new file mode 100644 index 000000000..19ad848cf --- /dev/null +++ b/lib/sbi/openapi/model/transfer_reason.h @@ -0,0 +1,31 @@ +/* + * transfer_reason.h + * + * + */ + +#ifndef _OpenAPI_transfer_reason_H_ +#define _OpenAPI_transfer_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_transfer_reason_NULL = 0, OpenAPI_transfer_reason_INIT_REG, OpenAPI_transfer_reason_MOBI_REG, OpenAPI_transfer_reason_MOBI_REG_UE_VALIDATED } OpenAPI_transfer_reason_e; + +char* OpenAPI_transfer_reason_ToString(OpenAPI_transfer_reason_e transfer_reason); + +OpenAPI_transfer_reason_e OpenAPI_transfer_reason_FromString(char* transfer_reason); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_transfer_reason_H_ */ + diff --git a/lib/sbi/openapi/model/transport_protocol.c b/lib/sbi/openapi/model/transport_protocol.c index f2002ef56..bd61f83fe 100644 --- a/lib/sbi/openapi/model/transport_protocol.c +++ b/lib/sbi/openapi/model/transport_protocol.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_copy(OpenAPI_transport_protocol_t *dst, OpenAPI_transport_protocol_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_transport_protocol_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_transport_protocol_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_transport_protocol_free(dst); + dst = OpenAPI_transport_protocol_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/transport_protocol.h b/lib/sbi/openapi/model/transport_protocol.h index bbfa3f4ac..32be818b1 100644 --- a/lib/sbi/openapi/model/transport_protocol.h +++ b/lib/sbi/openapi/model/transport_protocol.h @@ -26,6 +26,7 @@ OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_create( void OpenAPI_transport_protocol_free(OpenAPI_transport_protocol_t *transport_protocol); OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_parseFromJSON(cJSON *transport_protocolJSON); cJSON *OpenAPI_transport_protocol_convertToJSON(OpenAPI_transport_protocol_t *transport_protocol); +OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_copy(OpenAPI_transport_protocol_t *dst, OpenAPI_transport_protocol_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/trigger.c b/lib/sbi/openapi/model/trigger.c new file mode 100644 index 000000000..868e1b398 --- /dev/null +++ b/lib/sbi/openapi/model/trigger.c @@ -0,0 +1,219 @@ + +#include +#include +#include +#include "trigger.h" + +OpenAPI_trigger_t *OpenAPI_trigger_create( + OpenAPI_trigger_type_t *trigger_type, + OpenAPI_trigger_category_t *trigger_category, + int time_limit, + int volume_limit, + long volume_limit64, + int max_number_ofccc + ) +{ + OpenAPI_trigger_t *trigger_local_var = OpenAPI_malloc(sizeof(OpenAPI_trigger_t)); + if (!trigger_local_var) { + return NULL; + } + trigger_local_var->trigger_type = trigger_type; + trigger_local_var->trigger_category = trigger_category; + trigger_local_var->time_limit = time_limit; + trigger_local_var->volume_limit = volume_limit; + trigger_local_var->volume_limit64 = volume_limit64; + trigger_local_var->max_number_ofccc = max_number_ofccc; + + return trigger_local_var; +} + +void OpenAPI_trigger_free(OpenAPI_trigger_t *trigger) +{ + if (NULL == trigger) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_trigger_type_free(trigger->trigger_type); + OpenAPI_trigger_category_free(trigger->trigger_category); + ogs_free(trigger); +} + +cJSON *OpenAPI_trigger_convertToJSON(OpenAPI_trigger_t *trigger) +{ + cJSON *item = NULL; + + if (trigger == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [Trigger]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!trigger->trigger_type) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [trigger_type]"); + goto end; + } + cJSON *trigger_type_local_JSON = OpenAPI_trigger_type_convertToJSON(trigger->trigger_type); + if (trigger_type_local_JSON == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [trigger_type]"); + goto end; + } + cJSON_AddItemToObject(item, "triggerType", trigger_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [trigger_type]"); + goto end; + } + + if (!trigger->trigger_category) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [trigger_category]"); + goto end; + } + cJSON *trigger_category_local_JSON = OpenAPI_trigger_category_convertToJSON(trigger->trigger_category); + if (trigger_category_local_JSON == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [trigger_category]"); + goto end; + } + cJSON_AddItemToObject(item, "triggerCategory", trigger_category_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [trigger_category]"); + goto end; + } + + if (trigger->time_limit) { + if (cJSON_AddNumberToObject(item, "timeLimit", trigger->time_limit) == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [time_limit]"); + goto end; + } + } + + if (trigger->volume_limit) { + if (cJSON_AddNumberToObject(item, "volumeLimit", trigger->volume_limit) == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [volume_limit]"); + goto end; + } + } + + if (trigger->volume_limit64) { + if (cJSON_AddNumberToObject(item, "volumeLimit64", trigger->volume_limit64) == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [volume_limit64]"); + goto end; + } + } + + if (trigger->max_number_ofccc) { + if (cJSON_AddNumberToObject(item, "maxNumberOfccc", trigger->max_number_ofccc) == NULL) { + ogs_error("OpenAPI_trigger_convertToJSON() failed [max_number_ofccc]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_trigger_t *OpenAPI_trigger_parseFromJSON(cJSON *triggerJSON) +{ + OpenAPI_trigger_t *trigger_local_var = NULL; + cJSON *trigger_type = cJSON_GetObjectItemCaseSensitive(triggerJSON, "triggerType"); + if (!trigger_type) { + ogs_error("OpenAPI_trigger_parseFromJSON() failed [trigger_type]"); + goto end; + } + + OpenAPI_trigger_type_t *trigger_type_local_nonprim = NULL; + + trigger_type_local_nonprim = OpenAPI_trigger_type_parseFromJSON(trigger_type); + + cJSON *trigger_category = cJSON_GetObjectItemCaseSensitive(triggerJSON, "triggerCategory"); + if (!trigger_category) { + ogs_error("OpenAPI_trigger_parseFromJSON() failed [trigger_category]"); + goto end; + } + + OpenAPI_trigger_category_t *trigger_category_local_nonprim = NULL; + + trigger_category_local_nonprim = OpenAPI_trigger_category_parseFromJSON(trigger_category); + + cJSON *time_limit = cJSON_GetObjectItemCaseSensitive(triggerJSON, "timeLimit"); + + if (time_limit) { + if (!cJSON_IsNumber(time_limit)) { + ogs_error("OpenAPI_trigger_parseFromJSON() failed [time_limit]"); + goto end; + } + } + + cJSON *volume_limit = cJSON_GetObjectItemCaseSensitive(triggerJSON, "volumeLimit"); + + if (volume_limit) { + if (!cJSON_IsNumber(volume_limit)) { + ogs_error("OpenAPI_trigger_parseFromJSON() failed [volume_limit]"); + goto end; + } + } + + cJSON *volume_limit64 = cJSON_GetObjectItemCaseSensitive(triggerJSON, "volumeLimit64"); + + if (volume_limit64) { + if (!cJSON_IsNumber(volume_limit64)) { + ogs_error("OpenAPI_trigger_parseFromJSON() failed [volume_limit64]"); + goto end; + } + } + + cJSON *max_number_ofccc = cJSON_GetObjectItemCaseSensitive(triggerJSON, "maxNumberOfccc"); + + if (max_number_ofccc) { + if (!cJSON_IsNumber(max_number_ofccc)) { + ogs_error("OpenAPI_trigger_parseFromJSON() failed [max_number_ofccc]"); + goto end; + } + } + + trigger_local_var = OpenAPI_trigger_create ( + trigger_type_local_nonprim, + trigger_category_local_nonprim, + time_limit ? time_limit->valuedouble : 0, + volume_limit ? volume_limit->valuedouble : 0, + volume_limit64 ? volume_limit64->valuedouble : 0, + max_number_ofccc ? max_number_ofccc->valuedouble : 0 + ); + + return trigger_local_var; +end: + return NULL; +} + +OpenAPI_trigger_t *OpenAPI_trigger_copy(OpenAPI_trigger_t *dst, OpenAPI_trigger_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_trigger_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_trigger_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_trigger_free(dst); + dst = OpenAPI_trigger_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/trigger.h b/lib/sbi/openapi/model/trigger.h new file mode 100644 index 000000000..302be983c --- /dev/null +++ b/lib/sbi/openapi/model/trigger.h @@ -0,0 +1,50 @@ +/* + * trigger.h + * + * + */ + +#ifndef _OpenAPI_trigger_H_ +#define _OpenAPI_trigger_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "trigger_category.h" +#include "trigger_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_trigger_s OpenAPI_trigger_t; +typedef struct OpenAPI_trigger_s { + struct OpenAPI_trigger_type_s *trigger_type; + struct OpenAPI_trigger_category_s *trigger_category; + int time_limit; + int volume_limit; + long volume_limit64; + int max_number_ofccc; +} OpenAPI_trigger_t; + +OpenAPI_trigger_t *OpenAPI_trigger_create( + OpenAPI_trigger_type_t *trigger_type, + OpenAPI_trigger_category_t *trigger_category, + int time_limit, + int volume_limit, + long volume_limit64, + int max_number_ofccc + ); +void OpenAPI_trigger_free(OpenAPI_trigger_t *trigger); +OpenAPI_trigger_t *OpenAPI_trigger_parseFromJSON(cJSON *triggerJSON); +cJSON *OpenAPI_trigger_convertToJSON(OpenAPI_trigger_t *trigger); +OpenAPI_trigger_t *OpenAPI_trigger_copy(OpenAPI_trigger_t *dst, OpenAPI_trigger_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_trigger_H_ */ + diff --git a/lib/sbi/openapi/model/trigger_category.c b/lib/sbi/openapi/model/trigger_category.c new file mode 100644 index 000000000..455037d3e --- /dev/null +++ b/lib/sbi/openapi/model/trigger_category.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "trigger_category.h" + +OpenAPI_trigger_category_t *OpenAPI_trigger_category_create( + ) +{ + OpenAPI_trigger_category_t *trigger_category_local_var = OpenAPI_malloc(sizeof(OpenAPI_trigger_category_t)); + if (!trigger_category_local_var) { + return NULL; + } + + return trigger_category_local_var; +} + +void OpenAPI_trigger_category_free(OpenAPI_trigger_category_t *trigger_category) +{ + if (NULL == trigger_category) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(trigger_category); +} + +cJSON *OpenAPI_trigger_category_convertToJSON(OpenAPI_trigger_category_t *trigger_category) +{ + cJSON *item = NULL; + + if (trigger_category == NULL) { + ogs_error("OpenAPI_trigger_category_convertToJSON() failed [TriggerCategory]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_trigger_category_t *OpenAPI_trigger_category_parseFromJSON(cJSON *trigger_categoryJSON) +{ + OpenAPI_trigger_category_t *trigger_category_local_var = NULL; + trigger_category_local_var = OpenAPI_trigger_category_create ( + ); + + return trigger_category_local_var; +end: + return NULL; +} + +OpenAPI_trigger_category_t *OpenAPI_trigger_category_copy(OpenAPI_trigger_category_t *dst, OpenAPI_trigger_category_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_trigger_category_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_trigger_category_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_trigger_category_free(dst); + dst = OpenAPI_trigger_category_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/trigger_category.h b/lib/sbi/openapi/model/trigger_category.h new file mode 100644 index 000000000..bebca57e8 --- /dev/null +++ b/lib/sbi/openapi/model/trigger_category.h @@ -0,0 +1,36 @@ +/* + * trigger_category.h + * + * + */ + +#ifndef _OpenAPI_trigger_category_H_ +#define _OpenAPI_trigger_category_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_trigger_category_s OpenAPI_trigger_category_t; +typedef struct OpenAPI_trigger_category_s { +} OpenAPI_trigger_category_t; + +OpenAPI_trigger_category_t *OpenAPI_trigger_category_create( + ); +void OpenAPI_trigger_category_free(OpenAPI_trigger_category_t *trigger_category); +OpenAPI_trigger_category_t *OpenAPI_trigger_category_parseFromJSON(cJSON *trigger_categoryJSON); +cJSON *OpenAPI_trigger_category_convertToJSON(OpenAPI_trigger_category_t *trigger_category); +OpenAPI_trigger_category_t *OpenAPI_trigger_category_copy(OpenAPI_trigger_category_t *dst, OpenAPI_trigger_category_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_trigger_category_H_ */ + diff --git a/lib/sbi/openapi/model/trigger_request.c b/lib/sbi/openapi/model/trigger_request.c index 0f2269ed1..b75570295 100644 --- a/lib/sbi/openapi/model/trigger_request.c +++ b/lib/sbi/openapi/model/trigger_request.c @@ -74,3 +74,37 @@ end: return NULL; } +OpenAPI_trigger_request_t *OpenAPI_trigger_request_copy(OpenAPI_trigger_request_t *dst, OpenAPI_trigger_request_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_trigger_request_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_trigger_request_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_trigger_request_free(dst); + dst = OpenAPI_trigger_request_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/trigger_request.h b/lib/sbi/openapi/model/trigger_request.h index 56569c43c..9bfca9d42 100644 --- a/lib/sbi/openapi/model/trigger_request.h +++ b/lib/sbi/openapi/model/trigger_request.h @@ -28,6 +28,7 @@ OpenAPI_trigger_request_t *OpenAPI_trigger_request_create( void OpenAPI_trigger_request_free(OpenAPI_trigger_request_t *trigger_request); OpenAPI_trigger_request_t *OpenAPI_trigger_request_parseFromJSON(cJSON *trigger_requestJSON); cJSON *OpenAPI_trigger_request_convertToJSON(OpenAPI_trigger_request_t *trigger_request); +OpenAPI_trigger_request_t *OpenAPI_trigger_request_copy(OpenAPI_trigger_request_t *dst, OpenAPI_trigger_request_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/trigger_type.c b/lib/sbi/openapi/model/trigger_type.c new file mode 100644 index 000000000..cc0141536 --- /dev/null +++ b/lib/sbi/openapi/model/trigger_type.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "trigger_type.h" + +OpenAPI_trigger_type_t *OpenAPI_trigger_type_create( + ) +{ + OpenAPI_trigger_type_t *trigger_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_trigger_type_t)); + if (!trigger_type_local_var) { + return NULL; + } + + return trigger_type_local_var; +} + +void OpenAPI_trigger_type_free(OpenAPI_trigger_type_t *trigger_type) +{ + if (NULL == trigger_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(trigger_type); +} + +cJSON *OpenAPI_trigger_type_convertToJSON(OpenAPI_trigger_type_t *trigger_type) +{ + cJSON *item = NULL; + + if (trigger_type == NULL) { + ogs_error("OpenAPI_trigger_type_convertToJSON() failed [TriggerType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_trigger_type_t *OpenAPI_trigger_type_parseFromJSON(cJSON *trigger_typeJSON) +{ + OpenAPI_trigger_type_t *trigger_type_local_var = NULL; + trigger_type_local_var = OpenAPI_trigger_type_create ( + ); + + return trigger_type_local_var; +end: + return NULL; +} + +OpenAPI_trigger_type_t *OpenAPI_trigger_type_copy(OpenAPI_trigger_type_t *dst, OpenAPI_trigger_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_trigger_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_trigger_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_trigger_type_free(dst); + dst = OpenAPI_trigger_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/trigger_type.h b/lib/sbi/openapi/model/trigger_type.h new file mode 100644 index 000000000..9bf30ebec --- /dev/null +++ b/lib/sbi/openapi/model/trigger_type.h @@ -0,0 +1,36 @@ +/* + * trigger_type.h + * + * + */ + +#ifndef _OpenAPI_trigger_type_H_ +#define _OpenAPI_trigger_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 struct OpenAPI_trigger_type_s OpenAPI_trigger_type_t; +typedef struct OpenAPI_trigger_type_s { +} OpenAPI_trigger_type_t; + +OpenAPI_trigger_type_t *OpenAPI_trigger_type_create( + ); +void OpenAPI_trigger_type_free(OpenAPI_trigger_type_t *trigger_type); +OpenAPI_trigger_type_t *OpenAPI_trigger_type_parseFromJSON(cJSON *trigger_typeJSON); +cJSON *OpenAPI_trigger_type_convertToJSON(OpenAPI_trigger_type_t *trigger_type); +OpenAPI_trigger_type_t *OpenAPI_trigger_type_copy(OpenAPI_trigger_type_t *dst, OpenAPI_trigger_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_trigger_type_H_ */ + diff --git a/lib/sbi/openapi/model/tunnel_info.c b/lib/sbi/openapi/model/tunnel_info.c new file mode 100644 index 000000000..2df730079 --- /dev/null +++ b/lib/sbi/openapi/model/tunnel_info.c @@ -0,0 +1,171 @@ + +#include +#include +#include +#include "tunnel_info.h" + +OpenAPI_tunnel_info_t *OpenAPI_tunnel_info_create( + char *ipv4_addr, + char *ipv6_addr, + char *gtp_teid, + OpenAPI_access_type_e an_type + ) +{ + OpenAPI_tunnel_info_t *tunnel_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_tunnel_info_t)); + if (!tunnel_info_local_var) { + return NULL; + } + tunnel_info_local_var->ipv4_addr = ipv4_addr; + tunnel_info_local_var->ipv6_addr = ipv6_addr; + tunnel_info_local_var->gtp_teid = gtp_teid; + tunnel_info_local_var->an_type = an_type; + + return tunnel_info_local_var; +} + +void OpenAPI_tunnel_info_free(OpenAPI_tunnel_info_t *tunnel_info) +{ + if (NULL == tunnel_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(tunnel_info->ipv4_addr); + ogs_free(tunnel_info->ipv6_addr); + ogs_free(tunnel_info->gtp_teid); + ogs_free(tunnel_info); +} + +cJSON *OpenAPI_tunnel_info_convertToJSON(OpenAPI_tunnel_info_t *tunnel_info) +{ + cJSON *item = NULL; + + if (tunnel_info == NULL) { + ogs_error("OpenAPI_tunnel_info_convertToJSON() failed [TunnelInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (tunnel_info->ipv4_addr) { + if (cJSON_AddStringToObject(item, "ipv4Addr", tunnel_info->ipv4_addr) == NULL) { + ogs_error("OpenAPI_tunnel_info_convertToJSON() failed [ipv4_addr]"); + goto end; + } + } + + if (tunnel_info->ipv6_addr) { + if (cJSON_AddStringToObject(item, "ipv6Addr", tunnel_info->ipv6_addr) == NULL) { + ogs_error("OpenAPI_tunnel_info_convertToJSON() failed [ipv6_addr]"); + goto end; + } + } + + if (!tunnel_info->gtp_teid) { + ogs_error("OpenAPI_tunnel_info_convertToJSON() failed [gtp_teid]"); + goto end; + } + if (cJSON_AddStringToObject(item, "gtpTeid", tunnel_info->gtp_teid) == NULL) { + ogs_error("OpenAPI_tunnel_info_convertToJSON() failed [gtp_teid]"); + goto end; + } + + if (tunnel_info->an_type) { + if (cJSON_AddStringToObject(item, "anType", OpenAPI_access_type_ToString(tunnel_info->an_type)) == NULL) { + ogs_error("OpenAPI_tunnel_info_convertToJSON() failed [an_type]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_tunnel_info_t *OpenAPI_tunnel_info_parseFromJSON(cJSON *tunnel_infoJSON) +{ + OpenAPI_tunnel_info_t *tunnel_info_local_var = NULL; + cJSON *ipv4_addr = cJSON_GetObjectItemCaseSensitive(tunnel_infoJSON, "ipv4Addr"); + + if (ipv4_addr) { + if (!cJSON_IsString(ipv4_addr)) { + ogs_error("OpenAPI_tunnel_info_parseFromJSON() failed [ipv4_addr]"); + goto end; + } + } + + cJSON *ipv6_addr = cJSON_GetObjectItemCaseSensitive(tunnel_infoJSON, "ipv6Addr"); + + if (ipv6_addr) { + if (!cJSON_IsString(ipv6_addr)) { + ogs_error("OpenAPI_tunnel_info_parseFromJSON() failed [ipv6_addr]"); + goto end; + } + } + + cJSON *gtp_teid = cJSON_GetObjectItemCaseSensitive(tunnel_infoJSON, "gtpTeid"); + if (!gtp_teid) { + ogs_error("OpenAPI_tunnel_info_parseFromJSON() failed [gtp_teid]"); + goto end; + } + + + if (!cJSON_IsString(gtp_teid)) { + ogs_error("OpenAPI_tunnel_info_parseFromJSON() failed [gtp_teid]"); + goto end; + } + + cJSON *an_type = cJSON_GetObjectItemCaseSensitive(tunnel_infoJSON, "anType"); + + OpenAPI_access_type_e an_typeVariable; + if (an_type) { + if (!cJSON_IsString(an_type)) { + ogs_error("OpenAPI_tunnel_info_parseFromJSON() failed [an_type]"); + goto end; + } + an_typeVariable = OpenAPI_access_type_FromString(an_type->valuestring); + } + + tunnel_info_local_var = OpenAPI_tunnel_info_create ( + ipv4_addr ? ogs_strdup(ipv4_addr->valuestring) : NULL, + ipv6_addr ? ogs_strdup(ipv6_addr->valuestring) : NULL, + ogs_strdup(gtp_teid->valuestring), + an_type ? an_typeVariable : 0 + ); + + return tunnel_info_local_var; +end: + return NULL; +} + +OpenAPI_tunnel_info_t *OpenAPI_tunnel_info_copy(OpenAPI_tunnel_info_t *dst, OpenAPI_tunnel_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tunnel_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tunnel_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_tunnel_info_free(dst); + dst = OpenAPI_tunnel_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tunnel_info.h b/lib/sbi/openapi/model/tunnel_info.h new file mode 100644 index 000000000..8217383a5 --- /dev/null +++ b/lib/sbi/openapi/model/tunnel_info.h @@ -0,0 +1,45 @@ +/* + * tunnel_info.h + * + * + */ + +#ifndef _OpenAPI_tunnel_info_H_ +#define _OpenAPI_tunnel_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tunnel_info_s OpenAPI_tunnel_info_t; +typedef struct OpenAPI_tunnel_info_s { + char *ipv4_addr; + char *ipv6_addr; + char *gtp_teid; + OpenAPI_access_type_e an_type; +} OpenAPI_tunnel_info_t; + +OpenAPI_tunnel_info_t *OpenAPI_tunnel_info_create( + char *ipv4_addr, + char *ipv6_addr, + char *gtp_teid, + OpenAPI_access_type_e an_type + ); +void OpenAPI_tunnel_info_free(OpenAPI_tunnel_info_t *tunnel_info); +OpenAPI_tunnel_info_t *OpenAPI_tunnel_info_parseFromJSON(cJSON *tunnel_infoJSON); +cJSON *OpenAPI_tunnel_info_convertToJSON(OpenAPI_tunnel_info_t *tunnel_info); +OpenAPI_tunnel_info_t *OpenAPI_tunnel_info_copy(OpenAPI_tunnel_info_t *dst, OpenAPI_tunnel_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tunnel_info_H_ */ + diff --git a/lib/sbi/openapi/model/twif_info.c b/lib/sbi/openapi/model/twif_info.c index c3903bda4..ade289631 100644 --- a/lib/sbi/openapi/model/twif_info.c +++ b/lib/sbi/openapi/model/twif_info.c @@ -155,3 +155,37 @@ end: return NULL; } +OpenAPI_twif_info_t *OpenAPI_twif_info_copy(OpenAPI_twif_info_t *dst, OpenAPI_twif_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_twif_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_twif_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_twif_info_free(dst); + dst = OpenAPI_twif_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/twif_info.h b/lib/sbi/openapi/model/twif_info.h index d00679f3e..882827b5b 100644 --- a/lib/sbi/openapi/model/twif_info.h +++ b/lib/sbi/openapi/model/twif_info.h @@ -32,6 +32,7 @@ OpenAPI_twif_info_t *OpenAPI_twif_info_create( void OpenAPI_twif_info_free(OpenAPI_twif_info_t *twif_info); OpenAPI_twif_info_t *OpenAPI_twif_info_parseFromJSON(cJSON *twif_infoJSON); cJSON *OpenAPI_twif_info_convertToJSON(OpenAPI_twif_info_t *twif_info); +OpenAPI_twif_info_t *OpenAPI_twif_info_copy(OpenAPI_twif_info_t *dst, OpenAPI_twif_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/udm_info.c b/lib/sbi/openapi/model/udm_info.c index 49e005b61..fb248f3dd 100644 --- a/lib/sbi/openapi/model/udm_info.c +++ b/lib/sbi/openapi/model/udm_info.c @@ -312,3 +312,37 @@ end: return NULL; } +OpenAPI_udm_info_t *OpenAPI_udm_info_copy(OpenAPI_udm_info_t *dst, OpenAPI_udm_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_udm_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_udm_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_udm_info_free(dst); + dst = OpenAPI_udm_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/udm_info.h b/lib/sbi/openapi/model/udm_info.h index f85eec5d5..2da214557 100644 --- a/lib/sbi/openapi/model/udm_info.h +++ b/lib/sbi/openapi/model/udm_info.h @@ -41,6 +41,7 @@ OpenAPI_udm_info_t *OpenAPI_udm_info_create( void OpenAPI_udm_info_free(OpenAPI_udm_info_t *udm_info); OpenAPI_udm_info_t *OpenAPI_udm_info_parseFromJSON(cJSON *udm_infoJSON); cJSON *OpenAPI_udm_info_convertToJSON(OpenAPI_udm_info_t *udm_info); +OpenAPI_udm_info_t *OpenAPI_udm_info_copy(OpenAPI_udm_info_t *dst, OpenAPI_udm_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/udr_info.c b/lib/sbi/openapi/model/udr_info.c index ee8503c70..8c5999263 100644 --- a/lib/sbi/openapi/model/udr_info.c +++ b/lib/sbi/openapi/model/udr_info.c @@ -269,3 +269,37 @@ end: return NULL; } +OpenAPI_udr_info_t *OpenAPI_udr_info_copy(OpenAPI_udr_info_t *dst, OpenAPI_udr_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_udr_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_udr_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_udr_info_free(dst); + dst = OpenAPI_udr_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/udr_info.h b/lib/sbi/openapi/model/udr_info.h index 3845cf4d3..6d6bf8c17 100644 --- a/lib/sbi/openapi/model/udr_info.h +++ b/lib/sbi/openapi/model/udr_info.h @@ -39,6 +39,7 @@ OpenAPI_udr_info_t *OpenAPI_udr_info_create( void OpenAPI_udr_info_free(OpenAPI_udr_info_t *udr_info); OpenAPI_udr_info_t *OpenAPI_udr_info_parseFromJSON(cJSON *udr_infoJSON); cJSON *OpenAPI_udr_info_convertToJSON(OpenAPI_udr_info_t *udr_info); +OpenAPI_udr_info_t *OpenAPI_udr_info_copy(OpenAPI_udr_info_t *dst, OpenAPI_udr_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/udsf_info.c b/lib/sbi/openapi/model/udsf_info.c index 3a3a08d04..92a9acfb5 100644 --- a/lib/sbi/openapi/model/udsf_info.c +++ b/lib/sbi/openapi/model/udsf_info.c @@ -119,3 +119,37 @@ end: return NULL; } +OpenAPI_udsf_info_t *OpenAPI_udsf_info_copy(OpenAPI_udsf_info_t *dst, OpenAPI_udsf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_udsf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_udsf_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_udsf_info_free(dst); + dst = OpenAPI_udsf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/udsf_info.h b/lib/sbi/openapi/model/udsf_info.h index 0476a8bcf..6e2d33a2b 100644 --- a/lib/sbi/openapi/model/udsf_info.h +++ b/lib/sbi/openapi/model/udsf_info.h @@ -31,6 +31,7 @@ OpenAPI_udsf_info_t *OpenAPI_udsf_info_create( void OpenAPI_udsf_info_free(OpenAPI_udsf_info_t *udsf_info); OpenAPI_udsf_info_t *OpenAPI_udsf_info_parseFromJSON(cJSON *udsf_infoJSON); cJSON *OpenAPI_udsf_info_convertToJSON(OpenAPI_udsf_info_t *udsf_info); +OpenAPI_udsf_info_t *OpenAPI_udsf_info_copy(OpenAPI_udsf_info_t *dst, OpenAPI_udsf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_auth.c b/lib/sbi/openapi/model/ue_auth.c index 9fba8bba8..f0bfdb64a 100644 --- a/lib/sbi/openapi/model/ue_auth.c +++ b/lib/sbi/openapi/model/ue_auth.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_ue_auth_t *OpenAPI_ue_auth_copy(OpenAPI_ue_auth_t *dst, OpenAPI_ue_auth_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_auth_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_auth_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_auth_free(dst); + dst = OpenAPI_ue_auth_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_auth.h b/lib/sbi/openapi/model/ue_auth.h index c1ca50f69..d680d4ba2 100644 --- a/lib/sbi/openapi/model/ue_auth.h +++ b/lib/sbi/openapi/model/ue_auth.h @@ -26,6 +26,7 @@ OpenAPI_ue_auth_t *OpenAPI_ue_auth_create( void OpenAPI_ue_auth_free(OpenAPI_ue_auth_t *ue_auth); OpenAPI_ue_auth_t *OpenAPI_ue_auth_parseFromJSON(cJSON *ue_authJSON); cJSON *OpenAPI_ue_auth_convertToJSON(OpenAPI_ue_auth_t *ue_auth); +OpenAPI_ue_auth_t *OpenAPI_ue_auth_copy(OpenAPI_ue_auth_t *dst, OpenAPI_ue_auth_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_authentication_ctx.c b/lib/sbi/openapi/model/ue_authentication_ctx.c index d238bb316..1e11f845d 100644 --- a/lib/sbi/openapi/model/ue_authentication_ctx.c +++ b/lib/sbi/openapi/model/ue_authentication_ctx.c @@ -182,3 +182,37 @@ end: return NULL; } +OpenAPI_ue_authentication_ctx_t *OpenAPI_ue_authentication_ctx_copy(OpenAPI_ue_authentication_ctx_t *dst, OpenAPI_ue_authentication_ctx_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_authentication_ctx_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_authentication_ctx_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_authentication_ctx_free(dst); + dst = OpenAPI_ue_authentication_ctx_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_authentication_ctx.h b/lib/sbi/openapi/model/ue_authentication_ctx.h index ddc4ed507..ccc9bd981 100644 --- a/lib/sbi/openapi/model/ue_authentication_ctx.h +++ b/lib/sbi/openapi/model/ue_authentication_ctx.h @@ -37,6 +37,7 @@ OpenAPI_ue_authentication_ctx_t *OpenAPI_ue_authentication_ctx_create( void OpenAPI_ue_authentication_ctx_free(OpenAPI_ue_authentication_ctx_t *ue_authentication_ctx); OpenAPI_ue_authentication_ctx_t *OpenAPI_ue_authentication_ctx_parseFromJSON(cJSON *ue_authentication_ctxJSON); cJSON *OpenAPI_ue_authentication_ctx_convertToJSON(OpenAPI_ue_authentication_ctx_t *ue_authentication_ctx); +OpenAPI_ue_authentication_ctx_t *OpenAPI_ue_authentication_ctx_copy(OpenAPI_ue_authentication_ctx_t *dst, OpenAPI_ue_authentication_ctx_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_context.c b/lib/sbi/openapi/model/ue_context.c new file mode 100644 index 000000000..e92a1dce6 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context.c @@ -0,0 +1,1354 @@ + +#include +#include +#include +#include "ue_context.h" + +OpenAPI_ue_context_t *OpenAPI_ue_context_create( + char *supi, + int supi_unauth_ind, + OpenAPI_list_t *gpsi_list, + char *pei, + char *udm_group_id, + char *ausf_group_id, + char *routing_indicator, + OpenAPI_list_t *group_list, + char drx_parameter, + int sub_rfsp, + int used_rfsp, + OpenAPI_ambr_t *sub_ue_ambr, + char *smsf_id, + OpenAPI_seaf_data_t *seaf_data, + char _5g_mm_capability, + char *pcf_id, + char *pcf_set_id, + char *pcf_amp_service_set_id, + char *pcf_uep_service_set_id, + OpenAPI_sbi_binding_level_e pcf_binding, + char *pcf_am_policy_uri, + OpenAPI_list_t *am_policy_req_trigger_list, + char *pcf_ue_policy_uri, + OpenAPI_list_t *ue_policy_req_trigger_list, + char *hpcf_id, + OpenAPI_list_t *restricted_rat_list, + OpenAPI_list_t *forbidden_area_list, + OpenAPI_service_area_restriction_t *service_area_restriction, + OpenAPI_list_t *restricted_core_nw_type_list, + OpenAPI_list_t *event_subscription_list, + OpenAPI_list_t *mm_context_list, + OpenAPI_list_t *session_context_list, + OpenAPI_trace_data_t *trace_data, + char *service_gap_expiry_time, + char *stn_sr, + char *c_msisdn, + char ms_classmark2, + OpenAPI_list_t *supported_codec_list, + OpenAPI_list_t *small_data_rate_status_infos, + OpenAPI_list_t *restricted_primary_rat_list, + OpenAPI_list_t *restricted_secondary_rat_list, + OpenAPI_list_t *v2x_context, + int lte_cat_m_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter + ) +{ + OpenAPI_ue_context_t *ue_context_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_context_t)); + if (!ue_context_local_var) { + return NULL; + } + ue_context_local_var->supi = supi; + ue_context_local_var->supi_unauth_ind = supi_unauth_ind; + ue_context_local_var->gpsi_list = gpsi_list; + ue_context_local_var->pei = pei; + ue_context_local_var->udm_group_id = udm_group_id; + ue_context_local_var->ausf_group_id = ausf_group_id; + ue_context_local_var->routing_indicator = routing_indicator; + ue_context_local_var->group_list = group_list; + ue_context_local_var->drx_parameter = drx_parameter; + ue_context_local_var->sub_rfsp = sub_rfsp; + ue_context_local_var->used_rfsp = used_rfsp; + ue_context_local_var->sub_ue_ambr = sub_ue_ambr; + ue_context_local_var->smsf_id = smsf_id; + ue_context_local_var->seaf_data = seaf_data; + ue_context_local_var->_5g_mm_capability = _5g_mm_capability; + ue_context_local_var->pcf_id = pcf_id; + ue_context_local_var->pcf_set_id = pcf_set_id; + ue_context_local_var->pcf_amp_service_set_id = pcf_amp_service_set_id; + ue_context_local_var->pcf_uep_service_set_id = pcf_uep_service_set_id; + ue_context_local_var->pcf_binding = pcf_binding; + ue_context_local_var->pcf_am_policy_uri = pcf_am_policy_uri; + ue_context_local_var->am_policy_req_trigger_list = am_policy_req_trigger_list; + ue_context_local_var->pcf_ue_policy_uri = pcf_ue_policy_uri; + ue_context_local_var->ue_policy_req_trigger_list = ue_policy_req_trigger_list; + ue_context_local_var->hpcf_id = hpcf_id; + ue_context_local_var->restricted_rat_list = restricted_rat_list; + ue_context_local_var->forbidden_area_list = forbidden_area_list; + ue_context_local_var->service_area_restriction = service_area_restriction; + ue_context_local_var->restricted_core_nw_type_list = restricted_core_nw_type_list; + ue_context_local_var->event_subscription_list = event_subscription_list; + ue_context_local_var->mm_context_list = mm_context_list; + ue_context_local_var->session_context_list = session_context_list; + ue_context_local_var->trace_data = trace_data; + ue_context_local_var->service_gap_expiry_time = service_gap_expiry_time; + ue_context_local_var->stn_sr = stn_sr; + ue_context_local_var->c_msisdn = c_msisdn; + ue_context_local_var->ms_classmark2 = ms_classmark2; + ue_context_local_var->supported_codec_list = supported_codec_list; + ue_context_local_var->small_data_rate_status_infos = small_data_rate_status_infos; + ue_context_local_var->restricted_primary_rat_list = restricted_primary_rat_list; + ue_context_local_var->restricted_secondary_rat_list = restricted_secondary_rat_list; + ue_context_local_var->v2x_context = v2x_context; + ue_context_local_var->lte_cat_m_ind = lte_cat_m_ind; + ue_context_local_var->mo_exp_data_counter = mo_exp_data_counter; + + return ue_context_local_var; +} + +void OpenAPI_ue_context_free(OpenAPI_ue_context_t *ue_context) +{ + if (NULL == ue_context) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ue_context->supi); + OpenAPI_list_for_each(ue_context->gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_context->gpsi_list); + ogs_free(ue_context->pei); + ogs_free(ue_context->udm_group_id); + ogs_free(ue_context->ausf_group_id); + ogs_free(ue_context->routing_indicator); + OpenAPI_list_for_each(ue_context->group_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_context->group_list); + OpenAPI_ambr_free(ue_context->sub_ue_ambr); + ogs_free(ue_context->smsf_id); + OpenAPI_seaf_data_free(ue_context->seaf_data); + ogs_free(ue_context->pcf_id); + ogs_free(ue_context->pcf_set_id); + ogs_free(ue_context->pcf_amp_service_set_id); + ogs_free(ue_context->pcf_uep_service_set_id); + ogs_free(ue_context->pcf_am_policy_uri); + OpenAPI_list_free(ue_context->am_policy_req_trigger_list); + ogs_free(ue_context->pcf_ue_policy_uri); + OpenAPI_list_free(ue_context->ue_policy_req_trigger_list); + ogs_free(ue_context->hpcf_id); + OpenAPI_list_free(ue_context->restricted_rat_list); + OpenAPI_list_for_each(ue_context->forbidden_area_list, node) { + OpenAPI_area_free(node->data); + } + OpenAPI_list_free(ue_context->forbidden_area_list); + OpenAPI_service_area_restriction_free(ue_context->service_area_restriction); + OpenAPI_list_for_each(ue_context->restricted_core_nw_type_list, node) { + OpenAPI_core_network_type_free(node->data); + } + OpenAPI_list_free(ue_context->restricted_core_nw_type_list); + OpenAPI_list_for_each(ue_context->event_subscription_list, node) { + OpenAPI_amf_event_subscription_free(node->data); + } + OpenAPI_list_free(ue_context->event_subscription_list); + OpenAPI_list_for_each(ue_context->mm_context_list, node) { + OpenAPI_mm_context_free(node->data); + } + OpenAPI_list_free(ue_context->mm_context_list); + OpenAPI_list_for_each(ue_context->session_context_list, node) { + OpenAPI_pdu_session_context_free(node->data); + } + OpenAPI_list_free(ue_context->session_context_list); + OpenAPI_trace_data_free(ue_context->trace_data); + ogs_free(ue_context->service_gap_expiry_time); + ogs_free(ue_context->stn_sr); + ogs_free(ue_context->c_msisdn); + OpenAPI_list_for_each(ue_context->supported_codec_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_context->supported_codec_list); + OpenAPI_list_for_each(ue_context->small_data_rate_status_infos, node) { + OpenAPI_small_data_rate_status_info_free(node->data); + } + OpenAPI_list_free(ue_context->small_data_rate_status_infos); + OpenAPI_list_free(ue_context->restricted_primary_rat_list); + OpenAPI_list_free(ue_context->restricted_secondary_rat_list); + OpenAPI_list_for_each(ue_context->v2x_context, node) { + OpenAPI_v2x_context_free(node->data); + } + OpenAPI_list_free(ue_context->v2x_context); + OpenAPI_mo_exp_data_counter_free(ue_context->mo_exp_data_counter); + ogs_free(ue_context); +} + +cJSON *OpenAPI_ue_context_convertToJSON(OpenAPI_ue_context_t *ue_context) +{ + cJSON *item = NULL; + + if (ue_context == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [UeContext]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_context->supi) { + if (cJSON_AddStringToObject(item, "supi", ue_context->supi) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [supi]"); + goto end; + } + } + + if (ue_context->supi_unauth_ind) { + if (cJSON_AddBoolToObject(item, "supiUnauthInd", ue_context->supi_unauth_ind) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [supi_unauth_ind]"); + goto end; + } + } + + if (ue_context->gpsi_list) { + cJSON *gpsi_list = cJSON_AddArrayToObject(item, "gpsiList"); + if (gpsi_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [gpsi_list]"); + goto end; + } + + OpenAPI_lnode_t *gpsi_list_node; + OpenAPI_list_for_each(ue_context->gpsi_list, gpsi_list_node) { + if (cJSON_AddStringToObject(gpsi_list, "", (char*)gpsi_list_node->data) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [gpsi_list]"); + goto end; + } + } + } + + if (ue_context->pei) { + if (cJSON_AddStringToObject(item, "pei", ue_context->pei) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pei]"); + goto end; + } + } + + if (ue_context->udm_group_id) { + if (cJSON_AddStringToObject(item, "udmGroupId", ue_context->udm_group_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [udm_group_id]"); + goto end; + } + } + + if (ue_context->ausf_group_id) { + if (cJSON_AddStringToObject(item, "ausfGroupId", ue_context->ausf_group_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [ausf_group_id]"); + goto end; + } + } + + if (ue_context->routing_indicator) { + if (cJSON_AddStringToObject(item, "routingIndicator", ue_context->routing_indicator) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [routing_indicator]"); + goto end; + } + } + + if (ue_context->group_list) { + cJSON *group_list = cJSON_AddArrayToObject(item, "groupList"); + if (group_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [group_list]"); + goto end; + } + + OpenAPI_lnode_t *group_list_node; + OpenAPI_list_for_each(ue_context->group_list, group_list_node) { + if (cJSON_AddStringToObject(group_list, "", (char*)group_list_node->data) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [group_list]"); + goto end; + } + } + } + + if (ue_context->drx_parameter) { + if (cJSON_AddNumberToObject(item, "drxParameter", ue_context->drx_parameter) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [drx_parameter]"); + goto end; + } + } + + if (ue_context->sub_rfsp) { + if (cJSON_AddNumberToObject(item, "subRfsp", ue_context->sub_rfsp) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [sub_rfsp]"); + goto end; + } + } + + if (ue_context->used_rfsp) { + if (cJSON_AddNumberToObject(item, "usedRfsp", ue_context->used_rfsp) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [used_rfsp]"); + goto end; + } + } + + if (ue_context->sub_ue_ambr) { + cJSON *sub_ue_ambr_local_JSON = OpenAPI_ambr_convertToJSON(ue_context->sub_ue_ambr); + if (sub_ue_ambr_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [sub_ue_ambr]"); + goto end; + } + cJSON_AddItemToObject(item, "subUeAmbr", sub_ue_ambr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [sub_ue_ambr]"); + goto end; + } + } + + if (ue_context->smsf_id) { + if (cJSON_AddStringToObject(item, "smsfId", ue_context->smsf_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [smsf_id]"); + goto end; + } + } + + if (ue_context->seaf_data) { + cJSON *seaf_data_local_JSON = OpenAPI_seaf_data_convertToJSON(ue_context->seaf_data); + if (seaf_data_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [seaf_data]"); + goto end; + } + cJSON_AddItemToObject(item, "seafData", seaf_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [seaf_data]"); + goto end; + } + } + + if (ue_context->_5g_mm_capability) { + if (cJSON_AddNumberToObject(item, "5gMmCapability", ue_context->_5g_mm_capability) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [_5g_mm_capability]"); + goto end; + } + } + + if (ue_context->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", ue_context->pcf_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (ue_context->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", ue_context->pcf_set_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (ue_context->pcf_amp_service_set_id) { + if (cJSON_AddStringToObject(item, "pcfAmpServiceSetId", ue_context->pcf_amp_service_set_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_amp_service_set_id]"); + goto end; + } + } + + if (ue_context->pcf_uep_service_set_id) { + if (cJSON_AddStringToObject(item, "pcfUepServiceSetId", ue_context->pcf_uep_service_set_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_uep_service_set_id]"); + goto end; + } + } + + if (ue_context->pcf_binding) { + if (cJSON_AddStringToObject(item, "pcfBinding", OpenAPI_sbi_binding_level_ToString(ue_context->pcf_binding)) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_binding]"); + goto end; + } + } + + if (ue_context->pcf_am_policy_uri) { + if (cJSON_AddStringToObject(item, "pcfAmPolicyUri", ue_context->pcf_am_policy_uri) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_am_policy_uri]"); + goto end; + } + } + + if (ue_context->am_policy_req_trigger_list) { + cJSON *am_policy_req_trigger_list = cJSON_AddArrayToObject(item, "amPolicyReqTriggerList"); + if (am_policy_req_trigger_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [am_policy_req_trigger_list]"); + goto end; + } + OpenAPI_lnode_t *am_policy_req_trigger_list_node; + OpenAPI_list_for_each(ue_context->am_policy_req_trigger_list, am_policy_req_trigger_list_node) { + if (cJSON_AddStringToObject(am_policy_req_trigger_list, "", OpenAPI_policy_req_trigger_ToString((OpenAPI_policy_req_trigger_e)am_policy_req_trigger_list_node->data)) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [am_policy_req_trigger_list]"); + goto end; + } + } + } + + if (ue_context->pcf_ue_policy_uri) { + if (cJSON_AddStringToObject(item, "pcfUePolicyUri", ue_context->pcf_ue_policy_uri) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_ue_policy_uri]"); + goto end; + } + } + + if (ue_context->ue_policy_req_trigger_list) { + cJSON *ue_policy_req_trigger_list = cJSON_AddArrayToObject(item, "uePolicyReqTriggerList"); + if (ue_policy_req_trigger_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [ue_policy_req_trigger_list]"); + goto end; + } + OpenAPI_lnode_t *ue_policy_req_trigger_list_node; + OpenAPI_list_for_each(ue_context->ue_policy_req_trigger_list, ue_policy_req_trigger_list_node) { + if (cJSON_AddStringToObject(ue_policy_req_trigger_list, "", OpenAPI_policy_req_trigger_ToString((OpenAPI_policy_req_trigger_e)ue_policy_req_trigger_list_node->data)) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [ue_policy_req_trigger_list]"); + goto end; + } + } + } + + if (ue_context->hpcf_id) { + if (cJSON_AddStringToObject(item, "hpcfId", ue_context->hpcf_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [hpcf_id]"); + goto end; + } + } + + if (ue_context->restricted_rat_list) { + cJSON *restricted_rat_list = cJSON_AddArrayToObject(item, "restrictedRatList"); + if (restricted_rat_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [restricted_rat_list]"); + goto end; + } + OpenAPI_lnode_t *restricted_rat_list_node; + OpenAPI_list_for_each(ue_context->restricted_rat_list, restricted_rat_list_node) { + if (cJSON_AddStringToObject(restricted_rat_list, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)restricted_rat_list_node->data)) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [restricted_rat_list]"); + goto end; + } + } + } + + if (ue_context->forbidden_area_list) { + cJSON *forbidden_area_listList = cJSON_AddArrayToObject(item, "forbiddenAreaList"); + if (forbidden_area_listList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [forbidden_area_list]"); + goto end; + } + + OpenAPI_lnode_t *forbidden_area_list_node; + if (ue_context->forbidden_area_list) { + OpenAPI_list_for_each(ue_context->forbidden_area_list, forbidden_area_list_node) { + cJSON *itemLocal = OpenAPI_area_convertToJSON(forbidden_area_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [forbidden_area_list]"); + goto end; + } + cJSON_AddItemToArray(forbidden_area_listList, itemLocal); + } + } + } + + if (ue_context->service_area_restriction) { + cJSON *service_area_restriction_local_JSON = OpenAPI_service_area_restriction_convertToJSON(ue_context->service_area_restriction); + if (service_area_restriction_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [service_area_restriction]"); + goto end; + } + cJSON_AddItemToObject(item, "serviceAreaRestriction", service_area_restriction_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [service_area_restriction]"); + goto end; + } + } + + if (ue_context->restricted_core_nw_type_list) { + cJSON *restricted_core_nw_type_listList = cJSON_AddArrayToObject(item, "restrictedCoreNwTypeList"); + if (restricted_core_nw_type_listList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [restricted_core_nw_type_list]"); + goto end; + } + + OpenAPI_lnode_t *restricted_core_nw_type_list_node; + if (ue_context->restricted_core_nw_type_list) { + OpenAPI_list_for_each(ue_context->restricted_core_nw_type_list, restricted_core_nw_type_list_node) { + cJSON *itemLocal = OpenAPI_core_network_type_convertToJSON(restricted_core_nw_type_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [restricted_core_nw_type_list]"); + goto end; + } + cJSON_AddItemToArray(restricted_core_nw_type_listList, itemLocal); + } + } + } + + if (ue_context->event_subscription_list) { + cJSON *event_subscription_listList = cJSON_AddArrayToObject(item, "eventSubscriptionList"); + if (event_subscription_listList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [event_subscription_list]"); + goto end; + } + + OpenAPI_lnode_t *event_subscription_list_node; + if (ue_context->event_subscription_list) { + OpenAPI_list_for_each(ue_context->event_subscription_list, event_subscription_list_node) { + cJSON *itemLocal = OpenAPI_amf_event_subscription_convertToJSON(event_subscription_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [event_subscription_list]"); + goto end; + } + cJSON_AddItemToArray(event_subscription_listList, itemLocal); + } + } + } + + if (ue_context->mm_context_list) { + cJSON *mm_context_listList = cJSON_AddArrayToObject(item, "mmContextList"); + if (mm_context_listList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [mm_context_list]"); + goto end; + } + + OpenAPI_lnode_t *mm_context_list_node; + if (ue_context->mm_context_list) { + OpenAPI_list_for_each(ue_context->mm_context_list, mm_context_list_node) { + cJSON *itemLocal = OpenAPI_mm_context_convertToJSON(mm_context_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [mm_context_list]"); + goto end; + } + cJSON_AddItemToArray(mm_context_listList, itemLocal); + } + } + } + + if (ue_context->session_context_list) { + cJSON *session_context_listList = cJSON_AddArrayToObject(item, "sessionContextList"); + if (session_context_listList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [session_context_list]"); + goto end; + } + + OpenAPI_lnode_t *session_context_list_node; + if (ue_context->session_context_list) { + OpenAPI_list_for_each(ue_context->session_context_list, session_context_list_node) { + cJSON *itemLocal = OpenAPI_pdu_session_context_convertToJSON(session_context_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [session_context_list]"); + goto end; + } + cJSON_AddItemToArray(session_context_listList, itemLocal); + } + } + } + + if (ue_context->trace_data) { + cJSON *trace_data_local_JSON = OpenAPI_trace_data_convertToJSON(ue_context->trace_data); + if (trace_data_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [trace_data]"); + goto end; + } + cJSON_AddItemToObject(item, "traceData", trace_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [trace_data]"); + goto end; + } + } + + if (ue_context->service_gap_expiry_time) { + if (cJSON_AddStringToObject(item, "serviceGapExpiryTime", ue_context->service_gap_expiry_time) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [service_gap_expiry_time]"); + goto end; + } + } + + if (ue_context->stn_sr) { + if (cJSON_AddStringToObject(item, "stnSr", ue_context->stn_sr) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [stn_sr]"); + goto end; + } + } + + if (ue_context->c_msisdn) { + if (cJSON_AddStringToObject(item, "cMsisdn", ue_context->c_msisdn) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [c_msisdn]"); + goto end; + } + } + + if (ue_context->ms_classmark2) { + if (cJSON_AddNumberToObject(item, "msClassmark2", ue_context->ms_classmark2) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [ms_classmark2]"); + goto end; + } + } + + if (ue_context->supported_codec_list) { + cJSON *supported_codec_list = cJSON_AddArrayToObject(item, "supportedCodecList"); + if (supported_codec_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [supported_codec_list]"); + goto end; + } + + OpenAPI_lnode_t *supported_codec_list_node; + OpenAPI_list_for_each(ue_context->supported_codec_list, supported_codec_list_node) { + } + } + + if (ue_context->small_data_rate_status_infos) { + cJSON *small_data_rate_status_infosList = cJSON_AddArrayToObject(item, "smallDataRateStatusInfos"); + if (small_data_rate_status_infosList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [small_data_rate_status_infos]"); + goto end; + } + + OpenAPI_lnode_t *small_data_rate_status_infos_node; + if (ue_context->small_data_rate_status_infos) { + OpenAPI_list_for_each(ue_context->small_data_rate_status_infos, small_data_rate_status_infos_node) { + cJSON *itemLocal = OpenAPI_small_data_rate_status_info_convertToJSON(small_data_rate_status_infos_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [small_data_rate_status_infos]"); + goto end; + } + cJSON_AddItemToArray(small_data_rate_status_infosList, itemLocal); + } + } + } + + if (ue_context->restricted_primary_rat_list) { + cJSON *restricted_primary_rat_list = cJSON_AddArrayToObject(item, "restrictedPrimaryRatList"); + if (restricted_primary_rat_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [restricted_primary_rat_list]"); + goto end; + } + OpenAPI_lnode_t *restricted_primary_rat_list_node; + OpenAPI_list_for_each(ue_context->restricted_primary_rat_list, restricted_primary_rat_list_node) { + if (cJSON_AddStringToObject(restricted_primary_rat_list, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)restricted_primary_rat_list_node->data)) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [restricted_primary_rat_list]"); + goto end; + } + } + } + + if (ue_context->restricted_secondary_rat_list) { + cJSON *restricted_secondary_rat_list = cJSON_AddArrayToObject(item, "restrictedSecondaryRatList"); + if (restricted_secondary_rat_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [restricted_secondary_rat_list]"); + goto end; + } + OpenAPI_lnode_t *restricted_secondary_rat_list_node; + OpenAPI_list_for_each(ue_context->restricted_secondary_rat_list, restricted_secondary_rat_list_node) { + if (cJSON_AddStringToObject(restricted_secondary_rat_list, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)restricted_secondary_rat_list_node->data)) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [restricted_secondary_rat_list]"); + goto end; + } + } + } + + if (ue_context->v2x_context) { + cJSON *v2x_contextList = cJSON_AddArrayToObject(item, "v2xContext"); + if (v2x_contextList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [v2x_context]"); + goto end; + } + + OpenAPI_lnode_t *v2x_context_node; + if (ue_context->v2x_context) { + OpenAPI_list_for_each(ue_context->v2x_context, v2x_context_node) { + cJSON *itemLocal = OpenAPI_v2x_context_convertToJSON(v2x_context_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [v2x_context]"); + goto end; + } + cJSON_AddItemToArray(v2x_contextList, itemLocal); + } + } + } + + if (ue_context->lte_cat_m_ind) { + if (cJSON_AddBoolToObject(item, "lteCatMInd", ue_context->lte_cat_m_ind) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [lte_cat_m_ind]"); + goto end; + } + } + + if (ue_context->mo_exp_data_counter) { + cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(ue_context->mo_exp_data_counter); + if (mo_exp_data_counter_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + cJSON_AddItemToObject(item, "moExpDataCounter", mo_exp_data_counter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [mo_exp_data_counter]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) +{ + OpenAPI_ue_context_t *ue_context_local_var = NULL; + cJSON *supi = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "supi"); + + if (supi) { + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [supi]"); + goto end; + } + } + + cJSON *supi_unauth_ind = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "supiUnauthInd"); + + if (supi_unauth_ind) { + if (!cJSON_IsBool(supi_unauth_ind)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [supi_unauth_ind]"); + goto end; + } + } + + cJSON *gpsi_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "gpsiList"); + + OpenAPI_list_t *gpsi_listList; + if (gpsi_list) { + cJSON *gpsi_list_local; + if (!cJSON_IsArray(gpsi_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [gpsi_list]"); + goto end; + } + gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_list_local, gpsi_list) { + if (!cJSON_IsString(gpsi_list_local)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [gpsi_list]"); + goto end; + } + OpenAPI_list_add(gpsi_listList, ogs_strdup(gpsi_list_local->valuestring)); + } + } + + cJSON *pei = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pei"); + + if (pei) { + if (!cJSON_IsString(pei)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pei]"); + goto end; + } + } + + cJSON *udm_group_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "udmGroupId"); + + if (udm_group_id) { + if (!cJSON_IsString(udm_group_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [udm_group_id]"); + goto end; + } + } + + cJSON *ausf_group_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "ausfGroupId"); + + if (ausf_group_id) { + if (!cJSON_IsString(ausf_group_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [ausf_group_id]"); + goto end; + } + } + + cJSON *routing_indicator = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "routingIndicator"); + + if (routing_indicator) { + if (!cJSON_IsString(routing_indicator)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [routing_indicator]"); + goto end; + } + } + + cJSON *group_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "groupList"); + + OpenAPI_list_t *group_listList; + if (group_list) { + cJSON *group_list_local; + if (!cJSON_IsArray(group_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [group_list]"); + goto end; + } + group_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(group_list_local, group_list) { + if (!cJSON_IsString(group_list_local)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [group_list]"); + goto end; + } + OpenAPI_list_add(group_listList, ogs_strdup(group_list_local->valuestring)); + } + } + + cJSON *drx_parameter = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "drxParameter"); + + if (drx_parameter) { + if (!cJSON_IsNumber(drx_parameter)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [drx_parameter]"); + goto end; + } + } + + cJSON *sub_rfsp = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "subRfsp"); + + if (sub_rfsp) { + if (!cJSON_IsNumber(sub_rfsp)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [sub_rfsp]"); + goto end; + } + } + + cJSON *used_rfsp = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "usedRfsp"); + + if (used_rfsp) { + if (!cJSON_IsNumber(used_rfsp)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [used_rfsp]"); + goto end; + } + } + + cJSON *sub_ue_ambr = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "subUeAmbr"); + + OpenAPI_ambr_t *sub_ue_ambr_local_nonprim = NULL; + if (sub_ue_ambr) { + sub_ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(sub_ue_ambr); + } + + cJSON *smsf_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "smsfId"); + + if (smsf_id) { + if (!cJSON_IsString(smsf_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [smsf_id]"); + goto end; + } + } + + cJSON *seaf_data = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "seafData"); + + OpenAPI_seaf_data_t *seaf_data_local_nonprim = NULL; + if (seaf_data) { + seaf_data_local_nonprim = OpenAPI_seaf_data_parseFromJSON(seaf_data); + } + + cJSON *_5g_mm_capability = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "5gMmCapability"); + + if (_5g_mm_capability) { + if (!cJSON_IsNumber(_5g_mm_capability)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [_5g_mm_capability]"); + goto end; + } + } + + cJSON *pcf_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfId"); + + if (pcf_id) { + if (!cJSON_IsString(pcf_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + cJSON *pcf_set_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfSetId"); + + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + cJSON *pcf_amp_service_set_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfAmpServiceSetId"); + + if (pcf_amp_service_set_id) { + if (!cJSON_IsString(pcf_amp_service_set_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_amp_service_set_id]"); + goto end; + } + } + + cJSON *pcf_uep_service_set_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfUepServiceSetId"); + + if (pcf_uep_service_set_id) { + if (!cJSON_IsString(pcf_uep_service_set_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_uep_service_set_id]"); + goto end; + } + } + + cJSON *pcf_binding = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfBinding"); + + OpenAPI_sbi_binding_level_e pcf_bindingVariable; + if (pcf_binding) { + if (!cJSON_IsString(pcf_binding)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_binding]"); + goto end; + } + pcf_bindingVariable = OpenAPI_sbi_binding_level_FromString(pcf_binding->valuestring); + } + + cJSON *pcf_am_policy_uri = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfAmPolicyUri"); + + if (pcf_am_policy_uri) { + if (!cJSON_IsString(pcf_am_policy_uri)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_am_policy_uri]"); + goto end; + } + } + + cJSON *am_policy_req_trigger_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "amPolicyReqTriggerList"); + + OpenAPI_list_t *am_policy_req_trigger_listList; + if (am_policy_req_trigger_list) { + cJSON *am_policy_req_trigger_list_local_nonprimitive; + if (!cJSON_IsArray(am_policy_req_trigger_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [am_policy_req_trigger_list]"); + goto end; + } + + am_policy_req_trigger_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(am_policy_req_trigger_list_local_nonprimitive, am_policy_req_trigger_list ) { + if (!cJSON_IsString(am_policy_req_trigger_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [am_policy_req_trigger_list]"); + goto end; + } + + OpenAPI_list_add(am_policy_req_trigger_listList, (void *)OpenAPI_policy_req_trigger_FromString(am_policy_req_trigger_list_local_nonprimitive->valuestring)); + } + } + + cJSON *pcf_ue_policy_uri = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfUePolicyUri"); + + if (pcf_ue_policy_uri) { + if (!cJSON_IsString(pcf_ue_policy_uri)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_ue_policy_uri]"); + goto end; + } + } + + cJSON *ue_policy_req_trigger_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "uePolicyReqTriggerList"); + + OpenAPI_list_t *ue_policy_req_trigger_listList; + if (ue_policy_req_trigger_list) { + cJSON *ue_policy_req_trigger_list_local_nonprimitive; + if (!cJSON_IsArray(ue_policy_req_trigger_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [ue_policy_req_trigger_list]"); + goto end; + } + + ue_policy_req_trigger_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_policy_req_trigger_list_local_nonprimitive, ue_policy_req_trigger_list ) { + if (!cJSON_IsString(ue_policy_req_trigger_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [ue_policy_req_trigger_list]"); + goto end; + } + + OpenAPI_list_add(ue_policy_req_trigger_listList, (void *)OpenAPI_policy_req_trigger_FromString(ue_policy_req_trigger_list_local_nonprimitive->valuestring)); + } + } + + cJSON *hpcf_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "hpcfId"); + + if (hpcf_id) { + if (!cJSON_IsString(hpcf_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [hpcf_id]"); + goto end; + } + } + + cJSON *restricted_rat_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "restrictedRatList"); + + OpenAPI_list_t *restricted_rat_listList; + if (restricted_rat_list) { + cJSON *restricted_rat_list_local_nonprimitive; + if (!cJSON_IsArray(restricted_rat_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [restricted_rat_list]"); + goto end; + } + + restricted_rat_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(restricted_rat_list_local_nonprimitive, restricted_rat_list ) { + if (!cJSON_IsString(restricted_rat_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [restricted_rat_list]"); + goto end; + } + + OpenAPI_list_add(restricted_rat_listList, (void *)OpenAPI_rat_type_FromString(restricted_rat_list_local_nonprimitive->valuestring)); + } + } + + cJSON *forbidden_area_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "forbiddenAreaList"); + + OpenAPI_list_t *forbidden_area_listList; + if (forbidden_area_list) { + cJSON *forbidden_area_list_local_nonprimitive; + if (!cJSON_IsArray(forbidden_area_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [forbidden_area_list]"); + goto end; + } + + forbidden_area_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(forbidden_area_list_local_nonprimitive, forbidden_area_list ) { + if (!cJSON_IsObject(forbidden_area_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [forbidden_area_list]"); + goto end; + } + OpenAPI_area_t *forbidden_area_listItem = OpenAPI_area_parseFromJSON(forbidden_area_list_local_nonprimitive); + + OpenAPI_list_add(forbidden_area_listList, forbidden_area_listItem); + } + } + + cJSON *service_area_restriction = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "serviceAreaRestriction"); + + OpenAPI_service_area_restriction_t *service_area_restriction_local_nonprim = NULL; + if (service_area_restriction) { + service_area_restriction_local_nonprim = OpenAPI_service_area_restriction_parseFromJSON(service_area_restriction); + } + + cJSON *restricted_core_nw_type_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "restrictedCoreNwTypeList"); + + OpenAPI_list_t *restricted_core_nw_type_listList; + if (restricted_core_nw_type_list) { + cJSON *restricted_core_nw_type_list_local_nonprimitive; + if (!cJSON_IsArray(restricted_core_nw_type_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [restricted_core_nw_type_list]"); + goto end; + } + + restricted_core_nw_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(restricted_core_nw_type_list_local_nonprimitive, restricted_core_nw_type_list ) { + if (!cJSON_IsObject(restricted_core_nw_type_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [restricted_core_nw_type_list]"); + goto end; + } + OpenAPI_core_network_type_t *restricted_core_nw_type_listItem = OpenAPI_core_network_type_parseFromJSON(restricted_core_nw_type_list_local_nonprimitive); + + OpenAPI_list_add(restricted_core_nw_type_listList, restricted_core_nw_type_listItem); + } + } + + cJSON *event_subscription_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "eventSubscriptionList"); + + OpenAPI_list_t *event_subscription_listList; + if (event_subscription_list) { + cJSON *event_subscription_list_local_nonprimitive; + if (!cJSON_IsArray(event_subscription_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [event_subscription_list]"); + goto end; + } + + event_subscription_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_subscription_list_local_nonprimitive, event_subscription_list ) { + if (!cJSON_IsObject(event_subscription_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [event_subscription_list]"); + goto end; + } + OpenAPI_amf_event_subscription_t *event_subscription_listItem = OpenAPI_amf_event_subscription_parseFromJSON(event_subscription_list_local_nonprimitive); + + OpenAPI_list_add(event_subscription_listList, event_subscription_listItem); + } + } + + cJSON *mm_context_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "mmContextList"); + + OpenAPI_list_t *mm_context_listList; + if (mm_context_list) { + cJSON *mm_context_list_local_nonprimitive; + if (!cJSON_IsArray(mm_context_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [mm_context_list]"); + goto end; + } + + mm_context_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mm_context_list_local_nonprimitive, mm_context_list ) { + if (!cJSON_IsObject(mm_context_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [mm_context_list]"); + goto end; + } + OpenAPI_mm_context_t *mm_context_listItem = OpenAPI_mm_context_parseFromJSON(mm_context_list_local_nonprimitive); + + OpenAPI_list_add(mm_context_listList, mm_context_listItem); + } + } + + cJSON *session_context_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "sessionContextList"); + + OpenAPI_list_t *session_context_listList; + if (session_context_list) { + cJSON *session_context_list_local_nonprimitive; + if (!cJSON_IsArray(session_context_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [session_context_list]"); + goto end; + } + + session_context_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(session_context_list_local_nonprimitive, session_context_list ) { + if (!cJSON_IsObject(session_context_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [session_context_list]"); + goto end; + } + OpenAPI_pdu_session_context_t *session_context_listItem = OpenAPI_pdu_session_context_parseFromJSON(session_context_list_local_nonprimitive); + + OpenAPI_list_add(session_context_listList, session_context_listItem); + } + } + + cJSON *trace_data = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "traceData"); + + OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; + if (trace_data) { + trace_data_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_data); + } + + cJSON *service_gap_expiry_time = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "serviceGapExpiryTime"); + + if (service_gap_expiry_time) { + if (!cJSON_IsString(service_gap_expiry_time)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [service_gap_expiry_time]"); + goto end; + } + } + + cJSON *stn_sr = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "stnSr"); + + if (stn_sr) { + if (!cJSON_IsString(stn_sr)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [stn_sr]"); + goto end; + } + } + + cJSON *c_msisdn = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "cMsisdn"); + + if (c_msisdn) { + if (!cJSON_IsString(c_msisdn)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [c_msisdn]"); + goto end; + } + } + + cJSON *ms_classmark2 = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "msClassmark2"); + + if (ms_classmark2) { + if (!cJSON_IsNumber(ms_classmark2)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [ms_classmark2]"); + goto end; + } + } + + cJSON *supported_codec_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "supportedCodecList"); + + OpenAPI_list_t *supported_codec_listList; + if (supported_codec_list) { + cJSON *supported_codec_list_local; + if (!cJSON_IsArray(supported_codec_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [supported_codec_list]"); + goto end; + } + supported_codec_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supported_codec_list_local, supported_codec_list) { + } + } + + cJSON *small_data_rate_status_infos = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "smallDataRateStatusInfos"); + + OpenAPI_list_t *small_data_rate_status_infosList; + if (small_data_rate_status_infos) { + cJSON *small_data_rate_status_infos_local_nonprimitive; + if (!cJSON_IsArray(small_data_rate_status_infos)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [small_data_rate_status_infos]"); + goto end; + } + + small_data_rate_status_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(small_data_rate_status_infos_local_nonprimitive, small_data_rate_status_infos ) { + if (!cJSON_IsObject(small_data_rate_status_infos_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [small_data_rate_status_infos]"); + goto end; + } + OpenAPI_small_data_rate_status_info_t *small_data_rate_status_infosItem = OpenAPI_small_data_rate_status_info_parseFromJSON(small_data_rate_status_infos_local_nonprimitive); + + OpenAPI_list_add(small_data_rate_status_infosList, small_data_rate_status_infosItem); + } + } + + cJSON *restricted_primary_rat_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "restrictedPrimaryRatList"); + + OpenAPI_list_t *restricted_primary_rat_listList; + if (restricted_primary_rat_list) { + cJSON *restricted_primary_rat_list_local_nonprimitive; + if (!cJSON_IsArray(restricted_primary_rat_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [restricted_primary_rat_list]"); + goto end; + } + + restricted_primary_rat_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(restricted_primary_rat_list_local_nonprimitive, restricted_primary_rat_list ) { + if (!cJSON_IsString(restricted_primary_rat_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [restricted_primary_rat_list]"); + goto end; + } + + OpenAPI_list_add(restricted_primary_rat_listList, (void *)OpenAPI_rat_type_FromString(restricted_primary_rat_list_local_nonprimitive->valuestring)); + } + } + + cJSON *restricted_secondary_rat_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "restrictedSecondaryRatList"); + + OpenAPI_list_t *restricted_secondary_rat_listList; + if (restricted_secondary_rat_list) { + cJSON *restricted_secondary_rat_list_local_nonprimitive; + if (!cJSON_IsArray(restricted_secondary_rat_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [restricted_secondary_rat_list]"); + goto end; + } + + restricted_secondary_rat_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(restricted_secondary_rat_list_local_nonprimitive, restricted_secondary_rat_list ) { + if (!cJSON_IsString(restricted_secondary_rat_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [restricted_secondary_rat_list]"); + goto end; + } + + OpenAPI_list_add(restricted_secondary_rat_listList, (void *)OpenAPI_rat_type_FromString(restricted_secondary_rat_list_local_nonprimitive->valuestring)); + } + } + + cJSON *v2x_context = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "v2xContext"); + + OpenAPI_list_t *v2x_contextList; + if (v2x_context) { + cJSON *v2x_context_local_nonprimitive; + if (!cJSON_IsArray(v2x_context)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [v2x_context]"); + goto end; + } + + v2x_contextList = OpenAPI_list_create(); + + cJSON_ArrayForEach(v2x_context_local_nonprimitive, v2x_context ) { + if (!cJSON_IsObject(v2x_context_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [v2x_context]"); + goto end; + } + OpenAPI_v2x_context_t *v2x_contextItem = OpenAPI_v2x_context_parseFromJSON(v2x_context_local_nonprimitive); + + OpenAPI_list_add(v2x_contextList, v2x_contextItem); + } + } + + cJSON *lte_cat_m_ind = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "lteCatMInd"); + + if (lte_cat_m_ind) { + if (!cJSON_IsBool(lte_cat_m_ind)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [lte_cat_m_ind]"); + goto end; + } + } + + cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "moExpDataCounter"); + + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; + if (mo_exp_data_counter) { + mo_exp_data_counter_local_nonprim = OpenAPI_mo_exp_data_counter_parseFromJSON(mo_exp_data_counter); + } + + ue_context_local_var = OpenAPI_ue_context_create ( + supi ? ogs_strdup(supi->valuestring) : NULL, + supi_unauth_ind ? supi_unauth_ind->valueint : 0, + gpsi_list ? gpsi_listList : NULL, + pei ? ogs_strdup(pei->valuestring) : NULL, + udm_group_id ? ogs_strdup(udm_group_id->valuestring) : NULL, + ausf_group_id ? ogs_strdup(ausf_group_id->valuestring) : NULL, + routing_indicator ? ogs_strdup(routing_indicator->valuestring) : NULL, + group_list ? group_listList : NULL, + drx_parameter ? drx_parameter->valueint : 0, + sub_rfsp ? sub_rfsp->valuedouble : 0, + used_rfsp ? used_rfsp->valuedouble : 0, + sub_ue_ambr ? sub_ue_ambr_local_nonprim : NULL, + smsf_id ? ogs_strdup(smsf_id->valuestring) : NULL, + seaf_data ? seaf_data_local_nonprim : NULL, + _5g_mm_capability ? _5g_mm_capability->valueint : 0, + pcf_id ? ogs_strdup(pcf_id->valuestring) : NULL, + pcf_set_id ? ogs_strdup(pcf_set_id->valuestring) : NULL, + pcf_amp_service_set_id ? ogs_strdup(pcf_amp_service_set_id->valuestring) : NULL, + pcf_uep_service_set_id ? ogs_strdup(pcf_uep_service_set_id->valuestring) : NULL, + pcf_binding ? pcf_bindingVariable : 0, + pcf_am_policy_uri ? ogs_strdup(pcf_am_policy_uri->valuestring) : NULL, + am_policy_req_trigger_list ? am_policy_req_trigger_listList : NULL, + pcf_ue_policy_uri ? ogs_strdup(pcf_ue_policy_uri->valuestring) : NULL, + ue_policy_req_trigger_list ? ue_policy_req_trigger_listList : NULL, + hpcf_id ? ogs_strdup(hpcf_id->valuestring) : NULL, + restricted_rat_list ? restricted_rat_listList : NULL, + forbidden_area_list ? forbidden_area_listList : NULL, + service_area_restriction ? service_area_restriction_local_nonprim : NULL, + restricted_core_nw_type_list ? restricted_core_nw_type_listList : NULL, + event_subscription_list ? event_subscription_listList : NULL, + mm_context_list ? mm_context_listList : NULL, + session_context_list ? session_context_listList : NULL, + trace_data ? trace_data_local_nonprim : NULL, + service_gap_expiry_time ? ogs_strdup(service_gap_expiry_time->valuestring) : NULL, + stn_sr ? ogs_strdup(stn_sr->valuestring) : NULL, + c_msisdn ? ogs_strdup(c_msisdn->valuestring) : NULL, + ms_classmark2 ? ms_classmark2->valueint : 0, + supported_codec_list ? supported_codec_listList : NULL, + small_data_rate_status_infos ? small_data_rate_status_infosList : NULL, + restricted_primary_rat_list ? restricted_primary_rat_listList : NULL, + restricted_secondary_rat_list ? restricted_secondary_rat_listList : NULL, + v2x_context ? v2x_contextList : NULL, + lte_cat_m_ind ? lte_cat_m_ind->valueint : 0, + mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL + ); + + return ue_context_local_var; +end: + return NULL; +} + +OpenAPI_ue_context_t *OpenAPI_ue_context_copy(OpenAPI_ue_context_t *dst, OpenAPI_ue_context_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_context_free(dst); + dst = OpenAPI_ue_context_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context.h b/lib/sbi/openapi/model/ue_context.h new file mode 100644 index 000000000..3555a7533 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context.h @@ -0,0 +1,139 @@ +/* + * ue_context.h + * + * + */ + +#ifndef _OpenAPI_ue_context_H_ +#define _OpenAPI_ue_context_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ambr.h" +#include "amf_event_subscription.h" +#include "area.h" +#include "core_network_type.h" +#include "mm_context.h" +#include "mo_exp_data_counter.h" +#include "pdu_session_context.h" +#include "policy_req_trigger.h" +#include "rat_type.h" +#include "sbi_binding_level.h" +#include "seaf_data.h" +#include "service_area_restriction.h" +#include "small_data_rate_status_info.h" +#include "trace_data.h" +#include "v2x_context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_s OpenAPI_ue_context_t; +typedef struct OpenAPI_ue_context_s { + char *supi; + int supi_unauth_ind; + OpenAPI_list_t *gpsi_list; + char *pei; + char *udm_group_id; + char *ausf_group_id; + char *routing_indicator; + OpenAPI_list_t *group_list; + char drx_parameter; + int sub_rfsp; + int used_rfsp; + struct OpenAPI_ambr_s *sub_ue_ambr; + char *smsf_id; + struct OpenAPI_seaf_data_s *seaf_data; + char _5g_mm_capability; + char *pcf_id; + char *pcf_set_id; + char *pcf_amp_service_set_id; + char *pcf_uep_service_set_id; + OpenAPI_sbi_binding_level_e pcf_binding; + char *pcf_am_policy_uri; + OpenAPI_list_t *am_policy_req_trigger_list; + char *pcf_ue_policy_uri; + OpenAPI_list_t *ue_policy_req_trigger_list; + char *hpcf_id; + OpenAPI_list_t *restricted_rat_list; + OpenAPI_list_t *forbidden_area_list; + struct OpenAPI_service_area_restriction_s *service_area_restriction; + OpenAPI_list_t *restricted_core_nw_type_list; + OpenAPI_list_t *event_subscription_list; + OpenAPI_list_t *mm_context_list; + OpenAPI_list_t *session_context_list; + struct OpenAPI_trace_data_s *trace_data; + char *service_gap_expiry_time; + char *stn_sr; + char *c_msisdn; + char ms_classmark2; + OpenAPI_list_t *supported_codec_list; + OpenAPI_list_t *small_data_rate_status_infos; + OpenAPI_list_t *restricted_primary_rat_list; + OpenAPI_list_t *restricted_secondary_rat_list; + OpenAPI_list_t *v2x_context; + int lte_cat_m_ind; + struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; +} OpenAPI_ue_context_t; + +OpenAPI_ue_context_t *OpenAPI_ue_context_create( + char *supi, + int supi_unauth_ind, + OpenAPI_list_t *gpsi_list, + char *pei, + char *udm_group_id, + char *ausf_group_id, + char *routing_indicator, + OpenAPI_list_t *group_list, + char drx_parameter, + int sub_rfsp, + int used_rfsp, + OpenAPI_ambr_t *sub_ue_ambr, + char *smsf_id, + OpenAPI_seaf_data_t *seaf_data, + char _5g_mm_capability, + char *pcf_id, + char *pcf_set_id, + char *pcf_amp_service_set_id, + char *pcf_uep_service_set_id, + OpenAPI_sbi_binding_level_e pcf_binding, + char *pcf_am_policy_uri, + OpenAPI_list_t *am_policy_req_trigger_list, + char *pcf_ue_policy_uri, + OpenAPI_list_t *ue_policy_req_trigger_list, + char *hpcf_id, + OpenAPI_list_t *restricted_rat_list, + OpenAPI_list_t *forbidden_area_list, + OpenAPI_service_area_restriction_t *service_area_restriction, + OpenAPI_list_t *restricted_core_nw_type_list, + OpenAPI_list_t *event_subscription_list, + OpenAPI_list_t *mm_context_list, + OpenAPI_list_t *session_context_list, + OpenAPI_trace_data_t *trace_data, + char *service_gap_expiry_time, + char *stn_sr, + char *c_msisdn, + char ms_classmark2, + OpenAPI_list_t *supported_codec_list, + OpenAPI_list_t *small_data_rate_status_infos, + OpenAPI_list_t *restricted_primary_rat_list, + OpenAPI_list_t *restricted_secondary_rat_list, + OpenAPI_list_t *v2x_context, + int lte_cat_m_ind, + OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter + ); +void OpenAPI_ue_context_free(OpenAPI_ue_context_t *ue_context); +OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON); +cJSON *OpenAPI_ue_context_convertToJSON(OpenAPI_ue_context_t *ue_context); +OpenAPI_ue_context_t *OpenAPI_ue_context_copy(OpenAPI_ue_context_t *dst, OpenAPI_ue_context_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_create_data.c b/lib/sbi/openapi/model/ue_context_create_data.c new file mode 100644 index 000000000..826ec539e --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_create_data.c @@ -0,0 +1,334 @@ + +#include +#include +#include +#include "ue_context_create_data.h" + +OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_create( + OpenAPI_ue_context_t *ue_context, + OpenAPI_ng_ran_target_id_t *target_id, + OpenAPI_n2_info_content_t *source_to_target_data, + OpenAPI_list_t *pdu_session_list, + char mme_control_fteid, + char *n2_notify_uri, + OpenAPI_n2_info_content_t *ue_radio_capability, + OpenAPI_ng_ap_cause_t *ngap_cause, + char *supported_features + ) +{ + OpenAPI_ue_context_create_data_t *ue_context_create_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_context_create_data_t)); + if (!ue_context_create_data_local_var) { + return NULL; + } + ue_context_create_data_local_var->ue_context = ue_context; + ue_context_create_data_local_var->target_id = target_id; + ue_context_create_data_local_var->source_to_target_data = source_to_target_data; + ue_context_create_data_local_var->pdu_session_list = pdu_session_list; + ue_context_create_data_local_var->mme_control_fteid = mme_control_fteid; + ue_context_create_data_local_var->n2_notify_uri = n2_notify_uri; + ue_context_create_data_local_var->ue_radio_capability = ue_radio_capability; + ue_context_create_data_local_var->ngap_cause = ngap_cause; + ue_context_create_data_local_var->supported_features = supported_features; + + return ue_context_create_data_local_var; +} + +void OpenAPI_ue_context_create_data_free(OpenAPI_ue_context_create_data_t *ue_context_create_data) +{ + if (NULL == ue_context_create_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ue_context_free(ue_context_create_data->ue_context); + OpenAPI_ng_ran_target_id_free(ue_context_create_data->target_id); + OpenAPI_n2_info_content_free(ue_context_create_data->source_to_target_data); + OpenAPI_list_for_each(ue_context_create_data->pdu_session_list, node) { + OpenAPI_n2_sm_information_free(node->data); + } + OpenAPI_list_free(ue_context_create_data->pdu_session_list); + ogs_free(ue_context_create_data->n2_notify_uri); + OpenAPI_n2_info_content_free(ue_context_create_data->ue_radio_capability); + OpenAPI_ng_ap_cause_free(ue_context_create_data->ngap_cause); + ogs_free(ue_context_create_data->supported_features); + ogs_free(ue_context_create_data); +} + +cJSON *OpenAPI_ue_context_create_data_convertToJSON(OpenAPI_ue_context_create_data_t *ue_context_create_data) +{ + cJSON *item = NULL; + + if (ue_context_create_data == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [UeContextCreateData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_context_create_data->ue_context) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ue_context]"); + goto end; + } + cJSON *ue_context_local_JSON = OpenAPI_ue_context_convertToJSON(ue_context_create_data->ue_context); + if (ue_context_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ue_context]"); + goto end; + } + cJSON_AddItemToObject(item, "ueContext", ue_context_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ue_context]"); + goto end; + } + + if (!ue_context_create_data->target_id) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [target_id]"); + goto end; + } + cJSON *target_id_local_JSON = OpenAPI_ng_ran_target_id_convertToJSON(ue_context_create_data->target_id); + if (target_id_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [target_id]"); + goto end; + } + cJSON_AddItemToObject(item, "targetId", target_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [target_id]"); + goto end; + } + + if (!ue_context_create_data->source_to_target_data) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [source_to_target_data]"); + goto end; + } + cJSON *source_to_target_data_local_JSON = OpenAPI_n2_info_content_convertToJSON(ue_context_create_data->source_to_target_data); + if (source_to_target_data_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [source_to_target_data]"); + goto end; + } + cJSON_AddItemToObject(item, "sourceToTargetData", source_to_target_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [source_to_target_data]"); + goto end; + } + + if (!ue_context_create_data->pdu_session_list) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [pdu_session_list]"); + goto end; + } + cJSON *pdu_session_listList = cJSON_AddArrayToObject(item, "pduSessionList"); + if (pdu_session_listList == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [pdu_session_list]"); + goto end; + } + + OpenAPI_lnode_t *pdu_session_list_node; + if (ue_context_create_data->pdu_session_list) { + OpenAPI_list_for_each(ue_context_create_data->pdu_session_list, pdu_session_list_node) { + cJSON *itemLocal = OpenAPI_n2_sm_information_convertToJSON(pdu_session_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [pdu_session_list]"); + goto end; + } + cJSON_AddItemToArray(pdu_session_listList, itemLocal); + } + } + + if (ue_context_create_data->mme_control_fteid) { + if (cJSON_AddNumberToObject(item, "mmeControlFteid", ue_context_create_data->mme_control_fteid) == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [mme_control_fteid]"); + goto end; + } + } + + if (ue_context_create_data->n2_notify_uri) { + if (cJSON_AddStringToObject(item, "n2NotifyUri", ue_context_create_data->n2_notify_uri) == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [n2_notify_uri]"); + goto end; + } + } + + if (ue_context_create_data->ue_radio_capability) { + cJSON *ue_radio_capability_local_JSON = OpenAPI_n2_info_content_convertToJSON(ue_context_create_data->ue_radio_capability); + if (ue_radio_capability_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ue_radio_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "ueRadioCapability", ue_radio_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ue_radio_capability]"); + goto end; + } + } + + if (ue_context_create_data->ngap_cause) { + cJSON *ngap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(ue_context_create_data->ngap_cause); + if (ngap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ngap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngapCause", ngap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ngap_cause]"); + goto end; + } + } + + if (ue_context_create_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ue_context_create_data->supported_features) == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_parseFromJSON(cJSON *ue_context_create_dataJSON) +{ + OpenAPI_ue_context_create_data_t *ue_context_create_data_local_var = NULL; + cJSON *ue_context = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "ueContext"); + if (!ue_context) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [ue_context]"); + goto end; + } + + OpenAPI_ue_context_t *ue_context_local_nonprim = NULL; + + ue_context_local_nonprim = OpenAPI_ue_context_parseFromJSON(ue_context); + + cJSON *target_id = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "targetId"); + if (!target_id) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [target_id]"); + goto end; + } + + OpenAPI_ng_ran_target_id_t *target_id_local_nonprim = NULL; + + target_id_local_nonprim = OpenAPI_ng_ran_target_id_parseFromJSON(target_id); + + cJSON *source_to_target_data = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "sourceToTargetData"); + if (!source_to_target_data) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [source_to_target_data]"); + goto end; + } + + OpenAPI_n2_info_content_t *source_to_target_data_local_nonprim = NULL; + + source_to_target_data_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(source_to_target_data); + + cJSON *pdu_session_list = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "pduSessionList"); + if (!pdu_session_list) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [pdu_session_list]"); + goto end; + } + + OpenAPI_list_t *pdu_session_listList; + + cJSON *pdu_session_list_local_nonprimitive; + if (!cJSON_IsArray(pdu_session_list)) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [pdu_session_list]"); + goto end; + } + + pdu_session_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pdu_session_list_local_nonprimitive, pdu_session_list ) { + if (!cJSON_IsObject(pdu_session_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [pdu_session_list]"); + goto end; + } + OpenAPI_n2_sm_information_t *pdu_session_listItem = OpenAPI_n2_sm_information_parseFromJSON(pdu_session_list_local_nonprimitive); + + OpenAPI_list_add(pdu_session_listList, pdu_session_listItem); + } + + cJSON *mme_control_fteid = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "mmeControlFteid"); + + if (mme_control_fteid) { + if (!cJSON_IsNumber(mme_control_fteid)) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [mme_control_fteid]"); + goto end; + } + } + + cJSON *n2_notify_uri = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "n2NotifyUri"); + + if (n2_notify_uri) { + if (!cJSON_IsString(n2_notify_uri)) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [n2_notify_uri]"); + goto end; + } + } + + cJSON *ue_radio_capability = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "ueRadioCapability"); + + OpenAPI_n2_info_content_t *ue_radio_capability_local_nonprim = NULL; + if (ue_radio_capability) { + ue_radio_capability_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(ue_radio_capability); + } + + cJSON *ngap_cause = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "ngapCause"); + + OpenAPI_ng_ap_cause_t *ngap_cause_local_nonprim = NULL; + if (ngap_cause) { + ngap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ngap_cause); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_ue_context_create_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + ue_context_create_data_local_var = OpenAPI_ue_context_create_data_create ( + ue_context_local_nonprim, + target_id_local_nonprim, + source_to_target_data_local_nonprim, + pdu_session_listList, + mme_control_fteid ? mme_control_fteid->valueint : 0, + n2_notify_uri ? ogs_strdup(n2_notify_uri->valuestring) : NULL, + ue_radio_capability ? ue_radio_capability_local_nonprim : NULL, + ngap_cause ? ngap_cause_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return ue_context_create_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_copy(OpenAPI_ue_context_create_data_t *dst, OpenAPI_ue_context_create_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_create_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_create_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_ue_context_create_data_free(dst); + dst = OpenAPI_ue_context_create_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_create_data.h b/lib/sbi/openapi/model/ue_context_create_data.h new file mode 100644 index 000000000..9864a2a42 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_create_data.h @@ -0,0 +1,59 @@ +/* + * ue_context_create_data.h + * + * + */ + +#ifndef _OpenAPI_ue_context_create_data_H_ +#define _OpenAPI_ue_context_create_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" +#include "n2_sm_information.h" +#include "ng_ap_cause.h" +#include "ng_ran_target_id.h" +#include "ue_context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_create_data_s OpenAPI_ue_context_create_data_t; +typedef struct OpenAPI_ue_context_create_data_s { + struct OpenAPI_ue_context_s *ue_context; + struct OpenAPI_ng_ran_target_id_s *target_id; + struct OpenAPI_n2_info_content_s *source_to_target_data; + OpenAPI_list_t *pdu_session_list; + char mme_control_fteid; + char *n2_notify_uri; + struct OpenAPI_n2_info_content_s *ue_radio_capability; + struct OpenAPI_ng_ap_cause_s *ngap_cause; + char *supported_features; +} OpenAPI_ue_context_create_data_t; + +OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_create( + OpenAPI_ue_context_t *ue_context, + OpenAPI_ng_ran_target_id_t *target_id, + OpenAPI_n2_info_content_t *source_to_target_data, + OpenAPI_list_t *pdu_session_list, + char mme_control_fteid, + char *n2_notify_uri, + OpenAPI_n2_info_content_t *ue_radio_capability, + OpenAPI_ng_ap_cause_t *ngap_cause, + char *supported_features + ); +void OpenAPI_ue_context_create_data_free(OpenAPI_ue_context_create_data_t *ue_context_create_data); +OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_parseFromJSON(cJSON *ue_context_create_dataJSON); +cJSON *OpenAPI_ue_context_create_data_convertToJSON(OpenAPI_ue_context_create_data_t *ue_context_create_data); +OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_copy(OpenAPI_ue_context_create_data_t *dst, OpenAPI_ue_context_create_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_create_data_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_create_error.c b/lib/sbi/openapi/model/ue_context_create_error.c new file mode 100644 index 000000000..b90d14621 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_create_error.c @@ -0,0 +1,138 @@ + +#include +#include +#include +#include "ue_context_create_error.h" + +OpenAPI_ue_context_create_error_t *OpenAPI_ue_context_create_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_ng_ap_cause_t *ngap_cause + ) +{ + OpenAPI_ue_context_create_error_t *ue_context_create_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_context_create_error_t)); + if (!ue_context_create_error_local_var) { + return NULL; + } + ue_context_create_error_local_var->error = error; + ue_context_create_error_local_var->ngap_cause = ngap_cause; + + return ue_context_create_error_local_var; +} + +void OpenAPI_ue_context_create_error_free(OpenAPI_ue_context_create_error_t *ue_context_create_error) +{ + if (NULL == ue_context_create_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(ue_context_create_error->error); + OpenAPI_ng_ap_cause_free(ue_context_create_error->ngap_cause); + ogs_free(ue_context_create_error); +} + +cJSON *OpenAPI_ue_context_create_error_convertToJSON(OpenAPI_ue_context_create_error_t *ue_context_create_error) +{ + cJSON *item = NULL; + + if (ue_context_create_error == NULL) { + ogs_error("OpenAPI_ue_context_create_error_convertToJSON() failed [UeContextCreateError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_context_create_error->error) { + ogs_error("OpenAPI_ue_context_create_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(ue_context_create_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_create_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_create_error_convertToJSON() failed [error]"); + goto end; + } + + if (ue_context_create_error->ngap_cause) { + cJSON *ngap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(ue_context_create_error->ngap_cause); + if (ngap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_create_error_convertToJSON() failed [ngap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngapCause", ngap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_create_error_convertToJSON() failed [ngap_cause]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_create_error_t *OpenAPI_ue_context_create_error_parseFromJSON(cJSON *ue_context_create_errorJSON) +{ + OpenAPI_ue_context_create_error_t *ue_context_create_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(ue_context_create_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_ue_context_create_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *ngap_cause = cJSON_GetObjectItemCaseSensitive(ue_context_create_errorJSON, "ngapCause"); + + OpenAPI_ng_ap_cause_t *ngap_cause_local_nonprim = NULL; + if (ngap_cause) { + ngap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ngap_cause); + } + + ue_context_create_error_local_var = OpenAPI_ue_context_create_error_create ( + error_local_nonprim, + ngap_cause ? ngap_cause_local_nonprim : NULL + ); + + return ue_context_create_error_local_var; +end: + return NULL; +} + +OpenAPI_ue_context_create_error_t *OpenAPI_ue_context_create_error_copy(OpenAPI_ue_context_create_error_t *dst, OpenAPI_ue_context_create_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_create_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_create_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_context_create_error_free(dst); + dst = OpenAPI_ue_context_create_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_create_error.h b/lib/sbi/openapi/model/ue_context_create_error.h new file mode 100644 index 000000000..d780956b3 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_create_error.h @@ -0,0 +1,42 @@ +/* + * ue_context_create_error.h + * + * + */ + +#ifndef _OpenAPI_ue_context_create_error_H_ +#define _OpenAPI_ue_context_create_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ng_ap_cause.h" +#include "problem_details.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_create_error_s OpenAPI_ue_context_create_error_t; +typedef struct OpenAPI_ue_context_create_error_s { + struct OpenAPI_problem_details_s *error; + struct OpenAPI_ng_ap_cause_s *ngap_cause; +} OpenAPI_ue_context_create_error_t; + +OpenAPI_ue_context_create_error_t *OpenAPI_ue_context_create_error_create( + OpenAPI_problem_details_t *error, + OpenAPI_ng_ap_cause_t *ngap_cause + ); +void OpenAPI_ue_context_create_error_free(OpenAPI_ue_context_create_error_t *ue_context_create_error); +OpenAPI_ue_context_create_error_t *OpenAPI_ue_context_create_error_parseFromJSON(cJSON *ue_context_create_errorJSON); +cJSON *OpenAPI_ue_context_create_error_convertToJSON(OpenAPI_ue_context_create_error_t *ue_context_create_error); +OpenAPI_ue_context_create_error_t *OpenAPI_ue_context_create_error_copy(OpenAPI_ue_context_create_error_t *dst, OpenAPI_ue_context_create_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_create_error_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_created_data.c b/lib/sbi/openapi/model/ue_context_created_data.c new file mode 100644 index 000000000..e068787a1 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_created_data.c @@ -0,0 +1,287 @@ + +#include +#include +#include +#include "ue_context_created_data.h" + +OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_create( + OpenAPI_ue_context_t *ue_context, + OpenAPI_n2_info_content_t *target_to_source_data, + OpenAPI_list_t *pdu_session_list, + OpenAPI_list_t *failed_session_list, + char *supported_features, + int pcf_reselected_ind + ) +{ + OpenAPI_ue_context_created_data_t *ue_context_created_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_context_created_data_t)); + if (!ue_context_created_data_local_var) { + return NULL; + } + ue_context_created_data_local_var->ue_context = ue_context; + ue_context_created_data_local_var->target_to_source_data = target_to_source_data; + ue_context_created_data_local_var->pdu_session_list = pdu_session_list; + ue_context_created_data_local_var->failed_session_list = failed_session_list; + ue_context_created_data_local_var->supported_features = supported_features; + ue_context_created_data_local_var->pcf_reselected_ind = pcf_reselected_ind; + + return ue_context_created_data_local_var; +} + +void OpenAPI_ue_context_created_data_free(OpenAPI_ue_context_created_data_t *ue_context_created_data) +{ + if (NULL == ue_context_created_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ue_context_free(ue_context_created_data->ue_context); + OpenAPI_n2_info_content_free(ue_context_created_data->target_to_source_data); + OpenAPI_list_for_each(ue_context_created_data->pdu_session_list, node) { + OpenAPI_n2_sm_information_free(node->data); + } + OpenAPI_list_free(ue_context_created_data->pdu_session_list); + OpenAPI_list_for_each(ue_context_created_data->failed_session_list, node) { + OpenAPI_n2_sm_information_free(node->data); + } + OpenAPI_list_free(ue_context_created_data->failed_session_list); + ogs_free(ue_context_created_data->supported_features); + ogs_free(ue_context_created_data); +} + +cJSON *OpenAPI_ue_context_created_data_convertToJSON(OpenAPI_ue_context_created_data_t *ue_context_created_data) +{ + cJSON *item = NULL; + + if (ue_context_created_data == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [UeContextCreatedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_context_created_data->ue_context) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [ue_context]"); + goto end; + } + cJSON *ue_context_local_JSON = OpenAPI_ue_context_convertToJSON(ue_context_created_data->ue_context); + if (ue_context_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [ue_context]"); + goto end; + } + cJSON_AddItemToObject(item, "ueContext", ue_context_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [ue_context]"); + goto end; + } + + if (!ue_context_created_data->target_to_source_data) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [target_to_source_data]"); + goto end; + } + cJSON *target_to_source_data_local_JSON = OpenAPI_n2_info_content_convertToJSON(ue_context_created_data->target_to_source_data); + if (target_to_source_data_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [target_to_source_data]"); + goto end; + } + cJSON_AddItemToObject(item, "targetToSourceData", target_to_source_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [target_to_source_data]"); + goto end; + } + + if (!ue_context_created_data->pdu_session_list) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [pdu_session_list]"); + goto end; + } + cJSON *pdu_session_listList = cJSON_AddArrayToObject(item, "pduSessionList"); + if (pdu_session_listList == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [pdu_session_list]"); + goto end; + } + + OpenAPI_lnode_t *pdu_session_list_node; + if (ue_context_created_data->pdu_session_list) { + OpenAPI_list_for_each(ue_context_created_data->pdu_session_list, pdu_session_list_node) { + cJSON *itemLocal = OpenAPI_n2_sm_information_convertToJSON(pdu_session_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [pdu_session_list]"); + goto end; + } + cJSON_AddItemToArray(pdu_session_listList, itemLocal); + } + } + + if (ue_context_created_data->failed_session_list) { + cJSON *failed_session_listList = cJSON_AddArrayToObject(item, "failedSessionList"); + if (failed_session_listList == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [failed_session_list]"); + goto end; + } + + OpenAPI_lnode_t *failed_session_list_node; + if (ue_context_created_data->failed_session_list) { + OpenAPI_list_for_each(ue_context_created_data->failed_session_list, failed_session_list_node) { + cJSON *itemLocal = OpenAPI_n2_sm_information_convertToJSON(failed_session_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [failed_session_list]"); + goto end; + } + cJSON_AddItemToArray(failed_session_listList, itemLocal); + } + } + } + + if (ue_context_created_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ue_context_created_data->supported_features) == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (ue_context_created_data->pcf_reselected_ind) { + if (cJSON_AddBoolToObject(item, "pcfReselectedInd", ue_context_created_data->pcf_reselected_ind) == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [pcf_reselected_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_parseFromJSON(cJSON *ue_context_created_dataJSON) +{ + OpenAPI_ue_context_created_data_t *ue_context_created_data_local_var = NULL; + cJSON *ue_context = cJSON_GetObjectItemCaseSensitive(ue_context_created_dataJSON, "ueContext"); + if (!ue_context) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [ue_context]"); + goto end; + } + + OpenAPI_ue_context_t *ue_context_local_nonprim = NULL; + + ue_context_local_nonprim = OpenAPI_ue_context_parseFromJSON(ue_context); + + cJSON *target_to_source_data = cJSON_GetObjectItemCaseSensitive(ue_context_created_dataJSON, "targetToSourceData"); + if (!target_to_source_data) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [target_to_source_data]"); + goto end; + } + + OpenAPI_n2_info_content_t *target_to_source_data_local_nonprim = NULL; + + target_to_source_data_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(target_to_source_data); + + cJSON *pdu_session_list = cJSON_GetObjectItemCaseSensitive(ue_context_created_dataJSON, "pduSessionList"); + if (!pdu_session_list) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [pdu_session_list]"); + goto end; + } + + OpenAPI_list_t *pdu_session_listList; + + cJSON *pdu_session_list_local_nonprimitive; + if (!cJSON_IsArray(pdu_session_list)) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [pdu_session_list]"); + goto end; + } + + pdu_session_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pdu_session_list_local_nonprimitive, pdu_session_list ) { + if (!cJSON_IsObject(pdu_session_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [pdu_session_list]"); + goto end; + } + OpenAPI_n2_sm_information_t *pdu_session_listItem = OpenAPI_n2_sm_information_parseFromJSON(pdu_session_list_local_nonprimitive); + + OpenAPI_list_add(pdu_session_listList, pdu_session_listItem); + } + + cJSON *failed_session_list = cJSON_GetObjectItemCaseSensitive(ue_context_created_dataJSON, "failedSessionList"); + + OpenAPI_list_t *failed_session_listList; + if (failed_session_list) { + cJSON *failed_session_list_local_nonprimitive; + if (!cJSON_IsArray(failed_session_list)) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [failed_session_list]"); + goto end; + } + + failed_session_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(failed_session_list_local_nonprimitive, failed_session_list ) { + if (!cJSON_IsObject(failed_session_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [failed_session_list]"); + goto end; + } + OpenAPI_n2_sm_information_t *failed_session_listItem = OpenAPI_n2_sm_information_parseFromJSON(failed_session_list_local_nonprimitive); + + OpenAPI_list_add(failed_session_listList, failed_session_listItem); + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(ue_context_created_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *pcf_reselected_ind = cJSON_GetObjectItemCaseSensitive(ue_context_created_dataJSON, "pcfReselectedInd"); + + if (pcf_reselected_ind) { + if (!cJSON_IsBool(pcf_reselected_ind)) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [pcf_reselected_ind]"); + goto end; + } + } + + ue_context_created_data_local_var = OpenAPI_ue_context_created_data_create ( + ue_context_local_nonprim, + target_to_source_data_local_nonprim, + pdu_session_listList, + failed_session_list ? failed_session_listList : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + pcf_reselected_ind ? pcf_reselected_ind->valueint : 0 + ); + + return ue_context_created_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_copy(OpenAPI_ue_context_created_data_t *dst, OpenAPI_ue_context_created_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_created_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_created_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_ue_context_created_data_free(dst); + dst = OpenAPI_ue_context_created_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_created_data.h b/lib/sbi/openapi/model/ue_context_created_data.h new file mode 100644 index 000000000..0533ed3c5 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_created_data.h @@ -0,0 +1,51 @@ +/* + * ue_context_created_data.h + * + * + */ + +#ifndef _OpenAPI_ue_context_created_data_H_ +#define _OpenAPI_ue_context_created_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" +#include "n2_sm_information.h" +#include "ue_context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_created_data_s OpenAPI_ue_context_created_data_t; +typedef struct OpenAPI_ue_context_created_data_s { + struct OpenAPI_ue_context_s *ue_context; + struct OpenAPI_n2_info_content_s *target_to_source_data; + OpenAPI_list_t *pdu_session_list; + OpenAPI_list_t *failed_session_list; + char *supported_features; + int pcf_reselected_ind; +} OpenAPI_ue_context_created_data_t; + +OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_create( + OpenAPI_ue_context_t *ue_context, + OpenAPI_n2_info_content_t *target_to_source_data, + OpenAPI_list_t *pdu_session_list, + OpenAPI_list_t *failed_session_list, + char *supported_features, + int pcf_reselected_ind + ); +void OpenAPI_ue_context_created_data_free(OpenAPI_ue_context_created_data_t *ue_context_created_data); +OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_parseFromJSON(cJSON *ue_context_created_dataJSON); +cJSON *OpenAPI_ue_context_created_data_convertToJSON(OpenAPI_ue_context_created_data_t *ue_context_created_data); +OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_copy(OpenAPI_ue_context_created_data_t *dst, OpenAPI_ue_context_created_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_created_data_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_in_smf_data.c b/lib/sbi/openapi/model/ue_context_in_smf_data.c index 4b90e022f..4eeba2c3d 100644 --- a/lib/sbi/openapi/model/ue_context_in_smf_data.c +++ b/lib/sbi/openapi/model/ue_context_in_smf_data.c @@ -176,3 +176,37 @@ end: return NULL; } +OpenAPI_ue_context_in_smf_data_t *OpenAPI_ue_context_in_smf_data_copy(OpenAPI_ue_context_in_smf_data_t *dst, OpenAPI_ue_context_in_smf_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_in_smf_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_in_smf_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_ue_context_in_smf_data_free(dst); + dst = OpenAPI_ue_context_in_smf_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_in_smf_data.h b/lib/sbi/openapi/model/ue_context_in_smf_data.h index 5e08c1642..ec2fddbbc 100644 --- a/lib/sbi/openapi/model/ue_context_in_smf_data.h +++ b/lib/sbi/openapi/model/ue_context_in_smf_data.h @@ -35,6 +35,7 @@ OpenAPI_ue_context_in_smf_data_t *OpenAPI_ue_context_in_smf_data_create( void OpenAPI_ue_context_in_smf_data_free(OpenAPI_ue_context_in_smf_data_t *ue_context_in_smf_data); OpenAPI_ue_context_in_smf_data_t *OpenAPI_ue_context_in_smf_data_parseFromJSON(cJSON *ue_context_in_smf_dataJSON); cJSON *OpenAPI_ue_context_in_smf_data_convertToJSON(OpenAPI_ue_context_in_smf_data_t *ue_context_in_smf_data); +OpenAPI_ue_context_in_smf_data_t *OpenAPI_ue_context_in_smf_data_copy(OpenAPI_ue_context_in_smf_data_t *dst, OpenAPI_ue_context_in_smf_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_context_in_smsf_data.c b/lib/sbi/openapi/model/ue_context_in_smsf_data.c index 9506d1afa..1755862fa 100644 --- a/lib/sbi/openapi/model/ue_context_in_smsf_data.c +++ b/lib/sbi/openapi/model/ue_context_in_smsf_data.c @@ -97,3 +97,37 @@ end: return NULL; } +OpenAPI_ue_context_in_smsf_data_t *OpenAPI_ue_context_in_smsf_data_copy(OpenAPI_ue_context_in_smsf_data_t *dst, OpenAPI_ue_context_in_smsf_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_in_smsf_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_in_smsf_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_ue_context_in_smsf_data_free(dst); + dst = OpenAPI_ue_context_in_smsf_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_in_smsf_data.h b/lib/sbi/openapi/model/ue_context_in_smsf_data.h index 25b1647bc..8570843a4 100644 --- a/lib/sbi/openapi/model/ue_context_in_smsf_data.h +++ b/lib/sbi/openapi/model/ue_context_in_smsf_data.h @@ -31,6 +31,7 @@ OpenAPI_ue_context_in_smsf_data_t *OpenAPI_ue_context_in_smsf_data_create( void OpenAPI_ue_context_in_smsf_data_free(OpenAPI_ue_context_in_smsf_data_t *ue_context_in_smsf_data); OpenAPI_ue_context_in_smsf_data_t *OpenAPI_ue_context_in_smsf_data_parseFromJSON(cJSON *ue_context_in_smsf_dataJSON); cJSON *OpenAPI_ue_context_in_smsf_data_convertToJSON(OpenAPI_ue_context_in_smsf_data_t *ue_context_in_smsf_data); +OpenAPI_ue_context_in_smsf_data_t *OpenAPI_ue_context_in_smsf_data_copy(OpenAPI_ue_context_in_smsf_data_t *dst, OpenAPI_ue_context_in_smsf_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_context_release.c b/lib/sbi/openapi/model/ue_context_release.c new file mode 100644 index 000000000..eb2a5b6c1 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_release.c @@ -0,0 +1,153 @@ + +#include +#include +#include +#include "ue_context_release.h" + +OpenAPI_ue_context_release_t *OpenAPI_ue_context_release_create( + char *supi, + int unauthenticated_supi, + OpenAPI_ng_ap_cause_t *ngap_cause + ) +{ + OpenAPI_ue_context_release_t *ue_context_release_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_context_release_t)); + if (!ue_context_release_local_var) { + return NULL; + } + ue_context_release_local_var->supi = supi; + ue_context_release_local_var->unauthenticated_supi = unauthenticated_supi; + ue_context_release_local_var->ngap_cause = ngap_cause; + + return ue_context_release_local_var; +} + +void OpenAPI_ue_context_release_free(OpenAPI_ue_context_release_t *ue_context_release) +{ + if (NULL == ue_context_release) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ue_context_release->supi); + OpenAPI_ng_ap_cause_free(ue_context_release->ngap_cause); + ogs_free(ue_context_release); +} + +cJSON *OpenAPI_ue_context_release_convertToJSON(OpenAPI_ue_context_release_t *ue_context_release) +{ + cJSON *item = NULL; + + if (ue_context_release == NULL) { + ogs_error("OpenAPI_ue_context_release_convertToJSON() failed [UEContextRelease]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_context_release->supi) { + if (cJSON_AddStringToObject(item, "supi", ue_context_release->supi) == NULL) { + ogs_error("OpenAPI_ue_context_release_convertToJSON() failed [supi]"); + goto end; + } + } + + if (ue_context_release->unauthenticated_supi) { + if (cJSON_AddBoolToObject(item, "unauthenticatedSupi", ue_context_release->unauthenticated_supi) == NULL) { + ogs_error("OpenAPI_ue_context_release_convertToJSON() failed [unauthenticated_supi]"); + goto end; + } + } + + if (!ue_context_release->ngap_cause) { + ogs_error("OpenAPI_ue_context_release_convertToJSON() failed [ngap_cause]"); + goto end; + } + cJSON *ngap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(ue_context_release->ngap_cause); + if (ngap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_release_convertToJSON() failed [ngap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngapCause", ngap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_release_convertToJSON() failed [ngap_cause]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ue_context_release_t *OpenAPI_ue_context_release_parseFromJSON(cJSON *ue_context_releaseJSON) +{ + OpenAPI_ue_context_release_t *ue_context_release_local_var = NULL; + cJSON *supi = cJSON_GetObjectItemCaseSensitive(ue_context_releaseJSON, "supi"); + + if (supi) { + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_ue_context_release_parseFromJSON() failed [supi]"); + goto end; + } + } + + cJSON *unauthenticated_supi = cJSON_GetObjectItemCaseSensitive(ue_context_releaseJSON, "unauthenticatedSupi"); + + if (unauthenticated_supi) { + if (!cJSON_IsBool(unauthenticated_supi)) { + ogs_error("OpenAPI_ue_context_release_parseFromJSON() failed [unauthenticated_supi]"); + goto end; + } + } + + cJSON *ngap_cause = cJSON_GetObjectItemCaseSensitive(ue_context_releaseJSON, "ngapCause"); + if (!ngap_cause) { + ogs_error("OpenAPI_ue_context_release_parseFromJSON() failed [ngap_cause]"); + goto end; + } + + OpenAPI_ng_ap_cause_t *ngap_cause_local_nonprim = NULL; + + ngap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ngap_cause); + + ue_context_release_local_var = OpenAPI_ue_context_release_create ( + supi ? ogs_strdup(supi->valuestring) : NULL, + unauthenticated_supi ? unauthenticated_supi->valueint : 0, + ngap_cause_local_nonprim + ); + + return ue_context_release_local_var; +end: + return NULL; +} + +OpenAPI_ue_context_release_t *OpenAPI_ue_context_release_copy(OpenAPI_ue_context_release_t *dst, OpenAPI_ue_context_release_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_release_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_release_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_context_release_free(dst); + dst = OpenAPI_ue_context_release_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_release.h b/lib/sbi/openapi/model/ue_context_release.h new file mode 100644 index 000000000..cb3975036 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_release.h @@ -0,0 +1,43 @@ +/* + * ue_context_release.h + * + * + */ + +#ifndef _OpenAPI_ue_context_release_H_ +#define _OpenAPI_ue_context_release_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ng_ap_cause.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_release_s OpenAPI_ue_context_release_t; +typedef struct OpenAPI_ue_context_release_s { + char *supi; + int unauthenticated_supi; + struct OpenAPI_ng_ap_cause_s *ngap_cause; +} OpenAPI_ue_context_release_t; + +OpenAPI_ue_context_release_t *OpenAPI_ue_context_release_create( + char *supi, + int unauthenticated_supi, + OpenAPI_ng_ap_cause_t *ngap_cause + ); +void OpenAPI_ue_context_release_free(OpenAPI_ue_context_release_t *ue_context_release); +OpenAPI_ue_context_release_t *OpenAPI_ue_context_release_parseFromJSON(cJSON *ue_context_releaseJSON); +cJSON *OpenAPI_ue_context_release_convertToJSON(OpenAPI_ue_context_release_t *ue_context_release); +OpenAPI_ue_context_release_t *OpenAPI_ue_context_release_copy(OpenAPI_ue_context_release_t *dst, OpenAPI_ue_context_release_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_release_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_transfer_req_data.c b/lib/sbi/openapi/model/ue_context_transfer_req_data.c new file mode 100644 index 000000000..e293fa7cc --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_transfer_req_data.c @@ -0,0 +1,205 @@ + +#include +#include +#include +#include "ue_context_transfer_req_data.h" + +OpenAPI_ue_context_transfer_req_data_t *OpenAPI_ue_context_transfer_req_data_create( + OpenAPI_transfer_reason_e reason, + OpenAPI_access_type_e access_type, + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_n1_message_container_t *reg_request, + char *supported_features + ) +{ + OpenAPI_ue_context_transfer_req_data_t *ue_context_transfer_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_context_transfer_req_data_t)); + if (!ue_context_transfer_req_data_local_var) { + return NULL; + } + ue_context_transfer_req_data_local_var->reason = reason; + ue_context_transfer_req_data_local_var->access_type = access_type; + ue_context_transfer_req_data_local_var->plmn_id = plmn_id; + ue_context_transfer_req_data_local_var->reg_request = reg_request; + ue_context_transfer_req_data_local_var->supported_features = supported_features; + + return ue_context_transfer_req_data_local_var; +} + +void OpenAPI_ue_context_transfer_req_data_free(OpenAPI_ue_context_transfer_req_data_t *ue_context_transfer_req_data) +{ + if (NULL == ue_context_transfer_req_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_plmn_id_free(ue_context_transfer_req_data->plmn_id); + OpenAPI_n1_message_container_free(ue_context_transfer_req_data->reg_request); + ogs_free(ue_context_transfer_req_data->supported_features); + ogs_free(ue_context_transfer_req_data); +} + +cJSON *OpenAPI_ue_context_transfer_req_data_convertToJSON(OpenAPI_ue_context_transfer_req_data_t *ue_context_transfer_req_data) +{ + cJSON *item = NULL; + + if (ue_context_transfer_req_data == NULL) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [UeContextTransferReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_context_transfer_req_data->reason) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [reason]"); + goto end; + } + if (cJSON_AddStringToObject(item, "reason", OpenAPI_transfer_reason_ToString(ue_context_transfer_req_data->reason)) == NULL) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [reason]"); + goto end; + } + + if (!ue_context_transfer_req_data->access_type) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [access_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(ue_context_transfer_req_data->access_type)) == NULL) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [access_type]"); + goto end; + } + + if (ue_context_transfer_req_data->plmn_id) { + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(ue_context_transfer_req_data->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [plmn_id]"); + goto end; + } + } + + if (ue_context_transfer_req_data->reg_request) { + cJSON *reg_request_local_JSON = OpenAPI_n1_message_container_convertToJSON(ue_context_transfer_req_data->reg_request); + if (reg_request_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [reg_request]"); + goto end; + } + cJSON_AddItemToObject(item, "regRequest", reg_request_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [reg_request]"); + goto end; + } + } + + if (ue_context_transfer_req_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ue_context_transfer_req_data->supported_features) == NULL) { + ogs_error("OpenAPI_ue_context_transfer_req_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_transfer_req_data_t *OpenAPI_ue_context_transfer_req_data_parseFromJSON(cJSON *ue_context_transfer_req_dataJSON) +{ + OpenAPI_ue_context_transfer_req_data_t *ue_context_transfer_req_data_local_var = NULL; + cJSON *reason = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_req_dataJSON, "reason"); + if (!reason) { + ogs_error("OpenAPI_ue_context_transfer_req_data_parseFromJSON() failed [reason]"); + goto end; + } + + OpenAPI_transfer_reason_e reasonVariable; + + if (!cJSON_IsString(reason)) { + ogs_error("OpenAPI_ue_context_transfer_req_data_parseFromJSON() failed [reason]"); + goto end; + } + reasonVariable = OpenAPI_transfer_reason_FromString(reason->valuestring); + + cJSON *access_type = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_req_dataJSON, "accessType"); + if (!access_type) { + ogs_error("OpenAPI_ue_context_transfer_req_data_parseFromJSON() failed [access_type]"); + goto end; + } + + OpenAPI_access_type_e access_typeVariable; + + if (!cJSON_IsString(access_type)) { + ogs_error("OpenAPI_ue_context_transfer_req_data_parseFromJSON() failed [access_type]"); + goto end; + } + access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring); + + cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_req_dataJSON, "plmnId"); + + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + if (plmn_id) { + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + } + + cJSON *reg_request = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_req_dataJSON, "regRequest"); + + OpenAPI_n1_message_container_t *reg_request_local_nonprim = NULL; + if (reg_request) { + reg_request_local_nonprim = OpenAPI_n1_message_container_parseFromJSON(reg_request); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_req_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_ue_context_transfer_req_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + ue_context_transfer_req_data_local_var = OpenAPI_ue_context_transfer_req_data_create ( + reasonVariable, + access_typeVariable, + plmn_id ? plmn_id_local_nonprim : NULL, + reg_request ? reg_request_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return ue_context_transfer_req_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_context_transfer_req_data_t *OpenAPI_ue_context_transfer_req_data_copy(OpenAPI_ue_context_transfer_req_data_t *dst, OpenAPI_ue_context_transfer_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_transfer_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_transfer_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_ue_context_transfer_req_data_free(dst); + dst = OpenAPI_ue_context_transfer_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_transfer_req_data.h b/lib/sbi/openapi/model/ue_context_transfer_req_data.h new file mode 100644 index 000000000..e4f33a633 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_transfer_req_data.h @@ -0,0 +1,50 @@ +/* + * ue_context_transfer_req_data.h + * + * + */ + +#ifndef _OpenAPI_ue_context_transfer_req_data_H_ +#define _OpenAPI_ue_context_transfer_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "n1_message_container.h" +#include "plmn_id.h" +#include "transfer_reason.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_transfer_req_data_s OpenAPI_ue_context_transfer_req_data_t; +typedef struct OpenAPI_ue_context_transfer_req_data_s { + OpenAPI_transfer_reason_e reason; + OpenAPI_access_type_e access_type; + struct OpenAPI_plmn_id_s *plmn_id; + struct OpenAPI_n1_message_container_s *reg_request; + char *supported_features; +} OpenAPI_ue_context_transfer_req_data_t; + +OpenAPI_ue_context_transfer_req_data_t *OpenAPI_ue_context_transfer_req_data_create( + OpenAPI_transfer_reason_e reason, + OpenAPI_access_type_e access_type, + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_n1_message_container_t *reg_request, + char *supported_features + ); +void OpenAPI_ue_context_transfer_req_data_free(OpenAPI_ue_context_transfer_req_data_t *ue_context_transfer_req_data); +OpenAPI_ue_context_transfer_req_data_t *OpenAPI_ue_context_transfer_req_data_parseFromJSON(cJSON *ue_context_transfer_req_dataJSON); +cJSON *OpenAPI_ue_context_transfer_req_data_convertToJSON(OpenAPI_ue_context_transfer_req_data_t *ue_context_transfer_req_data); +OpenAPI_ue_context_transfer_req_data_t *OpenAPI_ue_context_transfer_req_data_copy(OpenAPI_ue_context_transfer_req_data_t *dst, OpenAPI_ue_context_transfer_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_transfer_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_transfer_rsp_data.c b/lib/sbi/openapi/model/ue_context_transfer_rsp_data.c new file mode 100644 index 000000000..645332246 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_transfer_rsp_data.c @@ -0,0 +1,182 @@ + +#include +#include +#include +#include "ue_context_transfer_rsp_data.h" + +OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_create( + OpenAPI_ue_context_t *ue_context, + OpenAPI_n2_info_content_t *ue_radio_capability, + OpenAPI_n2_info_content_t *ue_nbiot_radio_capability, + char *supported_features + ) +{ + OpenAPI_ue_context_transfer_rsp_data_t *ue_context_transfer_rsp_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_context_transfer_rsp_data_t)); + if (!ue_context_transfer_rsp_data_local_var) { + return NULL; + } + ue_context_transfer_rsp_data_local_var->ue_context = ue_context; + ue_context_transfer_rsp_data_local_var->ue_radio_capability = ue_radio_capability; + ue_context_transfer_rsp_data_local_var->ue_nbiot_radio_capability = ue_nbiot_radio_capability; + ue_context_transfer_rsp_data_local_var->supported_features = supported_features; + + return ue_context_transfer_rsp_data_local_var; +} + +void OpenAPI_ue_context_transfer_rsp_data_free(OpenAPI_ue_context_transfer_rsp_data_t *ue_context_transfer_rsp_data) +{ + if (NULL == ue_context_transfer_rsp_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_ue_context_free(ue_context_transfer_rsp_data->ue_context); + OpenAPI_n2_info_content_free(ue_context_transfer_rsp_data->ue_radio_capability); + OpenAPI_n2_info_content_free(ue_context_transfer_rsp_data->ue_nbiot_radio_capability); + ogs_free(ue_context_transfer_rsp_data->supported_features); + ogs_free(ue_context_transfer_rsp_data); +} + +cJSON *OpenAPI_ue_context_transfer_rsp_data_convertToJSON(OpenAPI_ue_context_transfer_rsp_data_t *ue_context_transfer_rsp_data) +{ + cJSON *item = NULL; + + if (ue_context_transfer_rsp_data == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [UeContextTransferRspData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_context_transfer_rsp_data->ue_context) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_context]"); + goto end; + } + cJSON *ue_context_local_JSON = OpenAPI_ue_context_convertToJSON(ue_context_transfer_rsp_data->ue_context); + if (ue_context_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_context]"); + goto end; + } + cJSON_AddItemToObject(item, "ueContext", ue_context_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_context]"); + goto end; + } + + if (ue_context_transfer_rsp_data->ue_radio_capability) { + cJSON *ue_radio_capability_local_JSON = OpenAPI_n2_info_content_convertToJSON(ue_context_transfer_rsp_data->ue_radio_capability); + if (ue_radio_capability_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_radio_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "ueRadioCapability", ue_radio_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_radio_capability]"); + goto end; + } + } + + if (ue_context_transfer_rsp_data->ue_nbiot_radio_capability) { + cJSON *ue_nbiot_radio_capability_local_JSON = OpenAPI_n2_info_content_convertToJSON(ue_context_transfer_rsp_data->ue_nbiot_radio_capability); + if (ue_nbiot_radio_capability_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_nbiot_radio_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "ueNbiotRadioCapability", ue_nbiot_radio_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_nbiot_radio_capability]"); + goto end; + } + } + + if (ue_context_transfer_rsp_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ue_context_transfer_rsp_data->supported_features) == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_parseFromJSON(cJSON *ue_context_transfer_rsp_dataJSON) +{ + OpenAPI_ue_context_transfer_rsp_data_t *ue_context_transfer_rsp_data_local_var = NULL; + cJSON *ue_context = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_rsp_dataJSON, "ueContext"); + if (!ue_context) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_parseFromJSON() failed [ue_context]"); + goto end; + } + + OpenAPI_ue_context_t *ue_context_local_nonprim = NULL; + + ue_context_local_nonprim = OpenAPI_ue_context_parseFromJSON(ue_context); + + cJSON *ue_radio_capability = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_rsp_dataJSON, "ueRadioCapability"); + + OpenAPI_n2_info_content_t *ue_radio_capability_local_nonprim = NULL; + if (ue_radio_capability) { + ue_radio_capability_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(ue_radio_capability); + } + + cJSON *ue_nbiot_radio_capability = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_rsp_dataJSON, "ueNbiotRadioCapability"); + + OpenAPI_n2_info_content_t *ue_nbiot_radio_capability_local_nonprim = NULL; + if (ue_nbiot_radio_capability) { + ue_nbiot_radio_capability_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(ue_nbiot_radio_capability); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_rsp_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + ue_context_transfer_rsp_data_local_var = OpenAPI_ue_context_transfer_rsp_data_create ( + ue_context_local_nonprim, + ue_radio_capability ? ue_radio_capability_local_nonprim : NULL, + ue_nbiot_radio_capability ? ue_nbiot_radio_capability_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return ue_context_transfer_rsp_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_copy(OpenAPI_ue_context_transfer_rsp_data_t *dst, OpenAPI_ue_context_transfer_rsp_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_transfer_rsp_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_transfer_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_ue_context_transfer_rsp_data_free(dst); + dst = OpenAPI_ue_context_transfer_rsp_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_transfer_rsp_data.h b/lib/sbi/openapi/model/ue_context_transfer_rsp_data.h new file mode 100644 index 000000000..8c8180fb0 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_transfer_rsp_data.h @@ -0,0 +1,46 @@ +/* + * ue_context_transfer_rsp_data.h + * + * + */ + +#ifndef _OpenAPI_ue_context_transfer_rsp_data_H_ +#define _OpenAPI_ue_context_transfer_rsp_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" +#include "ue_context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_transfer_rsp_data_s OpenAPI_ue_context_transfer_rsp_data_t; +typedef struct OpenAPI_ue_context_transfer_rsp_data_s { + struct OpenAPI_ue_context_s *ue_context; + struct OpenAPI_n2_info_content_s *ue_radio_capability; + struct OpenAPI_n2_info_content_s *ue_nbiot_radio_capability; + char *supported_features; +} OpenAPI_ue_context_transfer_rsp_data_t; + +OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_create( + OpenAPI_ue_context_t *ue_context, + OpenAPI_n2_info_content_t *ue_radio_capability, + OpenAPI_n2_info_content_t *ue_nbiot_radio_capability, + char *supported_features + ); +void OpenAPI_ue_context_transfer_rsp_data_free(OpenAPI_ue_context_transfer_rsp_data_t *ue_context_transfer_rsp_data); +OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_parseFromJSON(cJSON *ue_context_transfer_rsp_dataJSON); +cJSON *OpenAPI_ue_context_transfer_rsp_data_convertToJSON(OpenAPI_ue_context_transfer_rsp_data_t *ue_context_transfer_rsp_data); +OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_copy(OpenAPI_ue_context_transfer_rsp_data_t *dst, OpenAPI_ue_context_transfer_rsp_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_transfer_rsp_data_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_transfer_status.c b/lib/sbi/openapi/model/ue_context_transfer_status.c new file mode 100644 index 000000000..38327d2d3 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_transfer_status.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ue_context_transfer_status.h" + +char* OpenAPI_ue_context_transfer_status_ToString(OpenAPI_ue_context_transfer_status_e ue_context_transfer_status) +{ + const char *ue_context_transfer_statusArray[] = { "NULL", "TRANSFERRED", "NOT_TRANSFERRED" }; + size_t sizeofArray = sizeof(ue_context_transfer_statusArray) / sizeof(ue_context_transfer_statusArray[0]); + if (ue_context_transfer_status < sizeofArray) + return (char *)ue_context_transfer_statusArray[ue_context_transfer_status]; + else + return (char *)"Unknown"; +} + +OpenAPI_ue_context_transfer_status_e OpenAPI_ue_context_transfer_status_FromString(char* ue_context_transfer_status) +{ + int stringToReturn = 0; + const char *ue_context_transfer_statusArray[] = { "NULL", "TRANSFERRED", "NOT_TRANSFERRED" }; + size_t sizeofArray = sizeof(ue_context_transfer_statusArray) / sizeof(ue_context_transfer_statusArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ue_context_transfer_status, ue_context_transfer_statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ue_context_transfer_status.h b/lib/sbi/openapi/model/ue_context_transfer_status.h new file mode 100644 index 000000000..6f3972d0b --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_transfer_status.h @@ -0,0 +1,31 @@ +/* + * ue_context_transfer_status.h + * + * + */ + +#ifndef _OpenAPI_ue_context_transfer_status_H_ +#define _OpenAPI_ue_context_transfer_status_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_ue_context_transfer_status_NULL = 0, OpenAPI_ue_context_transfer_status_TRANSFERRED, OpenAPI_ue_context_transfer_status_NOT_TRANSFERRED } OpenAPI_ue_context_transfer_status_e; + +char* OpenAPI_ue_context_transfer_status_ToString(OpenAPI_ue_context_transfer_status_e ue_context_transfer_status); + +OpenAPI_ue_context_transfer_status_e OpenAPI_ue_context_transfer_status_FromString(char* ue_context_transfer_status); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_transfer_status_H_ */ + diff --git a/lib/sbi/openapi/model/ue_id.c b/lib/sbi/openapi/model/ue_id.c index 15dba508a..4e18ede4c 100644 --- a/lib/sbi/openapi/model/ue_id.c +++ b/lib/sbi/openapi/model/ue_id.c @@ -117,3 +117,37 @@ end: return NULL; } +OpenAPI_ue_id_t *OpenAPI_ue_id_copy(OpenAPI_ue_id_t *dst, OpenAPI_ue_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_id_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_id_free(dst); + dst = OpenAPI_ue_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_id.h b/lib/sbi/openapi/model/ue_id.h index 534fa5b78..fdff35000 100644 --- a/lib/sbi/openapi/model/ue_id.h +++ b/lib/sbi/openapi/model/ue_id.h @@ -30,6 +30,7 @@ OpenAPI_ue_id_t *OpenAPI_ue_id_create( void OpenAPI_ue_id_free(OpenAPI_ue_id_t *ue_id); OpenAPI_ue_id_t *OpenAPI_ue_id_parseFromJSON(cJSON *ue_idJSON); cJSON *OpenAPI_ue_id_convertToJSON(OpenAPI_ue_id_t *ue_id); +OpenAPI_ue_id_t *OpenAPI_ue_id_copy(OpenAPI_ue_id_t *dst, OpenAPI_ue_id_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.c b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.c new file mode 100644 index 000000000..6c9d47227 --- /dev/null +++ b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.c @@ -0,0 +1,231 @@ + +#include +#include +#include +#include "ue_n1_n2_info_subscription_create_data.h" + +OpenAPI_ue_n1_n2_info_subscription_create_data_t *OpenAPI_ue_n1_n2_info_subscription_create_data_create( + OpenAPI_n2_information_class_e n2_information_class, + char *n2_notify_callback_uri, + OpenAPI_n1_message_class_e n1_message_class, + char *n1_notify_callback_uri, + char *nf_id, + char *supported_features, + OpenAPI_guami_t *old_guami + ) +{ + OpenAPI_ue_n1_n2_info_subscription_create_data_t *ue_n1_n2_info_subscription_create_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_n1_n2_info_subscription_create_data_t)); + if (!ue_n1_n2_info_subscription_create_data_local_var) { + return NULL; + } + ue_n1_n2_info_subscription_create_data_local_var->n2_information_class = n2_information_class; + ue_n1_n2_info_subscription_create_data_local_var->n2_notify_callback_uri = n2_notify_callback_uri; + ue_n1_n2_info_subscription_create_data_local_var->n1_message_class = n1_message_class; + ue_n1_n2_info_subscription_create_data_local_var->n1_notify_callback_uri = n1_notify_callback_uri; + ue_n1_n2_info_subscription_create_data_local_var->nf_id = nf_id; + ue_n1_n2_info_subscription_create_data_local_var->supported_features = supported_features; + ue_n1_n2_info_subscription_create_data_local_var->old_guami = old_guami; + + return ue_n1_n2_info_subscription_create_data_local_var; +} + +void OpenAPI_ue_n1_n2_info_subscription_create_data_free(OpenAPI_ue_n1_n2_info_subscription_create_data_t *ue_n1_n2_info_subscription_create_data) +{ + if (NULL == ue_n1_n2_info_subscription_create_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ue_n1_n2_info_subscription_create_data->n2_notify_callback_uri); + ogs_free(ue_n1_n2_info_subscription_create_data->n1_notify_callback_uri); + ogs_free(ue_n1_n2_info_subscription_create_data->nf_id); + ogs_free(ue_n1_n2_info_subscription_create_data->supported_features); + OpenAPI_guami_free(ue_n1_n2_info_subscription_create_data->old_guami); + ogs_free(ue_n1_n2_info_subscription_create_data); +} + +cJSON *OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON(OpenAPI_ue_n1_n2_info_subscription_create_data_t *ue_n1_n2_info_subscription_create_data) +{ + cJSON *item = NULL; + + if (ue_n1_n2_info_subscription_create_data == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [UeN1N2InfoSubscriptionCreateData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_n1_n2_info_subscription_create_data->n2_information_class) { + if (cJSON_AddStringToObject(item, "n2InformationClass", OpenAPI_n2_information_class_ToString(ue_n1_n2_info_subscription_create_data->n2_information_class)) == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [n2_information_class]"); + goto end; + } + } + + if (ue_n1_n2_info_subscription_create_data->n2_notify_callback_uri) { + if (cJSON_AddStringToObject(item, "n2NotifyCallbackUri", ue_n1_n2_info_subscription_create_data->n2_notify_callback_uri) == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [n2_notify_callback_uri]"); + goto end; + } + } + + if (ue_n1_n2_info_subscription_create_data->n1_message_class) { + if (cJSON_AddStringToObject(item, "n1MessageClass", OpenAPI_n1_message_class_ToString(ue_n1_n2_info_subscription_create_data->n1_message_class)) == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [n1_message_class]"); + goto end; + } + } + + if (ue_n1_n2_info_subscription_create_data->n1_notify_callback_uri) { + if (cJSON_AddStringToObject(item, "n1NotifyCallbackUri", ue_n1_n2_info_subscription_create_data->n1_notify_callback_uri) == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [n1_notify_callback_uri]"); + goto end; + } + } + + if (ue_n1_n2_info_subscription_create_data->nf_id) { + if (cJSON_AddStringToObject(item, "nfId", ue_n1_n2_info_subscription_create_data->nf_id) == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [nf_id]"); + goto end; + } + } + + if (ue_n1_n2_info_subscription_create_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ue_n1_n2_info_subscription_create_data->supported_features) == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (ue_n1_n2_info_subscription_create_data->old_guami) { + cJSON *old_guami_local_JSON = OpenAPI_guami_convertToJSON(ue_n1_n2_info_subscription_create_data->old_guami); + if (old_guami_local_JSON == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [old_guami]"); + goto end; + } + cJSON_AddItemToObject(item, "oldGuami", old_guami_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON() failed [old_guami]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_n1_n2_info_subscription_create_data_t *OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON(cJSON *ue_n1_n2_info_subscription_create_dataJSON) +{ + OpenAPI_ue_n1_n2_info_subscription_create_data_t *ue_n1_n2_info_subscription_create_data_local_var = NULL; + cJSON *n2_information_class = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_create_dataJSON, "n2InformationClass"); + + OpenAPI_n2_information_class_e n2_information_classVariable; + if (n2_information_class) { + if (!cJSON_IsString(n2_information_class)) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON() failed [n2_information_class]"); + goto end; + } + n2_information_classVariable = OpenAPI_n2_information_class_FromString(n2_information_class->valuestring); + } + + cJSON *n2_notify_callback_uri = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_create_dataJSON, "n2NotifyCallbackUri"); + + if (n2_notify_callback_uri) { + if (!cJSON_IsString(n2_notify_callback_uri)) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON() failed [n2_notify_callback_uri]"); + goto end; + } + } + + cJSON *n1_message_class = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_create_dataJSON, "n1MessageClass"); + + OpenAPI_n1_message_class_e n1_message_classVariable; + if (n1_message_class) { + if (!cJSON_IsString(n1_message_class)) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON() failed [n1_message_class]"); + goto end; + } + n1_message_classVariable = OpenAPI_n1_message_class_FromString(n1_message_class->valuestring); + } + + cJSON *n1_notify_callback_uri = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_create_dataJSON, "n1NotifyCallbackUri"); + + if (n1_notify_callback_uri) { + if (!cJSON_IsString(n1_notify_callback_uri)) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON() failed [n1_notify_callback_uri]"); + goto end; + } + } + + cJSON *nf_id = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_create_dataJSON, "nfId"); + + if (nf_id) { + if (!cJSON_IsString(nf_id)) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON() failed [nf_id]"); + goto end; + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_create_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *old_guami = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_create_dataJSON, "oldGuami"); + + OpenAPI_guami_t *old_guami_local_nonprim = NULL; + if (old_guami) { + old_guami_local_nonprim = OpenAPI_guami_parseFromJSON(old_guami); + } + + ue_n1_n2_info_subscription_create_data_local_var = OpenAPI_ue_n1_n2_info_subscription_create_data_create ( + n2_information_class ? n2_information_classVariable : 0, + n2_notify_callback_uri ? ogs_strdup(n2_notify_callback_uri->valuestring) : NULL, + n1_message_class ? n1_message_classVariable : 0, + n1_notify_callback_uri ? ogs_strdup(n1_notify_callback_uri->valuestring) : NULL, + nf_id ? ogs_strdup(nf_id->valuestring) : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + old_guami ? old_guami_local_nonprim : NULL + ); + + return ue_n1_n2_info_subscription_create_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_n1_n2_info_subscription_create_data_t *OpenAPI_ue_n1_n2_info_subscription_create_data_copy(OpenAPI_ue_n1_n2_info_subscription_create_data_t *dst, OpenAPI_ue_n1_n2_info_subscription_create_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_create_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_ue_n1_n2_info_subscription_create_data_free(dst); + dst = OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.h b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.h new file mode 100644 index 000000000..3bdc98461 --- /dev/null +++ b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.h @@ -0,0 +1,53 @@ +/* + * ue_n1_n2_info_subscription_create_data.h + * + * + */ + +#ifndef _OpenAPI_ue_n1_n2_info_subscription_create_data_H_ +#define _OpenAPI_ue_n1_n2_info_subscription_create_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "guami.h" +#include "n1_message_class.h" +#include "n2_information_class.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_n1_n2_info_subscription_create_data_s OpenAPI_ue_n1_n2_info_subscription_create_data_t; +typedef struct OpenAPI_ue_n1_n2_info_subscription_create_data_s { + OpenAPI_n2_information_class_e n2_information_class; + char *n2_notify_callback_uri; + OpenAPI_n1_message_class_e n1_message_class; + char *n1_notify_callback_uri; + char *nf_id; + char *supported_features; + struct OpenAPI_guami_s *old_guami; +} OpenAPI_ue_n1_n2_info_subscription_create_data_t; + +OpenAPI_ue_n1_n2_info_subscription_create_data_t *OpenAPI_ue_n1_n2_info_subscription_create_data_create( + OpenAPI_n2_information_class_e n2_information_class, + char *n2_notify_callback_uri, + OpenAPI_n1_message_class_e n1_message_class, + char *n1_notify_callback_uri, + char *nf_id, + char *supported_features, + OpenAPI_guami_t *old_guami + ); +void OpenAPI_ue_n1_n2_info_subscription_create_data_free(OpenAPI_ue_n1_n2_info_subscription_create_data_t *ue_n1_n2_info_subscription_create_data); +OpenAPI_ue_n1_n2_info_subscription_create_data_t *OpenAPI_ue_n1_n2_info_subscription_create_data_parseFromJSON(cJSON *ue_n1_n2_info_subscription_create_dataJSON); +cJSON *OpenAPI_ue_n1_n2_info_subscription_create_data_convertToJSON(OpenAPI_ue_n1_n2_info_subscription_create_data_t *ue_n1_n2_info_subscription_create_data); +OpenAPI_ue_n1_n2_info_subscription_create_data_t *OpenAPI_ue_n1_n2_info_subscription_create_data_copy(OpenAPI_ue_n1_n2_info_subscription_create_data_t *dst, OpenAPI_ue_n1_n2_info_subscription_create_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_n1_n2_info_subscription_create_data_H_ */ + diff --git a/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.c b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.c new file mode 100644 index 000000000..451709975 --- /dev/null +++ b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.c @@ -0,0 +1,130 @@ + +#include +#include +#include +#include "ue_n1_n2_info_subscription_created_data.h" + +OpenAPI_ue_n1_n2_info_subscription_created_data_t *OpenAPI_ue_n1_n2_info_subscription_created_data_create( + char *n1n2_notify_subscription_id, + char *supported_features + ) +{ + OpenAPI_ue_n1_n2_info_subscription_created_data_t *ue_n1_n2_info_subscription_created_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_n1_n2_info_subscription_created_data_t)); + if (!ue_n1_n2_info_subscription_created_data_local_var) { + return NULL; + } + ue_n1_n2_info_subscription_created_data_local_var->n1n2_notify_subscription_id = n1n2_notify_subscription_id; + ue_n1_n2_info_subscription_created_data_local_var->supported_features = supported_features; + + return ue_n1_n2_info_subscription_created_data_local_var; +} + +void OpenAPI_ue_n1_n2_info_subscription_created_data_free(OpenAPI_ue_n1_n2_info_subscription_created_data_t *ue_n1_n2_info_subscription_created_data) +{ + if (NULL == ue_n1_n2_info_subscription_created_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ue_n1_n2_info_subscription_created_data->n1n2_notify_subscription_id); + ogs_free(ue_n1_n2_info_subscription_created_data->supported_features); + ogs_free(ue_n1_n2_info_subscription_created_data); +} + +cJSON *OpenAPI_ue_n1_n2_info_subscription_created_data_convertToJSON(OpenAPI_ue_n1_n2_info_subscription_created_data_t *ue_n1_n2_info_subscription_created_data) +{ + cJSON *item = NULL; + + if (ue_n1_n2_info_subscription_created_data == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_created_data_convertToJSON() failed [UeN1N2InfoSubscriptionCreatedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_n1_n2_info_subscription_created_data->n1n2_notify_subscription_id) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_created_data_convertToJSON() failed [n1n2_notify_subscription_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "n1n2NotifySubscriptionId", ue_n1_n2_info_subscription_created_data->n1n2_notify_subscription_id) == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_created_data_convertToJSON() failed [n1n2_notify_subscription_id]"); + goto end; + } + + if (ue_n1_n2_info_subscription_created_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ue_n1_n2_info_subscription_created_data->supported_features) == NULL) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_created_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_n1_n2_info_subscription_created_data_t *OpenAPI_ue_n1_n2_info_subscription_created_data_parseFromJSON(cJSON *ue_n1_n2_info_subscription_created_dataJSON) +{ + OpenAPI_ue_n1_n2_info_subscription_created_data_t *ue_n1_n2_info_subscription_created_data_local_var = NULL; + cJSON *n1n2_notify_subscription_id = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_created_dataJSON, "n1n2NotifySubscriptionId"); + if (!n1n2_notify_subscription_id) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_created_data_parseFromJSON() failed [n1n2_notify_subscription_id]"); + goto end; + } + + + if (!cJSON_IsString(n1n2_notify_subscription_id)) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_created_data_parseFromJSON() failed [n1n2_notify_subscription_id]"); + goto end; + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(ue_n1_n2_info_subscription_created_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_created_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + ue_n1_n2_info_subscription_created_data_local_var = OpenAPI_ue_n1_n2_info_subscription_created_data_create ( + ogs_strdup(n1n2_notify_subscription_id->valuestring), + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return ue_n1_n2_info_subscription_created_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_n1_n2_info_subscription_created_data_t *OpenAPI_ue_n1_n2_info_subscription_created_data_copy(OpenAPI_ue_n1_n2_info_subscription_created_data_t *dst, OpenAPI_ue_n1_n2_info_subscription_created_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_n1_n2_info_subscription_created_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_n1_n2_info_subscription_created_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_ue_n1_n2_info_subscription_created_data_free(dst); + dst = OpenAPI_ue_n1_n2_info_subscription_created_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.h b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.h new file mode 100644 index 000000000..7907046f6 --- /dev/null +++ b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.h @@ -0,0 +1,40 @@ +/* + * ue_n1_n2_info_subscription_created_data.h + * + * + */ + +#ifndef _OpenAPI_ue_n1_n2_info_subscription_created_data_H_ +#define _OpenAPI_ue_n1_n2_info_subscription_created_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_n1_n2_info_subscription_created_data_s OpenAPI_ue_n1_n2_info_subscription_created_data_t; +typedef struct OpenAPI_ue_n1_n2_info_subscription_created_data_s { + char *n1n2_notify_subscription_id; + char *supported_features; +} OpenAPI_ue_n1_n2_info_subscription_created_data_t; + +OpenAPI_ue_n1_n2_info_subscription_created_data_t *OpenAPI_ue_n1_n2_info_subscription_created_data_create( + char *n1n2_notify_subscription_id, + char *supported_features + ); +void OpenAPI_ue_n1_n2_info_subscription_created_data_free(OpenAPI_ue_n1_n2_info_subscription_created_data_t *ue_n1_n2_info_subscription_created_data); +OpenAPI_ue_n1_n2_info_subscription_created_data_t *OpenAPI_ue_n1_n2_info_subscription_created_data_parseFromJSON(cJSON *ue_n1_n2_info_subscription_created_dataJSON); +cJSON *OpenAPI_ue_n1_n2_info_subscription_created_data_convertToJSON(OpenAPI_ue_n1_n2_info_subscription_created_data_t *ue_n1_n2_info_subscription_created_data); +OpenAPI_ue_n1_n2_info_subscription_created_data_t *OpenAPI_ue_n1_n2_info_subscription_created_data_copy(OpenAPI_ue_n1_n2_info_subscription_created_data_t *dst, OpenAPI_ue_n1_n2_info_subscription_created_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_n1_n2_info_subscription_created_data_H_ */ + diff --git a/lib/sbi/openapi/model/ue_policy_section.c b/lib/sbi/openapi/model/ue_policy_section.c index 0c66962d2..66b78b8c1 100644 --- a/lib/sbi/openapi/model/ue_policy_section.c +++ b/lib/sbi/openapi/model/ue_policy_section.c @@ -98,3 +98,37 @@ end: return NULL; } +OpenAPI_ue_policy_section_t *OpenAPI_ue_policy_section_copy(OpenAPI_ue_policy_section_t *dst, OpenAPI_ue_policy_section_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_policy_section_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_policy_section_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_policy_section_free(dst); + dst = OpenAPI_ue_policy_section_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_policy_section.h b/lib/sbi/openapi/model/ue_policy_section.h index c5ea80b34..badfe7f21 100644 --- a/lib/sbi/openapi/model/ue_policy_section.h +++ b/lib/sbi/openapi/model/ue_policy_section.h @@ -30,6 +30,7 @@ OpenAPI_ue_policy_section_t *OpenAPI_ue_policy_section_create( void OpenAPI_ue_policy_section_free(OpenAPI_ue_policy_section_t *ue_policy_section); OpenAPI_ue_policy_section_t *OpenAPI_ue_policy_section_parseFromJSON(cJSON *ue_policy_sectionJSON); cJSON *OpenAPI_ue_policy_section_convertToJSON(OpenAPI_ue_policy_section_t *ue_policy_section); +OpenAPI_ue_policy_section_t *OpenAPI_ue_policy_section_copy(OpenAPI_ue_policy_section_t *dst, OpenAPI_ue_policy_section_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_policy_set.c b/lib/sbi/openapi/model/ue_policy_set.c index 2c974a9cb..9fec23140 100644 --- a/lib/sbi/openapi/model/ue_policy_set.c +++ b/lib/sbi/openapi/model/ue_policy_set.c @@ -176,7 +176,7 @@ cJSON *OpenAPI_ue_policy_set_convertToJSON(OpenAPI_ue_policy_set_t *ue_policy_se } } - if (ue_policy_set->andsp_ind >= 0) { + if (ue_policy_set->andsp_ind) { if (cJSON_AddBoolToObject(item, "andspInd", ue_policy_set->andsp_ind) == NULL) { ogs_error("OpenAPI_ue_policy_set_convertToJSON() failed [andsp_ind]"); goto end; @@ -376,3 +376,37 @@ end: return NULL; } +OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_copy(OpenAPI_ue_policy_set_t *dst, OpenAPI_ue_policy_set_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_policy_set_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_policy_set_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_policy_set_free(dst); + dst = OpenAPI_ue_policy_set_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_policy_set.h b/lib/sbi/openapi/model/ue_policy_set.h index 6b0d52635..d4cd114e7 100644 --- a/lib/sbi/openapi/model/ue_policy_set.h +++ b/lib/sbi/openapi/model/ue_policy_set.h @@ -45,6 +45,7 @@ OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_create( void OpenAPI_ue_policy_set_free(OpenAPI_ue_policy_set_t *ue_policy_set); OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_parseFromJSON(cJSON *ue_policy_setJSON); cJSON *OpenAPI_ue_policy_set_convertToJSON(OpenAPI_ue_policy_set_t *ue_policy_set); +OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_copy(OpenAPI_ue_policy_set_t *dst, OpenAPI_ue_policy_set_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_policy_set_patch.c b/lib/sbi/openapi/model/ue_policy_set_patch.c index 7391dfbed..0e7dbe81f 100644 --- a/lib/sbi/openapi/model/ue_policy_set_patch.c +++ b/lib/sbi/openapi/model/ue_policy_set_patch.c @@ -96,7 +96,7 @@ cJSON *OpenAPI_ue_policy_set_patch_convertToJSON(OpenAPI_ue_policy_set_patch_t * } } - if (ue_policy_set_patch->andsp_ind >= 0) { + if (ue_policy_set_patch->andsp_ind) { if (cJSON_AddBoolToObject(item, "andspInd", ue_policy_set_patch->andsp_ind) == NULL) { ogs_error("OpenAPI_ue_policy_set_patch_convertToJSON() failed [andsp_ind]"); goto end; @@ -227,3 +227,37 @@ end: return NULL; } +OpenAPI_ue_policy_set_patch_t *OpenAPI_ue_policy_set_patch_copy(OpenAPI_ue_policy_set_patch_t *dst, OpenAPI_ue_policy_set_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_policy_set_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_policy_set_patch_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_policy_set_patch_free(dst); + dst = OpenAPI_ue_policy_set_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_policy_set_patch.h b/lib/sbi/openapi/model/ue_policy_set_patch.h index 5994b5646..4108c942d 100644 --- a/lib/sbi/openapi/model/ue_policy_set_patch.h +++ b/lib/sbi/openapi/model/ue_policy_set_patch.h @@ -37,6 +37,7 @@ OpenAPI_ue_policy_set_patch_t *OpenAPI_ue_policy_set_patch_create( void OpenAPI_ue_policy_set_patch_free(OpenAPI_ue_policy_set_patch_t *ue_policy_set_patch); OpenAPI_ue_policy_set_patch_t *OpenAPI_ue_policy_set_patch_parseFromJSON(cJSON *ue_policy_set_patchJSON); cJSON *OpenAPI_ue_policy_set_patch_convertToJSON(OpenAPI_ue_policy_set_patch_t *ue_policy_set_patch); +OpenAPI_ue_policy_set_patch_t *OpenAPI_ue_policy_set_patch_copy(OpenAPI_ue_policy_set_patch_t *dst, OpenAPI_ue_policy_set_patch_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_reachability.c b/lib/sbi/openapi/model/ue_reachability.c index 450288dd2..b6ed53c72 100644 --- a/lib/sbi/openapi/model/ue_reachability.c +++ b/lib/sbi/openapi/model/ue_reachability.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_ue_reachability_t *OpenAPI_ue_reachability_copy(OpenAPI_ue_reachability_t *dst, OpenAPI_ue_reachability_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_reachability_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_reachability_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ue_reachability_free(dst); + dst = OpenAPI_ue_reachability_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_reachability.h b/lib/sbi/openapi/model/ue_reachability.h index 6c2c3b358..2e63c1363 100644 --- a/lib/sbi/openapi/model/ue_reachability.h +++ b/lib/sbi/openapi/model/ue_reachability.h @@ -26,6 +26,7 @@ OpenAPI_ue_reachability_t *OpenAPI_ue_reachability_create( void OpenAPI_ue_reachability_free(OpenAPI_ue_reachability_t *ue_reachability); OpenAPI_ue_reachability_t *OpenAPI_ue_reachability_parseFromJSON(cJSON *ue_reachabilityJSON); cJSON *OpenAPI_ue_reachability_convertToJSON(OpenAPI_ue_reachability_t *ue_reachability); +OpenAPI_ue_reachability_t *OpenAPI_ue_reachability_copy(OpenAPI_ue_reachability_t *dst, OpenAPI_ue_reachability_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_reg_status_update_req_data.c b/lib/sbi/openapi/model/ue_reg_status_update_req_data.c new file mode 100644 index 000000000..758774aa7 --- /dev/null +++ b/lib/sbi/openapi/model/ue_reg_status_update_req_data.c @@ -0,0 +1,223 @@ + +#include +#include +#include +#include "ue_reg_status_update_req_data.h" + +OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_create( + OpenAPI_ue_context_transfer_status_e transfer_status, + OpenAPI_list_t *to_release_session_list, + int pcf_reselected_ind, + OpenAPI_list_t *smf_change_info_list + ) +{ + OpenAPI_ue_reg_status_update_req_data_t *ue_reg_status_update_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_reg_status_update_req_data_t)); + if (!ue_reg_status_update_req_data_local_var) { + return NULL; + } + ue_reg_status_update_req_data_local_var->transfer_status = transfer_status; + ue_reg_status_update_req_data_local_var->to_release_session_list = to_release_session_list; + ue_reg_status_update_req_data_local_var->pcf_reselected_ind = pcf_reselected_ind; + ue_reg_status_update_req_data_local_var->smf_change_info_list = smf_change_info_list; + + return ue_reg_status_update_req_data_local_var; +} + +void OpenAPI_ue_reg_status_update_req_data_free(OpenAPI_ue_reg_status_update_req_data_t *ue_reg_status_update_req_data) +{ + if (NULL == ue_reg_status_update_req_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(ue_reg_status_update_req_data->to_release_session_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_reg_status_update_req_data->to_release_session_list); + OpenAPI_list_for_each(ue_reg_status_update_req_data->smf_change_info_list, node) { + OpenAPI_smf_change_info_free(node->data); + } + OpenAPI_list_free(ue_reg_status_update_req_data->smf_change_info_list); + ogs_free(ue_reg_status_update_req_data); +} + +cJSON *OpenAPI_ue_reg_status_update_req_data_convertToJSON(OpenAPI_ue_reg_status_update_req_data_t *ue_reg_status_update_req_data) +{ + cJSON *item = NULL; + + if (ue_reg_status_update_req_data == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [UeRegStatusUpdateReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_reg_status_update_req_data->transfer_status) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [transfer_status]"); + goto end; + } + if (cJSON_AddStringToObject(item, "transferStatus", OpenAPI_ue_context_transfer_status_ToString(ue_reg_status_update_req_data->transfer_status)) == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [transfer_status]"); + goto end; + } + + if (ue_reg_status_update_req_data->to_release_session_list) { + cJSON *to_release_session_list = cJSON_AddArrayToObject(item, "toReleaseSessionList"); + if (to_release_session_list == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [to_release_session_list]"); + goto end; + } + + OpenAPI_lnode_t *to_release_session_list_node; + OpenAPI_list_for_each(ue_reg_status_update_req_data->to_release_session_list, to_release_session_list_node) { + if (cJSON_AddNumberToObject(to_release_session_list, "", *(double *)to_release_session_list_node->data) == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [to_release_session_list]"); + goto end; + } + } + } + + if (ue_reg_status_update_req_data->pcf_reselected_ind) { + if (cJSON_AddBoolToObject(item, "pcfReselectedInd", ue_reg_status_update_req_data->pcf_reselected_ind) == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [pcf_reselected_ind]"); + goto end; + } + } + + if (ue_reg_status_update_req_data->smf_change_info_list) { + cJSON *smf_change_info_listList = cJSON_AddArrayToObject(item, "smfChangeInfoList"); + if (smf_change_info_listList == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [smf_change_info_list]"); + goto end; + } + + OpenAPI_lnode_t *smf_change_info_list_node; + if (ue_reg_status_update_req_data->smf_change_info_list) { + OpenAPI_list_for_each(ue_reg_status_update_req_data->smf_change_info_list, smf_change_info_list_node) { + cJSON *itemLocal = OpenAPI_smf_change_info_convertToJSON(smf_change_info_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [smf_change_info_list]"); + goto end; + } + cJSON_AddItemToArray(smf_change_info_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_parseFromJSON(cJSON *ue_reg_status_update_req_dataJSON) +{ + OpenAPI_ue_reg_status_update_req_data_t *ue_reg_status_update_req_data_local_var = NULL; + cJSON *transfer_status = cJSON_GetObjectItemCaseSensitive(ue_reg_status_update_req_dataJSON, "transferStatus"); + if (!transfer_status) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [transfer_status]"); + goto end; + } + + OpenAPI_ue_context_transfer_status_e transfer_statusVariable; + + if (!cJSON_IsString(transfer_status)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [transfer_status]"); + goto end; + } + transfer_statusVariable = OpenAPI_ue_context_transfer_status_FromString(transfer_status->valuestring); + + cJSON *to_release_session_list = cJSON_GetObjectItemCaseSensitive(ue_reg_status_update_req_dataJSON, "toReleaseSessionList"); + + OpenAPI_list_t *to_release_session_listList; + if (to_release_session_list) { + cJSON *to_release_session_list_local; + if (!cJSON_IsArray(to_release_session_list)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [to_release_session_list]"); + goto end; + } + to_release_session_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(to_release_session_list_local, to_release_session_list) { + if (!cJSON_IsNumber(to_release_session_list_local)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [to_release_session_list]"); + goto end; + } + OpenAPI_list_add(to_release_session_listList, &to_release_session_list_local->valuedouble); + } + } + + cJSON *pcf_reselected_ind = cJSON_GetObjectItemCaseSensitive(ue_reg_status_update_req_dataJSON, "pcfReselectedInd"); + + if (pcf_reselected_ind) { + if (!cJSON_IsBool(pcf_reselected_ind)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [pcf_reselected_ind]"); + goto end; + } + } + + cJSON *smf_change_info_list = cJSON_GetObjectItemCaseSensitive(ue_reg_status_update_req_dataJSON, "smfChangeInfoList"); + + OpenAPI_list_t *smf_change_info_listList; + if (smf_change_info_list) { + cJSON *smf_change_info_list_local_nonprimitive; + if (!cJSON_IsArray(smf_change_info_list)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [smf_change_info_list]"); + goto end; + } + + smf_change_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(smf_change_info_list_local_nonprimitive, smf_change_info_list ) { + if (!cJSON_IsObject(smf_change_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [smf_change_info_list]"); + goto end; + } + OpenAPI_smf_change_info_t *smf_change_info_listItem = OpenAPI_smf_change_info_parseFromJSON(smf_change_info_list_local_nonprimitive); + + OpenAPI_list_add(smf_change_info_listList, smf_change_info_listItem); + } + } + + ue_reg_status_update_req_data_local_var = OpenAPI_ue_reg_status_update_req_data_create ( + transfer_statusVariable, + to_release_session_list ? to_release_session_listList : NULL, + pcf_reselected_ind ? pcf_reselected_ind->valueint : 0, + smf_change_info_list ? smf_change_info_listList : NULL + ); + + return ue_reg_status_update_req_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_copy(OpenAPI_ue_reg_status_update_req_data_t *dst, OpenAPI_ue_reg_status_update_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_reg_status_update_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_reg_status_update_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_ue_reg_status_update_req_data_free(dst); + dst = OpenAPI_ue_reg_status_update_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_reg_status_update_req_data.h b/lib/sbi/openapi/model/ue_reg_status_update_req_data.h new file mode 100644 index 000000000..38e011d2e --- /dev/null +++ b/lib/sbi/openapi/model/ue_reg_status_update_req_data.h @@ -0,0 +1,46 @@ +/* + * ue_reg_status_update_req_data.h + * + * + */ + +#ifndef _OpenAPI_ue_reg_status_update_req_data_H_ +#define _OpenAPI_ue_reg_status_update_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "smf_change_info.h" +#include "ue_context_transfer_status.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_reg_status_update_req_data_s OpenAPI_ue_reg_status_update_req_data_t; +typedef struct OpenAPI_ue_reg_status_update_req_data_s { + OpenAPI_ue_context_transfer_status_e transfer_status; + OpenAPI_list_t *to_release_session_list; + int pcf_reselected_ind; + OpenAPI_list_t *smf_change_info_list; +} OpenAPI_ue_reg_status_update_req_data_t; + +OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_create( + OpenAPI_ue_context_transfer_status_e transfer_status, + OpenAPI_list_t *to_release_session_list, + int pcf_reselected_ind, + OpenAPI_list_t *smf_change_info_list + ); +void OpenAPI_ue_reg_status_update_req_data_free(OpenAPI_ue_reg_status_update_req_data_t *ue_reg_status_update_req_data); +OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_parseFromJSON(cJSON *ue_reg_status_update_req_dataJSON); +cJSON *OpenAPI_ue_reg_status_update_req_data_convertToJSON(OpenAPI_ue_reg_status_update_req_data_t *ue_reg_status_update_req_data); +OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_copy(OpenAPI_ue_reg_status_update_req_data_t *dst, OpenAPI_ue_reg_status_update_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_reg_status_update_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.c b/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.c new file mode 100644 index 000000000..70c2f1416 --- /dev/null +++ b/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.c @@ -0,0 +1,105 @@ + +#include +#include +#include +#include "ue_reg_status_update_rsp_data.h" + +OpenAPI_ue_reg_status_update_rsp_data_t *OpenAPI_ue_reg_status_update_rsp_data_create( + int reg_status_transfer_complete + ) +{ + OpenAPI_ue_reg_status_update_rsp_data_t *ue_reg_status_update_rsp_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_reg_status_update_rsp_data_t)); + if (!ue_reg_status_update_rsp_data_local_var) { + return NULL; + } + ue_reg_status_update_rsp_data_local_var->reg_status_transfer_complete = reg_status_transfer_complete; + + return ue_reg_status_update_rsp_data_local_var; +} + +void OpenAPI_ue_reg_status_update_rsp_data_free(OpenAPI_ue_reg_status_update_rsp_data_t *ue_reg_status_update_rsp_data) +{ + if (NULL == ue_reg_status_update_rsp_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ue_reg_status_update_rsp_data); +} + +cJSON *OpenAPI_ue_reg_status_update_rsp_data_convertToJSON(OpenAPI_ue_reg_status_update_rsp_data_t *ue_reg_status_update_rsp_data) +{ + cJSON *item = NULL; + + if (ue_reg_status_update_rsp_data == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_rsp_data_convertToJSON() failed [UeRegStatusUpdateRspData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddBoolToObject(item, "regStatusTransferComplete", ue_reg_status_update_rsp_data->reg_status_transfer_complete) == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_rsp_data_convertToJSON() failed [reg_status_transfer_complete]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ue_reg_status_update_rsp_data_t *OpenAPI_ue_reg_status_update_rsp_data_parseFromJSON(cJSON *ue_reg_status_update_rsp_dataJSON) +{ + OpenAPI_ue_reg_status_update_rsp_data_t *ue_reg_status_update_rsp_data_local_var = NULL; + cJSON *reg_status_transfer_complete = cJSON_GetObjectItemCaseSensitive(ue_reg_status_update_rsp_dataJSON, "regStatusTransferComplete"); + if (!reg_status_transfer_complete) { + ogs_error("OpenAPI_ue_reg_status_update_rsp_data_parseFromJSON() failed [reg_status_transfer_complete]"); + goto end; + } + + + if (!cJSON_IsBool(reg_status_transfer_complete)) { + ogs_error("OpenAPI_ue_reg_status_update_rsp_data_parseFromJSON() failed [reg_status_transfer_complete]"); + goto end; + } + + ue_reg_status_update_rsp_data_local_var = OpenAPI_ue_reg_status_update_rsp_data_create ( + reg_status_transfer_complete->valueint + ); + + return ue_reg_status_update_rsp_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_reg_status_update_rsp_data_t *OpenAPI_ue_reg_status_update_rsp_data_copy(OpenAPI_ue_reg_status_update_rsp_data_t *dst, OpenAPI_ue_reg_status_update_rsp_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_reg_status_update_rsp_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_reg_status_update_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_ue_reg_status_update_rsp_data_free(dst); + dst = OpenAPI_ue_reg_status_update_rsp_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.h b/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.h new file mode 100644 index 000000000..3be7748b4 --- /dev/null +++ b/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.h @@ -0,0 +1,38 @@ +/* + * ue_reg_status_update_rsp_data.h + * + * + */ + +#ifndef _OpenAPI_ue_reg_status_update_rsp_data_H_ +#define _OpenAPI_ue_reg_status_update_rsp_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_reg_status_update_rsp_data_s OpenAPI_ue_reg_status_update_rsp_data_t; +typedef struct OpenAPI_ue_reg_status_update_rsp_data_s { + int reg_status_transfer_complete; +} OpenAPI_ue_reg_status_update_rsp_data_t; + +OpenAPI_ue_reg_status_update_rsp_data_t *OpenAPI_ue_reg_status_update_rsp_data_create( + int reg_status_transfer_complete + ); +void OpenAPI_ue_reg_status_update_rsp_data_free(OpenAPI_ue_reg_status_update_rsp_data_t *ue_reg_status_update_rsp_data); +OpenAPI_ue_reg_status_update_rsp_data_t *OpenAPI_ue_reg_status_update_rsp_data_parseFromJSON(cJSON *ue_reg_status_update_rsp_dataJSON); +cJSON *OpenAPI_ue_reg_status_update_rsp_data_convertToJSON(OpenAPI_ue_reg_status_update_rsp_data_t *ue_reg_status_update_rsp_data); +OpenAPI_ue_reg_status_update_rsp_data_t *OpenAPI_ue_reg_status_update_rsp_data_copy(OpenAPI_ue_reg_status_update_rsp_data_t *dst, OpenAPI_ue_reg_status_update_rsp_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_reg_status_update_rsp_data_H_ */ + diff --git a/lib/sbi/openapi/model/ulcl_bp_information.c b/lib/sbi/openapi/model/ulcl_bp_information.c new file mode 100644 index 000000000..50ff70c2e --- /dev/null +++ b/lib/sbi/openapi/model/ulcl_bp_information.c @@ -0,0 +1,105 @@ + +#include +#include +#include +#include "ulcl_bp_information.h" + +OpenAPI_ulcl_bp_information_t *OpenAPI_ulcl_bp_information_create( + char *ulcl_bp_upf_id + ) +{ + OpenAPI_ulcl_bp_information_t *ulcl_bp_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_ulcl_bp_information_t)); + if (!ulcl_bp_information_local_var) { + return NULL; + } + ulcl_bp_information_local_var->ulcl_bp_upf_id = ulcl_bp_upf_id; + + return ulcl_bp_information_local_var; +} + +void OpenAPI_ulcl_bp_information_free(OpenAPI_ulcl_bp_information_t *ulcl_bp_information) +{ + if (NULL == ulcl_bp_information) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ulcl_bp_information->ulcl_bp_upf_id); + ogs_free(ulcl_bp_information); +} + +cJSON *OpenAPI_ulcl_bp_information_convertToJSON(OpenAPI_ulcl_bp_information_t *ulcl_bp_information) +{ + cJSON *item = NULL; + + if (ulcl_bp_information == NULL) { + ogs_error("OpenAPI_ulcl_bp_information_convertToJSON() failed [UlclBpInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ulcl_bp_information->ulcl_bp_upf_id) { + if (cJSON_AddStringToObject(item, "ulclBpUpfId", ulcl_bp_information->ulcl_bp_upf_id) == NULL) { + ogs_error("OpenAPI_ulcl_bp_information_convertToJSON() failed [ulcl_bp_upf_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ulcl_bp_information_t *OpenAPI_ulcl_bp_information_parseFromJSON(cJSON *ulcl_bp_informationJSON) +{ + OpenAPI_ulcl_bp_information_t *ulcl_bp_information_local_var = NULL; + cJSON *ulcl_bp_upf_id = cJSON_GetObjectItemCaseSensitive(ulcl_bp_informationJSON, "ulclBpUpfId"); + + if (ulcl_bp_upf_id) { + if (!cJSON_IsString(ulcl_bp_upf_id)) { + ogs_error("OpenAPI_ulcl_bp_information_parseFromJSON() failed [ulcl_bp_upf_id]"); + goto end; + } + } + + ulcl_bp_information_local_var = OpenAPI_ulcl_bp_information_create ( + ulcl_bp_upf_id ? ogs_strdup(ulcl_bp_upf_id->valuestring) : NULL + ); + + return ulcl_bp_information_local_var; +end: + return NULL; +} + +OpenAPI_ulcl_bp_information_t *OpenAPI_ulcl_bp_information_copy(OpenAPI_ulcl_bp_information_t *dst, OpenAPI_ulcl_bp_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ulcl_bp_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ulcl_bp_information_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_ulcl_bp_information_free(dst); + dst = OpenAPI_ulcl_bp_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ulcl_bp_information.h b/lib/sbi/openapi/model/ulcl_bp_information.h new file mode 100644 index 000000000..2b63f61cf --- /dev/null +++ b/lib/sbi/openapi/model/ulcl_bp_information.h @@ -0,0 +1,38 @@ +/* + * ulcl_bp_information.h + * + * + */ + +#ifndef _OpenAPI_ulcl_bp_information_H_ +#define _OpenAPI_ulcl_bp_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ulcl_bp_information_s OpenAPI_ulcl_bp_information_t; +typedef struct OpenAPI_ulcl_bp_information_s { + char *ulcl_bp_upf_id; +} OpenAPI_ulcl_bp_information_t; + +OpenAPI_ulcl_bp_information_t *OpenAPI_ulcl_bp_information_create( + char *ulcl_bp_upf_id + ); +void OpenAPI_ulcl_bp_information_free(OpenAPI_ulcl_bp_information_t *ulcl_bp_information); +OpenAPI_ulcl_bp_information_t *OpenAPI_ulcl_bp_information_parseFromJSON(cJSON *ulcl_bp_informationJSON); +cJSON *OpenAPI_ulcl_bp_information_convertToJSON(OpenAPI_ulcl_bp_information_t *ulcl_bp_information); +OpenAPI_ulcl_bp_information_t *OpenAPI_ulcl_bp_information_copy(OpenAPI_ulcl_bp_information_t *dst, OpenAPI_ulcl_bp_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ulcl_bp_information_H_ */ + diff --git a/lib/sbi/openapi/model/unavailable_access_indication.c b/lib/sbi/openapi/model/unavailable_access_indication.c new file mode 100644 index 000000000..bce64eec1 --- /dev/null +++ b/lib/sbi/openapi/model/unavailable_access_indication.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "unavailable_access_indication.h" + +OpenAPI_unavailable_access_indication_t *OpenAPI_unavailable_access_indication_create( + ) +{ + OpenAPI_unavailable_access_indication_t *unavailable_access_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_unavailable_access_indication_t)); + if (!unavailable_access_indication_local_var) { + return NULL; + } + + return unavailable_access_indication_local_var; +} + +void OpenAPI_unavailable_access_indication_free(OpenAPI_unavailable_access_indication_t *unavailable_access_indication) +{ + if (NULL == unavailable_access_indication) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(unavailable_access_indication); +} + +cJSON *OpenAPI_unavailable_access_indication_convertToJSON(OpenAPI_unavailable_access_indication_t *unavailable_access_indication) +{ + cJSON *item = NULL; + + if (unavailable_access_indication == NULL) { + ogs_error("OpenAPI_unavailable_access_indication_convertToJSON() failed [UnavailableAccessIndication]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_unavailable_access_indication_t *OpenAPI_unavailable_access_indication_parseFromJSON(cJSON *unavailable_access_indicationJSON) +{ + OpenAPI_unavailable_access_indication_t *unavailable_access_indication_local_var = NULL; + unavailable_access_indication_local_var = OpenAPI_unavailable_access_indication_create ( + ); + + return unavailable_access_indication_local_var; +end: + return NULL; +} + +OpenAPI_unavailable_access_indication_t *OpenAPI_unavailable_access_indication_copy(OpenAPI_unavailable_access_indication_t *dst, OpenAPI_unavailable_access_indication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_unavailable_access_indication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_unavailable_access_indication_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_unavailable_access_indication_free(dst); + dst = OpenAPI_unavailable_access_indication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/unavailable_access_indication.h b/lib/sbi/openapi/model/unavailable_access_indication.h new file mode 100644 index 000000000..c542a55e7 --- /dev/null +++ b/lib/sbi/openapi/model/unavailable_access_indication.h @@ -0,0 +1,36 @@ +/* + * unavailable_access_indication.h + * + * Possible values are - 3GA_UNAVAILABLE - N3GA_UNAVAILABLE + */ + +#ifndef _OpenAPI_unavailable_access_indication_H_ +#define _OpenAPI_unavailable_access_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_unavailable_access_indication_s OpenAPI_unavailable_access_indication_t; +typedef struct OpenAPI_unavailable_access_indication_s { +} OpenAPI_unavailable_access_indication_t; + +OpenAPI_unavailable_access_indication_t *OpenAPI_unavailable_access_indication_create( + ); +void OpenAPI_unavailable_access_indication_free(OpenAPI_unavailable_access_indication_t *unavailable_access_indication); +OpenAPI_unavailable_access_indication_t *OpenAPI_unavailable_access_indication_parseFromJSON(cJSON *unavailable_access_indicationJSON); +cJSON *OpenAPI_unavailable_access_indication_convertToJSON(OpenAPI_unavailable_access_indication_t *unavailable_access_indication); +OpenAPI_unavailable_access_indication_t *OpenAPI_unavailable_access_indication_copy(OpenAPI_unavailable_access_indication_t *dst, OpenAPI_unavailable_access_indication_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_unavailable_access_indication_H_ */ + diff --git a/lib/sbi/openapi/model/uncertainty_ellipse.c b/lib/sbi/openapi/model/uncertainty_ellipse.c index 841747838..4427c4d21 100644 --- a/lib/sbi/openapi/model/uncertainty_ellipse.c +++ b/lib/sbi/openapi/model/uncertainty_ellipse.c @@ -121,3 +121,37 @@ end: return NULL; } +OpenAPI_uncertainty_ellipse_t *OpenAPI_uncertainty_ellipse_copy(OpenAPI_uncertainty_ellipse_t *dst, OpenAPI_uncertainty_ellipse_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_uncertainty_ellipse_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_uncertainty_ellipse_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_uncertainty_ellipse_free(dst); + dst = OpenAPI_uncertainty_ellipse_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/uncertainty_ellipse.h b/lib/sbi/openapi/model/uncertainty_ellipse.h index fbca8fc4b..9dd9b1a8e 100644 --- a/lib/sbi/openapi/model/uncertainty_ellipse.h +++ b/lib/sbi/openapi/model/uncertainty_ellipse.h @@ -32,6 +32,7 @@ OpenAPI_uncertainty_ellipse_t *OpenAPI_uncertainty_ellipse_create( void OpenAPI_uncertainty_ellipse_free(OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse); OpenAPI_uncertainty_ellipse_t *OpenAPI_uncertainty_ellipse_parseFromJSON(cJSON *uncertainty_ellipseJSON); cJSON *OpenAPI_uncertainty_ellipse_convertToJSON(OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse); +OpenAPI_uncertainty_ellipse_t *OpenAPI_uncertainty_ellipse_copy(OpenAPI_uncertainty_ellipse_t *dst, OpenAPI_uncertainty_ellipse_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/unrelated_class.c b/lib/sbi/openapi/model/unrelated_class.c index d27ebf8f5..edf5bea89 100644 --- a/lib/sbi/openapi/model/unrelated_class.c +++ b/lib/sbi/openapi/model/unrelated_class.c @@ -152,3 +152,37 @@ end: return NULL; } +OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_copy(OpenAPI_unrelated_class_t *dst, OpenAPI_unrelated_class_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_unrelated_class_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_unrelated_class_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_unrelated_class_free(dst); + dst = OpenAPI_unrelated_class_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/unrelated_class.h b/lib/sbi/openapi/model/unrelated_class.h index c21509da2..1679b7bf4 100644 --- a/lib/sbi/openapi/model/unrelated_class.h +++ b/lib/sbi/openapi/model/unrelated_class.h @@ -35,6 +35,7 @@ OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_create( void OpenAPI_unrelated_class_free(OpenAPI_unrelated_class_t *unrelated_class); OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_parseFromJSON(cJSON *unrelated_classJSON); cJSON *OpenAPI_unrelated_class_convertToJSON(OpenAPI_unrelated_class_t *unrelated_class); +OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_copy(OpenAPI_unrelated_class_t *dst, OpenAPI_unrelated_class_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/up_cnx_state.c b/lib/sbi/openapi/model/up_cnx_state.c new file mode 100644 index 000000000..da699fac6 --- /dev/null +++ b/lib/sbi/openapi/model/up_cnx_state.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "up_cnx_state.h" + +OpenAPI_up_cnx_state_t *OpenAPI_up_cnx_state_create( + ) +{ + OpenAPI_up_cnx_state_t *up_cnx_state_local_var = OpenAPI_malloc(sizeof(OpenAPI_up_cnx_state_t)); + if (!up_cnx_state_local_var) { + return NULL; + } + + return up_cnx_state_local_var; +} + +void OpenAPI_up_cnx_state_free(OpenAPI_up_cnx_state_t *up_cnx_state) +{ + if (NULL == up_cnx_state) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(up_cnx_state); +} + +cJSON *OpenAPI_up_cnx_state_convertToJSON(OpenAPI_up_cnx_state_t *up_cnx_state) +{ + cJSON *item = NULL; + + if (up_cnx_state == NULL) { + ogs_error("OpenAPI_up_cnx_state_convertToJSON() failed [UpCnxState]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_up_cnx_state_t *OpenAPI_up_cnx_state_parseFromJSON(cJSON *up_cnx_stateJSON) +{ + OpenAPI_up_cnx_state_t *up_cnx_state_local_var = NULL; + up_cnx_state_local_var = OpenAPI_up_cnx_state_create ( + ); + + return up_cnx_state_local_var; +end: + return NULL; +} + +OpenAPI_up_cnx_state_t *OpenAPI_up_cnx_state_copy(OpenAPI_up_cnx_state_t *dst, OpenAPI_up_cnx_state_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_up_cnx_state_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_up_cnx_state_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_up_cnx_state_free(dst); + dst = OpenAPI_up_cnx_state_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/up_cnx_state.h b/lib/sbi/openapi/model/up_cnx_state.h new file mode 100644 index 000000000..dd0f82209 --- /dev/null +++ b/lib/sbi/openapi/model/up_cnx_state.h @@ -0,0 +1,36 @@ +/* + * up_cnx_state.h + * + * Possible values are - ACTIVATED - DEACTIVATED - ACTIVATING - SUSPENDED + */ + +#ifndef _OpenAPI_up_cnx_state_H_ +#define _OpenAPI_up_cnx_state_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_up_cnx_state_s OpenAPI_up_cnx_state_t; +typedef struct OpenAPI_up_cnx_state_s { +} OpenAPI_up_cnx_state_t; + +OpenAPI_up_cnx_state_t *OpenAPI_up_cnx_state_create( + ); +void OpenAPI_up_cnx_state_free(OpenAPI_up_cnx_state_t *up_cnx_state); +OpenAPI_up_cnx_state_t *OpenAPI_up_cnx_state_parseFromJSON(cJSON *up_cnx_stateJSON); +cJSON *OpenAPI_up_cnx_state_convertToJSON(OpenAPI_up_cnx_state_t *up_cnx_state); +OpenAPI_up_cnx_state_t *OpenAPI_up_cnx_state_copy(OpenAPI_up_cnx_state_t *dst, OpenAPI_up_cnx_state_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_up_cnx_state_H_ */ + diff --git a/lib/sbi/openapi/model/up_confidentiality.c b/lib/sbi/openapi/model/up_confidentiality.c index 7fa208fa3..f1afddd47 100644 --- a/lib/sbi/openapi/model/up_confidentiality.c +++ b/lib/sbi/openapi/model/up_confidentiality.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_copy(OpenAPI_up_confidentiality_t *dst, OpenAPI_up_confidentiality_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_up_confidentiality_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_up_confidentiality_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_up_confidentiality_free(dst); + dst = OpenAPI_up_confidentiality_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/up_confidentiality.h b/lib/sbi/openapi/model/up_confidentiality.h index 501a043a1..f89079cfa 100644 --- a/lib/sbi/openapi/model/up_confidentiality.h +++ b/lib/sbi/openapi/model/up_confidentiality.h @@ -26,6 +26,7 @@ OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_create( void OpenAPI_up_confidentiality_free(OpenAPI_up_confidentiality_t *up_confidentiality); OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_parseFromJSON(cJSON *up_confidentialityJSON); cJSON *OpenAPI_up_confidentiality_convertToJSON(OpenAPI_up_confidentiality_t *up_confidentiality); +OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_copy(OpenAPI_up_confidentiality_t *dst, OpenAPI_up_confidentiality_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/up_integrity.c b/lib/sbi/openapi/model/up_integrity.c index d06e5b4b8..a15de0427 100644 --- a/lib/sbi/openapi/model/up_integrity.c +++ b/lib/sbi/openapi/model/up_integrity.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_up_integrity_t *OpenAPI_up_integrity_copy(OpenAPI_up_integrity_t *dst, OpenAPI_up_integrity_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_up_integrity_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_up_integrity_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_up_integrity_free(dst); + dst = OpenAPI_up_integrity_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/up_integrity.h b/lib/sbi/openapi/model/up_integrity.h index c71d54a67..2d3f2dc7f 100644 --- a/lib/sbi/openapi/model/up_integrity.h +++ b/lib/sbi/openapi/model/up_integrity.h @@ -26,6 +26,7 @@ OpenAPI_up_integrity_t *OpenAPI_up_integrity_create( void OpenAPI_up_integrity_free(OpenAPI_up_integrity_t *up_integrity); OpenAPI_up_integrity_t *OpenAPI_up_integrity_parseFromJSON(cJSON *up_integrityJSON); cJSON *OpenAPI_up_integrity_convertToJSON(OpenAPI_up_integrity_t *up_integrity); +OpenAPI_up_integrity_t *OpenAPI_up_integrity_copy(OpenAPI_up_integrity_t *dst, OpenAPI_up_integrity_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/up_interface_type.c b/lib/sbi/openapi/model/up_interface_type.c index 5fd6e5e4c..a7b8d272e 100644 --- a/lib/sbi/openapi/model/up_interface_type.c +++ b/lib/sbi/openapi/model/up_interface_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_up_interface_type_t *OpenAPI_up_interface_type_copy(OpenAPI_up_interface_type_t *dst, OpenAPI_up_interface_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_up_interface_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_up_interface_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_up_interface_type_free(dst); + dst = OpenAPI_up_interface_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/up_interface_type.h b/lib/sbi/openapi/model/up_interface_type.h index b185e4b0f..c1e5049e5 100644 --- a/lib/sbi/openapi/model/up_interface_type.h +++ b/lib/sbi/openapi/model/up_interface_type.h @@ -26,6 +26,7 @@ OpenAPI_up_interface_type_t *OpenAPI_up_interface_type_create( void OpenAPI_up_interface_type_free(OpenAPI_up_interface_type_t *up_interface_type); OpenAPI_up_interface_type_t *OpenAPI_up_interface_type_parseFromJSON(cJSON *up_interface_typeJSON); cJSON *OpenAPI_up_interface_type_convertToJSON(OpenAPI_up_interface_type_t *up_interface_type); +OpenAPI_up_interface_type_t *OpenAPI_up_interface_type_copy(OpenAPI_up_interface_type_t *dst, OpenAPI_up_interface_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/up_security.c b/lib/sbi/openapi/model/up_security.c index e4ee49385..ac91ebaad 100644 --- a/lib/sbi/openapi/model/up_security.c +++ b/lib/sbi/openapi/model/up_security.c @@ -107,3 +107,37 @@ end: return NULL; } +OpenAPI_up_security_t *OpenAPI_up_security_copy(OpenAPI_up_security_t *dst, OpenAPI_up_security_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_up_security_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_up_security_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_up_security_free(dst); + dst = OpenAPI_up_security_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/up_security.h b/lib/sbi/openapi/model/up_security.h index 3578b691b..655ca0da8 100644 --- a/lib/sbi/openapi/model/up_security.h +++ b/lib/sbi/openapi/model/up_security.h @@ -32,6 +32,7 @@ OpenAPI_up_security_t *OpenAPI_up_security_create( void OpenAPI_up_security_free(OpenAPI_up_security_t *up_security); OpenAPI_up_security_t *OpenAPI_up_security_parseFromJSON(cJSON *up_securityJSON); cJSON *OpenAPI_up_security_convertToJSON(OpenAPI_up_security_t *up_security); +OpenAPI_up_security_t *OpenAPI_up_security_copy(OpenAPI_up_security_t *dst, OpenAPI_up_security_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/updated_item.c b/lib/sbi/openapi/model/updated_item.c index 70bfbcf8d..efeadfef4 100644 --- a/lib/sbi/openapi/model/updated_item.c +++ b/lib/sbi/openapi/model/updated_item.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_updated_item_t *OpenAPI_updated_item_copy(OpenAPI_updated_item_t *dst, OpenAPI_updated_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_updated_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_updated_item_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_updated_item_free(dst); + dst = OpenAPI_updated_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/updated_item.h b/lib/sbi/openapi/model/updated_item.h index d812372db..05c9faccf 100644 --- a/lib/sbi/openapi/model/updated_item.h +++ b/lib/sbi/openapi/model/updated_item.h @@ -30,6 +30,7 @@ OpenAPI_updated_item_t *OpenAPI_updated_item_create( void OpenAPI_updated_item_free(OpenAPI_updated_item_t *updated_item); OpenAPI_updated_item_t *OpenAPI_updated_item_parseFromJSON(cJSON *updated_itemJSON); cJSON *OpenAPI_updated_item_convertToJSON(OpenAPI_updated_item_t *updated_item); +OpenAPI_updated_item_t *OpenAPI_updated_item_copy(OpenAPI_updated_item_t *dst, OpenAPI_updated_item_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/upf_cond.c b/lib/sbi/openapi/model/upf_cond.c index 8e2c34d54..501881f27 100644 --- a/lib/sbi/openapi/model/upf_cond.c +++ b/lib/sbi/openapi/model/upf_cond.c @@ -142,3 +142,37 @@ end: return NULL; } +OpenAPI_upf_cond_t *OpenAPI_upf_cond_copy(OpenAPI_upf_cond_t *dst, OpenAPI_upf_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_upf_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_upf_cond_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_upf_cond_free(dst); + dst = OpenAPI_upf_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/upf_cond.h b/lib/sbi/openapi/model/upf_cond.h index e333a9496..bf66fd8d6 100644 --- a/lib/sbi/openapi/model/upf_cond.h +++ b/lib/sbi/openapi/model/upf_cond.h @@ -31,6 +31,7 @@ OpenAPI_upf_cond_t *OpenAPI_upf_cond_create( void OpenAPI_upf_cond_free(OpenAPI_upf_cond_t *upf_cond); OpenAPI_upf_cond_t *OpenAPI_upf_cond_parseFromJSON(cJSON *upf_condJSON); cJSON *OpenAPI_upf_cond_convertToJSON(OpenAPI_upf_cond_t *upf_cond); +OpenAPI_upf_cond_t *OpenAPI_upf_cond_copy(OpenAPI_upf_cond_t *dst, OpenAPI_upf_cond_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/upf_info.c b/lib/sbi/openapi/model/upf_info.c index 58933ee78..eeffd3a18 100644 --- a/lib/sbi/openapi/model/upf_info.c +++ b/lib/sbi/openapi/model/upf_info.c @@ -59,9 +59,6 @@ void OpenAPI_upf_info_free(OpenAPI_upf_info_t *upf_info) OpenAPI_interface_upf_info_item_free(node->data); } OpenAPI_list_free(upf_info->interface_upf_info_list); - OpenAPI_list_for_each(upf_info->pdu_session_types, node) { - OpenAPI_pdu_session_type_free(node->data); - } OpenAPI_list_free(upf_info->pdu_session_types); OpenAPI_atsss_capability_free(upf_info->atsss_capability); OpenAPI_list_for_each(upf_info->tai_list, node) { @@ -142,7 +139,7 @@ cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info) } } - if (upf_info->iwk_eps_ind >= 0) { + if (upf_info->iwk_eps_ind) { if (cJSON_AddBoolToObject(item, "iwkEpsInd", upf_info->iwk_eps_ind) == NULL) { ogs_error("OpenAPI_upf_info_convertToJSON() failed [iwk_eps_ind]"); goto end; @@ -150,21 +147,16 @@ cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info) } if (upf_info->pdu_session_types) { - cJSON *pdu_session_typesList = cJSON_AddArrayToObject(item, "pduSessionTypes"); - if (pdu_session_typesList == NULL) { + cJSON *pdu_session_types = cJSON_AddArrayToObject(item, "pduSessionTypes"); + if (pdu_session_types == NULL) { ogs_error("OpenAPI_upf_info_convertToJSON() failed [pdu_session_types]"); goto end; } - OpenAPI_lnode_t *pdu_session_types_node; - if (upf_info->pdu_session_types) { - OpenAPI_list_for_each(upf_info->pdu_session_types, pdu_session_types_node) { - cJSON *itemLocal = OpenAPI_pdu_session_type_convertToJSON(pdu_session_types_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_upf_info_convertToJSON() failed [pdu_session_types]"); - goto end; - } - cJSON_AddItemToArray(pdu_session_typesList, itemLocal); + OpenAPI_list_for_each(upf_info->pdu_session_types, pdu_session_types_node) { + if (cJSON_AddStringToObject(pdu_session_types, "", OpenAPI_pdu_session_type_ToString((OpenAPI_pdu_session_type_e)pdu_session_types_node->data)) == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [pdu_session_types]"); + goto end; } } } @@ -182,7 +174,7 @@ cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info) } } - if (upf_info->ue_ip_addr_ind >= 0) { + if (upf_info->ue_ip_addr_ind) { if (cJSON_AddBoolToObject(item, "ueIpAddrInd", upf_info->ue_ip_addr_ind) == NULL) { ogs_error("OpenAPI_upf_info_convertToJSON() failed [ue_ip_addr_ind]"); goto end; @@ -255,7 +247,7 @@ cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info) } } - if (upf_info->redundant_gtpu >= 0) { + if (upf_info->redundant_gtpu) { if (cJSON_AddBoolToObject(item, "redundantGtpu", upf_info->redundant_gtpu) == NULL) { ogs_error("OpenAPI_upf_info_convertToJSON() failed [redundant_gtpu]"); goto end; @@ -360,13 +352,12 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) pdu_session_typesList = OpenAPI_list_create(); cJSON_ArrayForEach(pdu_session_types_local_nonprimitive, pdu_session_types ) { - if (!cJSON_IsObject(pdu_session_types_local_nonprimitive)) { + if (!cJSON_IsString(pdu_session_types_local_nonprimitive)) { ogs_error("OpenAPI_upf_info_parseFromJSON() failed [pdu_session_types]"); goto end; } - OpenAPI_pdu_session_type_t *pdu_session_typesItem = OpenAPI_pdu_session_type_parseFromJSON(pdu_session_types_local_nonprimitive); - OpenAPI_list_add(pdu_session_typesList, pdu_session_typesItem); + OpenAPI_list_add(pdu_session_typesList, (void *)OpenAPI_pdu_session_type_FromString(pdu_session_types_local_nonprimitive->valuestring)); } } @@ -469,3 +460,37 @@ end: return NULL; } +OpenAPI_upf_info_t *OpenAPI_upf_info_copy(OpenAPI_upf_info_t *dst, OpenAPI_upf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_upf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_upf_info_free(dst); + dst = OpenAPI_upf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/upf_info.h b/lib/sbi/openapi/model/upf_info.h index ffc9bef76..c4d7bab1c 100644 --- a/lib/sbi/openapi/model/upf_info.h +++ b/lib/sbi/openapi/model/upf_info.h @@ -60,6 +60,7 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( void OpenAPI_upf_info_free(OpenAPI_upf_info_t *upf_info); OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON); cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info); +OpenAPI_upf_info_t *OpenAPI_upf_info_copy(OpenAPI_upf_info_t *dst, OpenAPI_upf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/upu_data.c b/lib/sbi/openapi/model/upu_data.c index ad5dcd847..591a34bbf 100644 --- a/lib/sbi/openapi/model/upu_data.c +++ b/lib/sbi/openapi/model/upu_data.c @@ -140,3 +140,37 @@ end: return NULL; } +OpenAPI_upu_data_t *OpenAPI_upu_data_copy(OpenAPI_upu_data_t *dst, OpenAPI_upu_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_upu_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_upu_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_upu_data_free(dst); + dst = OpenAPI_upu_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/upu_data.h b/lib/sbi/openapi/model/upu_data.h index 85c136504..7b6ae8dc5 100644 --- a/lib/sbi/openapi/model/upu_data.h +++ b/lib/sbi/openapi/model/upu_data.h @@ -35,6 +35,7 @@ OpenAPI_upu_data_t *OpenAPI_upu_data_create( void OpenAPI_upu_data_free(OpenAPI_upu_data_t *upu_data); OpenAPI_upu_data_t *OpenAPI_upu_data_parseFromJSON(cJSON *upu_dataJSON); cJSON *OpenAPI_upu_data_convertToJSON(OpenAPI_upu_data_t *upu_data); +OpenAPI_upu_data_t *OpenAPI_upu_data_copy(OpenAPI_upu_data_t *dst, OpenAPI_upu_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/upu_data_2.c b/lib/sbi/openapi/model/upu_data_2.c index 70cc38f6d..81d24c8df 100644 --- a/lib/sbi/openapi/model/upu_data_2.c +++ b/lib/sbi/openapi/model/upu_data_2.c @@ -139,3 +139,37 @@ end: return NULL; } +OpenAPI_upu_data_2_t *OpenAPI_upu_data_2_copy(OpenAPI_upu_data_2_t *dst, OpenAPI_upu_data_2_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_upu_data_2_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_upu_data_2_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_upu_data_2_free(dst); + dst = OpenAPI_upu_data_2_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/upu_data_2.h b/lib/sbi/openapi/model/upu_data_2.h index 65610cfd5..41ef9b041 100644 --- a/lib/sbi/openapi/model/upu_data_2.h +++ b/lib/sbi/openapi/model/upu_data_2.h @@ -33,6 +33,7 @@ OpenAPI_upu_data_2_t *OpenAPI_upu_data_2_create( void OpenAPI_upu_data_2_free(OpenAPI_upu_data_2_t *upu_data_2); OpenAPI_upu_data_2_t *OpenAPI_upu_data_2_parseFromJSON(cJSON *upu_data_2JSON); cJSON *OpenAPI_upu_data_2_convertToJSON(OpenAPI_upu_data_2_t *upu_data_2); +OpenAPI_upu_data_2_t *OpenAPI_upu_data_2_copy(OpenAPI_upu_data_2_t *dst, OpenAPI_upu_data_2_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/upu_info.c b/lib/sbi/openapi/model/upu_info.c index 489fec816..a18bb90c5 100644 --- a/lib/sbi/openapi/model/upu_info.c +++ b/lib/sbi/openapi/model/upu_info.c @@ -209,3 +209,37 @@ end: return NULL; } +OpenAPI_upu_info_t *OpenAPI_upu_info_copy(OpenAPI_upu_info_t *dst, OpenAPI_upu_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_upu_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_upu_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_upu_info_free(dst); + dst = OpenAPI_upu_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/upu_info.h b/lib/sbi/openapi/model/upu_info.h index e479bac3f..2c3f4fee3 100644 --- a/lib/sbi/openapi/model/upu_info.h +++ b/lib/sbi/openapi/model/upu_info.h @@ -39,6 +39,7 @@ OpenAPI_upu_info_t *OpenAPI_upu_info_create( void OpenAPI_upu_info_free(OpenAPI_upu_info_t *upu_info); OpenAPI_upu_info_t *OpenAPI_upu_info_parseFromJSON(cJSON *upu_infoJSON); cJSON *OpenAPI_upu_info_convertToJSON(OpenAPI_upu_info_t *upu_info); +OpenAPI_upu_info_t *OpenAPI_upu_info_copy(OpenAPI_upu_info_t *dst, OpenAPI_upu_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/usage_mon_data.c b/lib/sbi/openapi/model/usage_mon_data.c index 3dd87cc95..5c4f77807 100644 --- a/lib/sbi/openapi/model/usage_mon_data.c +++ b/lib/sbi/openapi/model/usage_mon_data.c @@ -199,3 +199,37 @@ end: return NULL; } +OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_copy(OpenAPI_usage_mon_data_t *dst, OpenAPI_usage_mon_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_usage_mon_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_usage_mon_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_usage_mon_data_free(dst); + dst = OpenAPI_usage_mon_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/usage_mon_data.h b/lib/sbi/openapi/model/usage_mon_data.h index cc7c3c4a5..b73265f42 100644 --- a/lib/sbi/openapi/model/usage_mon_data.h +++ b/lib/sbi/openapi/model/usage_mon_data.h @@ -40,6 +40,7 @@ OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_create( void OpenAPI_usage_mon_data_free(OpenAPI_usage_mon_data_t *usage_mon_data); OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_parseFromJSON(cJSON *usage_mon_dataJSON); cJSON *OpenAPI_usage_mon_data_convertToJSON(OpenAPI_usage_mon_data_t *usage_mon_data); +OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_copy(OpenAPI_usage_mon_data_t *dst, OpenAPI_usage_mon_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/usage_mon_data_limit.c b/lib/sbi/openapi/model/usage_mon_data_limit.c index ef215e269..837f5ea36 100644 --- a/lib/sbi/openapi/model/usage_mon_data_limit.c +++ b/lib/sbi/openapi/model/usage_mon_data_limit.c @@ -235,3 +235,37 @@ end: return NULL; } +OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_copy(OpenAPI_usage_mon_data_limit_t *dst, OpenAPI_usage_mon_data_limit_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_usage_mon_data_limit_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_usage_mon_data_limit_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_usage_mon_data_limit_free(dst); + dst = OpenAPI_usage_mon_data_limit_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/usage_mon_data_limit.h b/lib/sbi/openapi/model/usage_mon_data_limit.h index eca1ebb9d..88f346af2 100644 --- a/lib/sbi/openapi/model/usage_mon_data_limit.h +++ b/lib/sbi/openapi/model/usage_mon_data_limit.h @@ -43,6 +43,7 @@ OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_create( void OpenAPI_usage_mon_data_limit_free(OpenAPI_usage_mon_data_limit_t *usage_mon_data_limit); OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_parseFromJSON(cJSON *usage_mon_data_limitJSON); cJSON *OpenAPI_usage_mon_data_limit_convertToJSON(OpenAPI_usage_mon_data_limit_t *usage_mon_data_limit); +OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_copy(OpenAPI_usage_mon_data_limit_t *dst, OpenAPI_usage_mon_data_limit_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/usage_mon_data_scope.c b/lib/sbi/openapi/model/usage_mon_data_scope.c index 3d307d8a2..72da080f1 100644 --- a/lib/sbi/openapi/model/usage_mon_data_scope.c +++ b/lib/sbi/openapi/model/usage_mon_data_scope.c @@ -121,3 +121,37 @@ end: return NULL; } +OpenAPI_usage_mon_data_scope_t *OpenAPI_usage_mon_data_scope_copy(OpenAPI_usage_mon_data_scope_t *dst, OpenAPI_usage_mon_data_scope_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_usage_mon_data_scope_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_usage_mon_data_scope_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_usage_mon_data_scope_free(dst); + dst = OpenAPI_usage_mon_data_scope_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/usage_mon_data_scope.h b/lib/sbi/openapi/model/usage_mon_data_scope.h index d8777c16f..b96e68ce6 100644 --- a/lib/sbi/openapi/model/usage_mon_data_scope.h +++ b/lib/sbi/openapi/model/usage_mon_data_scope.h @@ -31,6 +31,7 @@ OpenAPI_usage_mon_data_scope_t *OpenAPI_usage_mon_data_scope_create( void OpenAPI_usage_mon_data_scope_free(OpenAPI_usage_mon_data_scope_t *usage_mon_data_scope); OpenAPI_usage_mon_data_scope_t *OpenAPI_usage_mon_data_scope_parseFromJSON(cJSON *usage_mon_data_scopeJSON); cJSON *OpenAPI_usage_mon_data_scope_convertToJSON(OpenAPI_usage_mon_data_scope_t *usage_mon_data_scope); +OpenAPI_usage_mon_data_scope_t *OpenAPI_usage_mon_data_scope_copy(OpenAPI_usage_mon_data_scope_t *dst, OpenAPI_usage_mon_data_scope_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/usage_mon_level.c b/lib/sbi/openapi/model/usage_mon_level.c index c949f2dc3..b10864fec 100644 --- a/lib/sbi/openapi/model/usage_mon_level.c +++ b/lib/sbi/openapi/model/usage_mon_level.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_usage_mon_level_t *OpenAPI_usage_mon_level_copy(OpenAPI_usage_mon_level_t *dst, OpenAPI_usage_mon_level_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_usage_mon_level_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_usage_mon_level_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_usage_mon_level_free(dst); + dst = OpenAPI_usage_mon_level_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/usage_mon_level.h b/lib/sbi/openapi/model/usage_mon_level.h index 2f6038438..710abed54 100644 --- a/lib/sbi/openapi/model/usage_mon_level.h +++ b/lib/sbi/openapi/model/usage_mon_level.h @@ -26,6 +26,7 @@ OpenAPI_usage_mon_level_t *OpenAPI_usage_mon_level_create( void OpenAPI_usage_mon_level_free(OpenAPI_usage_mon_level_t *usage_mon_level); OpenAPI_usage_mon_level_t *OpenAPI_usage_mon_level_parseFromJSON(cJSON *usage_mon_levelJSON); cJSON *OpenAPI_usage_mon_level_convertToJSON(OpenAPI_usage_mon_level_t *usage_mon_level); +OpenAPI_usage_mon_level_t *OpenAPI_usage_mon_level_copy(OpenAPI_usage_mon_level_t *dst, OpenAPI_usage_mon_level_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/usage_threshold.c b/lib/sbi/openapi/model/usage_threshold.c index acd5d2a68..92336f2a3 100644 --- a/lib/sbi/openapi/model/usage_threshold.c +++ b/lib/sbi/openapi/model/usage_threshold.c @@ -125,3 +125,37 @@ end: return NULL; } +OpenAPI_usage_threshold_t *OpenAPI_usage_threshold_copy(OpenAPI_usage_threshold_t *dst, OpenAPI_usage_threshold_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_usage_threshold_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_usage_threshold_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_usage_threshold_free(dst); + dst = OpenAPI_usage_threshold_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/usage_threshold.h b/lib/sbi/openapi/model/usage_threshold.h index e4b7dd237..802804a6a 100644 --- a/lib/sbi/openapi/model/usage_threshold.h +++ b/lib/sbi/openapi/model/usage_threshold.h @@ -34,6 +34,7 @@ OpenAPI_usage_threshold_t *OpenAPI_usage_threshold_create( void OpenAPI_usage_threshold_free(OpenAPI_usage_threshold_t *usage_threshold); OpenAPI_usage_threshold_t *OpenAPI_usage_threshold_parseFromJSON(cJSON *usage_thresholdJSON); cJSON *OpenAPI_usage_threshold_convertToJSON(OpenAPI_usage_threshold_t *usage_threshold); +OpenAPI_usage_threshold_t *OpenAPI_usage_threshold_copy(OpenAPI_usage_threshold_t *dst, OpenAPI_usage_threshold_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/user_identifier.c b/lib/sbi/openapi/model/user_identifier.c index 8d96261a4..92b959094 100644 --- a/lib/sbi/openapi/model/user_identifier.c +++ b/lib/sbi/openapi/model/user_identifier.c @@ -114,3 +114,37 @@ end: return NULL; } +OpenAPI_user_identifier_t *OpenAPI_user_identifier_copy(OpenAPI_user_identifier_t *dst, OpenAPI_user_identifier_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_user_identifier_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_user_identifier_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_user_identifier_free(dst); + dst = OpenAPI_user_identifier_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/user_identifier.h b/lib/sbi/openapi/model/user_identifier.h index 655c7c6e6..e512509a6 100644 --- a/lib/sbi/openapi/model/user_identifier.h +++ b/lib/sbi/openapi/model/user_identifier.h @@ -32,6 +32,7 @@ OpenAPI_user_identifier_t *OpenAPI_user_identifier_create( void OpenAPI_user_identifier_free(OpenAPI_user_identifier_t *user_identifier); OpenAPI_user_identifier_t *OpenAPI_user_identifier_parseFromJSON(cJSON *user_identifierJSON); cJSON *OpenAPI_user_identifier_convertToJSON(OpenAPI_user_identifier_t *user_identifier); +OpenAPI_user_identifier_t *OpenAPI_user_identifier_copy(OpenAPI_user_identifier_t *dst, OpenAPI_user_identifier_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/user_location.c b/lib/sbi/openapi/model/user_location.c index fa5358144..846f7ca81 100644 --- a/lib/sbi/openapi/model/user_location.c +++ b/lib/sbi/openapi/model/user_location.c @@ -121,3 +121,37 @@ end: return NULL; } +OpenAPI_user_location_t *OpenAPI_user_location_copy(OpenAPI_user_location_t *dst, OpenAPI_user_location_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_user_location_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_user_location_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_user_location_free(dst); + dst = OpenAPI_user_location_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/user_location.h b/lib/sbi/openapi/model/user_location.h index d3c853429..52040f470 100644 --- a/lib/sbi/openapi/model/user_location.h +++ b/lib/sbi/openapi/model/user_location.h @@ -35,6 +35,7 @@ OpenAPI_user_location_t *OpenAPI_user_location_create( void OpenAPI_user_location_free(OpenAPI_user_location_t *user_location); OpenAPI_user_location_t *OpenAPI_user_location_parseFromJSON(cJSON *user_locationJSON); cJSON *OpenAPI_user_location_convertToJSON(OpenAPI_user_location_t *user_location); +OpenAPI_user_location_t *OpenAPI_user_location_copy(OpenAPI_user_location_t *dst, OpenAPI_user_location_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/v2x_context.c b/lib/sbi/openapi/model/v2x_context.c new file mode 100644 index 000000000..727426005 --- /dev/null +++ b/lib/sbi/openapi/model/v2x_context.c @@ -0,0 +1,197 @@ + +#include +#include +#include +#include "v2x_context.h" + +OpenAPI_v2x_context_t *OpenAPI_v2x_context_create( + OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth, + OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth, + char *nr_ue_sidelink_ambr, + char *lte_ue_sidelink_ambr, + OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para + ) +{ + OpenAPI_v2x_context_t *v2x_context_local_var = OpenAPI_malloc(sizeof(OpenAPI_v2x_context_t)); + if (!v2x_context_local_var) { + return NULL; + } + v2x_context_local_var->nr_v2x_services_auth = nr_v2x_services_auth; + v2x_context_local_var->lte_v2x_services_auth = lte_v2x_services_auth; + v2x_context_local_var->nr_ue_sidelink_ambr = nr_ue_sidelink_ambr; + v2x_context_local_var->lte_ue_sidelink_ambr = lte_ue_sidelink_ambr; + v2x_context_local_var->pc5_qo_s_para = pc5_qo_s_para; + + return v2x_context_local_var; +} + +void OpenAPI_v2x_context_free(OpenAPI_v2x_context_t *v2x_context) +{ + if (NULL == v2x_context) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_nr_v2x_auth_free(v2x_context->nr_v2x_services_auth); + OpenAPI_lte_v2x_auth_free(v2x_context->lte_v2x_services_auth); + ogs_free(v2x_context->nr_ue_sidelink_ambr); + ogs_free(v2x_context->lte_ue_sidelink_ambr); + OpenAPI_pc5_qo_s_para_free(v2x_context->pc5_qo_s_para); + ogs_free(v2x_context); +} + +cJSON *OpenAPI_v2x_context_convertToJSON(OpenAPI_v2x_context_t *v2x_context) +{ + cJSON *item = NULL; + + if (v2x_context == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [V2xContext]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (v2x_context->nr_v2x_services_auth) { + cJSON *nr_v2x_services_auth_local_JSON = OpenAPI_nr_v2x_auth_convertToJSON(v2x_context->nr_v2x_services_auth); + if (nr_v2x_services_auth_local_JSON == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [nr_v2x_services_auth]"); + goto end; + } + cJSON_AddItemToObject(item, "nrV2xServicesAuth", nr_v2x_services_auth_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [nr_v2x_services_auth]"); + goto end; + } + } + + if (v2x_context->lte_v2x_services_auth) { + cJSON *lte_v2x_services_auth_local_JSON = OpenAPI_lte_v2x_auth_convertToJSON(v2x_context->lte_v2x_services_auth); + if (lte_v2x_services_auth_local_JSON == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [lte_v2x_services_auth]"); + goto end; + } + cJSON_AddItemToObject(item, "lteV2xServicesAuth", lte_v2x_services_auth_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [lte_v2x_services_auth]"); + goto end; + } + } + + if (v2x_context->nr_ue_sidelink_ambr) { + if (cJSON_AddStringToObject(item, "nrUeSidelinkAmbr", v2x_context->nr_ue_sidelink_ambr) == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [nr_ue_sidelink_ambr]"); + goto end; + } + } + + if (v2x_context->lte_ue_sidelink_ambr) { + if (cJSON_AddStringToObject(item, "lteUeSidelinkAmbr", v2x_context->lte_ue_sidelink_ambr) == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [lte_ue_sidelink_ambr]"); + goto end; + } + } + + if (v2x_context->pc5_qo_s_para) { + cJSON *pc5_qo_s_para_local_JSON = OpenAPI_pc5_qo_s_para_convertToJSON(v2x_context->pc5_qo_s_para); + if (pc5_qo_s_para_local_JSON == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [pc5_qo_s_para]"); + goto end; + } + cJSON_AddItemToObject(item, "Pc5QoSPara", pc5_qo_s_para_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed [pc5_qo_s_para]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_v2x_context_t *OpenAPI_v2x_context_parseFromJSON(cJSON *v2x_contextJSON) +{ + OpenAPI_v2x_context_t *v2x_context_local_var = NULL; + cJSON *nr_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(v2x_contextJSON, "nrV2xServicesAuth"); + + OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth_local_nonprim = NULL; + if (nr_v2x_services_auth) { + nr_v2x_services_auth_local_nonprim = OpenAPI_nr_v2x_auth_parseFromJSON(nr_v2x_services_auth); + } + + cJSON *lte_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(v2x_contextJSON, "lteV2xServicesAuth"); + + OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth_local_nonprim = NULL; + if (lte_v2x_services_auth) { + lte_v2x_services_auth_local_nonprim = OpenAPI_lte_v2x_auth_parseFromJSON(lte_v2x_services_auth); + } + + cJSON *nr_ue_sidelink_ambr = cJSON_GetObjectItemCaseSensitive(v2x_contextJSON, "nrUeSidelinkAmbr"); + + if (nr_ue_sidelink_ambr) { + if (!cJSON_IsString(nr_ue_sidelink_ambr)) { + ogs_error("OpenAPI_v2x_context_parseFromJSON() failed [nr_ue_sidelink_ambr]"); + goto end; + } + } + + cJSON *lte_ue_sidelink_ambr = cJSON_GetObjectItemCaseSensitive(v2x_contextJSON, "lteUeSidelinkAmbr"); + + if (lte_ue_sidelink_ambr) { + if (!cJSON_IsString(lte_ue_sidelink_ambr)) { + ogs_error("OpenAPI_v2x_context_parseFromJSON() failed [lte_ue_sidelink_ambr]"); + goto end; + } + } + + cJSON *pc5_qo_s_para = cJSON_GetObjectItemCaseSensitive(v2x_contextJSON, "Pc5QoSPara"); + + OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para_local_nonprim = NULL; + if (pc5_qo_s_para) { + pc5_qo_s_para_local_nonprim = OpenAPI_pc5_qo_s_para_parseFromJSON(pc5_qo_s_para); + } + + v2x_context_local_var = OpenAPI_v2x_context_create ( + nr_v2x_services_auth ? nr_v2x_services_auth_local_nonprim : NULL, + lte_v2x_services_auth ? lte_v2x_services_auth_local_nonprim : NULL, + nr_ue_sidelink_ambr ? ogs_strdup(nr_ue_sidelink_ambr->valuestring) : NULL, + lte_ue_sidelink_ambr ? ogs_strdup(lte_ue_sidelink_ambr->valuestring) : NULL, + pc5_qo_s_para ? pc5_qo_s_para_local_nonprim : NULL + ); + + return v2x_context_local_var; +end: + return NULL; +} + +OpenAPI_v2x_context_t *OpenAPI_v2x_context_copy(OpenAPI_v2x_context_t *dst, OpenAPI_v2x_context_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_v2x_context_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_v2x_context_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_v2x_context_free(dst); + dst = OpenAPI_v2x_context_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/v2x_context.h b/lib/sbi/openapi/model/v2x_context.h new file mode 100644 index 000000000..dfd6c65be --- /dev/null +++ b/lib/sbi/openapi/model/v2x_context.h @@ -0,0 +1,49 @@ +/* + * v2x_context.h + * + * + */ + +#ifndef _OpenAPI_v2x_context_H_ +#define _OpenAPI_v2x_context_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "lte_v2x_auth.h" +#include "nr_v2x_auth.h" +#include "pc5_qo_s_para.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_v2x_context_s OpenAPI_v2x_context_t; +typedef struct OpenAPI_v2x_context_s { + struct OpenAPI_nr_v2x_auth_s *nr_v2x_services_auth; + struct OpenAPI_lte_v2x_auth_s *lte_v2x_services_auth; + char *nr_ue_sidelink_ambr; + char *lte_ue_sidelink_ambr; + struct OpenAPI_pc5_qo_s_para_s *pc5_qo_s_para; +} OpenAPI_v2x_context_t; + +OpenAPI_v2x_context_t *OpenAPI_v2x_context_create( + OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth, + OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth, + char *nr_ue_sidelink_ambr, + char *lte_ue_sidelink_ambr, + OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para + ); +void OpenAPI_v2x_context_free(OpenAPI_v2x_context_t *v2x_context); +OpenAPI_v2x_context_t *OpenAPI_v2x_context_parseFromJSON(cJSON *v2x_contextJSON); +cJSON *OpenAPI_v2x_context_convertToJSON(OpenAPI_v2x_context_t *v2x_context); +OpenAPI_v2x_context_t *OpenAPI_v2x_context_copy(OpenAPI_v2x_context_t *dst, OpenAPI_v2x_context_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_v2x_context_H_ */ + diff --git a/lib/sbi/openapi/model/v2x_rat_type.c b/lib/sbi/openapi/model/v2x_rat_type.c index 96c3d55ae..35cf028e1 100644 --- a/lib/sbi/openapi/model/v2x_rat_type.c +++ b/lib/sbi/openapi/model/v2x_rat_type.c @@ -49,3 +49,37 @@ end: return NULL; } +OpenAPI_v2x_rat_type_t *OpenAPI_v2x_rat_type_copy(OpenAPI_v2x_rat_type_t *dst, OpenAPI_v2x_rat_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_v2x_rat_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_v2x_rat_type_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_v2x_rat_type_free(dst); + dst = OpenAPI_v2x_rat_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/v2x_rat_type.h b/lib/sbi/openapi/model/v2x_rat_type.h index 29fda89c7..92dc4a56d 100644 --- a/lib/sbi/openapi/model/v2x_rat_type.h +++ b/lib/sbi/openapi/model/v2x_rat_type.h @@ -26,6 +26,7 @@ OpenAPI_v2x_rat_type_t *OpenAPI_v2x_rat_type_create( void OpenAPI_v2x_rat_type_free(OpenAPI_v2x_rat_type_t *v2x_rat_type); OpenAPI_v2x_rat_type_t *OpenAPI_v2x_rat_type_parseFromJSON(cJSON *v2x_rat_typeJSON); cJSON *OpenAPI_v2x_rat_type_convertToJSON(OpenAPI_v2x_rat_type_t *v2x_rat_type); +OpenAPI_v2x_rat_type_t *OpenAPI_v2x_rat_type_copy(OpenAPI_v2x_rat_type_t *dst, OpenAPI_v2x_rat_type_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/valid_time_period.c b/lib/sbi/openapi/model/valid_time_period.c index d9d1d028e..b58bb6d00 100644 --- a/lib/sbi/openapi/model/valid_time_period.c +++ b/lib/sbi/openapi/model/valid_time_period.c @@ -89,3 +89,37 @@ end: return NULL; } +OpenAPI_valid_time_period_t *OpenAPI_valid_time_period_copy(OpenAPI_valid_time_period_t *dst, OpenAPI_valid_time_period_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_valid_time_period_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_valid_time_period_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_valid_time_period_free(dst); + dst = OpenAPI_valid_time_period_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/valid_time_period.h b/lib/sbi/openapi/model/valid_time_period.h index 937b159a4..68e17e673 100644 --- a/lib/sbi/openapi/model/valid_time_period.h +++ b/lib/sbi/openapi/model/valid_time_period.h @@ -30,6 +30,7 @@ OpenAPI_valid_time_period_t *OpenAPI_valid_time_period_create( void OpenAPI_valid_time_period_free(OpenAPI_valid_time_period_t *valid_time_period); OpenAPI_valid_time_period_t *OpenAPI_valid_time_period_parseFromJSON(cJSON *valid_time_periodJSON); cJSON *OpenAPI_valid_time_period_convertToJSON(OpenAPI_valid_time_period_t *valid_time_period); +OpenAPI_valid_time_period_t *OpenAPI_valid_time_period_copy(OpenAPI_valid_time_period_t *dst, OpenAPI_valid_time_period_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/vendor_specific_feature.c b/lib/sbi/openapi/model/vendor_specific_feature.c index ac8eaf080..f9df3bb84 100644 --- a/lib/sbi/openapi/model/vendor_specific_feature.c +++ b/lib/sbi/openapi/model/vendor_specific_feature.c @@ -99,3 +99,37 @@ end: return NULL; } +OpenAPI_vendor_specific_feature_t *OpenAPI_vendor_specific_feature_copy(OpenAPI_vendor_specific_feature_t *dst, OpenAPI_vendor_specific_feature_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_vendor_specific_feature_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_vendor_specific_feature_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_vendor_specific_feature_free(dst); + dst = OpenAPI_vendor_specific_feature_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/vendor_specific_feature.h b/lib/sbi/openapi/model/vendor_specific_feature.h index a3a89178d..aca2d5b1f 100644 --- a/lib/sbi/openapi/model/vendor_specific_feature.h +++ b/lib/sbi/openapi/model/vendor_specific_feature.h @@ -30,6 +30,7 @@ OpenAPI_vendor_specific_feature_t *OpenAPI_vendor_specific_feature_create( void OpenAPI_vendor_specific_feature_free(OpenAPI_vendor_specific_feature_t *vendor_specific_feature); OpenAPI_vendor_specific_feature_t *OpenAPI_vendor_specific_feature_parseFromJSON(cJSON *vendor_specific_featureJSON); cJSON *OpenAPI_vendor_specific_feature_convertToJSON(OpenAPI_vendor_specific_feature_t *vendor_specific_feature); +OpenAPI_vendor_specific_feature_t *OpenAPI_vendor_specific_feature_copy(OpenAPI_vendor_specific_feature_t *dst, OpenAPI_vendor_specific_feature_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/vgmlc_address.c b/lib/sbi/openapi/model/vgmlc_address.c index 3170da156..320a94cf0 100644 --- a/lib/sbi/openapi/model/vgmlc_address.c +++ b/lib/sbi/openapi/model/vgmlc_address.c @@ -109,3 +109,37 @@ end: return NULL; } +OpenAPI_vgmlc_address_t *OpenAPI_vgmlc_address_copy(OpenAPI_vgmlc_address_t *dst, OpenAPI_vgmlc_address_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_vgmlc_address_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_vgmlc_address_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_vgmlc_address_free(dst); + dst = OpenAPI_vgmlc_address_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/vgmlc_address.h b/lib/sbi/openapi/model/vgmlc_address.h index fef49a48f..f98fcdde6 100644 --- a/lib/sbi/openapi/model/vgmlc_address.h +++ b/lib/sbi/openapi/model/vgmlc_address.h @@ -32,6 +32,7 @@ OpenAPI_vgmlc_address_t *OpenAPI_vgmlc_address_create( void OpenAPI_vgmlc_address_free(OpenAPI_vgmlc_address_t *vgmlc_address); OpenAPI_vgmlc_address_t *OpenAPI_vgmlc_address_parseFromJSON(cJSON *vgmlc_addressJSON); cJSON *OpenAPI_vgmlc_address_convertToJSON(OpenAPI_vgmlc_address_t *vgmlc_address); +OpenAPI_vgmlc_address_t *OpenAPI_vgmlc_address_copy(OpenAPI_vgmlc_address_t *dst, OpenAPI_vgmlc_address_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/vn_group_data.c b/lib/sbi/openapi/model/vn_group_data.c index b780f23df..b80479bf5 100644 --- a/lib/sbi/openapi/model/vn_group_data.c +++ b/lib/sbi/openapi/model/vn_group_data.c @@ -167,3 +167,37 @@ end: return NULL; } +OpenAPI_vn_group_data_t *OpenAPI_vn_group_data_copy(OpenAPI_vn_group_data_t *dst, OpenAPI_vn_group_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_vn_group_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_vn_group_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_vn_group_data_free(dst); + dst = OpenAPI_vn_group_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/vn_group_data.h b/lib/sbi/openapi/model/vn_group_data.h index 871a096ed..775151ffd 100644 --- a/lib/sbi/openapi/model/vn_group_data.h +++ b/lib/sbi/openapi/model/vn_group_data.h @@ -37,6 +37,7 @@ OpenAPI_vn_group_data_t *OpenAPI_vn_group_data_create( void OpenAPI_vn_group_data_free(OpenAPI_vn_group_data_t *vn_group_data); OpenAPI_vn_group_data_t *OpenAPI_vn_group_data_parseFromJSON(cJSON *vn_group_dataJSON); cJSON *OpenAPI_vn_group_data_convertToJSON(OpenAPI_vn_group_data_t *vn_group_data); +OpenAPI_vn_group_data_t *OpenAPI_vn_group_data_copy(OpenAPI_vn_group_data_t *dst, OpenAPI_vn_group_data_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/volume_timed_report.c b/lib/sbi/openapi/model/volume_timed_report.c new file mode 100644 index 000000000..ca7929d20 --- /dev/null +++ b/lib/sbi/openapi/model/volume_timed_report.c @@ -0,0 +1,183 @@ + +#include +#include +#include +#include "volume_timed_report.h" + +OpenAPI_volume_timed_report_t *OpenAPI_volume_timed_report_create( + char *start_time_stamp, + char *end_time_stamp, + long downlink_volume, + long uplink_volume + ) +{ + OpenAPI_volume_timed_report_t *volume_timed_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_volume_timed_report_t)); + if (!volume_timed_report_local_var) { + return NULL; + } + volume_timed_report_local_var->start_time_stamp = start_time_stamp; + volume_timed_report_local_var->end_time_stamp = end_time_stamp; + volume_timed_report_local_var->downlink_volume = downlink_volume; + volume_timed_report_local_var->uplink_volume = uplink_volume; + + return volume_timed_report_local_var; +} + +void OpenAPI_volume_timed_report_free(OpenAPI_volume_timed_report_t *volume_timed_report) +{ + if (NULL == volume_timed_report) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(volume_timed_report->start_time_stamp); + ogs_free(volume_timed_report->end_time_stamp); + ogs_free(volume_timed_report); +} + +cJSON *OpenAPI_volume_timed_report_convertToJSON(OpenAPI_volume_timed_report_t *volume_timed_report) +{ + cJSON *item = NULL; + + if (volume_timed_report == NULL) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [VolumeTimedReport]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!volume_timed_report->start_time_stamp) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [start_time_stamp]"); + goto end; + } + if (cJSON_AddStringToObject(item, "startTimeStamp", volume_timed_report->start_time_stamp) == NULL) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [start_time_stamp]"); + goto end; + } + + if (!volume_timed_report->end_time_stamp) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [end_time_stamp]"); + goto end; + } + if (cJSON_AddStringToObject(item, "endTimeStamp", volume_timed_report->end_time_stamp) == NULL) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [end_time_stamp]"); + goto end; + } + + if (!volume_timed_report->downlink_volume) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [downlink_volume]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "downlinkVolume", volume_timed_report->downlink_volume) == NULL) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [downlink_volume]"); + goto end; + } + + if (!volume_timed_report->uplink_volume) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [uplink_volume]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "uplinkVolume", volume_timed_report->uplink_volume) == NULL) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed [uplink_volume]"); + goto end; + } + +end: + return item; +} + +OpenAPI_volume_timed_report_t *OpenAPI_volume_timed_report_parseFromJSON(cJSON *volume_timed_reportJSON) +{ + OpenAPI_volume_timed_report_t *volume_timed_report_local_var = NULL; + cJSON *start_time_stamp = cJSON_GetObjectItemCaseSensitive(volume_timed_reportJSON, "startTimeStamp"); + if (!start_time_stamp) { + ogs_error("OpenAPI_volume_timed_report_parseFromJSON() failed [start_time_stamp]"); + goto end; + } + + + if (!cJSON_IsString(start_time_stamp)) { + ogs_error("OpenAPI_volume_timed_report_parseFromJSON() failed [start_time_stamp]"); + goto end; + } + + cJSON *end_time_stamp = cJSON_GetObjectItemCaseSensitive(volume_timed_reportJSON, "endTimeStamp"); + if (!end_time_stamp) { + ogs_error("OpenAPI_volume_timed_report_parseFromJSON() failed [end_time_stamp]"); + goto end; + } + + + if (!cJSON_IsString(end_time_stamp)) { + ogs_error("OpenAPI_volume_timed_report_parseFromJSON() failed [end_time_stamp]"); + goto end; + } + + cJSON *downlink_volume = cJSON_GetObjectItemCaseSensitive(volume_timed_reportJSON, "downlinkVolume"); + if (!downlink_volume) { + ogs_error("OpenAPI_volume_timed_report_parseFromJSON() failed [downlink_volume]"); + goto end; + } + + + if (!cJSON_IsNumber(downlink_volume)) { + ogs_error("OpenAPI_volume_timed_report_parseFromJSON() failed [downlink_volume]"); + goto end; + } + + cJSON *uplink_volume = cJSON_GetObjectItemCaseSensitive(volume_timed_reportJSON, "uplinkVolume"); + if (!uplink_volume) { + ogs_error("OpenAPI_volume_timed_report_parseFromJSON() failed [uplink_volume]"); + goto end; + } + + + if (!cJSON_IsNumber(uplink_volume)) { + ogs_error("OpenAPI_volume_timed_report_parseFromJSON() failed [uplink_volume]"); + goto end; + } + + volume_timed_report_local_var = OpenAPI_volume_timed_report_create ( + ogs_strdup(start_time_stamp->valuestring), + ogs_strdup(end_time_stamp->valuestring), + downlink_volume->valuedouble, + uplink_volume->valuedouble + ); + + return volume_timed_report_local_var; +end: + return NULL; +} + +OpenAPI_volume_timed_report_t *OpenAPI_volume_timed_report_copy(OpenAPI_volume_timed_report_t *dst, OpenAPI_volume_timed_report_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_volume_timed_report_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_volume_timed_report_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_volume_timed_report_free(dst); + dst = OpenAPI_volume_timed_report_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/volume_timed_report.h b/lib/sbi/openapi/model/volume_timed_report.h new file mode 100644 index 000000000..a41b845b4 --- /dev/null +++ b/lib/sbi/openapi/model/volume_timed_report.h @@ -0,0 +1,44 @@ +/* + * volume_timed_report.h + * + * + */ + +#ifndef _OpenAPI_volume_timed_report_H_ +#define _OpenAPI_volume_timed_report_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_volume_timed_report_s OpenAPI_volume_timed_report_t; +typedef struct OpenAPI_volume_timed_report_s { + char *start_time_stamp; + char *end_time_stamp; + long downlink_volume; + long uplink_volume; +} OpenAPI_volume_timed_report_t; + +OpenAPI_volume_timed_report_t *OpenAPI_volume_timed_report_create( + char *start_time_stamp, + char *end_time_stamp, + long downlink_volume, + long uplink_volume + ); +void OpenAPI_volume_timed_report_free(OpenAPI_volume_timed_report_t *volume_timed_report); +OpenAPI_volume_timed_report_t *OpenAPI_volume_timed_report_parseFromJSON(cJSON *volume_timed_reportJSON); +cJSON *OpenAPI_volume_timed_report_convertToJSON(OpenAPI_volume_timed_report_t *volume_timed_report); +OpenAPI_volume_timed_report_t *OpenAPI_volume_timed_report_copy(OpenAPI_volume_timed_report_t *dst, OpenAPI_volume_timed_report_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_volume_timed_report_H_ */ + diff --git a/lib/sbi/openapi/model/vplmn_qos.c b/lib/sbi/openapi/model/vplmn_qos.c new file mode 100644 index 000000000..2d2ddd616 --- /dev/null +++ b/lib/sbi/openapi/model/vplmn_qos.c @@ -0,0 +1,232 @@ + +#include +#include +#include +#include "vplmn_qos.h" + +OpenAPI_vplmn_qos_t *OpenAPI_vplmn_qos_create( + int _5qi, + OpenAPI_arp_t *arp, + OpenAPI_ambr_t *session_ambr, + char *max_fbr_dl, + char *max_fbr_ul, + char *gua_fbr_dl, + char *gua_fbr_ul + ) +{ + OpenAPI_vplmn_qos_t *vplmn_qos_local_var = OpenAPI_malloc(sizeof(OpenAPI_vplmn_qos_t)); + if (!vplmn_qos_local_var) { + return NULL; + } + vplmn_qos_local_var->_5qi = _5qi; + vplmn_qos_local_var->arp = arp; + vplmn_qos_local_var->session_ambr = session_ambr; + vplmn_qos_local_var->max_fbr_dl = max_fbr_dl; + vplmn_qos_local_var->max_fbr_ul = max_fbr_ul; + vplmn_qos_local_var->gua_fbr_dl = gua_fbr_dl; + vplmn_qos_local_var->gua_fbr_ul = gua_fbr_ul; + + return vplmn_qos_local_var; +} + +void OpenAPI_vplmn_qos_free(OpenAPI_vplmn_qos_t *vplmn_qos) +{ + if (NULL == vplmn_qos) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_arp_free(vplmn_qos->arp); + OpenAPI_ambr_free(vplmn_qos->session_ambr); + ogs_free(vplmn_qos->max_fbr_dl); + ogs_free(vplmn_qos->max_fbr_ul); + ogs_free(vplmn_qos->gua_fbr_dl); + ogs_free(vplmn_qos->gua_fbr_ul); + ogs_free(vplmn_qos); +} + +cJSON *OpenAPI_vplmn_qos_convertToJSON(OpenAPI_vplmn_qos_t *vplmn_qos) +{ + cJSON *item = NULL; + + if (vplmn_qos == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [VplmnQos]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (vplmn_qos->_5qi) { + if (cJSON_AddNumberToObject(item, "5qi", vplmn_qos->_5qi) == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [_5qi]"); + goto end; + } + } + + if (vplmn_qos->arp) { + cJSON *arp_local_JSON = OpenAPI_arp_convertToJSON(vplmn_qos->arp); + if (arp_local_JSON == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [arp]"); + goto end; + } + cJSON_AddItemToObject(item, "arp", arp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [arp]"); + goto end; + } + } + + if (vplmn_qos->session_ambr) { + cJSON *session_ambr_local_JSON = OpenAPI_ambr_convertToJSON(vplmn_qos->session_ambr); + if (session_ambr_local_JSON == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [session_ambr]"); + goto end; + } + cJSON_AddItemToObject(item, "sessionAmbr", session_ambr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [session_ambr]"); + goto end; + } + } + + if (vplmn_qos->max_fbr_dl) { + if (cJSON_AddStringToObject(item, "maxFbrDl", vplmn_qos->max_fbr_dl) == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [max_fbr_dl]"); + goto end; + } + } + + if (vplmn_qos->max_fbr_ul) { + if (cJSON_AddStringToObject(item, "maxFbrUl", vplmn_qos->max_fbr_ul) == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [max_fbr_ul]"); + goto end; + } + } + + if (vplmn_qos->gua_fbr_dl) { + if (cJSON_AddStringToObject(item, "guaFbrDl", vplmn_qos->gua_fbr_dl) == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [gua_fbr_dl]"); + goto end; + } + } + + if (vplmn_qos->gua_fbr_ul) { + if (cJSON_AddStringToObject(item, "guaFbrUl", vplmn_qos->gua_fbr_ul) == NULL) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed [gua_fbr_ul]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_vplmn_qos_t *OpenAPI_vplmn_qos_parseFromJSON(cJSON *vplmn_qosJSON) +{ + OpenAPI_vplmn_qos_t *vplmn_qos_local_var = NULL; + cJSON *_5qi = cJSON_GetObjectItemCaseSensitive(vplmn_qosJSON, "5qi"); + + if (_5qi) { + if (!cJSON_IsNumber(_5qi)) { + ogs_error("OpenAPI_vplmn_qos_parseFromJSON() failed [_5qi]"); + goto end; + } + } + + cJSON *arp = cJSON_GetObjectItemCaseSensitive(vplmn_qosJSON, "arp"); + + OpenAPI_arp_t *arp_local_nonprim = NULL; + if (arp) { + arp_local_nonprim = OpenAPI_arp_parseFromJSON(arp); + } + + cJSON *session_ambr = cJSON_GetObjectItemCaseSensitive(vplmn_qosJSON, "sessionAmbr"); + + OpenAPI_ambr_t *session_ambr_local_nonprim = NULL; + if (session_ambr) { + session_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(session_ambr); + } + + cJSON *max_fbr_dl = cJSON_GetObjectItemCaseSensitive(vplmn_qosJSON, "maxFbrDl"); + + if (max_fbr_dl) { + if (!cJSON_IsString(max_fbr_dl)) { + ogs_error("OpenAPI_vplmn_qos_parseFromJSON() failed [max_fbr_dl]"); + goto end; + } + } + + cJSON *max_fbr_ul = cJSON_GetObjectItemCaseSensitive(vplmn_qosJSON, "maxFbrUl"); + + if (max_fbr_ul) { + if (!cJSON_IsString(max_fbr_ul)) { + ogs_error("OpenAPI_vplmn_qos_parseFromJSON() failed [max_fbr_ul]"); + goto end; + } + } + + cJSON *gua_fbr_dl = cJSON_GetObjectItemCaseSensitive(vplmn_qosJSON, "guaFbrDl"); + + if (gua_fbr_dl) { + if (!cJSON_IsString(gua_fbr_dl)) { + ogs_error("OpenAPI_vplmn_qos_parseFromJSON() failed [gua_fbr_dl]"); + goto end; + } + } + + cJSON *gua_fbr_ul = cJSON_GetObjectItemCaseSensitive(vplmn_qosJSON, "guaFbrUl"); + + if (gua_fbr_ul) { + if (!cJSON_IsString(gua_fbr_ul)) { + ogs_error("OpenAPI_vplmn_qos_parseFromJSON() failed [gua_fbr_ul]"); + goto end; + } + } + + vplmn_qos_local_var = OpenAPI_vplmn_qos_create ( + _5qi ? _5qi->valuedouble : 0, + arp ? arp_local_nonprim : NULL, + session_ambr ? session_ambr_local_nonprim : NULL, + max_fbr_dl ? ogs_strdup(max_fbr_dl->valuestring) : NULL, + max_fbr_ul ? ogs_strdup(max_fbr_ul->valuestring) : NULL, + gua_fbr_dl ? ogs_strdup(gua_fbr_dl->valuestring) : NULL, + gua_fbr_ul ? ogs_strdup(gua_fbr_ul->valuestring) : NULL + ); + + return vplmn_qos_local_var; +end: + return NULL; +} + +OpenAPI_vplmn_qos_t *OpenAPI_vplmn_qos_copy(OpenAPI_vplmn_qos_t *dst, OpenAPI_vplmn_qos_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_vplmn_qos_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_vplmn_qos_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_vplmn_qos_free(dst); + dst = OpenAPI_vplmn_qos_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/vplmn_qos.h b/lib/sbi/openapi/model/vplmn_qos.h new file mode 100644 index 000000000..5b72af577 --- /dev/null +++ b/lib/sbi/openapi/model/vplmn_qos.h @@ -0,0 +1,52 @@ +/* + * vplmn_qos.h + * + * + */ + +#ifndef _OpenAPI_vplmn_qos_H_ +#define _OpenAPI_vplmn_qos_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ambr.h" +#include "arp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_vplmn_qos_s OpenAPI_vplmn_qos_t; +typedef struct OpenAPI_vplmn_qos_s { + int _5qi; + struct OpenAPI_arp_s *arp; + struct OpenAPI_ambr_s *session_ambr; + char *max_fbr_dl; + char *max_fbr_ul; + char *gua_fbr_dl; + char *gua_fbr_ul; +} OpenAPI_vplmn_qos_t; + +OpenAPI_vplmn_qos_t *OpenAPI_vplmn_qos_create( + int _5qi, + OpenAPI_arp_t *arp, + OpenAPI_ambr_t *session_ambr, + char *max_fbr_dl, + char *max_fbr_ul, + char *gua_fbr_dl, + char *gua_fbr_ul + ); +void OpenAPI_vplmn_qos_free(OpenAPI_vplmn_qos_t *vplmn_qos); +OpenAPI_vplmn_qos_t *OpenAPI_vplmn_qos_parseFromJSON(cJSON *vplmn_qosJSON); +cJSON *OpenAPI_vplmn_qos_convertToJSON(OpenAPI_vplmn_qos_t *vplmn_qos); +OpenAPI_vplmn_qos_t *OpenAPI_vplmn_qos_copy(OpenAPI_vplmn_qos_t *dst, OpenAPI_vplmn_qos_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_vplmn_qos_H_ */ + diff --git a/lib/sbi/openapi/model/vsmf_update_data.c b/lib/sbi/openapi/model/vsmf_update_data.c new file mode 100644 index 000000000..bde397699 --- /dev/null +++ b/lib/sbi/openapi/model/vsmf_update_data.c @@ -0,0 +1,778 @@ + +#include +#include +#include +#include "vsmf_update_data.h" + +OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( + OpenAPI_request_indication_t *request_indication, + OpenAPI_ambr_t *session_ambr, + OpenAPI_list_t *qos_flows_add_mod_request_list, + OpenAPI_list_t *qos_flows_rel_request_list, + OpenAPI_list_t *eps_bearer_info, + OpenAPI_list_t *assign_ebi_list, + OpenAPI_list_t *revoke_ebi_list, + OpenAPI_list_t *modified_ebi_list, + int pti, + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + int always_on_granted, + char *hsmf_pdu_session_uri, + char *supported_features, + OpenAPI_cause_t *cause, + char *n1sm_cause, + int back_off_timer, + OpenAPI_ma_release_indication_t *ma_release_ind, + int ma_accepted_ind, + OpenAPI_tunnel_info_t *additional_cn_tunnel_info, + OpenAPI_list_t *dnai_list, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 + ) +{ + OpenAPI_vsmf_update_data_t *vsmf_update_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_vsmf_update_data_t)); + if (!vsmf_update_data_local_var) { + return NULL; + } + vsmf_update_data_local_var->request_indication = request_indication; + vsmf_update_data_local_var->session_ambr = session_ambr; + vsmf_update_data_local_var->qos_flows_add_mod_request_list = qos_flows_add_mod_request_list; + vsmf_update_data_local_var->qos_flows_rel_request_list = qos_flows_rel_request_list; + vsmf_update_data_local_var->eps_bearer_info = eps_bearer_info; + vsmf_update_data_local_var->assign_ebi_list = assign_ebi_list; + vsmf_update_data_local_var->revoke_ebi_list = revoke_ebi_list; + vsmf_update_data_local_var->modified_ebi_list = modified_ebi_list; + vsmf_update_data_local_var->pti = pti; + vsmf_update_data_local_var->n1_sm_info_to_ue = n1_sm_info_to_ue; + vsmf_update_data_local_var->always_on_granted = always_on_granted; + vsmf_update_data_local_var->hsmf_pdu_session_uri = hsmf_pdu_session_uri; + vsmf_update_data_local_var->supported_features = supported_features; + vsmf_update_data_local_var->cause = cause; + vsmf_update_data_local_var->n1sm_cause = n1sm_cause; + vsmf_update_data_local_var->back_off_timer = back_off_timer; + vsmf_update_data_local_var->ma_release_ind = ma_release_ind; + vsmf_update_data_local_var->ma_accepted_ind = ma_accepted_ind; + vsmf_update_data_local_var->additional_cn_tunnel_info = additional_cn_tunnel_info; + vsmf_update_data_local_var->dnai_list = dnai_list; + vsmf_update_data_local_var->n4_info = n4_info; + vsmf_update_data_local_var->n4_info_ext1 = n4_info_ext1; + vsmf_update_data_local_var->n4_info_ext2 = n4_info_ext2; + + return vsmf_update_data_local_var; +} + +void OpenAPI_vsmf_update_data_free(OpenAPI_vsmf_update_data_t *vsmf_update_data) +{ + if (NULL == vsmf_update_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_request_indication_free(vsmf_update_data->request_indication); + OpenAPI_ambr_free(vsmf_update_data->session_ambr); + OpenAPI_list_for_each(vsmf_update_data->qos_flows_add_mod_request_list, node) { + OpenAPI_qos_flow_add_modify_request_item_free(node->data); + } + OpenAPI_list_free(vsmf_update_data->qos_flows_add_mod_request_list); + OpenAPI_list_for_each(vsmf_update_data->qos_flows_rel_request_list, node) { + OpenAPI_qos_flow_release_request_item_free(node->data); + } + OpenAPI_list_free(vsmf_update_data->qos_flows_rel_request_list); + OpenAPI_list_for_each(vsmf_update_data->eps_bearer_info, node) { + OpenAPI_eps_bearer_info_free(node->data); + } + OpenAPI_list_free(vsmf_update_data->eps_bearer_info); + OpenAPI_list_for_each(vsmf_update_data->assign_ebi_list, node) { + OpenAPI_arp_free(node->data); + } + OpenAPI_list_free(vsmf_update_data->assign_ebi_list); + OpenAPI_list_for_each(vsmf_update_data->revoke_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(vsmf_update_data->revoke_ebi_list); + OpenAPI_list_for_each(vsmf_update_data->modified_ebi_list, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(vsmf_update_data->modified_ebi_list); + OpenAPI_ref_to_binary_data_free(vsmf_update_data->n1_sm_info_to_ue); + ogs_free(vsmf_update_data->hsmf_pdu_session_uri); + ogs_free(vsmf_update_data->supported_features); + OpenAPI_cause_free(vsmf_update_data->cause); + ogs_free(vsmf_update_data->n1sm_cause); + OpenAPI_ma_release_indication_free(vsmf_update_data->ma_release_ind); + OpenAPI_tunnel_info_free(vsmf_update_data->additional_cn_tunnel_info); + OpenAPI_list_for_each(vsmf_update_data->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(vsmf_update_data->dnai_list); + OpenAPI_n4_information_free(vsmf_update_data->n4_info); + OpenAPI_n4_information_free(vsmf_update_data->n4_info_ext1); + OpenAPI_n4_information_free(vsmf_update_data->n4_info_ext2); + ogs_free(vsmf_update_data); +} + +cJSON *OpenAPI_vsmf_update_data_convertToJSON(OpenAPI_vsmf_update_data_t *vsmf_update_data) +{ + cJSON *item = NULL; + + if (vsmf_update_data == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [VsmfUpdateData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!vsmf_update_data->request_indication) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [request_indication]"); + goto end; + } + cJSON *request_indication_local_JSON = OpenAPI_request_indication_convertToJSON(vsmf_update_data->request_indication); + if (request_indication_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [request_indication]"); + goto end; + } + cJSON_AddItemToObject(item, "requestIndication", request_indication_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [request_indication]"); + goto end; + } + + if (vsmf_update_data->session_ambr) { + cJSON *session_ambr_local_JSON = OpenAPI_ambr_convertToJSON(vsmf_update_data->session_ambr); + if (session_ambr_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [session_ambr]"); + goto end; + } + cJSON_AddItemToObject(item, "sessionAmbr", session_ambr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [session_ambr]"); + goto end; + } + } + + if (vsmf_update_data->qos_flows_add_mod_request_list) { + cJSON *qos_flows_add_mod_request_listList = cJSON_AddArrayToObject(item, "qosFlowsAddModRequestList"); + if (qos_flows_add_mod_request_listList == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [qos_flows_add_mod_request_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_add_mod_request_list_node; + if (vsmf_update_data->qos_flows_add_mod_request_list) { + OpenAPI_list_for_each(vsmf_update_data->qos_flows_add_mod_request_list, qos_flows_add_mod_request_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_add_modify_request_item_convertToJSON(qos_flows_add_mod_request_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [qos_flows_add_mod_request_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_add_mod_request_listList, itemLocal); + } + } + } + + if (vsmf_update_data->qos_flows_rel_request_list) { + cJSON *qos_flows_rel_request_listList = cJSON_AddArrayToObject(item, "qosFlowsRelRequestList"); + if (qos_flows_rel_request_listList == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [qos_flows_rel_request_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_rel_request_list_node; + if (vsmf_update_data->qos_flows_rel_request_list) { + OpenAPI_list_for_each(vsmf_update_data->qos_flows_rel_request_list, qos_flows_rel_request_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_release_request_item_convertToJSON(qos_flows_rel_request_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [qos_flows_rel_request_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_rel_request_listList, itemLocal); + } + } + } + + if (vsmf_update_data->eps_bearer_info) { + cJSON *eps_bearer_infoList = cJSON_AddArrayToObject(item, "epsBearerInfo"); + if (eps_bearer_infoList == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [eps_bearer_info]"); + goto end; + } + + OpenAPI_lnode_t *eps_bearer_info_node; + if (vsmf_update_data->eps_bearer_info) { + OpenAPI_list_for_each(vsmf_update_data->eps_bearer_info, eps_bearer_info_node) { + cJSON *itemLocal = OpenAPI_eps_bearer_info_convertToJSON(eps_bearer_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [eps_bearer_info]"); + goto end; + } + cJSON_AddItemToArray(eps_bearer_infoList, itemLocal); + } + } + } + + if (vsmf_update_data->assign_ebi_list) { + cJSON *assign_ebi_listList = cJSON_AddArrayToObject(item, "assignEbiList"); + if (assign_ebi_listList == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [assign_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *assign_ebi_list_node; + if (vsmf_update_data->assign_ebi_list) { + OpenAPI_list_for_each(vsmf_update_data->assign_ebi_list, assign_ebi_list_node) { + cJSON *itemLocal = OpenAPI_arp_convertToJSON(assign_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [assign_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(assign_ebi_listList, itemLocal); + } + } + } + + if (vsmf_update_data->revoke_ebi_list) { + cJSON *revoke_ebi_list = cJSON_AddArrayToObject(item, "revokeEbiList"); + if (revoke_ebi_list == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [revoke_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *revoke_ebi_list_node; + OpenAPI_list_for_each(vsmf_update_data->revoke_ebi_list, revoke_ebi_list_node) { + if (cJSON_AddNumberToObject(revoke_ebi_list, "", *(double *)revoke_ebi_list_node->data) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [revoke_ebi_list]"); + goto end; + } + } + } + + if (vsmf_update_data->modified_ebi_list) { + cJSON *modified_ebi_listList = cJSON_AddArrayToObject(item, "modifiedEbiList"); + if (modified_ebi_listList == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [modified_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *modified_ebi_list_node; + if (vsmf_update_data->modified_ebi_list) { + OpenAPI_list_for_each(vsmf_update_data->modified_ebi_list, modified_ebi_list_node) { + cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(modified_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [modified_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(modified_ebi_listList, itemLocal); + } + } + } + + if (vsmf_update_data->pti) { + if (cJSON_AddNumberToObject(item, "pti", vsmf_update_data->pti) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [pti]"); + goto end; + } + } + + if (vsmf_update_data->n1_sm_info_to_ue) { + cJSON *n1_sm_info_to_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(vsmf_update_data->n1_sm_info_to_ue); + if (n1_sm_info_to_ue_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoToUe", n1_sm_info_to_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n1_sm_info_to_ue]"); + goto end; + } + } + + if (vsmf_update_data->always_on_granted) { + if (cJSON_AddBoolToObject(item, "alwaysOnGranted", vsmf_update_data->always_on_granted) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [always_on_granted]"); + goto end; + } + } + + if (vsmf_update_data->hsmf_pdu_session_uri) { + if (cJSON_AddStringToObject(item, "hsmfPduSessionUri", vsmf_update_data->hsmf_pdu_session_uri) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [hsmf_pdu_session_uri]"); + goto end; + } + } + + if (vsmf_update_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", vsmf_update_data->supported_features) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (vsmf_update_data->cause) { + cJSON *cause_local_JSON = OpenAPI_cause_convertToJSON(vsmf_update_data->cause); + if (cause_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [cause]"); + goto end; + } + cJSON_AddItemToObject(item, "cause", cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [cause]"); + goto end; + } + } + + if (vsmf_update_data->n1sm_cause) { + if (cJSON_AddStringToObject(item, "n1smCause", vsmf_update_data->n1sm_cause) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n1sm_cause]"); + goto end; + } + } + + if (vsmf_update_data->back_off_timer) { + if (cJSON_AddNumberToObject(item, "backOffTimer", vsmf_update_data->back_off_timer) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [back_off_timer]"); + goto end; + } + } + + if (vsmf_update_data->ma_release_ind) { + cJSON *ma_release_ind_local_JSON = OpenAPI_ma_release_indication_convertToJSON(vsmf_update_data->ma_release_ind); + if (ma_release_ind_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [ma_release_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "maReleaseInd", ma_release_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [ma_release_ind]"); + goto end; + } + } + + if (vsmf_update_data->ma_accepted_ind) { + if (cJSON_AddBoolToObject(item, "maAcceptedInd", vsmf_update_data->ma_accepted_ind) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [ma_accepted_ind]"); + goto end; + } + } + + if (vsmf_update_data->additional_cn_tunnel_info) { + cJSON *additional_cn_tunnel_info_local_JSON = OpenAPI_tunnel_info_convertToJSON(vsmf_update_data->additional_cn_tunnel_info); + if (additional_cn_tunnel_info_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [additional_cn_tunnel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "additionalCnTunnelInfo", additional_cn_tunnel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [additional_cn_tunnel_info]"); + goto end; + } + } + + if (vsmf_update_data->dnai_list) { + cJSON *dnai_list = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_list == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [dnai_list]"); + goto end; + } + + OpenAPI_lnode_t *dnai_list_node; + OpenAPI_list_for_each(vsmf_update_data->dnai_list, dnai_list_node) { + if (cJSON_AddStringToObject(dnai_list, "", (char*)dnai_list_node->data) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (vsmf_update_data->n4_info) { + cJSON *n4_info_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_update_data->n4_info); + if (n4_info_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n4_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n4Info", n4_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n4_info]"); + goto end; + } + } + + if (vsmf_update_data->n4_info_ext1) { + cJSON *n4_info_ext1_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_update_data->n4_info_ext1); + if (n4_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt1", n4_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + } + + if (vsmf_update_data->n4_info_ext2) { + cJSON *n4_info_ext2_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_update_data->n4_info_ext2); + if (n4_info_ext2_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt2", n4_info_ext2_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_update_dataJSON) +{ + OpenAPI_vsmf_update_data_t *vsmf_update_data_local_var = NULL; + cJSON *request_indication = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "requestIndication"); + if (!request_indication) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [request_indication]"); + goto end; + } + + OpenAPI_request_indication_t *request_indication_local_nonprim = NULL; + + request_indication_local_nonprim = OpenAPI_request_indication_parseFromJSON(request_indication); + + cJSON *session_ambr = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "sessionAmbr"); + + OpenAPI_ambr_t *session_ambr_local_nonprim = NULL; + if (session_ambr) { + session_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(session_ambr); + } + + cJSON *qos_flows_add_mod_request_list = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "qosFlowsAddModRequestList"); + + OpenAPI_list_t *qos_flows_add_mod_request_listList; + if (qos_flows_add_mod_request_list) { + cJSON *qos_flows_add_mod_request_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_add_mod_request_list)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [qos_flows_add_mod_request_list]"); + goto end; + } + + qos_flows_add_mod_request_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_add_mod_request_list_local_nonprimitive, qos_flows_add_mod_request_list ) { + if (!cJSON_IsObject(qos_flows_add_mod_request_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [qos_flows_add_mod_request_list]"); + goto end; + } + OpenAPI_qos_flow_add_modify_request_item_t *qos_flows_add_mod_request_listItem = OpenAPI_qos_flow_add_modify_request_item_parseFromJSON(qos_flows_add_mod_request_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_add_mod_request_listList, qos_flows_add_mod_request_listItem); + } + } + + cJSON *qos_flows_rel_request_list = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "qosFlowsRelRequestList"); + + OpenAPI_list_t *qos_flows_rel_request_listList; + if (qos_flows_rel_request_list) { + cJSON *qos_flows_rel_request_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_rel_request_list)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [qos_flows_rel_request_list]"); + goto end; + } + + qos_flows_rel_request_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_rel_request_list_local_nonprimitive, qos_flows_rel_request_list ) { + if (!cJSON_IsObject(qos_flows_rel_request_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [qos_flows_rel_request_list]"); + goto end; + } + OpenAPI_qos_flow_release_request_item_t *qos_flows_rel_request_listItem = OpenAPI_qos_flow_release_request_item_parseFromJSON(qos_flows_rel_request_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_rel_request_listList, qos_flows_rel_request_listItem); + } + } + + cJSON *eps_bearer_info = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "epsBearerInfo"); + + OpenAPI_list_t *eps_bearer_infoList; + if (eps_bearer_info) { + cJSON *eps_bearer_info_local_nonprimitive; + if (!cJSON_IsArray(eps_bearer_info)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [eps_bearer_info]"); + goto end; + } + + eps_bearer_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eps_bearer_info_local_nonprimitive, eps_bearer_info ) { + if (!cJSON_IsObject(eps_bearer_info_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [eps_bearer_info]"); + goto end; + } + OpenAPI_eps_bearer_info_t *eps_bearer_infoItem = OpenAPI_eps_bearer_info_parseFromJSON(eps_bearer_info_local_nonprimitive); + + OpenAPI_list_add(eps_bearer_infoList, eps_bearer_infoItem); + } + } + + cJSON *assign_ebi_list = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "assignEbiList"); + + OpenAPI_list_t *assign_ebi_listList; + if (assign_ebi_list) { + cJSON *assign_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(assign_ebi_list)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [assign_ebi_list]"); + goto end; + } + + assign_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(assign_ebi_list_local_nonprimitive, assign_ebi_list ) { + if (!cJSON_IsObject(assign_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [assign_ebi_list]"); + goto end; + } + OpenAPI_arp_t *assign_ebi_listItem = OpenAPI_arp_parseFromJSON(assign_ebi_list_local_nonprimitive); + + OpenAPI_list_add(assign_ebi_listList, assign_ebi_listItem); + } + } + + cJSON *revoke_ebi_list = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "revokeEbiList"); + + OpenAPI_list_t *revoke_ebi_listList; + if (revoke_ebi_list) { + cJSON *revoke_ebi_list_local; + if (!cJSON_IsArray(revoke_ebi_list)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [revoke_ebi_list]"); + goto end; + } + revoke_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(revoke_ebi_list_local, revoke_ebi_list) { + if (!cJSON_IsNumber(revoke_ebi_list_local)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [revoke_ebi_list]"); + goto end; + } + OpenAPI_list_add(revoke_ebi_listList, &revoke_ebi_list_local->valuedouble); + } + } + + cJSON *modified_ebi_list = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "modifiedEbiList"); + + OpenAPI_list_t *modified_ebi_listList; + if (modified_ebi_list) { + cJSON *modified_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(modified_ebi_list)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + + modified_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(modified_ebi_list_local_nonprimitive, modified_ebi_list ) { + if (!cJSON_IsObject(modified_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + OpenAPI_ebi_arp_mapping_t *modified_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(modified_ebi_list_local_nonprimitive); + + OpenAPI_list_add(modified_ebi_listList, modified_ebi_listItem); + } + } + + cJSON *pti = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "pti"); + + if (pti) { + if (!cJSON_IsNumber(pti)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [pti]"); + goto end; + } + } + + cJSON *n1_sm_info_to_ue = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "n1SmInfoToUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue_local_nonprim = NULL; + if (n1_sm_info_to_ue) { + n1_sm_info_to_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_to_ue); + } + + cJSON *always_on_granted = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "alwaysOnGranted"); + + if (always_on_granted) { + if (!cJSON_IsBool(always_on_granted)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [always_on_granted]"); + goto end; + } + } + + cJSON *hsmf_pdu_session_uri = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "hsmfPduSessionUri"); + + if (hsmf_pdu_session_uri) { + if (!cJSON_IsString(hsmf_pdu_session_uri)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [hsmf_pdu_session_uri]"); + goto end; + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "cause"); + + OpenAPI_cause_t *cause_local_nonprim = NULL; + if (cause) { + cause_local_nonprim = OpenAPI_cause_parseFromJSON(cause); + } + + cJSON *n1sm_cause = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "n1smCause"); + + if (n1sm_cause) { + if (!cJSON_IsString(n1sm_cause)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [n1sm_cause]"); + goto end; + } + } + + cJSON *back_off_timer = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "backOffTimer"); + + if (back_off_timer) { + if (!cJSON_IsNumber(back_off_timer)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [back_off_timer]"); + goto end; + } + } + + cJSON *ma_release_ind = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "maReleaseInd"); + + OpenAPI_ma_release_indication_t *ma_release_ind_local_nonprim = NULL; + if (ma_release_ind) { + ma_release_ind_local_nonprim = OpenAPI_ma_release_indication_parseFromJSON(ma_release_ind); + } + + cJSON *ma_accepted_ind = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "maAcceptedInd"); + + if (ma_accepted_ind) { + if (!cJSON_IsBool(ma_accepted_ind)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [ma_accepted_ind]"); + goto end; + } + } + + cJSON *additional_cn_tunnel_info = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "additionalCnTunnelInfo"); + + OpenAPI_tunnel_info_t *additional_cn_tunnel_info_local_nonprim = NULL; + if (additional_cn_tunnel_info) { + additional_cn_tunnel_info_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(additional_cn_tunnel_info); + } + + cJSON *dnai_list = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "dnaiList"); + + OpenAPI_list_t *dnai_listList; + if (dnai_list) { + cJSON *dnai_list_local; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + cJSON *n4_info = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "n4Info"); + + OpenAPI_n4_information_t *n4_info_local_nonprim = NULL; + if (n4_info) { + n4_info_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info); + } + + cJSON *n4_info_ext1 = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "n4InfoExt1"); + + OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; + if (n4_info_ext1) { + n4_info_ext1_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext1); + } + + cJSON *n4_info_ext2 = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "n4InfoExt2"); + + OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + if (n4_info_ext2) { + n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); + } + + vsmf_update_data_local_var = OpenAPI_vsmf_update_data_create ( + request_indication_local_nonprim, + session_ambr ? session_ambr_local_nonprim : NULL, + qos_flows_add_mod_request_list ? qos_flows_add_mod_request_listList : NULL, + qos_flows_rel_request_list ? qos_flows_rel_request_listList : NULL, + eps_bearer_info ? eps_bearer_infoList : NULL, + assign_ebi_list ? assign_ebi_listList : NULL, + revoke_ebi_list ? revoke_ebi_listList : NULL, + modified_ebi_list ? modified_ebi_listList : NULL, + pti ? pti->valuedouble : 0, + n1_sm_info_to_ue ? n1_sm_info_to_ue_local_nonprim : NULL, + always_on_granted ? always_on_granted->valueint : 0, + hsmf_pdu_session_uri ? ogs_strdup(hsmf_pdu_session_uri->valuestring) : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + cause ? cause_local_nonprim : NULL, + n1sm_cause ? ogs_strdup(n1sm_cause->valuestring) : NULL, + back_off_timer ? back_off_timer->valuedouble : 0, + ma_release_ind ? ma_release_ind_local_nonprim : NULL, + ma_accepted_ind ? ma_accepted_ind->valueint : 0, + additional_cn_tunnel_info ? additional_cn_tunnel_info_local_nonprim : NULL, + dnai_list ? dnai_listList : NULL, + n4_info ? n4_info_local_nonprim : NULL, + n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL + ); + + return vsmf_update_data_local_var; +end: + return NULL; +} + +OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_copy(OpenAPI_vsmf_update_data_t *dst, OpenAPI_vsmf_update_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_vsmf_update_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_vsmf_update_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_vsmf_update_data_free(dst); + dst = OpenAPI_vsmf_update_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/vsmf_update_data.h b/lib/sbi/openapi/model/vsmf_update_data.h new file mode 100644 index 000000000..e3106fb09 --- /dev/null +++ b/lib/sbi/openapi/model/vsmf_update_data.h @@ -0,0 +1,94 @@ +/* + * vsmf_update_data.h + * + * + */ + +#ifndef _OpenAPI_vsmf_update_data_H_ +#define _OpenAPI_vsmf_update_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ambr.h" +#include "arp.h" +#include "cause.h" +#include "ebi_arp_mapping.h" +#include "eps_bearer_info.h" +#include "ma_release_indication.h" +#include "n4_information.h" +#include "qos_flow_add_modify_request_item.h" +#include "qos_flow_release_request_item.h" +#include "ref_to_binary_data.h" +#include "request_indication.h" +#include "tunnel_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_vsmf_update_data_s OpenAPI_vsmf_update_data_t; +typedef struct OpenAPI_vsmf_update_data_s { + struct OpenAPI_request_indication_s *request_indication; + struct OpenAPI_ambr_s *session_ambr; + OpenAPI_list_t *qos_flows_add_mod_request_list; + OpenAPI_list_t *qos_flows_rel_request_list; + OpenAPI_list_t *eps_bearer_info; + OpenAPI_list_t *assign_ebi_list; + OpenAPI_list_t *revoke_ebi_list; + OpenAPI_list_t *modified_ebi_list; + int pti; + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_to_ue; + int always_on_granted; + char *hsmf_pdu_session_uri; + char *supported_features; + struct OpenAPI_cause_s *cause; + char *n1sm_cause; + int back_off_timer; + struct OpenAPI_ma_release_indication_s *ma_release_ind; + int ma_accepted_ind; + struct OpenAPI_tunnel_info_s *additional_cn_tunnel_info; + OpenAPI_list_t *dnai_list; + struct OpenAPI_n4_information_s *n4_info; + struct OpenAPI_n4_information_s *n4_info_ext1; + struct OpenAPI_n4_information_s *n4_info_ext2; +} OpenAPI_vsmf_update_data_t; + +OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( + OpenAPI_request_indication_t *request_indication, + OpenAPI_ambr_t *session_ambr, + OpenAPI_list_t *qos_flows_add_mod_request_list, + OpenAPI_list_t *qos_flows_rel_request_list, + OpenAPI_list_t *eps_bearer_info, + OpenAPI_list_t *assign_ebi_list, + OpenAPI_list_t *revoke_ebi_list, + OpenAPI_list_t *modified_ebi_list, + int pti, + OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue, + int always_on_granted, + char *hsmf_pdu_session_uri, + char *supported_features, + OpenAPI_cause_t *cause, + char *n1sm_cause, + int back_off_timer, + OpenAPI_ma_release_indication_t *ma_release_ind, + int ma_accepted_ind, + OpenAPI_tunnel_info_t *additional_cn_tunnel_info, + OpenAPI_list_t *dnai_list, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 + ); +void OpenAPI_vsmf_update_data_free(OpenAPI_vsmf_update_data_t *vsmf_update_data); +OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_update_dataJSON); +cJSON *OpenAPI_vsmf_update_data_convertToJSON(OpenAPI_vsmf_update_data_t *vsmf_update_data); +OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_copy(OpenAPI_vsmf_update_data_t *dst, OpenAPI_vsmf_update_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_vsmf_update_data_H_ */ + diff --git a/lib/sbi/openapi/model/vsmf_update_error.c b/lib/sbi/openapi/model/vsmf_update_error.c new file mode 100644 index 000000000..a7eef8d7a --- /dev/null +++ b/lib/sbi/openapi/model/vsmf_update_error.c @@ -0,0 +1,386 @@ + +#include +#include +#include +#include "vsmf_update_error.h" + +OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_create( + OpenAPI_problem_details_t *error, + int pti, + char *n1sm_cause, + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue, + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info, + OpenAPI_list_t *failed_to_assign_ebi_list, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + char *recovery_time, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 + ) +{ + OpenAPI_vsmf_update_error_t *vsmf_update_error_local_var = OpenAPI_malloc(sizeof(OpenAPI_vsmf_update_error_t)); + if (!vsmf_update_error_local_var) { + return NULL; + } + vsmf_update_error_local_var->error = error; + vsmf_update_error_local_var->pti = pti; + vsmf_update_error_local_var->n1sm_cause = n1sm_cause; + vsmf_update_error_local_var->n1_sm_info_from_ue = n1_sm_info_from_ue; + vsmf_update_error_local_var->unknown_n1_sm_info = unknown_n1_sm_info; + vsmf_update_error_local_var->failed_to_assign_ebi_list = failed_to_assign_ebi_list; + vsmf_update_error_local_var->ng_ap_cause = ng_ap_cause; + vsmf_update_error_local_var->_5g_mm_cause_value = _5g_mm_cause_value; + vsmf_update_error_local_var->recovery_time = recovery_time; + vsmf_update_error_local_var->n4_info = n4_info; + vsmf_update_error_local_var->n4_info_ext1 = n4_info_ext1; + vsmf_update_error_local_var->n4_info_ext2 = n4_info_ext2; + + return vsmf_update_error_local_var; +} + +void OpenAPI_vsmf_update_error_free(OpenAPI_vsmf_update_error_t *vsmf_update_error) +{ + if (NULL == vsmf_update_error) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_problem_details_free(vsmf_update_error->error); + ogs_free(vsmf_update_error->n1sm_cause); + OpenAPI_ref_to_binary_data_free(vsmf_update_error->n1_sm_info_from_ue); + OpenAPI_ref_to_binary_data_free(vsmf_update_error->unknown_n1_sm_info); + OpenAPI_list_for_each(vsmf_update_error->failed_to_assign_ebi_list, node) { + OpenAPI_arp_free(node->data); + } + OpenAPI_list_free(vsmf_update_error->failed_to_assign_ebi_list); + OpenAPI_ng_ap_cause_free(vsmf_update_error->ng_ap_cause); + ogs_free(vsmf_update_error->recovery_time); + OpenAPI_n4_information_free(vsmf_update_error->n4_info); + OpenAPI_n4_information_free(vsmf_update_error->n4_info_ext1); + OpenAPI_n4_information_free(vsmf_update_error->n4_info_ext2); + ogs_free(vsmf_update_error); +} + +cJSON *OpenAPI_vsmf_update_error_convertToJSON(OpenAPI_vsmf_update_error_t *vsmf_update_error) +{ + cJSON *item = NULL; + + if (vsmf_update_error == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [VsmfUpdateError]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!vsmf_update_error->error) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [error]"); + goto end; + } + cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(vsmf_update_error->error); + if (error_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [error]"); + goto end; + } + cJSON_AddItemToObject(item, "error", error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [error]"); + goto end; + } + + if (vsmf_update_error->pti) { + if (cJSON_AddNumberToObject(item, "pti", vsmf_update_error->pti) == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [pti]"); + goto end; + } + } + + if (vsmf_update_error->n1sm_cause) { + if (cJSON_AddStringToObject(item, "n1smCause", vsmf_update_error->n1sm_cause) == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n1sm_cause]"); + goto end; + } + } + + if (vsmf_update_error->n1_sm_info_from_ue) { + cJSON *n1_sm_info_from_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(vsmf_update_error->n1_sm_info_from_ue); + if (n1_sm_info_from_ue_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n1_sm_info_from_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoFromUe", n1_sm_info_from_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n1_sm_info_from_ue]"); + goto end; + } + } + + if (vsmf_update_error->unknown_n1_sm_info) { + cJSON *unknown_n1_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(vsmf_update_error->unknown_n1_sm_info); + if (unknown_n1_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [unknown_n1_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "unknownN1SmInfo", unknown_n1_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [unknown_n1_sm_info]"); + goto end; + } + } + + if (vsmf_update_error->failed_to_assign_ebi_list) { + cJSON *failed_to_assign_ebi_listList = cJSON_AddArrayToObject(item, "failedToAssignEbiList"); + if (failed_to_assign_ebi_listList == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [failed_to_assign_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *failed_to_assign_ebi_list_node; + if (vsmf_update_error->failed_to_assign_ebi_list) { + OpenAPI_list_for_each(vsmf_update_error->failed_to_assign_ebi_list, failed_to_assign_ebi_list_node) { + cJSON *itemLocal = OpenAPI_arp_convertToJSON(failed_to_assign_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [failed_to_assign_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(failed_to_assign_ebi_listList, itemLocal); + } + } + } + + if (vsmf_update_error->ng_ap_cause) { + cJSON *ng_ap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(vsmf_update_error->ng_ap_cause); + if (ng_ap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngApCause", ng_ap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + } + + if (vsmf_update_error->_5g_mm_cause_value) { + if (cJSON_AddNumberToObject(item, "5gMmCauseValue", vsmf_update_error->_5g_mm_cause_value) == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + if (vsmf_update_error->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", vsmf_update_error->recovery_time) == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (vsmf_update_error->n4_info) { + cJSON *n4_info_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_update_error->n4_info); + if (n4_info_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n4_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n4Info", n4_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n4_info]"); + goto end; + } + } + + if (vsmf_update_error->n4_info_ext1) { + cJSON *n4_info_ext1_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_update_error->n4_info_ext1); + if (n4_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt1", n4_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + } + + if (vsmf_update_error->n4_info_ext2) { + cJSON *n4_info_ext2_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_update_error->n4_info_ext2); + if (n4_info_ext2_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt2", n4_info_ext2_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_parseFromJSON(cJSON *vsmf_update_errorJSON) +{ + OpenAPI_vsmf_update_error_t *vsmf_update_error_local_var = NULL; + cJSON *error = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "error"); + if (!error) { + ogs_error("OpenAPI_vsmf_update_error_parseFromJSON() failed [error]"); + goto end; + } + + OpenAPI_problem_details_t *error_local_nonprim = NULL; + + error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + + cJSON *pti = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "pti"); + + if (pti) { + if (!cJSON_IsNumber(pti)) { + ogs_error("OpenAPI_vsmf_update_error_parseFromJSON() failed [pti]"); + goto end; + } + } + + cJSON *n1sm_cause = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "n1smCause"); + + if (n1sm_cause) { + if (!cJSON_IsString(n1sm_cause)) { + ogs_error("OpenAPI_vsmf_update_error_parseFromJSON() failed [n1sm_cause]"); + goto end; + } + } + + cJSON *n1_sm_info_from_ue = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "n1SmInfoFromUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue_local_nonprim = NULL; + if (n1_sm_info_from_ue) { + n1_sm_info_from_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_from_ue); + } + + cJSON *unknown_n1_sm_info = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "unknownN1SmInfo"); + + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info_local_nonprim = NULL; + if (unknown_n1_sm_info) { + unknown_n1_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(unknown_n1_sm_info); + } + + cJSON *failed_to_assign_ebi_list = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "failedToAssignEbiList"); + + OpenAPI_list_t *failed_to_assign_ebi_listList; + if (failed_to_assign_ebi_list) { + cJSON *failed_to_assign_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(failed_to_assign_ebi_list)) { + ogs_error("OpenAPI_vsmf_update_error_parseFromJSON() failed [failed_to_assign_ebi_list]"); + goto end; + } + + failed_to_assign_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(failed_to_assign_ebi_list_local_nonprimitive, failed_to_assign_ebi_list ) { + if (!cJSON_IsObject(failed_to_assign_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_update_error_parseFromJSON() failed [failed_to_assign_ebi_list]"); + goto end; + } + OpenAPI_arp_t *failed_to_assign_ebi_listItem = OpenAPI_arp_parseFromJSON(failed_to_assign_ebi_list_local_nonprimitive); + + OpenAPI_list_add(failed_to_assign_ebi_listList, failed_to_assign_ebi_listItem); + } + } + + cJSON *ng_ap_cause = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "ngApCause"); + + OpenAPI_ng_ap_cause_t *ng_ap_cause_local_nonprim = NULL; + if (ng_ap_cause) { + ng_ap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ng_ap_cause); + } + + cJSON *_5g_mm_cause_value = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "5gMmCauseValue"); + + if (_5g_mm_cause_value) { + if (!cJSON_IsNumber(_5g_mm_cause_value)) { + ogs_error("OpenAPI_vsmf_update_error_parseFromJSON() failed [_5g_mm_cause_value]"); + goto end; + } + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_vsmf_update_error_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + cJSON *n4_info = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "n4Info"); + + OpenAPI_n4_information_t *n4_info_local_nonprim = NULL; + if (n4_info) { + n4_info_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info); + } + + cJSON *n4_info_ext1 = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "n4InfoExt1"); + + OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; + if (n4_info_ext1) { + n4_info_ext1_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext1); + } + + cJSON *n4_info_ext2 = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "n4InfoExt2"); + + OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + if (n4_info_ext2) { + n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); + } + + vsmf_update_error_local_var = OpenAPI_vsmf_update_error_create ( + error_local_nonprim, + pti ? pti->valuedouble : 0, + n1sm_cause ? ogs_strdup(n1sm_cause->valuestring) : NULL, + n1_sm_info_from_ue ? n1_sm_info_from_ue_local_nonprim : NULL, + unknown_n1_sm_info ? unknown_n1_sm_info_local_nonprim : NULL, + failed_to_assign_ebi_list ? failed_to_assign_ebi_listList : NULL, + ng_ap_cause ? ng_ap_cause_local_nonprim : NULL, + _5g_mm_cause_value ? _5g_mm_cause_value->valuedouble : 0, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL, + n4_info ? n4_info_local_nonprim : NULL, + n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL + ); + + return vsmf_update_error_local_var; +end: + return NULL; +} + +OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_copy(OpenAPI_vsmf_update_error_t *dst, OpenAPI_vsmf_update_error_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_vsmf_update_error_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_vsmf_update_error_free(dst); + dst = OpenAPI_vsmf_update_error_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/vsmf_update_error.h b/lib/sbi/openapi/model/vsmf_update_error.h new file mode 100644 index 000000000..9945be0bb --- /dev/null +++ b/lib/sbi/openapi/model/vsmf_update_error.h @@ -0,0 +1,65 @@ +/* + * vsmf_update_error.h + * + * + */ + +#ifndef _OpenAPI_vsmf_update_error_H_ +#define _OpenAPI_vsmf_update_error_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "arp.h" +#include "n4_information.h" +#include "ng_ap_cause.h" +#include "problem_details.h" +#include "ref_to_binary_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_vsmf_update_error_s OpenAPI_vsmf_update_error_t; +typedef struct OpenAPI_vsmf_update_error_s { + struct OpenAPI_problem_details_s *error; + int pti; + char *n1sm_cause; + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_from_ue; + struct OpenAPI_ref_to_binary_data_s *unknown_n1_sm_info; + OpenAPI_list_t *failed_to_assign_ebi_list; + struct OpenAPI_ng_ap_cause_s *ng_ap_cause; + int _5g_mm_cause_value; + char *recovery_time; + struct OpenAPI_n4_information_s *n4_info; + struct OpenAPI_n4_information_s *n4_info_ext1; + struct OpenAPI_n4_information_s *n4_info_ext2; +} OpenAPI_vsmf_update_error_t; + +OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_create( + OpenAPI_problem_details_t *error, + int pti, + char *n1sm_cause, + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue, + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info, + OpenAPI_list_t *failed_to_assign_ebi_list, + OpenAPI_ng_ap_cause_t *ng_ap_cause, + int _5g_mm_cause_value, + char *recovery_time, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 + ); +void OpenAPI_vsmf_update_error_free(OpenAPI_vsmf_update_error_t *vsmf_update_error); +OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_parseFromJSON(cJSON *vsmf_update_errorJSON); +cJSON *OpenAPI_vsmf_update_error_convertToJSON(OpenAPI_vsmf_update_error_t *vsmf_update_error); +OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_copy(OpenAPI_vsmf_update_error_t *dst, OpenAPI_vsmf_update_error_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_vsmf_update_error_H_ */ + diff --git a/lib/sbi/openapi/model/vsmf_updated_data.c b/lib/sbi/openapi/model/vsmf_updated_data.c new file mode 100644 index 000000000..4d6f390e7 --- /dev/null +++ b/lib/sbi/openapi/model/vsmf_updated_data.c @@ -0,0 +1,716 @@ + +#include +#include +#include +#include "vsmf_updated_data.h" + +OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_create( + OpenAPI_list_t *qos_flows_add_mod_list, + OpenAPI_list_t *qos_flows_rel_list, + OpenAPI_list_t *qos_flows_failedto_add_mod_list, + OpenAPI_list_t *qos_flows_failedto_rel_list, + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue, + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + OpenAPI_list_t *assigned_ebi_list, + OpenAPI_list_t *failed_to_assign_ebi_list, + OpenAPI_list_t *released_ebi_list, + OpenAPI_list_t *secondary_rat_usage_report, + OpenAPI_list_t *secondary_rat_usage_info, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 + ) +{ + OpenAPI_vsmf_updated_data_t *vsmf_updated_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_vsmf_updated_data_t)); + if (!vsmf_updated_data_local_var) { + return NULL; + } + vsmf_updated_data_local_var->qos_flows_add_mod_list = qos_flows_add_mod_list; + vsmf_updated_data_local_var->qos_flows_rel_list = qos_flows_rel_list; + vsmf_updated_data_local_var->qos_flows_failedto_add_mod_list = qos_flows_failedto_add_mod_list; + vsmf_updated_data_local_var->qos_flows_failedto_rel_list = qos_flows_failedto_rel_list; + vsmf_updated_data_local_var->n1_sm_info_from_ue = n1_sm_info_from_ue; + vsmf_updated_data_local_var->unknown_n1_sm_info = unknown_n1_sm_info; + vsmf_updated_data_local_var->ue_location = ue_location; + vsmf_updated_data_local_var->ue_time_zone = ue_time_zone; + vsmf_updated_data_local_var->add_ue_location = add_ue_location; + vsmf_updated_data_local_var->assigned_ebi_list = assigned_ebi_list; + vsmf_updated_data_local_var->failed_to_assign_ebi_list = failed_to_assign_ebi_list; + vsmf_updated_data_local_var->released_ebi_list = released_ebi_list; + vsmf_updated_data_local_var->secondary_rat_usage_report = secondary_rat_usage_report; + vsmf_updated_data_local_var->secondary_rat_usage_info = secondary_rat_usage_info; + vsmf_updated_data_local_var->n4_info = n4_info; + vsmf_updated_data_local_var->n4_info_ext1 = n4_info_ext1; + vsmf_updated_data_local_var->n4_info_ext2 = n4_info_ext2; + + return vsmf_updated_data_local_var; +} + +void OpenAPI_vsmf_updated_data_free(OpenAPI_vsmf_updated_data_t *vsmf_updated_data) +{ + if (NULL == vsmf_updated_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(vsmf_updated_data->qos_flows_add_mod_list, node) { + OpenAPI_qos_flow_item_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->qos_flows_add_mod_list); + OpenAPI_list_for_each(vsmf_updated_data->qos_flows_rel_list, node) { + OpenAPI_qos_flow_item_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->qos_flows_rel_list); + OpenAPI_list_for_each(vsmf_updated_data->qos_flows_failedto_add_mod_list, node) { + OpenAPI_qos_flow_item_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->qos_flows_failedto_add_mod_list); + OpenAPI_list_for_each(vsmf_updated_data->qos_flows_failedto_rel_list, node) { + OpenAPI_qos_flow_item_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->qos_flows_failedto_rel_list); + OpenAPI_ref_to_binary_data_free(vsmf_updated_data->n1_sm_info_from_ue); + OpenAPI_ref_to_binary_data_free(vsmf_updated_data->unknown_n1_sm_info); + OpenAPI_user_location_free(vsmf_updated_data->ue_location); + ogs_free(vsmf_updated_data->ue_time_zone); + OpenAPI_user_location_free(vsmf_updated_data->add_ue_location); + OpenAPI_list_for_each(vsmf_updated_data->assigned_ebi_list, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->assigned_ebi_list); + OpenAPI_list_for_each(vsmf_updated_data->failed_to_assign_ebi_list, node) { + OpenAPI_arp_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->failed_to_assign_ebi_list); + OpenAPI_list_for_each(vsmf_updated_data->released_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->released_ebi_list); + OpenAPI_list_for_each(vsmf_updated_data->secondary_rat_usage_report, node) { + OpenAPI_secondary_rat_usage_report_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->secondary_rat_usage_report); + OpenAPI_list_for_each(vsmf_updated_data->secondary_rat_usage_info, node) { + OpenAPI_secondary_rat_usage_info_free(node->data); + } + OpenAPI_list_free(vsmf_updated_data->secondary_rat_usage_info); + OpenAPI_n4_information_free(vsmf_updated_data->n4_info); + OpenAPI_n4_information_free(vsmf_updated_data->n4_info_ext1); + OpenAPI_n4_information_free(vsmf_updated_data->n4_info_ext2); + ogs_free(vsmf_updated_data); +} + +cJSON *OpenAPI_vsmf_updated_data_convertToJSON(OpenAPI_vsmf_updated_data_t *vsmf_updated_data) +{ + cJSON *item = NULL; + + if (vsmf_updated_data == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [VsmfUpdatedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (vsmf_updated_data->qos_flows_add_mod_list) { + cJSON *qos_flows_add_mod_listList = cJSON_AddArrayToObject(item, "qosFlowsAddModList"); + if (qos_flows_add_mod_listList == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [qos_flows_add_mod_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_add_mod_list_node; + if (vsmf_updated_data->qos_flows_add_mod_list) { + OpenAPI_list_for_each(vsmf_updated_data->qos_flows_add_mod_list, qos_flows_add_mod_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_item_convertToJSON(qos_flows_add_mod_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [qos_flows_add_mod_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_add_mod_listList, itemLocal); + } + } + } + + if (vsmf_updated_data->qos_flows_rel_list) { + cJSON *qos_flows_rel_listList = cJSON_AddArrayToObject(item, "qosFlowsRelList"); + if (qos_flows_rel_listList == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [qos_flows_rel_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_rel_list_node; + if (vsmf_updated_data->qos_flows_rel_list) { + OpenAPI_list_for_each(vsmf_updated_data->qos_flows_rel_list, qos_flows_rel_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_item_convertToJSON(qos_flows_rel_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [qos_flows_rel_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_rel_listList, itemLocal); + } + } + } + + if (vsmf_updated_data->qos_flows_failedto_add_mod_list) { + cJSON *qos_flows_failedto_add_mod_listList = cJSON_AddArrayToObject(item, "qosFlowsFailedtoAddModList"); + if (qos_flows_failedto_add_mod_listList == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [qos_flows_failedto_add_mod_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_failedto_add_mod_list_node; + if (vsmf_updated_data->qos_flows_failedto_add_mod_list) { + OpenAPI_list_for_each(vsmf_updated_data->qos_flows_failedto_add_mod_list, qos_flows_failedto_add_mod_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_item_convertToJSON(qos_flows_failedto_add_mod_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [qos_flows_failedto_add_mod_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_failedto_add_mod_listList, itemLocal); + } + } + } + + if (vsmf_updated_data->qos_flows_failedto_rel_list) { + cJSON *qos_flows_failedto_rel_listList = cJSON_AddArrayToObject(item, "qosFlowsFailedtoRelList"); + if (qos_flows_failedto_rel_listList == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [qos_flows_failedto_rel_list]"); + goto end; + } + + OpenAPI_lnode_t *qos_flows_failedto_rel_list_node; + if (vsmf_updated_data->qos_flows_failedto_rel_list) { + OpenAPI_list_for_each(vsmf_updated_data->qos_flows_failedto_rel_list, qos_flows_failedto_rel_list_node) { + cJSON *itemLocal = OpenAPI_qos_flow_item_convertToJSON(qos_flows_failedto_rel_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [qos_flows_failedto_rel_list]"); + goto end; + } + cJSON_AddItemToArray(qos_flows_failedto_rel_listList, itemLocal); + } + } + } + + if (vsmf_updated_data->n1_sm_info_from_ue) { + cJSON *n1_sm_info_from_ue_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(vsmf_updated_data->n1_sm_info_from_ue); + if (n1_sm_info_from_ue_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n1_sm_info_from_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "n1SmInfoFromUe", n1_sm_info_from_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n1_sm_info_from_ue]"); + goto end; + } + } + + if (vsmf_updated_data->unknown_n1_sm_info) { + cJSON *unknown_n1_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(vsmf_updated_data->unknown_n1_sm_info); + if (unknown_n1_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [unknown_n1_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "unknownN1SmInfo", unknown_n1_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [unknown_n1_sm_info]"); + goto end; + } + } + + if (vsmf_updated_data->ue_location) { + cJSON *ue_location_local_JSON = OpenAPI_user_location_convertToJSON(vsmf_updated_data->ue_location); + if (ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLocation", ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [ue_location]"); + goto end; + } + } + + if (vsmf_updated_data->ue_time_zone) { + if (cJSON_AddStringToObject(item, "ueTimeZone", vsmf_updated_data->ue_time_zone) == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [ue_time_zone]"); + goto end; + } + } + + if (vsmf_updated_data->add_ue_location) { + cJSON *add_ue_location_local_JSON = OpenAPI_user_location_convertToJSON(vsmf_updated_data->add_ue_location); + if (add_ue_location_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + cJSON_AddItemToObject(item, "addUeLocation", add_ue_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [add_ue_location]"); + goto end; + } + } + + if (vsmf_updated_data->assigned_ebi_list) { + cJSON *assigned_ebi_listList = cJSON_AddArrayToObject(item, "assignedEbiList"); + if (assigned_ebi_listList == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [assigned_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *assigned_ebi_list_node; + if (vsmf_updated_data->assigned_ebi_list) { + OpenAPI_list_for_each(vsmf_updated_data->assigned_ebi_list, assigned_ebi_list_node) { + cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(assigned_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [assigned_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(assigned_ebi_listList, itemLocal); + } + } + } + + if (vsmf_updated_data->failed_to_assign_ebi_list) { + cJSON *failed_to_assign_ebi_listList = cJSON_AddArrayToObject(item, "failedToAssignEbiList"); + if (failed_to_assign_ebi_listList == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [failed_to_assign_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *failed_to_assign_ebi_list_node; + if (vsmf_updated_data->failed_to_assign_ebi_list) { + OpenAPI_list_for_each(vsmf_updated_data->failed_to_assign_ebi_list, failed_to_assign_ebi_list_node) { + cJSON *itemLocal = OpenAPI_arp_convertToJSON(failed_to_assign_ebi_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [failed_to_assign_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(failed_to_assign_ebi_listList, itemLocal); + } + } + } + + if (vsmf_updated_data->released_ebi_list) { + cJSON *released_ebi_list = cJSON_AddArrayToObject(item, "releasedEbiList"); + if (released_ebi_list == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [released_ebi_list]"); + goto end; + } + + OpenAPI_lnode_t *released_ebi_list_node; + OpenAPI_list_for_each(vsmf_updated_data->released_ebi_list, released_ebi_list_node) { + if (cJSON_AddNumberToObject(released_ebi_list, "", *(double *)released_ebi_list_node->data) == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [released_ebi_list]"); + goto end; + } + } + } + + if (vsmf_updated_data->secondary_rat_usage_report) { + cJSON *secondary_rat_usage_reportList = cJSON_AddArrayToObject(item, "secondaryRatUsageReport"); + if (secondary_rat_usage_reportList == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [secondary_rat_usage_report]"); + goto end; + } + + OpenAPI_lnode_t *secondary_rat_usage_report_node; + if (vsmf_updated_data->secondary_rat_usage_report) { + OpenAPI_list_for_each(vsmf_updated_data->secondary_rat_usage_report, secondary_rat_usage_report_node) { + cJSON *itemLocal = OpenAPI_secondary_rat_usage_report_convertToJSON(secondary_rat_usage_report_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [secondary_rat_usage_report]"); + goto end; + } + cJSON_AddItemToArray(secondary_rat_usage_reportList, itemLocal); + } + } + } + + if (vsmf_updated_data->secondary_rat_usage_info) { + cJSON *secondary_rat_usage_infoList = cJSON_AddArrayToObject(item, "secondaryRatUsageInfo"); + if (secondary_rat_usage_infoList == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [secondary_rat_usage_info]"); + goto end; + } + + OpenAPI_lnode_t *secondary_rat_usage_info_node; + if (vsmf_updated_data->secondary_rat_usage_info) { + OpenAPI_list_for_each(vsmf_updated_data->secondary_rat_usage_info, secondary_rat_usage_info_node) { + cJSON *itemLocal = OpenAPI_secondary_rat_usage_info_convertToJSON(secondary_rat_usage_info_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [secondary_rat_usage_info]"); + goto end; + } + cJSON_AddItemToArray(secondary_rat_usage_infoList, itemLocal); + } + } + } + + if (vsmf_updated_data->n4_info) { + cJSON *n4_info_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_updated_data->n4_info); + if (n4_info_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n4_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n4Info", n4_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n4_info]"); + goto end; + } + } + + if (vsmf_updated_data->n4_info_ext1) { + cJSON *n4_info_ext1_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_updated_data->n4_info_ext1); + if (n4_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt1", n4_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + } + + if (vsmf_updated_data->n4_info_ext2) { + cJSON *n4_info_ext2_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_updated_data->n4_info_ext2); + if (n4_info_ext2_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt2", n4_info_ext2_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_parseFromJSON(cJSON *vsmf_updated_dataJSON) +{ + OpenAPI_vsmf_updated_data_t *vsmf_updated_data_local_var = NULL; + cJSON *qos_flows_add_mod_list = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "qosFlowsAddModList"); + + OpenAPI_list_t *qos_flows_add_mod_listList; + if (qos_flows_add_mod_list) { + cJSON *qos_flows_add_mod_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_add_mod_list)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [qos_flows_add_mod_list]"); + goto end; + } + + qos_flows_add_mod_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_add_mod_list_local_nonprimitive, qos_flows_add_mod_list ) { + if (!cJSON_IsObject(qos_flows_add_mod_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [qos_flows_add_mod_list]"); + goto end; + } + OpenAPI_qos_flow_item_t *qos_flows_add_mod_listItem = OpenAPI_qos_flow_item_parseFromJSON(qos_flows_add_mod_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_add_mod_listList, qos_flows_add_mod_listItem); + } + } + + cJSON *qos_flows_rel_list = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "qosFlowsRelList"); + + OpenAPI_list_t *qos_flows_rel_listList; + if (qos_flows_rel_list) { + cJSON *qos_flows_rel_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_rel_list)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [qos_flows_rel_list]"); + goto end; + } + + qos_flows_rel_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_rel_list_local_nonprimitive, qos_flows_rel_list ) { + if (!cJSON_IsObject(qos_flows_rel_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [qos_flows_rel_list]"); + goto end; + } + OpenAPI_qos_flow_item_t *qos_flows_rel_listItem = OpenAPI_qos_flow_item_parseFromJSON(qos_flows_rel_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_rel_listList, qos_flows_rel_listItem); + } + } + + cJSON *qos_flows_failedto_add_mod_list = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "qosFlowsFailedtoAddModList"); + + OpenAPI_list_t *qos_flows_failedto_add_mod_listList; + if (qos_flows_failedto_add_mod_list) { + cJSON *qos_flows_failedto_add_mod_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_failedto_add_mod_list)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [qos_flows_failedto_add_mod_list]"); + goto end; + } + + qos_flows_failedto_add_mod_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_failedto_add_mod_list_local_nonprimitive, qos_flows_failedto_add_mod_list ) { + if (!cJSON_IsObject(qos_flows_failedto_add_mod_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [qos_flows_failedto_add_mod_list]"); + goto end; + } + OpenAPI_qos_flow_item_t *qos_flows_failedto_add_mod_listItem = OpenAPI_qos_flow_item_parseFromJSON(qos_flows_failedto_add_mod_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_failedto_add_mod_listList, qos_flows_failedto_add_mod_listItem); + } + } + + cJSON *qos_flows_failedto_rel_list = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "qosFlowsFailedtoRelList"); + + OpenAPI_list_t *qos_flows_failedto_rel_listList; + if (qos_flows_failedto_rel_list) { + cJSON *qos_flows_failedto_rel_list_local_nonprimitive; + if (!cJSON_IsArray(qos_flows_failedto_rel_list)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [qos_flows_failedto_rel_list]"); + goto end; + } + + qos_flows_failedto_rel_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flows_failedto_rel_list_local_nonprimitive, qos_flows_failedto_rel_list ) { + if (!cJSON_IsObject(qos_flows_failedto_rel_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [qos_flows_failedto_rel_list]"); + goto end; + } + OpenAPI_qos_flow_item_t *qos_flows_failedto_rel_listItem = OpenAPI_qos_flow_item_parseFromJSON(qos_flows_failedto_rel_list_local_nonprimitive); + + OpenAPI_list_add(qos_flows_failedto_rel_listList, qos_flows_failedto_rel_listItem); + } + } + + cJSON *n1_sm_info_from_ue = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "n1SmInfoFromUe"); + + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue_local_nonprim = NULL; + if (n1_sm_info_from_ue) { + n1_sm_info_from_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_from_ue); + } + + cJSON *unknown_n1_sm_info = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "unknownN1SmInfo"); + + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info_local_nonprim = NULL; + if (unknown_n1_sm_info) { + unknown_n1_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(unknown_n1_sm_info); + } + + cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "ueLocation"); + + OpenAPI_user_location_t *ue_location_local_nonprim = NULL; + if (ue_location) { + ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location); + } + + cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "ueTimeZone"); + + if (ue_time_zone) { + if (!cJSON_IsString(ue_time_zone)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [ue_time_zone]"); + goto end; + } + } + + cJSON *add_ue_location = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "addUeLocation"); + + OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL; + if (add_ue_location) { + add_ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(add_ue_location); + } + + cJSON *assigned_ebi_list = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "assignedEbiList"); + + OpenAPI_list_t *assigned_ebi_listList; + if (assigned_ebi_list) { + cJSON *assigned_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(assigned_ebi_list)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [assigned_ebi_list]"); + goto end; + } + + assigned_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(assigned_ebi_list_local_nonprimitive, assigned_ebi_list ) { + if (!cJSON_IsObject(assigned_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [assigned_ebi_list]"); + goto end; + } + OpenAPI_ebi_arp_mapping_t *assigned_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(assigned_ebi_list_local_nonprimitive); + + OpenAPI_list_add(assigned_ebi_listList, assigned_ebi_listItem); + } + } + + cJSON *failed_to_assign_ebi_list = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "failedToAssignEbiList"); + + OpenAPI_list_t *failed_to_assign_ebi_listList; + if (failed_to_assign_ebi_list) { + cJSON *failed_to_assign_ebi_list_local_nonprimitive; + if (!cJSON_IsArray(failed_to_assign_ebi_list)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [failed_to_assign_ebi_list]"); + goto end; + } + + failed_to_assign_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(failed_to_assign_ebi_list_local_nonprimitive, failed_to_assign_ebi_list ) { + if (!cJSON_IsObject(failed_to_assign_ebi_list_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [failed_to_assign_ebi_list]"); + goto end; + } + OpenAPI_arp_t *failed_to_assign_ebi_listItem = OpenAPI_arp_parseFromJSON(failed_to_assign_ebi_list_local_nonprimitive); + + OpenAPI_list_add(failed_to_assign_ebi_listList, failed_to_assign_ebi_listItem); + } + } + + cJSON *released_ebi_list = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "releasedEbiList"); + + OpenAPI_list_t *released_ebi_listList; + if (released_ebi_list) { + cJSON *released_ebi_list_local; + if (!cJSON_IsArray(released_ebi_list)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [released_ebi_list]"); + goto end; + } + released_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(released_ebi_list_local, released_ebi_list) { + if (!cJSON_IsNumber(released_ebi_list_local)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [released_ebi_list]"); + goto end; + } + OpenAPI_list_add(released_ebi_listList, &released_ebi_list_local->valuedouble); + } + } + + cJSON *secondary_rat_usage_report = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "secondaryRatUsageReport"); + + OpenAPI_list_t *secondary_rat_usage_reportList; + if (secondary_rat_usage_report) { + cJSON *secondary_rat_usage_report_local_nonprimitive; + if (!cJSON_IsArray(secondary_rat_usage_report)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [secondary_rat_usage_report]"); + goto end; + } + + secondary_rat_usage_reportList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_report_local_nonprimitive, secondary_rat_usage_report ) { + if (!cJSON_IsObject(secondary_rat_usage_report_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [secondary_rat_usage_report]"); + goto end; + } + OpenAPI_secondary_rat_usage_report_t *secondary_rat_usage_reportItem = OpenAPI_secondary_rat_usage_report_parseFromJSON(secondary_rat_usage_report_local_nonprimitive); + + OpenAPI_list_add(secondary_rat_usage_reportList, secondary_rat_usage_reportItem); + } + } + + cJSON *secondary_rat_usage_info = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "secondaryRatUsageInfo"); + + OpenAPI_list_t *secondary_rat_usage_infoList; + if (secondary_rat_usage_info) { + cJSON *secondary_rat_usage_info_local_nonprimitive; + if (!cJSON_IsArray(secondary_rat_usage_info)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [secondary_rat_usage_info]"); + goto end; + } + + secondary_rat_usage_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_info_local_nonprimitive, secondary_rat_usage_info ) { + if (!cJSON_IsObject(secondary_rat_usage_info_local_nonprimitive)) { + ogs_error("OpenAPI_vsmf_updated_data_parseFromJSON() failed [secondary_rat_usage_info]"); + goto end; + } + OpenAPI_secondary_rat_usage_info_t *secondary_rat_usage_infoItem = OpenAPI_secondary_rat_usage_info_parseFromJSON(secondary_rat_usage_info_local_nonprimitive); + + OpenAPI_list_add(secondary_rat_usage_infoList, secondary_rat_usage_infoItem); + } + } + + cJSON *n4_info = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "n4Info"); + + OpenAPI_n4_information_t *n4_info_local_nonprim = NULL; + if (n4_info) { + n4_info_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info); + } + + cJSON *n4_info_ext1 = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "n4InfoExt1"); + + OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; + if (n4_info_ext1) { + n4_info_ext1_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext1); + } + + cJSON *n4_info_ext2 = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "n4InfoExt2"); + + OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + if (n4_info_ext2) { + n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); + } + + vsmf_updated_data_local_var = OpenAPI_vsmf_updated_data_create ( + qos_flows_add_mod_list ? qos_flows_add_mod_listList : NULL, + qos_flows_rel_list ? qos_flows_rel_listList : NULL, + qos_flows_failedto_add_mod_list ? qos_flows_failedto_add_mod_listList : NULL, + qos_flows_failedto_rel_list ? qos_flows_failedto_rel_listList : NULL, + n1_sm_info_from_ue ? n1_sm_info_from_ue_local_nonprim : NULL, + unknown_n1_sm_info ? unknown_n1_sm_info_local_nonprim : NULL, + ue_location ? ue_location_local_nonprim : NULL, + ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL, + add_ue_location ? add_ue_location_local_nonprim : NULL, + assigned_ebi_list ? assigned_ebi_listList : NULL, + failed_to_assign_ebi_list ? failed_to_assign_ebi_listList : NULL, + released_ebi_list ? released_ebi_listList : NULL, + secondary_rat_usage_report ? secondary_rat_usage_reportList : NULL, + secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL, + n4_info ? n4_info_local_nonprim : NULL, + n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL + ); + + return vsmf_updated_data_local_var; +end: + return NULL; +} + +OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_copy(OpenAPI_vsmf_updated_data_t *dst, OpenAPI_vsmf_updated_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_vsmf_updated_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_vsmf_updated_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_vsmf_updated_data_free(dst); + dst = OpenAPI_vsmf_updated_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/vsmf_updated_data.h b/lib/sbi/openapi/model/vsmf_updated_data.h new file mode 100644 index 000000000..20bee5b64 --- /dev/null +++ b/lib/sbi/openapi/model/vsmf_updated_data.h @@ -0,0 +1,78 @@ +/* + * vsmf_updated_data.h + * + * + */ + +#ifndef _OpenAPI_vsmf_updated_data_H_ +#define _OpenAPI_vsmf_updated_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "arp.h" +#include "ebi_arp_mapping.h" +#include "n4_information.h" +#include "qos_flow_item.h" +#include "ref_to_binary_data.h" +#include "secondary_rat_usage_info.h" +#include "secondary_rat_usage_report.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_vsmf_updated_data_s OpenAPI_vsmf_updated_data_t; +typedef struct OpenAPI_vsmf_updated_data_s { + OpenAPI_list_t *qos_flows_add_mod_list; + OpenAPI_list_t *qos_flows_rel_list; + OpenAPI_list_t *qos_flows_failedto_add_mod_list; + OpenAPI_list_t *qos_flows_failedto_rel_list; + struct OpenAPI_ref_to_binary_data_s *n1_sm_info_from_ue; + struct OpenAPI_ref_to_binary_data_s *unknown_n1_sm_info; + struct OpenAPI_user_location_s *ue_location; + char *ue_time_zone; + struct OpenAPI_user_location_s *add_ue_location; + OpenAPI_list_t *assigned_ebi_list; + OpenAPI_list_t *failed_to_assign_ebi_list; + OpenAPI_list_t *released_ebi_list; + OpenAPI_list_t *secondary_rat_usage_report; + OpenAPI_list_t *secondary_rat_usage_info; + struct OpenAPI_n4_information_s *n4_info; + struct OpenAPI_n4_information_s *n4_info_ext1; + struct OpenAPI_n4_information_s *n4_info_ext2; +} OpenAPI_vsmf_updated_data_t; + +OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_create( + OpenAPI_list_t *qos_flows_add_mod_list, + OpenAPI_list_t *qos_flows_rel_list, + OpenAPI_list_t *qos_flows_failedto_add_mod_list, + OpenAPI_list_t *qos_flows_failedto_rel_list, + OpenAPI_ref_to_binary_data_t *n1_sm_info_from_ue, + OpenAPI_ref_to_binary_data_t *unknown_n1_sm_info, + OpenAPI_user_location_t *ue_location, + char *ue_time_zone, + OpenAPI_user_location_t *add_ue_location, + OpenAPI_list_t *assigned_ebi_list, + OpenAPI_list_t *failed_to_assign_ebi_list, + OpenAPI_list_t *released_ebi_list, + OpenAPI_list_t *secondary_rat_usage_report, + OpenAPI_list_t *secondary_rat_usage_info, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 + ); +void OpenAPI_vsmf_updated_data_free(OpenAPI_vsmf_updated_data_t *vsmf_updated_data); +OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_parseFromJSON(cJSON *vsmf_updated_dataJSON); +cJSON *OpenAPI_vsmf_updated_data_convertToJSON(OpenAPI_vsmf_updated_data_t *vsmf_updated_data); +OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_copy(OpenAPI_vsmf_updated_data_t *dst, OpenAPI_vsmf_updated_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_vsmf_updated_data_H_ */ + diff --git a/lib/sbi/openapi/model/w_agf_info.c b/lib/sbi/openapi/model/w_agf_info.c index a0a83f2eb..fa865bb6a 100644 --- a/lib/sbi/openapi/model/w_agf_info.c +++ b/lib/sbi/openapi/model/w_agf_info.c @@ -155,3 +155,37 @@ end: return NULL; } +OpenAPI_w_agf_info_t *OpenAPI_w_agf_info_copy(OpenAPI_w_agf_info_t *dst, OpenAPI_w_agf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_w_agf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_w_agf_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_w_agf_info_free(dst); + dst = OpenAPI_w_agf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/w_agf_info.h b/lib/sbi/openapi/model/w_agf_info.h index 6de436d01..581fdf4c8 100644 --- a/lib/sbi/openapi/model/w_agf_info.h +++ b/lib/sbi/openapi/model/w_agf_info.h @@ -32,6 +32,7 @@ OpenAPI_w_agf_info_t *OpenAPI_w_agf_info_create( void OpenAPI_w_agf_info_free(OpenAPI_w_agf_info_t *w_agf_info); OpenAPI_w_agf_info_t *OpenAPI_w_agf_info_parseFromJSON(cJSON *w_agf_infoJSON); cJSON *OpenAPI_w_agf_info_convertToJSON(OpenAPI_w_agf_info_t *w_agf_info); +OpenAPI_w_agf_info_t *OpenAPI_w_agf_info_copy(OpenAPI_w_agf_info_t *dst, OpenAPI_w_agf_info_t *src); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/src/apiKey.c b/lib/sbi/openapi/src/apiKey.c index d7e2a9bca..4e50a6e38 100644 --- a/lib/sbi/openapi/src/apiKey.c +++ b/lib/sbi/openapi/src/apiKey.c @@ -4,7 +4,7 @@ OpenAPI_map_t *OpenAPI_map_create(char *key, void *value) { - OpenAPI_map_t *OpenAPI_map = ogs_malloc(sizeof(OpenAPI_map_t)); + OpenAPI_map_t *OpenAPI_map = ogs_malloc(sizeof(OpenAPI_map_t)); OpenAPI_map->key = key; OpenAPI_map->value = value; return OpenAPI_map; diff --git a/lib/sbi/openapi/src/binary.c b/lib/sbi/openapi/src/binary.c new file mode 100644 index 000000000..6b996ed9d --- /dev/null +++ b/lib/sbi/openapi/src/binary.c @@ -0,0 +1,65 @@ +#include +#include +#include "../include/binary.h" +#ifdef OPENSSL +#include "openssl/pem.h" +#endif + +OpenAPI_binary_t *OpenAPI_instantiate_binary_t(char *data, int len) +{ + OpenAPI_binary_t* ret = malloc(sizeof(OpenAPI_binary_t)); + + ret->len=len; + ret->data = malloc(len); + memcpy(ret->data, data, len); + + return ret; +} + +char *OpenAPI_base64encode(const void *b64_encode_this, + int encode_this_many_bytes) +{ +#ifdef OPENSSL + BIO *b64_bio, *mem_bio; //Declares two OpenSSL BIOs: a base64 filter and a memory BIO. + BUF_MEM *mem_bio_mem_ptr; //Pointer to a "memory BIO" structure holding our base64 data. + b64_bio = BIO_new(BIO_f_base64()); //Initialize our base64 filter BIO. + mem_bio = BIO_new(BIO_s_mem()); //Initialize our memory sink BIO. + BIO_push(b64_bio, mem_bio); //Link the BIOs by creating a filter-sink BIO chain. + BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL); //No newlines every 64 characters or less. + BIO_write(b64_bio, b64_encode_this, encode_this_many_bytes); //Records base64 encoded data. + BIO_flush(b64_bio); //Flush data. Necessary for b64 encoding, because of pad characters. + BIO_get_mem_ptr(mem_bio, &mem_bio_mem_ptr); //Store address of mem_bio's memory structure. + BIO_set_close(mem_bio, BIO_NOCLOSE); //Permit access to mem_ptr after BIOs are destroyed. + BIO_free_all(b64_bio); //Destroys all BIOs in chain, starting with b64 (i.e. the 1st one). + BUF_MEM_grow(mem_bio_mem_ptr, (*mem_bio_mem_ptr).length + 1); //Makes space for end null. + (*mem_bio_mem_ptr).data[(*mem_bio_mem_ptr).length] = '\0'; //Adds null-terminator to tail. + return (*mem_bio_mem_ptr).data; //Returns base-64 encoded data. (See: "buf_mem_st" struct). +#else // OPENSSL +//#warning Data will not be encoded. If you want to use function "base64encode", please define "-DOPENSSL" when building the library. + return NULL; +#endif // OPENSSL +} + +char *OpenAPI_base64decode(const void *b64_decode_this, + int decode_this_many_bytes, int *decoded_bytes) +{ +#ifdef OPENSSL + BIO *b64_bio, *mem_bio; //Declares two OpenSSL BIOs: a base64 filter and a memory BIO. + char *base64_decoded = calloc( (decode_this_many_bytes*3)/4+1, sizeof(char) ); //+1 = null. + b64_bio = BIO_new(BIO_f_base64()); //Initialize our base64 filter BIO. + mem_bio = BIO_new(BIO_s_mem()); //Initialize our memory source BIO. + BIO_write(mem_bio, b64_decode_this, decode_this_many_bytes); //Base64 data saved in source. + BIO_push(b64_bio, mem_bio); //Link the BIOs by creating a filter-source BIO chain. + BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL); //Don't require trailing newlines. + int decoded_byte_index = 0; //Index where the next base64_decoded byte should be written. + while ( 0 < BIO_read(b64_bio, base64_decoded+decoded_byte_index, 1) ) { //Read byte-by-byte. + decoded_byte_index++; //Increment the index until read of BIO decoded data is complete. + } //Once we're done reading decoded data, BIO_read returns -1 even though there's no error. + BIO_free_all(b64_bio); //Destroys all BIOs in chain, starting with b64 (i.e. the 1st one). + *decoded_bytes = decoded_byte_index; + return base64_decoded; //Returns base-64 decoded data with trailing null terminator. +#else // OPENSSL +//#warning Data will not be decoded. If you want to use function "base64decode", please define "-DOPENSSL" when building the library. + return NULL; +#endif // OPENSSL +} diff --git a/lib/sbi/path.c b/lib/sbi/path.c index d7b65659d..14fba2820 100644 --- a/lib/sbi/path.c +++ b/lib/sbi/path.c @@ -19,6 +19,92 @@ #include "ogs-sbi.h" +static ogs_sbi_nf_instance_t *find_or_discover_nf_instance( + ogs_sbi_object_t *sbi_object, bool *nrf, bool *nf) +{ + ogs_assert(sbi_object); + ogs_assert(sbi_object->nf_type); + ogs_assert(sbi_object->nf_state_registered); + ogs_assert(sbi_object->client_wait.duration); + ogs_assert(nrf); + ogs_assert(nf); + + if (!OGS_SBI_NF_INSTANCE_GET(sbi_object->nf_types, OpenAPI_nf_type_NRF)) + *nrf = ogs_sbi_nf_types_associate(sbi_object->nf_types, + OpenAPI_nf_type_NRF, sbi_object->nf_state_registered); + if (!OGS_SBI_NF_INSTANCE_GET(sbi_object->nf_types, + sbi_object->nf_type)) + *nf = ogs_sbi_nf_types_associate(sbi_object->nf_types, + sbi_object->nf_type, sbi_object->nf_state_registered); + + if (*nrf == false && *nf == false) { + ogs_error("Cannot discover [%s]", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); + return NULL; + } + + if (*nf == false) { + ogs_warn("[%s] Try to discover", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); + ogs_timer_start(sbi_object->client_wait.timer, + sbi_object->client_wait.duration); + + ogs_nnrf_disc_send_nf_discover( + sbi_object->nf_types[OpenAPI_nf_type_NRF].nf_instance, + sbi_object->nf_type, sbi_object); + + return NULL; + } + + return sbi_object->nf_types[sbi_object->nf_type].nf_instance; +} + +void ogs_sbi_send( + ogs_sbi_object_t *sbi_object, ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + + ogs_assert(sbi_object); + request = sbi_object->request; + ogs_assert(request); + ogs_assert(sbi_object->client_wait.duration); + + ogs_assert(nf_instance); + + ogs_timer_start(sbi_object->client_wait.timer, + sbi_object->client_wait.duration); + + ogs_sbi_client_send_request_to_nf_instance( + nf_instance, sbi_object->request, sbi_object); +} + +bool ogs_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, ogs_sbi_object_t *sbi_object, void *data, + ogs_sbi_build_f build) +{ + bool nrf = true; + bool nf = true; + + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(sbi_object); + ogs_assert(nf_type); + ogs_assert(build); + + sbi_object->nf_type = nf_type; + if (sbi_object->request) + ogs_sbi_request_free(sbi_object->request); + sbi_object->request = (*build)(sbi_object, data); + + nf_instance = find_or_discover_nf_instance(sbi_object, &nrf, &nf); + if (nrf == false && nf == false) return false; + if (!nf_instance) return true; + + ogs_sbi_send(sbi_object, nf_instance); + + return true; +} + void ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) { ogs_sbi_request_t *request = NULL; @@ -31,6 +117,7 @@ void ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) request = ogs_nnrf_nfm_build_register(nf_instance); ogs_assert(request); ogs_sbi_client_send_request(client, request, nf_instance); + ogs_sbi_request_free(request); } void ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance) @@ -45,6 +132,7 @@ void ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance) request = ogs_nnrf_nfm_build_update(nf_instance); ogs_assert(request); ogs_sbi_client_send_request(client, request, nf_instance); + ogs_sbi_request_free(request); } void ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance) @@ -59,6 +147,7 @@ void ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance) request = ogs_nnrf_nfm_build_de_register(nf_instance); ogs_assert(request); ogs_sbi_client_send_request(client, request, nf_instance); + ogs_sbi_request_free(request); } void ogs_nnrf_nfm_send_nf_status_subscribe(ogs_sbi_client_t *client, @@ -80,6 +169,7 @@ void ogs_nnrf_nfm_send_nf_status_subscribe(ogs_sbi_client_t *client, request = ogs_nnrf_nfm_build_status_subscribe(subscription); ogs_assert(request); ogs_sbi_client_send_request(client, request, subscription); + ogs_sbi_request_free(request); } void ogs_nnrf_nfm_send_nf_status_unsubscribe( @@ -95,20 +185,23 @@ void ogs_nnrf_nfm_send_nf_status_unsubscribe( request = ogs_nnrf_nfm_build_status_unsubscribe(subscription); ogs_assert(request); ogs_sbi_client_send_request(client, request, subscription); + ogs_sbi_request_free(request); } void ogs_nnrf_disc_send_nf_discover(ogs_sbi_nf_instance_t *nf_instance, - OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type, - void *data) + OpenAPI_nf_type_e target_nf_type, void *data) { ogs_sbi_client_t *client = NULL; ogs_sbi_request_t *request = NULL; ogs_assert(nf_instance); + ogs_assert(nf_instance->nf_type); client = nf_instance->client; ogs_assert(client); - request = ogs_nnrf_disc_build_discover(target_nf_type, requester_nf_type); + request = ogs_nnrf_disc_build_discover( + target_nf_type, nf_instance->nf_type); ogs_assert(request); ogs_sbi_client_send_request(client, request, data); + ogs_sbi_request_free(request); } diff --git a/lib/sbi/path.h b/lib/sbi/path.h index c849116d0..0886f4b29 100644 --- a/lib/sbi/path.h +++ b/lib/sbi/path.h @@ -26,6 +26,15 @@ extern "C" { #endif +typedef ogs_sbi_request_t *(*ogs_sbi_build_f)( + ogs_sbi_object_t *sbi_object, void *data); + +void ogs_sbi_send( + ogs_sbi_object_t *sbi_object, ogs_sbi_nf_instance_t *nf_instance); +bool ogs_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, ogs_sbi_object_t *sbi_object, void *data, + ogs_sbi_build_f build); + void ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); void ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance); void ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance); @@ -36,8 +45,7 @@ void ogs_nnrf_nfm_send_nf_status_unsubscribe( ogs_sbi_subscription_t *subscription); void ogs_nnrf_disc_send_nf_discover(ogs_sbi_nf_instance_t *nf_instance, - OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type, - void *data); + OpenAPI_nf_type_e target_nf_type, void *data); #ifdef __cplusplus } diff --git a/lib/sbi/sbi-private.h b/lib/sbi/sbi-private.h index ec5aaf8a5..dfafa1466 100644 --- a/lib/sbi/sbi-private.h +++ b/lib/sbi/sbi-private.h @@ -20,37 +20,12 @@ #ifndef OGS_SBI_PRIVATE_H #define OGS_SBI_PRIVATE_H -#include "ogs-core.h" #include "yuarel.h" #ifdef __cplusplus extern "C" { #endif -typedef struct http_message_s { - ogs_hash_t *params; - ogs_hash_t *headers; - - char *content; - size_t content_length; -} http_message_t; - -typedef struct ogs_sbi_request_s { - ogs_sbi_header_t h; - http_message_t http; - - /* Used in microhttpd */ - bool suspended; - ogs_poll_t *poll; -} ogs_sbi_request_t; - -typedef struct ogs_sbi_response_s { - ogs_sbi_header_t h; - http_message_t http; - - int status; -} ogs_sbi_response_t; - #ifdef __cplusplus } #endif diff --git a/lib/sbi/server.c b/lib/sbi/server.c index ddb1d9027..a312d0e68 100644 --- a/lib/sbi/server.c +++ b/lib/sbi/server.c @@ -20,7 +20,6 @@ #include "ogs-app.h" #include "ogs-sbi.h" -#include "sbi-private.h" #include "microhttpd.h" typedef struct ogs_sbi_session_s { @@ -110,9 +109,9 @@ static ogs_sbi_session_t *session_add(ogs_sbi_server_t *server, ogs_sbi_self()->timer_mgr, session_timer_expired, session); ogs_assert(session->timer); - /* If User does not send http response within 5 second, + /* If User does not send http response within 3 second, * we will assert this program. */ - ogs_timer_start(session->timer, ogs_time_from_sec(5)); + ogs_timer_start(session->timer, ogs_time_from_sec(3)); ogs_list_add(&server->suspended_session_list, session); @@ -363,7 +362,7 @@ void ogs_sbi_server_send_response( if (response->http.content) { mhd_response = MHD_create_response_from_buffer( - strlen(response->http.content), response->http.content, + response->http.content_length, response->http.content, MHD_RESPMEM_PERSISTENT); ogs_assert(mhd_response); } else { @@ -542,7 +541,7 @@ static int access_handler( (MHD_KeyValueIterator)get_values, request->http.headers); request->h.method = ogs_strdup(method); - request->h.url = ogs_strdup(url); + request->h.uri = ogs_strdup(url); if (ogs_sbi_header_get(request->http.headers, "Content-Length") || ogs_sbi_header_get(request->http.headers, "Transfer-Encoding")) { diff --git a/lib/sbi/support/generator.sh b/lib/sbi/support/generator.sh index 8ec22748a..9b76c2e9d 100755 --- a/lib/sbi/support/generator.sh +++ b/lib/sbi/support/generator.sh @@ -11,3 +11,5 @@ $openapi_generator_cli generate -i ./modified/TS29509_Nausf_UEAuthentication.yam $openapi_generator_cli generate -i ./modified/TS29510_Nnrf_NFDiscovery.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi $openapi_generator_cli generate -i ./modified/TS29510_Nnrf_NFManagement.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi $openapi_generator_cli generate -i ./modified/TS29504_Nudr_DR.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi +$openapi_generator_cli generate -i ./modified/TS29502_Nsmf_PDUSession.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi +$openapi_generator_cli generate -i ./modified/TS29518_Namf_Communication.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi diff --git a/lib/sbi/support/modified/TS29502_Nsmf_PDUSession.yaml b/lib/sbi/support/modified/TS29502_Nsmf_PDUSession.yaml new file mode 100644 index 000000000..405245b90 --- /dev/null +++ b/lib/sbi/support/modified/TS29502_Nsmf_PDUSession.yaml @@ -0,0 +1,3720 @@ +openapi: 3.0.0 + +info: + version: '1.1.0.alpha-4' + title: 'Nsmf_PDUSession' + description: | + SMF PDU Session Service. + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +externalDocs: + description: 3GPP TS 29.502 V16.3.0; 5G System; Session Management Services; Stage 3 + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.502/ + +servers: + - url: '{apiRoot}/nsmf-pdusession/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501. The sm-contexts and pdu-sessions resources can be distributed on different processing instances or hosts. Thus the authority and/or deployment-specific string of the apiRoot of the created individual sm context and pdu-session resources' URIs may differ from the authority and/or deployment-specific string of the apiRoot of the sm-contexts and pdu-sessions collections' URIs. + +security: + - {} + - oAuth2ClientCredentials: + - nsmf-pdusession + +paths: + /sm-contexts: + post: + summary: Create SM Context + tags: + - SM contexts collection + operationId: PostSmContexts + requestBody: + description: representation of the SM context to be created in the SMF + required: true + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + binaryDataN2SmInformationExt1: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + callbacks: + smContextStatusNotification: + '{$request.body#/smContextStatusUri}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextStatusNotification' + responses: + '204': + description: successful notification + '307': + description: temporary redirect + headers: + Location: + required: true + description: 'A URI pointing to the endpoint of another NF service consumer to which the notification should be sent' + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + + responses: + '201': + description: successful creation of an SM context + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreatedData' + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nsmf-pdusession/{apiVersion}/sm-contexts/{smContextRef}' + required: true + schema: + type: string + + '307': + description: temporary redirect + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + required: true + schema: + type: string + '308': + description: permanent redirect + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + required: true + schema: + type: string + '400': + description: unsuccessful creation of an SM context - bad request + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '403': + description: unsuccessful creation of an SM context - forbidden + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '404': + description: unsuccessful creation of an SM context - not found + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + + '500': + description: unsuccessful creation of an SM context - internal server error + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '503': + description: unsuccessful creation of an SM context - service unavailable + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + '504': + description: unsuccessful creation of an SM context - gateway timeout + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + + /sm-contexts/{smContextRef}/retrieve: + post: + summary: Retrieve SM Context + tags: + - Individual SM context + operationId: RetrieveSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: parameters used to retrieve the SM context + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextRetrieveData' + responses: + '200': + description: successful retrieval of an SM context + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextRetrievedData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + '504': + $ref: 'TS29571_CommonData.yaml#/components/responses/504' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /sm-contexts/{smContextRef}/modify: + post: + summary: Update SM Context + tags: + - Individual SM context + operationId: UpdateSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: representation of the updates to apply to the SM context + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + binaryDataN2SmInformationExt1: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + responses: + '200': + description: successful update of an SM context with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdatedData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '204': + description: successful update of an SM context without content in the response + '400': + description: unsuccessful update of an SM context - bad request + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '403': + description: unsuccessful update of an SM context - forbidden + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '404': + description: unsuccessful update of an SM context - not found + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + description: unsuccessful update of an SM context - Internal server error + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '503': + description: unsuccessful update of an SM context - Service Unavailable + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /sm-contexts/{smContextRef}/release: + post: + summary: Release SM Context + tags: + - Individual SM context + operationId: ReleaseSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: representation of the data to be sent to the SMF when releasing the SM context + required: false + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextReleaseData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextReleaseData' + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + + responses: + '200': + description: successful release of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextReleasedData' + '204': + description: successful release of an SM context without content in the response + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /sm-contexts/{smContextRef}/send-mo-data: + post: + summary: Send MO Data + tags: + - Individual SM context + operationId: SendMoData + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: representation of the payload of Send MO Data Request + required: true + content: + multipart/related: # message with a binary body part + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/SendMoDataReqData' + binaryMoData: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryMoData: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: successful sending of MO data + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions: + post: + summary: Create + tags: + - PDU sessions collection + operationId: PostPduSessions + requestBody: + description: representation of the PDU session to be created in the H-SMF or SMF + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreateData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + callbacks: + statusNotification: + '{$request.body#/vsmfPduSessionUri}': + post: + summary: Notify Status + tags: + - Individual PDU session (V-SMF) + operationId: NotifyStatus + requestBody: + $ref: '#/components/requestBodies/NotifyStatusRequestBody' + responses: + '204': + description: successful notificationof the status change + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + statusNotification-ismf: + '{$request.body#/ismfPduSessionUri}': + post: + summary: Notify Status + tags: + - Individual PDU session (I-SMF) + operationId: NotifyStatus-isfm + requestBody: + $ref: '#/components/requestBodies/NotifyStatusRequestBody' + responses: + '204': + description: successful notificationof the status change + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + + update: + '{$request.body#/vsmfPduSessionUri}/modify': + post: + summary: Update (initiated by H-SMF) + tags: + - Individual PDU session (V-SMF) + operationId: ModifyPduSession + requestBody: + $ref: '#/components/requestBodies/VsmfUpdateRequestBody' + responses: + '200': + $ref: '#/components/responses/VsmfUpdateResponse200' + '204': + description: successful update of a PDU session without content in the response + '400': + $ref: '#/components/responses/VsmfUpdateError' + '403': + $ref: '#/components/responses/VsmfUpdateError' + '404': + $ref: '#/components/responses/VsmfUpdateError' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: '#/components/responses/VsmfUpdateError' + '503': + $ref: '#/components/responses/VsmfUpdateError' + '504': + $ref: '#/components/responses/VsmfUpdateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + update-ismf: + '{$request.body#/ismfPduSessionUri}/modify': + post: + summary: Update (initiated by SMF) + tags: + - Individual PDU session (I-SMF) + operationId: ModifyPduSession-ismf + requestBody: + $ref: '#/components/requestBodies/VsmfUpdateRequestBody' + responses: + '200': + $ref: '#/components/responses/VsmfUpdateResponse200' + '204': + description: successful update of a PDU session without content in the response + '400': + $ref: '#/components/responses/VsmfUpdateError' + '403': + $ref: '#/components/responses/VsmfUpdateError' + '404': + $ref: '#/components/responses/VsmfUpdateError' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: '#/components/responses/VsmfUpdateError' + '503': + $ref: '#/components/responses/VsmfUpdateError' + '504': + $ref: '#/components/responses/VsmfUpdateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + transferMtData: + '{$request.body#/vsmfPduSessionUri}/transfer-mt-data': + post: + summary: Transfer MT Data (by H-SMF) + tags: + - Individual PDU session (V-SMF) + operationId: TransferMtData + requestBody: + description: representation of the payload of Transfer MT Data Request + required: true + content: + multipart/related: # message with a binary body part + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/TransferMtDataReqData' + binaryMtData: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryMtData: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: successful transfering of MT data + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + '504': + description: unsuccessful delivery of mobile terminated data - gateway timeout + content: + application/json: + schema: + $ref: '#/components/schemas/TransferMtDataError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + transferMtData-ismf: + '{$request.body#/ismfPduSessionUri}/transfer-mt-data': + post: + summary: Transfer MT Data (by SMF) + tags: + - Individual PDU session (I-SMF) + operationId: TransferMtData-ismf + requestBody: + description: representation of the payload of Transfer MT Data Request + required: true + content: + multipart/related: # message with a binary body part + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/TransferMtDataReqData' + binaryMtData: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryMtData: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: successful transfering of MT data + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + '504': + description: unsuccessful delivery of mobile terminated data - gateway timeout + content: + application/json: + schema: + $ref: '#/components/schemas/TransferMtDataError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + responses: + '201': + description: successful creation of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreatedData' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nsmf-pdusession/{apiVersion}/pdu-sessions/{pduSessionRef}' + required: true + schema: + type: string + '307': + description: temporary redirect + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + required: true + schema: + type: string + '308': + description: permanent redirect + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + required: true + schema: + type: string + '400': + $ref: '#/components/responses/PduSessionCreateError' + '403': + $ref: '#/components/responses/PduSessionCreateError' + '404': + $ref: '#/components/responses/PduSessionCreateError' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: '#/components/responses/PduSessionCreateError' + '503': + $ref: '#/components/responses/PduSessionCreateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions/{pduSessionRef}/modify: + post: + summary: Update (initiated by V-SMF or I-SMF) + tags: + - Individual PDU session (H-SMF or SMF) + operationId: UpdatePduSession + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the updates to apply to the PDU session + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdateData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + responses: + '200': + description: successful update of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdatedData' + binaryDataN1SmInfoToUe: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + '204': + description: successful update of a PDU session without content in the response + '400': + $ref: '#/components/responses/HsmfUpdateError' + '403': + $ref: '#/components/responses/HsmfUpdateError' + '404': + $ref: '#/components/responses/HsmfUpdateError' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: '#/components/responses/HsmfUpdateError' + '503': + $ref: '#/components/responses/HsmfUpdateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions/{pduSessionRef}/release: + post: + summary: Release + tags: + - Individual PDU session (H-SMF or SMF) + operationId: ReleasePduSession + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the data to be sent to H-SMF or SMF when releasing the PDU session + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/ReleaseData' + responses: + '200': + description: successful release of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/ReleasedData' + '204': + description: successful release of a PDU session + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions/{pduSessionRef}/transfer-mo-data: + post: + summary: Transfer MO Data + tags: + - Individual PDU session (H-SMF or SMF) + operationId: TransferMoData + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the payload of Transfer MO Data Request + required: true + content: + multipart/related: # message with a binary body part + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/TransferMoDataReqData' + binaryMoData: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryMoData: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: successful transfering of MO data + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nsmf-pdusession: Access to the nsmf-pdusession API + + schemas: +# +# STRUCTURED DATA TYPES +# + SmContextCreateData: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + hplmnSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + serviceName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + requestType: + $ref: '#/components/schemas/RequestType' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + additionalAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + smContextStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + additionalHsmfUri: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + minItems: 1 + additionalSmfUri: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + minItems: 1 + oldPduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + pduSessionsActivateList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + minItems: 1 + ueEpsPdnConnection: + $ref: '#/components/schemas/EpsPdnCnxContainer' + hoState: + $ref: '#/components/schemas/HoState' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + pcfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + nrfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + backupAmfInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BackupAmfInfo' + minItems: 1 + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + indirectForwardingFlag: + type: boolean + targetId: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/NgRanTargetId' + epsBearerCtxStatus: + $ref: '#/components/schemas/EpsBearerContextStatus' + cpCiotEnabled: + type: boolean + default: false + cpOnlyInd: + type: boolean + default: false + invokeNef: + type: boolean + default: false + maRequestInd: + type: boolean + default: false + maNwUpgradeInd: + type: boolean + default: false + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + n2SmInfoExt1: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoTypeExt1: + $ref: '#/components/schemas/N2SmInfoType' + smContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + extendedNasSmTimerInd: + type: boolean + default: false + dlDataWaitingInd: + type: boolean + default: false + ddnFailureSubs: + $ref: '#/components/schemas/DdnFailureSubs' + smfTransferInd: + type: boolean + default: false + oldSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + oldSmContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + wAgfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/WAgfInfo' + tngfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/TngfInfo' + twifInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/TwifInfo' + required: + - servingNfId + - servingNetwork + - anType + - smContextStatusUri + + SmContextCreatedData: + type: object + properties: + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + allocatedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + hoState: + $ref: '#/components/schemas/HoState' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + smfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + + SmContextUpdateData: + type: object + properties: + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + backupAmfInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BackupAmfInfo' + minItems: 1 + nullable: true + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + additionalAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + hoState: + $ref: '#/components/schemas/HoState' + toBeSwitched: + type: boolean + default: false + failedToBeSwitched: + type: boolean + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + targetId: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/NgRanTargetId' + targetServingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smContextStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + dataForwarding: + type: boolean + default: false + n9ForwardingTunnel: + $ref: '#/components/schemas/TunnelInfo' + n9DlForwardingTnlList: + type: array + items: + $ref: '#/components/schemas/IndirectDataForwardingTunnelInfo' + minItems: 1 + n9UlForwardingTnlList: + type: array + items: + $ref: '#/components/schemas/IndirectDataForwardingTunnelInfo' + minItems: 1 + epsBearerSetup: + type: array + items: + $ref: '#/components/schemas/EpsBearerContainer' + minItems: 0 + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + release: + type: boolean + default: false + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + anTypeCanBeChanged: + type: boolean + default: false + n2SmInfoExt1: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoTypeExt1: + $ref: '#/components/schemas/N2SmInfoType' + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + maNwUpgradeInd: + type: boolean + default: false + maRequestInd: + type: boolean + default: false + exemptionInd: + $ref: '#/components/schemas/ExemptionInd' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + moExpDataInd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' + moExpDataCounter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' + extendedNasSmTimerInd: + type: boolean + forwardingFTeid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + forwardingBearerContexts: + type: array + items: + $ref: '#/components/schemas/ForwardingBearerContainer' + minItems: 1 + ddnFailureSubs: + $ref: '#/components/schemas/DdnFailureSubs' + + SmContextUpdatedData: + type: object + properties: + upCnxState: + $ref: '#/components/schemas/UpCnxState' + hoState: + $ref: '#/components/schemas/HoState' + releaseEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + allocatedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + modifiedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + epsBearerSetup: + type: array + items: + $ref: '#/components/schemas/EpsBearerContainer' + minItems: 1 + dataForwarding: + type: boolean + n3DlForwardingTnlList: + type: array + items: + $ref: '#/components/schemas/IndirectDataForwardingTunnelInfo' + minItems: 1 + n3UlForwardingTnlList: + type: array + items: + $ref: '#/components/schemas/IndirectDataForwardingTunnelInfo' + minItems: 1 + cause: + $ref: '#/components/schemas/Cause' + maAcceptedInd: + type: boolean + default: false + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + forwardingFTeid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + forwardingBearerContexts: + type: array + items: + $ref: '#/components/schemas/ForwardingBearerContainer' + minItems: 1 + + SmContextReleaseData: + type: object + properties: + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + vsmfReleaseOnly: + type: boolean + default: false + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + ismfReleaseOnly: + type: boolean + default: false + + SmContextReleasedData: + type: object + properties: + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + + SmContextStatusNotification: + type: object + properties: + statusInfo : + $ref: '#/components/schemas/StatusInfo' + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + ddnFailureStatus: + type: boolean + default: false + newSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + newSmfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + oldSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + oldSmContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + required: + - statusInfo + + PduSessionCreateData: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + vsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + ismfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + requestType: + $ref: '#/components/schemas/RequestType' + epsBearerId: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + pgwS8cFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + vsmfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + ismfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + vcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + icnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + n9ForwardingTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + additionalCnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + additionalAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + hPcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + pcfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + hoPreparationIndication: + type: boolean + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + alwaysOnRequested: + type: boolean + default: false + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + vSmfServiceInstanceId: + type: string + iSmfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + chargingId: + type: string + oldPduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + epsBearerCtxStatus: + $ref: '#/components/schemas/EpsBearerContextStatus' + amfNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + cpCiotEnabled: + type: boolean + default: false + cpOnlyInd: + type: boolean + default: false + invokeNef: + type: boolean + default: false + maRequestInd: + type: boolean + default: false + maNwUpgradeInd: + type: boolean + default: false + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + dlServingPlmnRateCtl: + type: integer + minimum: 10 + required: + - dnn + - servingNetwork + - anType + oneOf: + - required: [ vsmfId, vsmfPduSessionUri ] + - required: [ ismfId, ismfPduSessionUri ] + + PduSessionCreatedData: + type: object + properties: + pduSessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + sscMode: + type: string + pattern: '^[0-7]$' + hcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + cnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + additionalCnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsSetupList: + type: array + items: + $ref: '#/components/schemas/QosFlowSetupItem' + minItems: 1 + hSmfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + enablePauseCharging: + type: boolean + default: false + ueIpv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + epsPdnCnxInfo: + $ref: '#/components/schemas/EpsPdnCnxInfo' + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + maxIntegrityProtectedDataRate: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + alwaysOnGranted: + type: boolean + default: false + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + hSmfServiceInstanceId: + type: string + smfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + ipv6MultiHomingInd: + type: boolean + default: false + maAcceptedInd: + type: boolean + default: false + homeProvidedChargingId: + type: string + nefExtBufSupportInd: + type: boolean + default: false + required: + - pduSessionType + - sscMode + oneOf: + - required: [ hSmfInstanceId ] + - required: [ smfInstanceId ] + + HsmfUpdateData: + type: object + properties: + requestIndication: + $ref: '#/components/schemas/RequestIndication' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + vcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + icnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + additionalCnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + additionalAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + pauseCharging: + type: boolean + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + qosFlowsRelNotifyList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsNotifyList: + type: array + items: + $ref: '#/components/schemas/QosFlowNotifyItem' + minItems: 1 + NotifyList: + type: array + items: + $ref: '#/components/schemas/PduSessionNotifyItem' + minItems: 1 + epsBearerId: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 0 + hoPreparationIndication: + type: boolean + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + alwaysOnRequested: + type: boolean + default: false + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + anTypeCanBeChanged: + type: boolean + default: false + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + maNwUpgradeInd: + type: boolean + default: false + maRequestInd: + type: boolean + default: false + unavailableAccessInd: + $ref: '#/components/schemas/UnavailableAccessIndication' + psaInfo: + type: array + items: + $ref: '#/components/schemas/PsaInformation' + minItems: 1 + ulclBpInfo: + $ref: '#/components/schemas/UlclBpInformation' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + vsmfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + vsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + vSmfServiceInstanceId: + type: string + ismfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + ismfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + iSmfServiceInstanceId: + type: string + dlServingPlmnRateCtl: + type: integer + minimum: 10 + nullable: true + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + moExpDataInd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' + moExpDataCounter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' + vplmnQos: + $ref: '#/components/schemas/VplmnQos' + required: + - requestIndication + + HsmfUpdatedData: + type: object + properties: + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + ipv6MultiHomingInd: + type: boolean + default: false + + ReleaseData: + type: object + properties: + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + + ReleasedData: + type: object + properties: + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + + VsmfUpdateData: + type: object + properties: + requestIndication: + $ref: '#/components/schemas/RequestIndication' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsAddModRequestList: + type: array + items: + $ref: '#/components/schemas/QosFlowAddModifyRequestItem' + minItems: 1 + qosFlowsRelRequestList: + type: array + items: + $ref: '#/components/schemas/QosFlowReleaseRequestItem' + minItems: 1 + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + assignEbiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + modifiedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + alwaysOnGranted: + type: boolean + default: false + hsmfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + cause: + $ref: '#/components/schemas/Cause' + n1smCause: + type: string + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + maAcceptedInd: + type: boolean + default: false + additionalCnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + required: + - requestIndication + + VsmfUpdatedData: + type: object + properties: + qosFlowsAddModList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsRelList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsFailedtoAddModList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsFailedtoRelList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + assignedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + failedToAssignEbiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + releasedEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + + StatusNotification: + type: object + properties: + statusInfo : + $ref: '#/components/schemas/StatusInfo' + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + required: + - statusInfo + + QosFlowItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + cause: + $ref: '#/components/schemas/Cause' + required: + - qfi + + QosFlowSetupItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + ebi: + $ref: '#/components/schemas/EpsBearerId' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowProfile: + $ref: '#/components/schemas/QosFlowProfile' + associatedAnType: + $ref: '#/components/schemas/QosFlowAccessType' + required: + - qfi + - qosRules + + QosFlowAddModifyRequestItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + ebi: + $ref: '#/components/schemas/EpsBearerId' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowProfile: + $ref: '#/components/schemas/QosFlowProfile' + associatedAnType: + $ref: '#/components/schemas/QosFlowAccessType' + required: + - qfi + + QosFlowReleaseRequestItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + required: + - qfi + + QosFlowProfile: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + nonDynamic5Qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NonDynamic5Qi' + dynamic5Qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dynamic5Qi' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + gbrQosFlowInfo: + $ref: '#/components/schemas/GbrQosFlowInformation' + rqa: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ReflectiveQoSAttribute' + additionalQosFlowInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AdditionalQosFlowInfo' + required: + - 5qi + + GbrQosFlowInformation: + type: object + properties: + maxFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + notifControl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NotificationControl' + maxPacketLossRateDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' + maxPacketLossRateUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' + required: + - maxFbrDl + - maxFbrUl + - guaFbrDl + - guaFbrUl + + QosFlowNotifyItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + notificationCause: + $ref: '#/components/schemas/NotificationCause' + required: + - qfi + - notificationCause + + + SmContextRetrieveData: + type: object + properties: + targetMmeCap: + $ref: '#/components/schemas/MmeCapabilities' + smContextType: + $ref: '#/components/schemas/SmContextType' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + notToTransferEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + + SmContextRetrievedData: + type: object + properties: + ueEpsPdnConnection: + $ref: '#/components/schemas/EpsPdnCnxContainer' + smContext: + $ref: '#/components/schemas/SmContext' + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + dlDataWaitingInd: + type: boolean + default: false + required: + - ueEpsPdnConnection + + MmeCapabilities: + type: object + properties: + nonIpSupported: + type: boolean + default: false + ethernetSupported: + type: boolean + default: false + + TunnelInfo: + type: object + properties: + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + gtpTeid: + $ref: '#/components/schemas/Teid' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + required: + - gtpTeid + + StatusInfo: + type: object + properties: + resourceStatus: + $ref: '#/components/schemas/ResourceStatus' + cause: + $ref: '#/components/schemas/Cause' + cnAssistedRanPara: + $ref: '#/components/schemas/CnAssistedRanPara' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + required: + - resourceStatus + + + EpsPdnCnxInfo: + type: object + properties: + pgwS8cFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + pgwNodeName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + linkedBearerId: + $ref: '#/components/schemas/EpsBearerId' + required: + - pgwS8cFteid + + EpsBearerInfo: + type: object + properties: + ebi: + $ref: '#/components/schemas/EpsBearerId' + pgwS8uFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + bearerLevelQoS: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + required: + - ebi + - pgwS8uFteid + - bearerLevelQoS + + PduSessionNotifyItem: + type: object + properties: + notificationCause: + $ref: '#/components/schemas/NotificationCause' + required: + - notificationCause + + EbiArpMapping: + type: object + properties: + epsBearerId: + $ref: '#/components/schemas/EpsBearerId' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + required: + - epsBearerId + - arp + + SmContextCreateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + SmContextUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + PduSessionCreateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + HsmfUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + VsmfUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + failedToAssignEbiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + required: + - error + + SmContext: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + hplmnSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + pduSessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + pduSessionRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + pcfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsList: + type: array + items: + $ref: '#/components/schemas/QosFlowSetupItem' + minItems: 1 + hSmfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + enablePauseCharging: + type: boolean + default: false + ueIpv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + epsPdnCnxInfo: + $ref: '#/components/schemas/EpsPdnCnxInfo' + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + maxIntegrityProtectedDataRate: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + alwaysOnGranted: + type: boolean + default: false + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + hSmfServiceInstanceId: + type: string + smfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + forwardingInd: + type: boolean + default: false + psaTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + homeProvidedChargingId: + type: string + chargingInfo: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/ChargingInformation' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + nefExtBufSupportInd: + type: boolean + default: false + required: + - pduSessionId + - dnn + - sNssai + - pduSessionType + - sessionAmbr + - qosFlowsList + + ExemptionInd: + type: object + properties: + dnnCongestion: + type: boolean + default: false + snssaiOnlyCongestion: + type: boolean + default: false + snssaiDnnCongestion: + type: boolean + default: false + + PsaInformation: + type: object + properties: + psaInd: + $ref: '#/components/schemas/PsaIndication' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + ueIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + psaUpfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + + DnaiInformation: + type: object + properties: + dnai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + noDnaiChangeInd: + type: boolean + noLocalPsaChangeInd: + type: boolean + required: + - dnai + + N4Information: + type: object + properties: + n4MessageType: + $ref: '#/components/schemas/N4MessageType' + n4MessagePayload: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n4DnaiInfo: + $ref: '#/components/schemas/DnaiInformation' + required: + - n4MessageType + - n4MessagePayload + + IndirectDataForwardingTunnelInfo: + type: object + properties: + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + gtpTeid: + $ref: '#/components/schemas/Teid' + drbId: + $ref: '#/components/schemas/DrbId' + additionalTnlNb: + $ref: '#/components/schemas/AdditionalTnlNb' + required: + - gtpTeid + not: + required: [ drbId, additionalTnlNb ] + + SendMoDataReqData: + type: object + properties: + moData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + moExpDataInd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' + moExpDataCounter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + required: + - moData + + CnAssistedRanPara: + type: object + properties: + stationaryIndication: + $ref: 'TS29571_CommonData.yaml#/components/schemas/StationaryIndication' + communicationDurationTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + periodicTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + scheduledCommunicationTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ScheduledCommunicationTime' + scheduledCommunicationType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ScheduledCommunicationType' + trafficProfile: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TrafficProfile' + batteryIndication: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BatteryIndication' + + UlclBpInformation: + type: object + properties: + ulclBpUpfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + + TransferMoDataReqData: + type: object + properties: + moData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + moExpDataInd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' + moExpDataCounter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + required: + - moData + + TransferMtDataReqData: + type: object + properties: + mtData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + required: + - mtData + + TransferMtDataError: + allOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + - $ref: '#/components/schemas/TransferMtDataAddInfo' + + TransferMtDataAddInfo: + type: object + properties: + maxWaitingTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + + VplmnQos: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + maxFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + + DdnFailureSubs: + type: object + properties: + ddnFailureSubsInd: + type: boolean + default: false + dddTrafficDescriptorList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DddTrafficDescriptor' + minItems: 1 + +# +# SIMPLE DATA TYPES +# + ProcedureTransactionId: + type: integer + minimum: 0 + maximum: 255 + + EpsBearerId: + type: integer + minimum: 0 + maximum: 15 + + EpsPdnCnxContainer: + type: string + + EpsBearerContainer: + type: string + + Teid: + type: string + pattern: '^[A-F0-9]{8}$' + + EpsBearerContextStatus: + type: string + pattern: '^[A-Fa-f0-9]{4}$' + + DrbId: + type: integer + minimum: 1 + maximum: 32 + + AdditionalTnlNb: + type: integer + minimum: 1 + maximum: 3 + + ForwardingBearerContainer: + type: string + +# +# ENUMERATIONS +# + UpCnxState: + anyOf: + - type: string + enum: + - ACTIVATED + - DEACTIVATED + - ACTIVATING + - SUSPENDED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - ACTIVATED + - DEACTIVATED + - ACTIVATING + - SUSPENDED + + HoState: + anyOf: + - type: string + enum: + - NONE + - PREPARING + - PREPARED + - COMPLETED + - CANCELLED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - NONE + - PREPARING + - PREPARED + - COMPLETED + - CANCELLED + + RequestType: + anyOf: + - type: string + enum: + - INITIAL_REQUEST + - EXISTING_PDU_SESSION + - INITIAL_EMERGENCY_REQUEST + - EXISTING_EMERGENCY_PDU_SESSION + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - INITIAL_REQUEST + - EXISTING_PDU_SESSION + - INITIAL_EMERGENCY_REQUEST + - EXISTING_EMERGENCY_PDU_SESSION + + RequestIndication: + anyOf: + - type: string + enum: + - UE_REQ_PDU_SES_MOD + - UE_REQ_PDU_SES_REL + - PDU_SES_MOB + - NW_REQ_PDU_SES_AUTH + - NW_REQ_PDU_SES_MOD + - NW_REQ_PDU_SES_REL + - EBI_ASSIGNMENT_REQ + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - UE_REQ_PDU_SES_MOD + - UE_REQ_PDU_SES_REL + - PDU_SES_MOB + - NW_REQ_PDU_SES_AUTH + - NW_REQ_PDU_SES_MOD + - NW_REQ_PDU_SES_REL + - EBI_ASSIGNMENT_REQ + + NotificationCause: + anyOf: + - type: string + enum: + - QOS_FULFILLED + - QOS_NOT_FULFILLED + - UP_SEC_FULFILLED + - UP_SEC_NOT_FULFILLED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - QOS_FULFILLED + - QOS_NOT_FULFILLED + - UP_SEC_FULFILLED + - UP_SEC_NOT_FULFILLED + + Cause: + anyOf: + - type: string + enum: + - REL_DUE_TO_HO + - EPS_FALLBACK + - REL_DUE_TO_UP_SEC + - DNN_CONGESTION + - S_NSSAI_CONGESTION + - REL_DUE_TO_REACTIVATION + - 5G_AN_NOT_RESPONDING + - REL_DUE_TO_SLICE_NOT_AVAILABLE + - REL_DUE_TO_DUPLICATE_SESSION_ID + - PDU_SESSION_STATUS_MISMATCH + - HO_FAILURE + - INSUFFICIENT_UP_RESOURCES + - PDU_SESSION_HANDED_OVER + - PDU_SESSION_RESUMED + - CN_ASSISTED_RAN_PARAMETER_TUNING + - ISMF_CONTEXT_TRANSFER + - SMF_CONTEXT_TRANSFER + - REL_DUE_TO_PS_TO_CS_HO + - REL_DUE_TO_SUBSCRIPTION_CHANGE + - HO_CANCEL + - REL_DUE_TO_SLICE_NOT_AUTHORIZED + - PDU_SESSION_HAND_OVER_FAILURE + - DDN_FAILURE_STATUS + + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - REL_DUE_TO_HO + - EPS_FALLBACK + - REL_DUE_TO_UP_SEC + - DNN_CONGESTION + - S_NSSAI_CONGESTION + - REL_DUE_TO_REACTIVATION + - 5G_AN_NOT_RESPONDING + - REL_DUE_TO_SLICE_NOT_AVAILABLE + - REL_DUE_TO_DUPLICATE_SESSION_ID + - PDU_SESSION_STATUS_MISMATCH + - HO_FAILURE + - INSUFFICIENT_UP_RESOURCES + - PDU_SESSION_HANDED_OVER + - PDU_SESSION_RESUMED + - CN_ASSISTED_RAN_PARAMETER_TUNING + - ISMF_CONTEXT_TRANSFER + - SMF_CONTEXT_TRANSFER + - REL_DUE_TO_PS_TO_CS_HO + - REL_DUE_TO_SUBSCRIPTION_CHANGE + - HO_CANCEL + - REL_DUE_TO_SLICE_NOT_AUTHORIZED + - PDU_SESSION_HAND_OVER_FAILURE + - DDN_FAILURE_STATUS + + ResourceStatus: + anyOf: + - type: string + enum: + - RELEASED + - UNCHANGED + - TRANSFERRED + - UPDATED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - RELEASED + - UNCHANGED + - UPDATED + + DnnSelectionMode: + anyOf: + - type: string + enum: + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + + EpsInterworkingIndication: + anyOf: + - type: string + enum: + - NONE + - WITH_N26 + - WITHOUT_N26 + - IWK_NON_3GPP + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - NONE + - WITH_N26 + - WITHOUT_N26 + - IWK_NON_3GPP + + N2SmInfoType: +# anyOf: +# - type: string + enum: + - PDU_RES_SETUP_REQ + - PDU_RES_SETUP_RSP + - PDU_RES_SETUP_FAIL + - PDU_RES_REL_CMD + - PDU_RES_REL_RSP + - PDU_RES_MOD_REQ + - PDU_RES_MOD_RSP + - PDU_RES_MOD_FAIL + - PDU_RES_NTY + - PDU_RES_NTY_REL + - PDU_RES_MOD_IND + - PDU_RES_MOD_CFM + - PATH_SWITCH_REQ + - PATH_SWITCH_SETUP_FAIL + - PATH_SWITCH_REQ_ACK + - PATH_SWITCH_REQ_FAIL + - HANDOVER_REQUIRED + - HANDOVER_CMD + - HANDOVER_PREP_FAIL + - HANDOVER_REQ_ACK + - HANDOVER_RES_ALLOC_FAIL + - SECONDARY_RAT_USAGE + type: string +# description: > +# This string provides forward-compatibility with future +# extensions to the enumeration but is not used to encode +# content defined in the present version of this API. +# description: > +# Possible values are +# - PDU_RES_SETUP_REQ +# - PDU_RES_SETUP_RSP +# - PDU_RES_SETUP_FAIL +# - PDU_RES_REL_CMD +# - PDU_RES_REL_RSP +# - PDU_RES_MOD_REQ +# - PDU_RES_MOD_RSP +# - PDU_RES_MOD_FAIL +# - PDU_RES_NTY +# - PDU_RES_NTY_REL +# - PDU_RES_MOD_IND +# - PDU_RES_MOD_CFM +# - PATH_SWITCH_REQ +# - PATH_SWITCH_SETUP_FAIL +# - PATH_SWITCH_REQ_ACK +# - PATH_SWITCH_REQ_FAIL +# - HANDOVER_REQUIRED +# - HANDOVER_CMD +# - HANDOVER_PREP_FAIL +# - HANDOVER_REQ_ACK +# - HANDOVER_RES_ALLOC_FAIL +# - SECONDARY_RAT_USAGE + + MaxIntegrityProtectedDataRate: + anyOf: + - type: string + enum: + - 64_KBPS + - MAX_UE_RATE + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - 64_KBPS + - MAX_UE_RATE + + MaReleaseIndication: + anyOf: + - type: string + enum: + - REL_MAPDU_OVER_3GPP + - REL_MAPDU_OVER_N3GPP + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - REL_MAPDU_OVER_3GPP + - REL_MAPDU_OVER_N3GPP + + SmContextType: + anyOf: + - type: string + enum: + - EPS_PDN_CONNECTION + - SM_CONTEXT + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - EPS_PDN_CONNECTION + - SM_CONTEXT + + PsaIndication: + anyOf: + - type: string + enum: + - PSA_INSERTED + - PSA_REMOVED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - PSA_INSERTED + - PSA_REMOVED + + N4MessageType: + anyOf: + - type: string + enum: + - PFCP_SES_EST_REQ + - PFCP_SES_EST_RSP + - PFCP_SES_MOD_REQ + - PFCP_SES_MOD_RSP + - PFCP_SES_DEL_REQ + - PFCP_SES_DEL_RSP + - PFCP_SES_REP_REQ + - PFCP_SES_REP_RSP + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - PFCP_SES_EST_REQ + - PFCP_SES_EST_RSP + - PFCP_SES_MOD_REQ + - PFCP_SES_MOD_RSP + - PFCP_SES_DEL_REQ + - PFCP_SES_DEL_RSP + - PFCP_SES_REP_REQ + - PFCP_SES_REP_RSP + + QosFlowAccessType: + anyOf: + - type: string + enum: + - 3GPP + - NON_3GPP + - 3GPP_AND_NON_3GPP + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - 3GPP + - NON_3GPP + - 3GPP_AND_NON_3GPP + + UnavailableAccessIndication: + anyOf: + - type: string + enum: + - 3GA_UNAVAILABLE + - N3GA_UNAVAILABLE + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - 3GA_UNAVAILABLE + - N3GA_UNAVAILABLE + +# +# HTTP request bodies +# + requestBodies: + 'VsmfUpdateRequestBody': + description: representation of updates to apply to the PDU session + required: true + content: + application/+json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdateData' + binaryDataN1SmInfoToUe: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + + 'NotifyStatusRequestBody': + description: representation of the status notification + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/StatusNotification' + +# +# HTTP responses +# + responses: + 'VsmfUpdateResponse200': + description: successful update of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdatedData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + + 'PduSessionCreateError': + description: unsuccessful creation of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreateError' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + 'HsmfUpdateError': + description: unsuccessful update of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdateError' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + 'VsmfUpdateError': + description: unsuccessful update of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdateError' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string diff --git a/lib/sbi/support/modified/TS29518_Namf_Communication.yaml b/lib/sbi/support/modified/TS29518_Namf_Communication.yaml index e68bc8e81..ba72fe27e 100644 --- a/lib/sbi/support/modified/TS29518_Namf_Communication.yaml +++ b/lib/sbi/support/modified/TS29518_Namf_Communication.yaml @@ -949,7 +949,7 @@ paths: summary: Namf_Communication N2 Info Notify (UE Specific) service Operation tags: - N2 Info Notify - operationId: N2InfoNotify +# operationId: N2InfoNotify requestBody: description: UE Specific N2 Information Notification content: @@ -1237,7 +1237,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SubscriptionData' + $ref: '#/components/schemas/AMFStatusChangeSubscriptionData' required: true responses: '201': @@ -1251,7 +1251,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SubscriptionData' + $ref: '#/components/schemas/AMFStatusChangeSubscriptionData' '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -1347,7 +1347,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SubscriptionData' + $ref: '#/components/schemas/AMFStatusChangeSubscriptionData' required: true responses: '202': @@ -1355,7 +1355,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SubscriptionData' + $ref: '#/components/schemas/AMFStatusChangeSubscriptionData' '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -1420,7 +1420,7 @@ components: # # STRUCTURED DATA TYPES # - SubscriptionData: + AMFStatusChangeSubscriptionData: type: object properties: amfStatusUri: @@ -2460,15 +2460,15 @@ components: # ENUMERATIONS # StatusChange: - anyOf: - - type: string +# anyOf: +# - type: string enum: - AMF_UNAVAILABLE - AMF_AVAILABLE - - type: string + type: string N2InformationClass: - anyOf: - - type: string +# anyOf: +# - type: string enum: - SM - NRPPa @@ -2476,7 +2476,7 @@ components: - PWS-BCAL - PWS-RF - RAN - - type: string + type: string N1MessageClass: # anyOf: # - type: string @@ -2489,8 +2489,8 @@ components: - LCS type: string N1N2MessageTransferCause: - anyOf: - - type: string +# anyOf: +# - type: string enum: - ATTEMPTING_TO_REACH_UE - N1_N2_TRANSFER_INITIATED @@ -2500,89 +2500,89 @@ components: - UE_NOT_REACHABLE_FOR_SESSION - TEMPORARY_REJECT_REGISTRATION_ONGOING - TEMPORARY_REJECT_HANDOVER_ONGOING - - type: string + type: string UeContextTransferStatus: - anyOf: - - type: string +# anyOf: +# - type: string enum: - TRANSFERRED - NOT_TRANSFERRED - - type: string + type: string N2InformationTransferResult: - anyOf: - - type: string +# anyOf: +# - type: string enum: - N2_INFO_TRANSFER_INITIATED - - type: string + type: string CipheringAlgorithm: - anyOf: - - type: string +# anyOf: +# - type: string enum: - NEA0 - NEA1 - NEA2 - NEA3 - - type: string + type: string IntegrityAlgorithm: - anyOf: - - type: string +# anyOf: +# - type: string enum: - NIA0 - NIA1 - NIA2 - NIA3 - - type: string + type: string SmsSupport: - anyOf: - - type: string +# anyOf: +# - type: string enum: - 3GPP - NON_3GPP - BOTH - NONE - - type: string + type: string ScType: - anyOf: - - type: string +# anyOf: +# - type: string enum: - NATIVE - MAPPED - - type: string + type: string KeyAmfType: - anyOf: - - type: string +# anyOf: +# - type: string enum: - KAMF - KPRIMEAMF - - type: string + type: string TransferReason: - anyOf: - - type: string +# anyOf: +# - type: string enum: - INIT_REG - MOBI_REG - MOBI_REG_UE_VALIDATED - - type: string + type: string PolicyReqTrigger: - anyOf: - - type: string +# anyOf: +# - type: string enum: - LOCATION_CHANGE - PRA_CHANGE - SARI_CHANGE - RFSP_INDEX_CHANGE - ALLOWED_NSSAI_CHANGE - - type: string + type: string RatSelector: - anyOf: - - type: string +# anyOf: +# - type: string enum: - E-UTRA - NR - - type: string + type: string NgapIeType: - anyOf: - - type: string +# anyOf: +# - type: string enum: - PDU_RES_SETUP_REQ - PDU_RES_REL_CMD @@ -2598,25 +2598,25 @@ components: - UE_RADIO_CAPABILITY - RIM_INFO_TRANSFER - SECONDARY_RAT_USAGE - - type: string + type: string N2InfoNotifyReason: - anyOf: - - type: string +# anyOf: +# - type: string enum: - HANDOVER_COMPLETED - - type: string + type: string SmfChangeIndication: - anyOf: - - type: string +# anyOf: +# - type: string enum: - CHANGED - REMOVED - - type: string + type: string SbiBindingLevel: - anyOf: - - type: string +# anyOf: +# - type: string enum: - NF_INSTANCE_BINDING - NF_SET_BINDING - NF_SERVICE_SET_BINDING - - type: string + type: string diff --git a/lib/sbi/support/modified/TS29531_Nnssf_NSSelection.yaml b/lib/sbi/support/modified/TS29531_Nnssf_NSSelection.yaml new file mode 100644 index 000000000..54d34c0e5 --- /dev/null +++ b/lib/sbi/support/modified/TS29531_Nnssf_NSSelection.yaml @@ -0,0 +1,322 @@ +openapi: 3.0.0 + +info: + version: '2.1.0.alpha-2' + title: 'NSSF NS Selection' + description: | + NSSF Network Slice Selection Service. + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +security: + - {} + - oAuth2ClientCredentials: + - nnssf-nsselection +servers: + - url: '{apiRoot}/nnssf-nsselection/v2' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +externalDocs: + description: 3GPP TS 29.531 V16.2.0; 5G System; Network Slice Selection Services; Stage 3 + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.531/ +paths: + /network-slice-information: + get: + summary: Retrieve the Network Slice Selection Information + tags: + - Network Slice Information (Document) + operationId: NSSelectionGet + parameters: + - name: nf-type + in: query + description: NF type of the NF service consumer + required: true + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + - name: nf-id + in: query + description: NF Instance ID of the NF service consumer + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: slice-info-request-for-registration + in: query + description: Requested network slice information during Registration procedure + content: + application/json: + schema: + $ref: '#/components/schemas/SliceInfoForRegistration' + - name: slice-info-request-for-pdu-session + in: query + description: Requested network slice information during PDU session establishment procedure + content: + application/json: + schema: + $ref: '#/components/schemas/SliceInfoForPDUSession' + - name: slice-info-request-for-ue-cu + in: query + description: Requested network slice information during UE confuguration update procedure + content: + application/json: + schema: + $ref: '#/components/schemas/SliceInfoForUEConfigurationUpdate' + - name: home-plmn-id + in: query + description: PLMN ID of the HPLMN + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + - name: tai + in: query + description: TAI of the UE + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + - name: supported-features + in: query + description: Features required to be supported by the NFs in the target slice instance + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + + responses: + '200': + description: OK (Successful Network Slice Selection) + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizedNetworkSliceInfo' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnssf-nsselection: Access to the Nnssf_NSSelection API + schemas: + AuthorizedNetworkSliceInfo: + type: object + properties: + allowedNssaiList: + type: array + items: + $ref: '#/components/schemas/AllowedNssai' + minItems: 1 + configuredNssai: + type: array + items: + $ref: '#/components/schemas/ConfiguredSnssai' + minItems: 1 + targetAmfSet: + type: string + pattern: '^[0-9]{3}-[0-9]{2-3}-[A-Fa-f0-9]{2}-[0-3][A-Fa-f0-9]{2}$' + candidateAmfList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + rejectedNssaiInPlmn: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + rejectedNssaiInTa: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + nsiInformation: + $ref: '#/components/schemas/NsiInformation' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + nrfAmfSet: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nrfAmfSetNfMgtUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nrfAmfSetAccessTokenUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + targetAmfServiceSet: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' + + SubscribedSnssai: + type: object + required: + - subscribedSnssai + properties: + subscribedSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + defaultIndication: + type: boolean + + + AllowedSnssai: + type: object + required: + - allowedSnssai + properties: + allowedSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + nsiInformationList: + type: array + items: + $ref: '#/components/schemas/NsiInformation' + minItems: 1 + mappedHomeSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + + AllowedNssai: + type: object + required: + - allowedSnssaiList + - accessType + properties: + allowedSnssaiList: + type: array + items: + $ref: '#/components/schemas/AllowedSnssai' + minItems: 1 + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + + NsiInformation: + type: object + required: + - nrfId + properties: + nrfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nsiId: + $ref: '#/components/schemas/NsiId' + nrfNfMgtUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nrfAccessTokenUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + + MappingOfSnssai: + type: object + required: + - servingSnssai + - homeSnssai + properties: + servingSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + homeSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + + + SliceInfoForRegistration: + type: object + properties: + subscribedNssai: + type: array + items: + $ref: '#/components/schemas/SubscribedSnssai' + minItems: 1 + allowedNssaiCurrentAccess: + $ref: '#/components/schemas/AllowedNssai' + allowedNssaiOtherAccess: + $ref: '#/components/schemas/AllowedNssai' + sNssaiForMapping: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + requestedNssai: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + defaultConfiguredSnssaiInd: + type: boolean + mappingOfNssai: + type: array + items: + $ref: '#/components/schemas/MappingOfSnssai' + minItems: 1 + requestMapping: + type: boolean + + SliceInfoForPDUSession: + type: object + required: + - sNssai + - roamingIndication + properties: + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + roamingIndication: + $ref: '#/components/schemas/RoamingIndication' + homeSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + + SliceInfoForUEConfigurationUpdate: + type: object + properties: + subscribedNssai: + type: array + items: + $ref: '#/components/schemas/SubscribedSnssai' + minItems: 1 + allowedNssaiCurrentAccess: + $ref: '#/components/schemas/AllowedNssai' + allowedNssaiOtherAccess: + $ref: '#/components/schemas/AllowedNssai' + defaultConfiguredSnssaiInd: + type: boolean + requestedNssai: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + mappingOfNssai: + type: array + items: + $ref: '#/components/schemas/MappingOfSnssai' + minItems: 1 + + ConfiguredSnssai: + type: object + required: + - configuredSnssai + properties: + configuredSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + mappedHomeSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + + + RoamingIndication: + anyOf: + - type: string + enum: + - NON_ROAMING + - LOCAL_BREAKOUT + - HOME_ROUTED_ROAMING + - type: string + NsiId: + type: string diff --git a/lib/sbi/support/modified/TS29571_CommonData.yaml b/lib/sbi/support/modified/TS29571_CommonData.yaml index e6cea161c..d8e7671de 100644 --- a/lib/sbi/support/modified/TS29571_CommonData.yaml +++ b/lib/sbi/support/modified/TS29571_CommonData.yaml @@ -711,8 +711,8 @@ components: - $ref: '#/components/schemas/AccessType' - $ref: '#/components/schemas/NullValue' RatType: - anyOf: - - type: string +# anyOf: +# - type: string enum: - NR - EUTRA @@ -730,21 +730,21 @@ components: - TRUSTED_WLAN - UTRA - GERA - - type: string + type: string RatTypeRm: allOf: - $ref: '#/components/schemas/RatType' nullable: true PduSessionType: - anyOf: - - type: string +# anyOf: +# - type: string enum: - IPV4 - IPV6 - IPV4V6 - UNSTRUCTURED - ETHERNET - - type: string + type: string PduSessionTypeRm: anyOf: - $ref: '#/components/schemas/PduSessionType' @@ -774,13 +774,13 @@ components: - $ref: '#/components/schemas/UpConfidentiality' - $ref: '#/components/schemas/NullValue' SscMode: - anyOf: - - type: string +# anyOf: +# - type: string enum: - SSC_MODE_1 - SSC_MODE_2 - SSC_MODE_3 - - type: string + type: string SscModeRm: anyOf: - $ref: '#/components/schemas/SscMode' @@ -1928,23 +1928,23 @@ components: # PreemptionCapability: - anyOf: - - type: string +# anyOf: +# - type: string enum: - NOT_PREEMPT - MAY_PREEMPT - - type: string + type: string PreemptionCapabilityRm: anyOf: - $ref: '#/components/schemas/PreemptionCapability' - $ref: '#/components/schemas/NullValue' PreemptionVulnerability: - anyOf: - - type: string +# anyOf: +# - type: string enum: - NOT_PREEMPTABLE - PREEMPTABLE - - type: string + type: string PreemptionVulnerabilityRm: anyOf: - $ref: '#/components/schemas/PreemptionVulnerability' diff --git a/lib/sbi/support/modified/TS32291_Nchf_ConvergedCharging.yaml b/lib/sbi/support/modified/TS32291_Nchf_ConvergedCharging.yaml new file mode 100644 index 000000000..fdb7fe06e --- /dev/null +++ b/lib/sbi/support/modified/TS32291_Nchf_ConvergedCharging.yaml @@ -0,0 +1,1261 @@ +openapi: 3.0.0 +info: + title: Nchf_ConvergedCharging + version: 3.0.0.alpha-2 + description: | + ConvergedCharging Service © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: > + 3GPP TS 32.291 V16.2.0: Telecommunication management; Charging management; + 5G system, charging service; Stage 3. + url: 'http://www.3gpp.org/ftp/Specs/archive/32_series/32.291/' +servers: + - url: '{apiRoot}/nchf-convergedcharging/v2' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +paths: + /chargingdata: + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + myNotification: + '{$request.body#/notifyUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingNotifyRequest' + responses: + '204': + description: 'No Content, Notification was succesfull' + '400': + description: Bad request + content: + application/json: + schema: + $ref: >- + TS29571_CommonData.yaml#/components/schemas/ProblemDetails + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + '/chargingdata/{ChargingDataRef}/update': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + parameters: + - name: ChargingDataRef + in: path + description: a unique identifier for a charging data resource in a PLMN + required: true + schema: + type: string + responses: + '200': + description: OK. Updated Charging Data resource is returned + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + '/chargingdata/{ChargingDataRef}/release': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + parameters: + - name: ChargingDataRef + in: path + description: a unique identifier for a charging data resource in a PLMN + required: true + schema: + type: string + responses: + '204': + description: No Content. + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + schemas: + ChargingDataRequest: + type: object + properties: + subscriberIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + nfConsumerIdentification: + $ref: '#/components/schemas/NFIdentification' + invocationTimeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + invocationSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + oneTimeEvent: + type: boolean + oneTimeEventType: + $ref: '#/components/schemas/oneTimeEventType' + notifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + serviceSpecificationInfo: + type: string + multipleUnitUsage: + type: array + items: + $ref: '#/components/schemas/MultipleUnitUsage' + minItems: 0 + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + pDUSessionChargingInformation: + $ref: '#/components/schemas/PDUSessionChargingInformation' + roamingQBCInformation: + $ref: '#/components/schemas/RoamingQBCInformation' + sMSChargingInformation: + $ref: '#/components/schemas/SMSChargingInformation' + nEFChargingInformation: + $ref: '#/components/schemas/NEFChargingInformation' + registrationChargingInformation: + $ref: '#/components/schemas/RegistrationChargingInformation' + n2ConnectionChargingInformation: + $ref: '#/components/schemas/N2ConnectionChargingInformation' + locationReportingChargingInformation: + $ref: '#/components/schemas/LocationReportingChargingInformation' + required: + - nfConsumerIdentification + - invocationTimeStamp + - invocationSequenceNumber + ChargingDataResponse: + type: object + properties: + invocationTimeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + invocationSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + invocationResult: + $ref: '#/components/schemas/InvocationResult' + sessionFailover: + $ref: '#/components/schemas/SessionFailover' + multipleUnitInformation: + type: array + items: + $ref: '#/components/schemas/MultipleUnitInformation' + minItems: 0 + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + pDUSessionChargingInformation: + $ref: '#/components/schemas/PDUSessionChargingInformation' + roamingQBCInformation: + $ref: '#/components/schemas/RoamingQBCInformation' + required: + - invocationTimeStamp + - invocationSequenceNumber + ChargingNotifyRequest: + type: object + properties: + notificationType: + $ref: '#/components/schemas/NotificationType' + reauthorizationDetails: + type: array + items: + $ref: '#/components/schemas/ReauthorizationDetails' + minItems: 0 + required: + - notificationType + ChargingNotifyResponse: + type: object + properties: + invocationResult: + $ref: '#/components/schemas/InvocationResult' + NFIdentification: + type: object + properties: + nFName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nFIPv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + nFIPv6Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + nFPLMNID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + nodeFunctionality: + $ref: '#/components/schemas/NodeFunctionality' + nFFqdn: + type: string + required: + - nodeFunctionality + MultipleUnitUsage: + type: object + properties: + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + requestedUnit: + $ref: '#/components/schemas/RequestedUnit' + usedUnitContainer: + type: array + items: + $ref: '#/components/schemas/UsedUnitContainer' + minItems: 0 + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + required: + - ratingGroup + InvocationResult: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + failureHandling: + $ref: '#/components/schemas/FailureHandling' + Trigger: + type: object + properties: + triggerType: + $ref: '#/components/schemas/TriggerType' + triggerCategory: + $ref: '#/components/schemas/TriggerCategory' + timeLimit: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + volumeLimit: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + volumeLimit64: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + maxNumberOfccc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + required: + - triggerType + - triggerCategory + MultipleUnitInformation: + type: object + properties: + resultCode: + $ref: '#/components/schemas/ResultCode' + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + grantedUnit: + $ref: '#/components/schemas/GrantedUnit' + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + validityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + quotaHoldingTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + finalUnitIndication: + $ref: '#/components/schemas/FinalUnitIndication' + timeQuotaThreshold: + type: integer + volumeQuotaThreshold: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + unitQuotaThreshold: + type: integer + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + required: + - ratingGroup + RequestedUnit: + type: object + properties: + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + UsedUnitContainer: + type: object + properties: + serviceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceId' + quotaManagementIndicator: + $ref: '#/components/schemas/QuotaManagementIndicator' + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + triggerTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + eventTimeStamps: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + localSequenceNumber: + type: integer + pDUContainerInformation: + $ref: '#/components/schemas/PDUContainerInformation' + required: + - localSequenceNumber + GrantedUnit: + type: object + properties: + tariffTimeChange: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + FinalUnitIndication: + type: object + properties: + finalUnitAction: + $ref: '#/components/schemas/FinalUnitAction' + restrictionFilterRule: + $ref: '#/components/schemas/IPFilterRule' + filterId: + type: string + redirectServer: + $ref: '#/components/schemas/RedirectServer' + required: + - finalUnitAction + RedirectServer: + type: object + properties: + redirectAddressType: + $ref: '#/components/schemas/RedirectAddressType' + redirectServerAddress: + type: string + required: + - redirectAddressType + - redirectServerAddress + ReauthorizationDetails: + type: object + properties: + serviceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceId' + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + quotaManagementIndicator: + $ref: '#/components/schemas/QuotaManagementIndicator' + PDUSessionChargingInformation: + type: object + properties: + chargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + homeProvidedChargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + pduSessionInformation: + $ref: '#/components/schemas/PDUSessionInformation' + unitCountInactivityTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + rANSecondaryRATUsageReport: + $ref: '#/components/schemas/RANSecondaryRATUsageReport' + required: + - pduSessionInformation + UserInformation: + type: object + properties: + servedGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + servedPEI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + unauthenticatedFlag: + type: boolean + roamerInOut: + $ref: '#/components/schemas/RoamerInOut' + PDUSessionInformation: + type: object + properties: + networkSlicingInfo: + $ref: '#/components/schemas/NetworkSlicingInfo' + pduSessionID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + pduType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + sscMode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SscMode' + hPlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + servingNetworkFunctionID: + $ref: '#/components/schemas/ServingNetworkFunctionID' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + dnnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + dnnSelectionMode: + $ref: '#/components/schemas/dnnSelectionMode' + chargingCharacteristics: + type: string + chargingCharacteristicsSelectionMode: + $ref: '#/components/schemas/ChargingCharacteristicsSelectionMode' + startTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + stopTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + sessionStopIndicator: + type: boolean + pduAddress: + $ref: '#/components/schemas/PDUAddress' + diagnostics: + $ref: '#/components/schemas/Diagnostics' + authorizedQoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/AuthorizedDefaultQos' + subscribedQoSInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SubscribedDefaultQos' + authorizedSessionAMBR: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + subscribedSessionAMBR: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + servingCNPlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + required: + - pduSessionID + - dnnId + PDUContainerInformation: + type: object + properties: + timeofFirstUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofLastUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosData' + qoSCharacteristics: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosCharacteristics' + afChargingIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + userLocationInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + servingNodeID: + type: array + items: + $ref: '#/components/schemas/ServingNetworkFunctionID' + minItems: 0 + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + sponsorIdentity: + type: string + applicationserviceProviderIdentity: + type: string + chargingRuleBaseName: + type: string + NetworkSlicingInfo: + type: object + properties: + sNSSAI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + required: + - sNSSAI + PDUAddress: + type: object + properties: + pduIPv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + pduIPv6AddresswithPrefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + pduAddressprefixlength: + type: integer + iPv4dynamicAddressFlag: + type: boolean + iPv6dynamicPrefixFlag: + type: boolean + ServingNetworkFunctionID: + type: object + properties: + + servingNetworkFunctionInformation: + $ref: '#/components/schemas/NFIdentification' + aMFId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfId' + required: + - servingNetworkFunctionInformation + RoamingQBCInformation: + type: object + properties: + multipleQFIcontainer: + type: array + items: + $ref: '#/components/schemas/MultipleQFIcontainer' + minItems: 0 + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + roamingChargingProfile: + $ref: '#/components/schemas/RoamingChargingProfile' + MultipleQFIcontainer: + type: object + properties: + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + triggerTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + localSequenceNumber: + type: integer + qFIContainerInformation: + $ref: '#/components/schemas/QFIContainerInformation' + required: + - localSequenceNumber + QFIContainerInformation: + type: object + properties: + qFI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + reportTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofFirstUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofLastUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosData' + qoSCharacteristics: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosCharacteristics' + userLocationInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + servingNetworkFunctionID: + type: array + items: + $ref: '#/components/schemas/ServingNetworkFunctionID' + minItems: 0 + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + 3gppChargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + diagnostics: + $ref: '#/components/schemas/Diagnostics' + enhancedDiagnostics: + type: array + items: + type: string + required: + - reportTime + RoamingChargingProfile: + type: object + properties: + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + partialRecordMethod: + $ref: '#/components/schemas/PartialRecordMethod' + SMSChargingInformation: + type: object + properties: + originatorInfo: + $ref: '#/components/schemas/OriginatorInfo' + recipientInfo: + type: array + items: + $ref: '#/components/schemas/RecipientInfo' + minItems: 0 + userEquipmentInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + sMSCAddress: + type: string + sMDataCodingScheme: + type: integer + sMMessageType: + $ref: '#/components/schemas/SMMessageType' + sMReplyPathRequested: + $ref: '#/components/schemas/ReplyPathRequested' + sMUserDataHeader: + type: string + sMStatus: + type: string + sMDischargeTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + numberofMessagesSent: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + sMServiceType: + $ref: '#/components/schemas/SMServiceType' + sMSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + sMSresult: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + submissionTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + sMPriority: + $ref: '#/components/schemas/SMPriority' + messageReference: + type: string + messageSize: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + messageClass: + $ref: '#/components/schemas/MessageClass' + deliveryReportRequested: + $ref: '#/components/schemas/DeliveryReportRequested' + OriginatorInfo: + type: object + properties: + originatorSUPI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + originatorGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + originatorOtherAddress: + $ref: '#/components/schemas/SMAddressInfo' + originatorReceivedAddress: + $ref: '#/components/schemas/SMAddressInfo' + originatorSCCPAddress: + type: string + sMOriginatorInterface: + $ref: '#/components/schemas/SMInterface' + sMOriginatorProtocolId: + type: string + RecipientInfo: + type: object + properties: + recipientSUPI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + recipientGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + recipientOtherAddress: + $ref: '#/components/schemas/SMAddressInfo' + recipientReceivedAddress: + $ref: '#/components/schemas/SMAddressInfo' + recipientSCCPAddress: + type: string + sMDestinationInterface: + $ref: '#/components/schemas/SMInterface' + sMrecipientProtocolId: + type: string + SMAddressInfo: + type: object + properties: + sMaddressType: + $ref: '#/components/schemas/SMAddressType' + sMaddressData: + type: string + sMaddressDomain: + $ref: '#/components/schemas/SMAddressDomain' + RecipientAddress: + type: object + properties: + recipientAddressInfo: + $ref: '#/components/schemas/SMAddressInfo' + sMaddresseeType: + $ref: '#/components/schemas/SMAddresseeType' + MessageClass: + type: object + properties: + classIdentifier: + $ref: '#/components/schemas/ClassIdentifier' + tokenText: + type: string + SMAddressDomain: + type: object + properties: + domainName: + type: string + 3GPPIMSIMCCMNC: + type: string + SMInterface: + type: object + properties: + interfaceId: + type: string + interfaceText: + type: string + interfacePort: + type: string + interfaceType: + $ref: '#/components/schemas/InterfaceType' + RANSecondaryRATUsageReport: + type: object + properties: + rANSecondaryRATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + qosFlowsUsageReports: + type: array + items: + $ref: '#/components/schemas/QosFlowsUsageReport' + Diagnostics: + type: integer + IPFilterRule: + type: string + QosFlowsUsageReport: + type: object + properties: + qFI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + startTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + NEFChargingInformation: + type: object + properties: + groupIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + aPIDirection: + $ref: '#/components/schemas/APIDirection' + aPITargetNetworkFunction: + $ref: '#/components/schemas/NFIdentification' + aPIResultCode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + aPIName: + type: string + aPIReference: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + aPIContent: + type: string + required: + - aPIName + RegistrationChargingInformation: + type: object + properties: + registrationMessagetype: + $ref: '#/components/schemas/RegistrationMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + 5GMMCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + mICOModeIndication: + $ref: '#/components/schemas/MICOModeIndication' + smsIndication: + $ref: '#/components/schemas/SmsIndication' + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 0 + serviceAreaRestriction: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + minItems: 0 + requestedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + allowedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + rejectedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + required: + - registrationMessagetype + N2ConnectionChargingInformation: + type: object + properties: + n2ConnectionMessageType: + $ref: '#/components/schemas/N2ConnectionMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + amfUeNgapId: + type: integer + ranUeNgapId: + type: integer + ranNodeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + restrictedRatList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 0 + forbiddenAreaList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Area' + minItems: 0 + serviceAreaRestriction: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + minItems: 0 + restrictedCnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/CoreNetworkType' + minItems: 0 + allowedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + rrcEstCause: + type: string + pattern: '^[0-9a-fA-F]+$' + required: + - n2ConnectionMessageType + LocationReportingChargingInformation: + type: object + properties: + locationReportingMessageType: + $ref: '#/components/schemas/LocationReportingMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + required: + - locationReportingMessageType + N2ConnectionMessageType: + type: integer + LocationReportingMessageType: + type: integer + NotificationType: + anyOf: + - type: string + enum: + - REAUTHORIZATION + - ABORT_CHARGING + - type: string + NodeFunctionality: + anyOf: + - type: string + enum: + - SMF + - SMSF + - SGW + - I_SMF + - type: string + ChargingCharacteristicsSelectionMode: + anyOf: + - type: string + enum: + - HOME_DEFAULT + - ROAMING_DEFAULT + - VISITING_DEFAULT + - type: string + TriggerType: + anyOf: + - type: string + enum: + - QUOTA_THRESHOLD + - QHT + - FINAL + - QUOTA_EXHAUSTED + - VALIDITY_TIME + - OTHER_QUOTA_TYPE + - FORCED_REAUTHORISATION + - UNUSED_QUOTA_TIMER # Included for backwards compatibility, shall not be used + - UNIT_COUNT_INACTIVITY_TIMER + - ABNORMAL_RELEASE + - QOS_CHANGE + - VOLUME_LIMIT + - TIME_LIMIT + - PLMN_CHANGE + - USER_LOCATION_CHANGE + - RAT_CHANGE + - SESSION_AMBR_CHANGE + - UE_TIMEZONE_CHANGE + - TARIFF_TIME_CHANGE + - MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS + - MANAGEMENT_INTERVENTION + - CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA + - CHANGE_OF_3GPP_PS_DATA_OFF_STATUS + - SERVING_NODE_CHANGE + - REMOVAL_OF_UPF + - ADDITION_OF_UPF + - INSERTION_OF_ISMF + - REMOVAL_OF_ISMF + - CHANGE_OF_ISMF + - START_OF_SERVICE_DATA_FLOW + - ECGI_CHANGE + - TAI_CHANGE + - HANDOVER_CANCEL + - HANDOVER_START + - HANDOVER_COMPLETE + - GFBR_GUARANTEED_STATUS_CHANGE + - type: string + FinalUnitAction: + anyOf: + - type: string + enum: + - TERMINATE + - REDIRECT + - RESTRICT_ACCESS + - type: string + RedirectAddressType: + anyOf: + - type: string + enum: + - IPV4 + - IPV6 + - URL + - type: string + TriggerCategory: + anyOf: + - type: string + enum: + - IMMEDIATE_REPORT + - DEFERRED_REPORT + - type: string + QuotaManagementIndicator: + anyOf: + - type: string + enum: + - ONLINE_CHARGING + - OFFLINE_CHARGING + - type: string + FailureHandling: + anyOf: + - type: string + enum: + - TERMINATE + - CONTINUE + - RETRY_AND_TERMINATE + - type: string + SessionFailover: + anyOf: + - type: string + enum: + - FAILOVER_NOT_SUPPORTED + - FAILOVER_SUPPORTED + - type: string + 3GPPPSDataOffStatus: + anyOf: + - type: string + enum: + - ACTIVE + - INACTIVE + - type: string + ResultCode: + anyOf: + - type: string + enum: + - SUCCESS + - END_USER_SERVICE_DENIED + - QUOTA_MANAGEMENT_NOT_APPLICABLE + - QUOTA_LIMIT_REACHED + - END_USER_SERVICE_REJECTED + - USER_UNKNOWN + - RATING_FAILED + - type: string + PartialRecordMethod: + anyOf: + - type: string + enum: + - DEFAULT + - INDIVIDUAL + - type: string + RoamerInOut: + anyOf: + - type: string + enum: + - IN_BOUND + - OUT_BOUND + - type: string + SMMessageType: + anyOf: + - type: string + enum: + - SUBMISSION + - DELIVERY_REPORT + - SM_SERVICE_REQUEST + - type: string + SMPriority: + anyOf: + - type: string + enum: + - LOW + - NORMAL + - HIGH + - type: string + DeliveryReportRequested: + anyOf: + - type: string + enum: + - YES + - NO + - type: string + InterfaceType: + anyOf: + - type: string + enum: + - UNKNOWN + - MOBILE_ORIGINATING + - MOBILE_TERMINATING + - APPLICATION_ORIGINATING + - APPLICATION_TERMINATING + - type: string + ClassIdentifier: + anyOf: + - type: string + enum: + - PERSONAL + - ADVERTISEMENT + - INFORMATIONAL + - AUTO + - type: string + SMAddressType: + anyOf: + - type: string + enum: + - EMAIL_ADDRESS + - MSISDN + - IPV4_ADDRESS + - IPV6_ADDRESS + - NUMERIC_SHORTCODE + - ALPHANUMERIC_SHORTCODE + - OTHER + - IMSI + - type: string + SMAddresseeType: + anyOf: + - type: string + enum: + - TO + - CC + - BCC + - type: string + SMServiceType: + anyOf: + - type: string + enum: + - VAS4SMS_SHORT_MESSAGE_CONTENT_PROCESSING + - VAS4SMS_SHORT_MESSAGE_FORWARDING + - VAS4SMS_SHORT_MESSAGE_FORWARDING_MULTIPLE_SUBSCRIPTIONS + - VAS4SMS_SHORT_MESSAGE_FILTERING + - VAS4SMS_SHORT_MESSAGE_RECEIPT + - VAS4SMS_SHORT_MESSAGE_NETWORK_STORAGE + - VAS4SMS_SHORT_MESSAGE_TO_MULTIPLE_DESTINATIONS + - VAS4SMS_SHORT_MESSAGE_VIRTUAL_PRIVATE_NETWORK(VPN) + - VAS4SMS_SHORT_MESSAGE_AUTO_REPLY + - VAS4SMS_SHORT_MESSAGE_PERSONAL_SIGNATURE + - VAS4SMS_SHORT_MESSAGE_DEFERRED_DELIVERY + - type: string + ReplyPathRequested: + anyOf: + - type: string + enum: + - NO_REPLY_PATH_SET + - REPLY_PATH_SET + - type: string + oneTimeEventType: + anyOf: + - type: string + enum: + - IEC + - PEC + - type: string + dnnSelectionMode: + anyOf: + - type: string + enum: + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + - type: string + APIDirection: + anyOf: + - type: string + enum: + - INVOCATION + - NOTIFICATION + - type: string + RegistrationMessageType: + anyOf: + - type: string + enum: + - INITIAL + - MOBILITY + - PERIODIC + - EMERGENCY + - DEREGISTRATION + - type: string + MICOModeIndication: + anyOf: + - type: string + enum: + - MICO_MODE + - NO_MICO_MODE + - type: string + SmsIndication: + anyOf: + - type: string + enum: + - SMS_SUPPORTED + - SMS_NOT_SUPPORTED + - type: string diff --git a/lib/sbi/support/standard/TS29502_Nsmf_PDUSession.yaml b/lib/sbi/support/standard/TS29502_Nsmf_PDUSession.yaml new file mode 100644 index 000000000..4747cd33b --- /dev/null +++ b/lib/sbi/support/standard/TS29502_Nsmf_PDUSession.yaml @@ -0,0 +1,3720 @@ +openapi: 3.0.0 + +info: + version: '1.1.0.alpha-4' + title: 'Nsmf_PDUSession' + description: | + SMF PDU Session Service. + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +externalDocs: + description: 3GPP TS 29.502 V16.3.0; 5G System; Session Management Services; Stage 3 + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.502/ + +servers: + - url: '{apiRoot}/nsmf-pdusession/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501. The sm-contexts and pdu-sessions resources can be distributed on different processing instances or hosts. Thus the authority and/or deployment-specific string of the apiRoot of the created individual sm context and pdu-session resources' URIs may differ from the authority and/or deployment-specific string of the apiRoot of the sm-contexts and pdu-sessions collections' URIs. + +security: + - {} + - oAuth2ClientCredentials: + - nsmf-pdusession + +paths: + /sm-contexts: + post: + summary: Create SM Context + tags: + - SM contexts collection + operationId: PostSmContexts + requestBody: + description: representation of the SM context to be created in the SMF + required: true + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + binaryDataN2SmInformationExt1: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + callbacks: + smContextStatusNotification: + '{$request.body#/smContextStatusUri}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextStatusNotification' + responses: + '204': + description: successful notification + '307': + description: temporary redirect + headers: + Location: + required: true + description: 'A URI pointing to the endpoint of another NF service consumer to which the notification should be sent' + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + + responses: + '201': + description: successful creation of an SM context + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreatedData' + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nsmf-pdusession/{apiVersion}/sm-contexts/{smContextRef}' + required: true + schema: + type: string + + '307': + description: temporary redirect + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + required: true + schema: + type: string + '308': + description: permanent redirect + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + required: true + schema: + type: string + '400': + description: unsuccessful creation of an SM context - bad request + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '403': + description: unsuccessful creation of an SM context - forbidden + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '404': + description: unsuccessful creation of an SM context - not found + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + + '500': + description: unsuccessful creation of an SM context - internal server error + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '503': + description: unsuccessful creation of an SM context - service unavailable + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + '504': + description: unsuccessful creation of an SM context - gateway timeout + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + + /sm-contexts/{smContextRef}/retrieve: + post: + summary: Retrieve SM Context + tags: + - Individual SM context + operationId: RetrieveSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: parameters used to retrieve the SM context + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextRetrieveData' + responses: + '200': + description: successful retrieval of an SM context + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextRetrievedData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + '504': + $ref: 'TS29571_CommonData.yaml#/components/responses/504' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /sm-contexts/{smContextRef}/modify: + post: + summary: Update SM Context + tags: + - Individual SM context + operationId: UpdateSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: representation of the updates to apply to the SM context + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + binaryDataN2SmInformationExt1: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + responses: + '200': + description: successful update of an SM context with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdatedData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '204': + description: successful update of an SM context without content in the response + '400': + description: unsuccessful update of an SM context - bad request + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '403': + description: unsuccessful update of an SM context - forbidden + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '404': + description: unsuccessful update of an SM context - not found + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + description: unsuccessful update of an SM context - Internal server error + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '503': + description: unsuccessful update of an SM context - Service Unavailable + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /sm-contexts/{smContextRef}/release: + post: + summary: Release SM Context + tags: + - Individual SM context + operationId: ReleaseSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: representation of the data to be sent to the SMF when releasing the SM context + required: false + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextReleaseData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextReleaseData' + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + + responses: + '200': + description: successful release of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextReleasedData' + '204': + description: successful release of an SM context without content in the response + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /sm-contexts/{smContextRef}/send-mo-data: + post: + summary: Send MO Data + tags: + - Individual SM context + operationId: SendMoData + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: representation of the payload of Send MO Data Request + required: true + content: + multipart/related: # message with a binary body part + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/SendMoDataReqData' + binaryMoData: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryMoData: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: successful sending of MO data + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions: + post: + summary: Create + tags: + - PDU sessions collection + operationId: PostPduSessions + requestBody: + description: representation of the PDU session to be created in the H-SMF or SMF + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreateData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + callbacks: + statusNotification: + '{$request.body#/vsmfPduSessionUri}': + post: + summary: Notify Status + tags: + - Individual PDU session (V-SMF) + operationId: NotifyStatus + requestBody: + $ref: '#/components/requestBodies/NotifyStatusRequestBody' + responses: + '204': + description: successful notificationof the status change + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + statusNotification-ismf: + '{$request.body#/ismfPduSessionUri}': + post: + summary: Notify Status + tags: + - Individual PDU session (I-SMF) + operationId: NotifyStatus-isfm + requestBody: + $ref: '#/components/requestBodies/NotifyStatusRequestBody' + responses: + '204': + description: successful notificationof the status change + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + + update: + '{$request.body#/vsmfPduSessionUri}/modify': + post: + summary: Update (initiated by H-SMF) + tags: + - Individual PDU session (V-SMF) + operationId: ModifyPduSession + requestBody: + $ref: '#/components/requestBodies/VsmfUpdateRequestBody' + responses: + '200': + $ref: '#/components/responses/VsmfUpdateResponse200' + '204': + description: successful update of a PDU session without content in the response + '400': + $ref: '#/components/responses/VsmfUpdateError' + '403': + $ref: '#/components/responses/VsmfUpdateError' + '404': + $ref: '#/components/responses/VsmfUpdateError' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: '#/components/responses/VsmfUpdateError' + '503': + $ref: '#/components/responses/VsmfUpdateError' + '504': + $ref: '#/components/responses/VsmfUpdateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + update-ismf: + '{$request.body#/ismfPduSessionUri}/modify': + post: + summary: Update (initiated by SMF) + tags: + - Individual PDU session (I-SMF) + operationId: ModifyPduSession-ismf + requestBody: + $ref: '#/components/requestBodies/VsmfUpdateRequestBody' + responses: + '200': + $ref: '#/components/responses/VsmfUpdateResponse200' + '204': + description: successful update of a PDU session without content in the response + '400': + $ref: '#/components/responses/VsmfUpdateError' + '403': + $ref: '#/components/responses/VsmfUpdateError' + '404': + $ref: '#/components/responses/VsmfUpdateError' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: '#/components/responses/VsmfUpdateError' + '503': + $ref: '#/components/responses/VsmfUpdateError' + '504': + $ref: '#/components/responses/VsmfUpdateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + transferMtData: + '{$request.body#/vsmfPduSessionUri}/transfer-mt-data': + post: + summary: Transfer MT Data (by H-SMF) + tags: + - Individual PDU session (V-SMF) + operationId: TransferMtData + requestBody: + description: representation of the payload of Transfer MT Data Request + required: true + content: + multipart/related: # message with a binary body part + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/TransferMtDataReqData' + binaryMtData: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryMtData: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: successful transfering of MT data + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + '504': + description: unsuccessful delivery of mobile terminated data - gateway timeout + content: + application/json: + schema: + $ref: '#/components/schemas/TransferMtDataError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + transferMtData-ismf: + '{$request.body#/ismfPduSessionUri}/transfer-mt-data': + post: + summary: Transfer MT Data (by SMF) + tags: + - Individual PDU session (I-SMF) + operationId: TransferMtData-ismf + requestBody: + description: representation of the payload of Transfer MT Data Request + required: true + content: + multipart/related: # message with a binary body part + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/TransferMtDataReqData' + binaryMtData: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryMtData: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: successful transfering of MT data + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + '504': + description: unsuccessful delivery of mobile terminated data - gateway timeout + content: + application/json: + schema: + $ref: '#/components/schemas/TransferMtDataError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + responses: + '201': + description: successful creation of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreatedData' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nsmf-pdusession/{apiVersion}/pdu-sessions/{pduSessionRef}' + required: true + schema: + type: string + '307': + description: temporary redirect + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + required: true + schema: + type: string + '308': + description: permanent redirect + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + required: true + schema: + type: string + '400': + $ref: '#/components/responses/PduSessionCreateError' + '403': + $ref: '#/components/responses/PduSessionCreateError' + '404': + $ref: '#/components/responses/PduSessionCreateError' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: '#/components/responses/PduSessionCreateError' + '503': + $ref: '#/components/responses/PduSessionCreateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions/{pduSessionRef}/modify: + post: + summary: Update (initiated by V-SMF or I-SMF) + tags: + - Individual PDU session (H-SMF or SMF) + operationId: UpdatePduSession + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the updates to apply to the PDU session + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdateData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + responses: + '200': + description: successful update of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdatedData' + binaryDataN1SmInfoToUe: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + '204': + description: successful update of a PDU session without content in the response + '400': + $ref: '#/components/responses/HsmfUpdateError' + '403': + $ref: '#/components/responses/HsmfUpdateError' + '404': + $ref: '#/components/responses/HsmfUpdateError' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: '#/components/responses/HsmfUpdateError' + '503': + $ref: '#/components/responses/HsmfUpdateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions/{pduSessionRef}/release: + post: + summary: Release + tags: + - Individual PDU session (H-SMF or SMF) + operationId: ReleasePduSession + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the data to be sent to H-SMF or SMF when releasing the PDU session + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/ReleaseData' + responses: + '200': + description: successful release of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/ReleasedData' + '204': + description: successful release of a PDU session + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions/{pduSessionRef}/transfer-mo-data: + post: + summary: Transfer MO Data + tags: + - Individual PDU session (H-SMF or SMF) + operationId: TransferMoData + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the payload of Transfer MO Data Request + required: true + content: + multipart/related: # message with a binary body part + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/TransferMoDataReqData' + binaryMoData: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryMoData: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: successful transfering of MO data + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nsmf-pdusession: Access to the nsmf-pdusession API + + schemas: +# +# STRUCTURED DATA TYPES +# + SmContextCreateData: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + hplmnSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + serviceName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + requestType: + $ref: '#/components/schemas/RequestType' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + additionalAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + smContextStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + additionalHsmfUri: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + minItems: 1 + additionalSmfUri: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + minItems: 1 + oldPduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + pduSessionsActivateList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + minItems: 1 + ueEpsPdnConnection: + $ref: '#/components/schemas/EpsPdnCnxContainer' + hoState: + $ref: '#/components/schemas/HoState' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + pcfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + nrfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + backupAmfInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BackupAmfInfo' + minItems: 1 + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + indirectForwardingFlag: + type: boolean + targetId: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/NgRanTargetId' + epsBearerCtxStatus: + $ref: '#/components/schemas/EpsBearerContextStatus' + cpCiotEnabled: + type: boolean + default: false + cpOnlyInd: + type: boolean + default: false + invokeNef: + type: boolean + default: false + maRequestInd: + type: boolean + default: false + maNwUpgradeInd: + type: boolean + default: false + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + n2SmInfoExt1: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoTypeExt1: + $ref: '#/components/schemas/N2SmInfoType' + smContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + extendedNasSmTimerInd: + type: boolean + default: false + dlDataWaitingInd: + type: boolean + default: false + ddnFailureSubs: + $ref: '#/components/schemas/DdnFailureSubs' + smfTransferInd: + type: boolean + default: false + oldSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + oldSmContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + wAgfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/WAgfInfo' + tngfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/TngfInfo' + twifInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/TwifInfo' + required: + - servingNfId + - servingNetwork + - anType + - smContextStatusUri + + SmContextCreatedData: + type: object + properties: + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + allocatedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + hoState: + $ref: '#/components/schemas/HoState' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + smfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + + SmContextUpdateData: + type: object + properties: + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + backupAmfInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BackupAmfInfo' + minItems: 1 + nullable: true + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + additionalAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + hoState: + $ref: '#/components/schemas/HoState' + toBeSwitched: + type: boolean + default: false + failedToBeSwitched: + type: boolean + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + targetId: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/NgRanTargetId' + targetServingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smContextStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + dataForwarding: + type: boolean + default: false + n9ForwardingTunnel: + $ref: '#/components/schemas/TunnelInfo' + n9DlForwardingTnlList: + type: array + items: + $ref: '#/components/schemas/IndirectDataForwardingTunnelInfo' + minItems: 1 + n9UlForwardingTnlList: + type: array + items: + $ref: '#/components/schemas/IndirectDataForwardingTunnelInfo' + minItems: 1 + epsBearerSetup: + type: array + items: + $ref: '#/components/schemas/EpsBearerContainer' + minItems: 0 + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + release: + type: boolean + default: false + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + anTypeCanBeChanged: + type: boolean + default: false + n2SmInfoExt1: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoTypeExt1: + $ref: '#/components/schemas/N2SmInfoType' + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + maNwUpgradeInd: + type: boolean + default: false + maRequestInd: + type: boolean + default: false + exemptionInd: + $ref: '#/components/schemas/ExemptionInd' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + moExpDataInd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' + moExpDataCounter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' + extendedNasSmTimerInd: + type: boolean + forwardingFTeid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + forwardingBearerContexts: + type: array + items: + $ref: '#/components/schemas/ForwardingBearerContainer' + minItems: 1 + ddnFailureSubs: + $ref: '#/components/schemas/DdnFailureSubs' + + SmContextUpdatedData: + type: object + properties: + upCnxState: + $ref: '#/components/schemas/UpCnxState' + hoState: + $ref: '#/components/schemas/HoState' + releaseEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + allocatedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + modifiedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + epsBearerSetup: + type: array + items: + $ref: '#/components/schemas/EpsBearerContainer' + minItems: 1 + dataForwarding: + type: boolean + n3DlForwardingTnlList: + type: array + items: + $ref: '#/components/schemas/IndirectDataForwardingTunnelInfo' + minItems: 1 + n3UlForwardingTnlList: + type: array + items: + $ref: '#/components/schemas/IndirectDataForwardingTunnelInfo' + minItems: 1 + cause: + $ref: '#/components/schemas/Cause' + maAcceptedInd: + type: boolean + default: false + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + forwardingFTeid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + forwardingBearerContexts: + type: array + items: + $ref: '#/components/schemas/ForwardingBearerContainer' + minItems: 1 + + SmContextReleaseData: + type: object + properties: + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + vsmfReleaseOnly: + type: boolean + default: false + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + ismfReleaseOnly: + type: boolean + default: false + + SmContextReleasedData: + type: object + properties: + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + + SmContextStatusNotification: + type: object + properties: + statusInfo : + $ref: '#/components/schemas/StatusInfo' + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + ddnFailureStatus: + type: boolean + default: false + newSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + newSmfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + oldSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + oldSmContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + required: + - statusInfo + + PduSessionCreateData: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + vsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + ismfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + requestType: + $ref: '#/components/schemas/RequestType' + epsBearerId: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + pgwS8cFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + vsmfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + ismfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + vcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + icnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + n9ForwardingTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + additionalCnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + additionalAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + hPcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + pcfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + hoPreparationIndication: + type: boolean + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + alwaysOnRequested: + type: boolean + default: false + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + vSmfServiceInstanceId: + type: string + iSmfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + chargingId: + type: string + oldPduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + epsBearerCtxStatus: + $ref: '#/components/schemas/EpsBearerContextStatus' + amfNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + cpCiotEnabled: + type: boolean + default: false + cpOnlyInd: + type: boolean + default: false + invokeNef: + type: boolean + default: false + maRequestInd: + type: boolean + default: false + maNwUpgradeInd: + type: boolean + default: false + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + dlServingPlmnRateCtl: + type: integer + minimum: 10 + required: + - dnn + - servingNetwork + - anType + oneOf: + - required: [ vsmfId, vsmfPduSessionUri ] + - required: [ ismfId, ismfPduSessionUri ] + + PduSessionCreatedData: + type: object + properties: + pduSessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + sscMode: + type: string + pattern: '^[0-7]$' + hcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + cnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + additionalCnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsSetupList: + type: array + items: + $ref: '#/components/schemas/QosFlowSetupItem' + minItems: 1 + hSmfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + enablePauseCharging: + type: boolean + default: false + ueIpv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + epsPdnCnxInfo: + $ref: '#/components/schemas/EpsPdnCnxInfo' + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + maxIntegrityProtectedDataRate: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + alwaysOnGranted: + type: boolean + default: false + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + hSmfServiceInstanceId: + type: string + smfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + ipv6MultiHomingInd: + type: boolean + default: false + maAcceptedInd: + type: boolean + default: false + homeProvidedChargingId: + type: string + nefExtBufSupportInd: + type: boolean + default: false + required: + - pduSessionType + - sscMode + oneOf: + - required: [ hSmfInstanceId ] + - required: [ smfInstanceId ] + + HsmfUpdateData: + type: object + properties: + requestIndication: + $ref: '#/components/schemas/RequestIndication' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + vcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + icnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + additionalCnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + additionalAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + pauseCharging: + type: boolean + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + qosFlowsRelNotifyList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsNotifyList: + type: array + items: + $ref: '#/components/schemas/QosFlowNotifyItem' + minItems: 1 + NotifyList: + type: array + items: + $ref: '#/components/schemas/PduSessionNotifyItem' + minItems: 1 + epsBearerId: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 0 + hoPreparationIndication: + type: boolean + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + alwaysOnRequested: + type: boolean + default: false + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + anTypeCanBeChanged: + type: boolean + default: false + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + maNwUpgradeInd: + type: boolean + default: false + maRequestInd: + type: boolean + default: false + unavailableAccessInd: + $ref: '#/components/schemas/UnavailableAccessIndication' + psaInfo: + type: array + items: + $ref: '#/components/schemas/PsaInformation' + minItems: 1 + ulclBpInfo: + $ref: '#/components/schemas/UlclBpInformation' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + vsmfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + vsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + vSmfServiceInstanceId: + type: string + ismfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + ismfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + iSmfServiceInstanceId: + type: string + dlServingPlmnRateCtl: + type: integer + minimum: 10 + nullable: true + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + moExpDataInd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' + moExpDataCounter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' + vplmnQos: + $ref: '#/components/schemas/VplmnQos' + required: + - requestIndication + + HsmfUpdatedData: + type: object + properties: + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + ipv6MultiHomingInd: + type: boolean + default: false + + ReleaseData: + type: object + properties: + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + + ReleasedData: + type: object + properties: + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + + VsmfUpdateData: + type: object + properties: + requestIndication: + $ref: '#/components/schemas/RequestIndication' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsAddModRequestList: + type: array + items: + $ref: '#/components/schemas/QosFlowAddModifyRequestItem' + minItems: 1 + qosFlowsRelRequestList: + type: array + items: + $ref: '#/components/schemas/QosFlowReleaseRequestItem' + minItems: 1 + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + assignEbiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + modifiedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + alwaysOnGranted: + type: boolean + default: false + hsmfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + cause: + $ref: '#/components/schemas/Cause' + n1smCause: + type: string + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + maAcceptedInd: + type: boolean + default: false + additionalCnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + required: + - requestIndication + + VsmfUpdatedData: + type: object + properties: + qosFlowsAddModList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsRelList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsFailedtoAddModList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsFailedtoRelList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + assignedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + failedToAssignEbiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + releasedEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + + StatusNotification: + type: object + properties: + statusInfo : + $ref: '#/components/schemas/StatusInfo' + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + required: + - statusInfo + + QosFlowItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + cause: + $ref: '#/components/schemas/Cause' + required: + - qfi + + QosFlowSetupItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + ebi: + $ref: '#/components/schemas/EpsBearerId' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowProfile: + $ref: '#/components/schemas/QosFlowProfile' + associatedAnType: + $ref: '#/components/schemas/QosFlowAccessType' + required: + - qfi + - qosRules + + QosFlowAddModifyRequestItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + ebi: + $ref: '#/components/schemas/EpsBearerId' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowProfile: + $ref: '#/components/schemas/QosFlowProfile' + associatedAnType: + $ref: '#/components/schemas/QosFlowAccessType' + required: + - qfi + + QosFlowReleaseRequestItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + required: + - qfi + + QosFlowProfile: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + nonDynamic5Qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NonDynamic5Qi' + dynamic5Qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dynamic5Qi' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + gbrQosFlowInfo: + $ref: '#/components/schemas/GbrQosFlowInformation' + rqa: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ReflectiveQoSAttribute' + additionalQosFlowInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AdditionalQosFlowInfo' + required: + - 5qi + + GbrQosFlowInformation: + type: object + properties: + maxFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + notifControl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NotificationControl' + maxPacketLossRateDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' + maxPacketLossRateUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' + required: + - maxFbrDl + - maxFbrUl + - guaFbrDl + - guaFbrUl + + QosFlowNotifyItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + notificationCause: + $ref: '#/components/schemas/NotificationCause' + required: + - qfi + - notificationCause + + + SmContextRetrieveData: + type: object + properties: + targetMmeCap: + $ref: '#/components/schemas/MmeCapabilities' + smContextType: + $ref: '#/components/schemas/SmContextType' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + notToTransferEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + + SmContextRetrievedData: + type: object + properties: + ueEpsPdnConnection: + $ref: '#/components/schemas/EpsPdnCnxContainer' + smContext: + $ref: '#/components/schemas/SmContext' + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + apnRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + dlDataWaitingInd: + type: boolean + default: false + required: + - ueEpsPdnConnection + + MmeCapabilities: + type: object + properties: + nonIpSupported: + type: boolean + default: false + ethernetSupported: + type: boolean + default: false + + TunnelInfo: + type: object + properties: + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + gtpTeid: + $ref: '#/components/schemas/Teid' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + required: + - gtpTeid + + StatusInfo: + type: object + properties: + resourceStatus: + $ref: '#/components/schemas/ResourceStatus' + cause: + $ref: '#/components/schemas/Cause' + cnAssistedRanPara: + $ref: '#/components/schemas/CnAssistedRanPara' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + required: + - resourceStatus + + + EpsPdnCnxInfo: + type: object + properties: + pgwS8cFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + pgwNodeName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + linkedBearerId: + $ref: '#/components/schemas/EpsBearerId' + required: + - pgwS8cFteid + + EpsBearerInfo: + type: object + properties: + ebi: + $ref: '#/components/schemas/EpsBearerId' + pgwS8uFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + bearerLevelQoS: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + required: + - ebi + - pgwS8uFteid + - bearerLevelQoS + + PduSessionNotifyItem: + type: object + properties: + notificationCause: + $ref: '#/components/schemas/NotificationCause' + required: + - notificationCause + + EbiArpMapping: + type: object + properties: + epsBearerId: + $ref: '#/components/schemas/EpsBearerId' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + required: + - epsBearerId + - arp + + SmContextCreateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + SmContextUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + PduSessionCreateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + HsmfUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + VsmfUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + failedToAssignEbiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' + required: + - error + + SmContext: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + hplmnSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + pduSessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + pduSessionRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + pcfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsList: + type: array + items: + $ref: '#/components/schemas/QosFlowSetupItem' + minItems: 1 + hSmfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + enablePauseCharging: + type: boolean + default: false + ueIpv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + epsPdnCnxInfo: + $ref: '#/components/schemas/EpsPdnCnxInfo' + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + maxIntegrityProtectedDataRate: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + alwaysOnGranted: + type: boolean + default: false + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + hSmfServiceInstanceId: + type: string + smfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + forwardingInd: + type: boolean + default: false + psaTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + homeProvidedChargingId: + type: string + chargingInfo: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/ChargingInformation' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + nefExtBufSupportInd: + type: boolean + default: false + required: + - pduSessionId + - dnn + - sNssai + - pduSessionType + - sessionAmbr + - qosFlowsList + + ExemptionInd: + type: object + properties: + dnnCongestion: + type: boolean + default: false + snssaiOnlyCongestion: + type: boolean + default: false + snssaiDnnCongestion: + type: boolean + default: false + + PsaInformation: + type: object + properties: + psaInd: + $ref: '#/components/schemas/PsaIndication' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + ueIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + psaUpfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + + DnaiInformation: + type: object + properties: + dnai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + noDnaiChangeInd: + type: boolean + noLocalPsaChangeInd: + type: boolean + required: + - dnai + + N4Information: + type: object + properties: + n4MessageType: + $ref: '#/components/schemas/N4MessageType' + n4MessagePayload: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n4DnaiInfo: + $ref: '#/components/schemas/DnaiInformation' + required: + - n4MessageType + - n4MessagePayload + + IndirectDataForwardingTunnelInfo: + type: object + properties: + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + gtpTeid: + $ref: '#/components/schemas/Teid' + drbId: + $ref: '#/components/schemas/DrbId' + additionalTnlNb: + $ref: '#/components/schemas/AdditionalTnlNb' + required: + - gtpTeid + not: + required: [ drbId, additionalTnlNb ] + + SendMoDataReqData: + type: object + properties: + moData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + moExpDataInd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' + moExpDataCounter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + required: + - moData + + CnAssistedRanPara: + type: object + properties: + stationaryIndication: + $ref: 'TS29571_CommonData.yaml#/components/schemas/StationaryIndication' + communicationDurationTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + periodicTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + scheduledCommunicationTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ScheduledCommunicationTime' + scheduledCommunicationType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ScheduledCommunicationType' + trafficProfile: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TrafficProfile' + batteryIndication: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BatteryIndication' + + UlclBpInformation: + type: object + properties: + ulclBpUpfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + + TransferMoDataReqData: + type: object + properties: + moData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + moExpDataInd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' + moExpDataCounter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + required: + - moData + + TransferMtDataReqData: + type: object + properties: + mtData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + required: + - mtData + + TransferMtDataError: + allOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + - $ref: '#/components/schemas/TransferMtDataAddInfo' + + TransferMtDataAddInfo: + type: object + properties: + maxWaitingTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + + VplmnQos: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + maxFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + + DdnFailureSubs: + type: object + properties: + ddnFailureSubsInd: + type: boolean + default: false + dddTrafficDescriptorList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DddTrafficDescriptor' + minItems: 1 + +# +# SIMPLE DATA TYPES +# + ProcedureTransactionId: + type: integer + minimum: 0 + maximum: 255 + + EpsBearerId: + type: integer + minimum: 0 + maximum: 15 + + EpsPdnCnxContainer: + type: string + + EpsBearerContainer: + type: string + + Teid: + type: string + pattern: '^[A-F0-9]{8}$' + + EpsBearerContextStatus: + type: string + pattern: '^[A-Fa-f0-9]{4}$' + + DrbId: + type: integer + minimum: 1 + maximum: 32 + + AdditionalTnlNb: + type: integer + minimum: 1 + maximum: 3 + + ForwardingBearerContainer: + type: string + +# +# ENUMERATIONS +# + UpCnxState: + anyOf: + - type: string + enum: + - ACTIVATED + - DEACTIVATED + - ACTIVATING + - SUSPENDED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - ACTIVATED + - DEACTIVATED + - ACTIVATING + - SUSPENDED + + HoState: + anyOf: + - type: string + enum: + - NONE + - PREPARING + - PREPARED + - COMPLETED + - CANCELLED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - NONE + - PREPARING + - PREPARED + - COMPLETED + - CANCELLED + + RequestType: + anyOf: + - type: string + enum: + - INITIAL_REQUEST + - EXISTING_PDU_SESSION + - INITIAL_EMERGENCY_REQUEST + - EXISTING_EMERGENCY_PDU_SESSION + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - INITIAL_REQUEST + - EXISTING_PDU_SESSION + - INITIAL_EMERGENCY_REQUEST + - EXISTING_EMERGENCY_PDU_SESSION + + RequestIndication: + anyOf: + - type: string + enum: + - UE_REQ_PDU_SES_MOD + - UE_REQ_PDU_SES_REL + - PDU_SES_MOB + - NW_REQ_PDU_SES_AUTH + - NW_REQ_PDU_SES_MOD + - NW_REQ_PDU_SES_REL + - EBI_ASSIGNMENT_REQ + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - UE_REQ_PDU_SES_MOD + - UE_REQ_PDU_SES_REL + - PDU_SES_MOB + - NW_REQ_PDU_SES_AUTH + - NW_REQ_PDU_SES_MOD + - NW_REQ_PDU_SES_REL + - EBI_ASSIGNMENT_REQ + + NotificationCause: + anyOf: + - type: string + enum: + - QOS_FULFILLED + - QOS_NOT_FULFILLED + - UP_SEC_FULFILLED + - UP_SEC_NOT_FULFILLED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - QOS_FULFILLED + - QOS_NOT_FULFILLED + - UP_SEC_FULFILLED + - UP_SEC_NOT_FULFILLED + + Cause: + anyOf: + - type: string + enum: + - REL_DUE_TO_HO + - EPS_FALLBACK + - REL_DUE_TO_UP_SEC + - DNN_CONGESTION + - S_NSSAI_CONGESTION + - REL_DUE_TO_REACTIVATION + - 5G_AN_NOT_RESPONDING + - REL_DUE_TO_SLICE_NOT_AVAILABLE + - REL_DUE_TO_DUPLICATE_SESSION_ID + - PDU_SESSION_STATUS_MISMATCH + - HO_FAILURE + - INSUFFICIENT_UP_RESOURCES + - PDU_SESSION_HANDED_OVER + - PDU_SESSION_RESUMED + - CN_ASSISTED_RAN_PARAMETER_TUNING + - ISMF_CONTEXT_TRANSFER + - SMF_CONTEXT_TRANSFER + - REL_DUE_TO_PS_TO_CS_HO + - REL_DUE_TO_SUBSCRIPTION_CHANGE + - HO_CANCEL + - REL_DUE_TO_SLICE_NOT_AUTHORIZED + - PDU_SESSION_HAND_OVER_FAILURE + - DDN_FAILURE_STATUS + + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - REL_DUE_TO_HO + - EPS_FALLBACK + - REL_DUE_TO_UP_SEC + - DNN_CONGESTION + - S_NSSAI_CONGESTION + - REL_DUE_TO_REACTIVATION + - 5G_AN_NOT_RESPONDING + - REL_DUE_TO_SLICE_NOT_AVAILABLE + - REL_DUE_TO_DUPLICATE_SESSION_ID + - PDU_SESSION_STATUS_MISMATCH + - HO_FAILURE + - INSUFFICIENT_UP_RESOURCES + - PDU_SESSION_HANDED_OVER + - PDU_SESSION_RESUMED + - CN_ASSISTED_RAN_PARAMETER_TUNING + - ISMF_CONTEXT_TRANSFER + - SMF_CONTEXT_TRANSFER + - REL_DUE_TO_PS_TO_CS_HO + - REL_DUE_TO_SUBSCRIPTION_CHANGE + - HO_CANCEL + - REL_DUE_TO_SLICE_NOT_AUTHORIZED + - PDU_SESSION_HAND_OVER_FAILURE + - DDN_FAILURE_STATUS + + ResourceStatus: + anyOf: + - type: string + enum: + - RELEASED + - UNCHANGED + - TRANSFERRED + - UPDATED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - RELEASED + - UNCHANGED + - UPDATED + + DnnSelectionMode: + anyOf: + - type: string + enum: + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + + EpsInterworkingIndication: + anyOf: + - type: string + enum: + - NONE + - WITH_N26 + - WITHOUT_N26 + - IWK_NON_3GPP + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - NONE + - WITH_N26 + - WITHOUT_N26 + - IWK_NON_3GPP + + N2SmInfoType: + anyOf: + - type: string + enum: + - PDU_RES_SETUP_REQ + - PDU_RES_SETUP_RSP + - PDU_RES_SETUP_FAIL + - PDU_RES_REL_CMD + - PDU_RES_REL_RSP + - PDU_RES_MOD_REQ + - PDU_RES_MOD_RSP + - PDU_RES_MOD_FAIL + - PDU_RES_NTY + - PDU_RES_NTY_REL + - PDU_RES_MOD_IND + - PDU_RES_MOD_CFM + - PATH_SWITCH_REQ + - PATH_SWITCH_SETUP_FAIL + - PATH_SWITCH_REQ_ACK + - PATH_SWITCH_REQ_FAIL + - HANDOVER_REQUIRED + - HANDOVER_CMD + - HANDOVER_PREP_FAIL + - HANDOVER_REQ_ACK + - HANDOVER_RES_ALLOC_FAIL + - SECONDARY_RAT_USAGE + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - PDU_RES_SETUP_REQ + - PDU_RES_SETUP_RSP + - PDU_RES_SETUP_FAIL + - PDU_RES_REL_CMD + - PDU_RES_REL_RSP + - PDU_RES_MOD_REQ + - PDU_RES_MOD_RSP + - PDU_RES_MOD_FAIL + - PDU_RES_NTY + - PDU_RES_NTY_REL + - PDU_RES_MOD_IND + - PDU_RES_MOD_CFM + - PATH_SWITCH_REQ + - PATH_SWITCH_SETUP_FAIL + - PATH_SWITCH_REQ_ACK + - PATH_SWITCH_REQ_FAIL + - HANDOVER_REQUIRED + - HANDOVER_CMD + - HANDOVER_PREP_FAIL + - HANDOVER_REQ_ACK + - HANDOVER_RES_ALLOC_FAIL + - SECONDARY_RAT_USAGE + + MaxIntegrityProtectedDataRate: + anyOf: + - type: string + enum: + - 64_KBPS + - MAX_UE_RATE + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - 64_KBPS + - MAX_UE_RATE + + MaReleaseIndication: + anyOf: + - type: string + enum: + - REL_MAPDU_OVER_3GPP + - REL_MAPDU_OVER_N3GPP + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - REL_MAPDU_OVER_3GPP + - REL_MAPDU_OVER_N3GPP + + SmContextType: + anyOf: + - type: string + enum: + - EPS_PDN_CONNECTION + - SM_CONTEXT + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - EPS_PDN_CONNECTION + - SM_CONTEXT + + PsaIndication: + anyOf: + - type: string + enum: + - PSA_INSERTED + - PSA_REMOVED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - PSA_INSERTED + - PSA_REMOVED + + N4MessageType: + anyOf: + - type: string + enum: + - PFCP_SES_EST_REQ + - PFCP_SES_EST_RSP + - PFCP_SES_MOD_REQ + - PFCP_SES_MOD_RSP + - PFCP_SES_DEL_REQ + - PFCP_SES_DEL_RSP + - PFCP_SES_REP_REQ + - PFCP_SES_REP_RSP + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - PFCP_SES_EST_REQ + - PFCP_SES_EST_RSP + - PFCP_SES_MOD_REQ + - PFCP_SES_MOD_RSP + - PFCP_SES_DEL_REQ + - PFCP_SES_DEL_RSP + - PFCP_SES_REP_REQ + - PFCP_SES_REP_RSP + + QosFlowAccessType: + anyOf: + - type: string + enum: + - 3GPP + - NON_3GPP + - 3GPP_AND_NON_3GPP + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - 3GPP + - NON_3GPP + - 3GPP_AND_NON_3GPP + + UnavailableAccessIndication: + anyOf: + - type: string + enum: + - 3GA_UNAVAILABLE + - N3GA_UNAVAILABLE + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - 3GA_UNAVAILABLE + - N3GA_UNAVAILABLE + +# +# HTTP request bodies +# + requestBodies: + 'VsmfUpdateRequestBody': + description: representation of updates to apply to the PDU session + required: true + content: + application/+json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdateData' + binaryDataN1SmInfoToUe: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + + 'NotifyStatusRequestBody': + description: representation of the status notification + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/StatusNotification' + +# +# HTTP responses +# + responses: + 'VsmfUpdateResponse200': + description: successful update of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdatedData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + + 'PduSessionCreateError': + description: unsuccessful creation of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreateError' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + 'HsmfUpdateError': + description: unsuccessful update of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdateError' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + 'VsmfUpdateError': + description: unsuccessful update of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdateError' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string diff --git a/lib/sbi/support/standard/TS29507_Npcf_AMPolicyControl.yaml b/lib/sbi/support/standard/TS29507_Npcf_AMPolicyControl.yaml new file mode 100644 index 000000000..b3e2e8b3e --- /dev/null +++ b/lib/sbi/support/standard/TS29507_Npcf_AMPolicyControl.yaml @@ -0,0 +1,586 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-4 + title: Npcf_AMPolicyControl + description: | + Access and Mobility Policy Control Service. + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.507 V16.3.0; 5G System; Access and Mobility Policy Control Service. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.507/' +servers: + - url: '{apiRoot}/npcf-am-policy-control/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - npcf-am-policy-control +paths: + /policies: + post: + operationId: CreateIndividualAMPolicyAssociation + summary: Create individual AM policy association. + tags: + - AM Policy Associations (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociationRequest' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociation' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/npcf-am-policy-control/v1/policies/{polAssoId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + policyUpdateNotification: + '{$request.body#/notificationUri}/update': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyUpdate' + responses: + '204': + description: No Content, Notification was succesfull + '307': + description: temporary redirect + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + policyAssocitionTerminationRequestNotification: + '{$request.body#/notificationUri}/terminate': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TerminationNotification' + responses: + '204': + description: No Content, Notification was succesfull + '307': + description: temporary redirect + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /policies/{polAssoId}: + get: + operationId: ReadIndividualAMPolicyAssociation + summary: Read individual AM policy association. + tags: + - Individual AM Policy Association (Document) + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociation' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + operationId: DeleteIndividualAMPolicyAssociation + summary: Delete individual AM policy association. + tags: + - Individual AM Policy Association (Document) + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /policies/{polAssoId}/update: + post: + operationId: ReportObservedEventTriggersForIndividualAMPolicyAssociation + summary: Report obeserved event triggers and obtain updated policies for an individual AM policy association. + tags: + - Individual AM Policy Association (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociationUpdateRequest' + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '200': + description: OK. Updated policies are returned + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyUpdate' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + npcf-am-policy-control: Access to the Npcf_AMPolicyControl API + schemas: + PolicyAssociation: + type: object + properties: + request: + $ref: '#/components/schemas/PolicyAssociationRequest' + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + description: Request Triggers that the PCF subscribes. Only values "LOC_CH" and "PRA_CH" are permitted. + servAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + wlServAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' + rfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + smfSelInfo: + $ref: '#/components/schemas/SmfSelectionData' + ueAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + rgTmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + pras: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - suppFeat + PolicyAssociationRequest: + description: Information which the NF service consumer provides when requesting the creation of a policy association. The serviveName property corresponds to the serviceName in the main body of the specification. + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + altNotifIpv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + description: Alternate or backup IPv4 Address(es) where to send Notifications. + altNotifIpv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + description: Alternate or backup IPv6 Address(es) where to send Notifications. + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + accessTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + userLoc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + timeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + servingPlmn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ratTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 1 + groupIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + minItems: 1 + servAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + wlServAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' + rfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + ueAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + rgTmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + allowedSnssais: + description: array of allowed S-NSSAIs for the 3GPP access. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + mappingSnssais: + description: mapping of each S-NSSAI of the Allowed NSSAI to the corresponding S-NSSAI of the HPLMN. + type: array + items: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/MappingOfSnssai' + minItems: 1 + n3gAllowedSnssais: + description: array of allowed S-NSSAIs for the Non-3GPP access. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + serviveName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + traceReq: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - notificationUri + - suppFeat + - supi + PolicyAssociationUpdateRequest: + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + altNotifIpv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + description: Alternate or backup IPv4 Address(es) where to send Notifications. + altNotifIpv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + description: Alternate or backup IPv6 Address(es) where to send Notifications. + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + description: Request Triggers that the NF service consumer observes. + servAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + wlServAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' + rfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + smfSelInfo: + $ref: '#/components/schemas/SmfSelectionData' + ueAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + rgTmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + praStatuses: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + description: Map of PRA status information. + userLoc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + allowedSnssais: + description: array of allowed S-NSSAIs for the 3GPP access. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + mappingSnssais: + description: mapping of each S-NSSAI of the Allowed NSSAI to the corresponding S-NSSAI of the HPLMN. + type: array + items: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/MappingOfSnssai' + minItems: 1 + accessTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + ratTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 1 + n3gAllowedSnssais: + description: array of allowed S-NSSAIs for the Non-3GPP access. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + traceReq: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + PolicyUpdate: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + nullable: true + description: Request Triggers that the PCF subscribes. Only values "LOC_CH" and "PRA_CH" are permitted. + servAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + wlServAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' + rfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + smfSelInfo: + $ref: '#/components/schemas/SmfSelectionData' + ueAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + rgTmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + pras: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfoRm' + description: Map of PRA information. + minProperties: 1 + nullable: true + required: + - resourceUri + TerminationNotification: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + cause: + $ref: '#/components/schemas/PolicyAssociationReleaseCause' + required: + - resourceUri + - cause + SmfSelectionData: + type: object + properties: + unsuppDnn: + type: boolean + candidates: + type: object + additionalProperties: + $ref: '#/components/schemas/CandidateForReplacement' + minProperties: 1 + nullable: true + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + mappingSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + nullable: true + CandidateForReplacement: + type: object + properties: + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + nullable: true + required: + - snssai + nullable: true + RequestTrigger: + anyOf: + - type: string + enum: + - LOC_CH + - PRA_CH + - SERV_AREA_CH + - RFSP_CH + - ALLOWED_NSSAI_CH + - UE_AMBR_CH + - SMF_SELECT_CH + - ACCESS_TYPE_CH + - RG_TMBR_CH + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - LOC_CH: Location change (tracking area). The tracking area of the UE has changed. + - PRA_CH: Change of UE presence in PRA. The UE is entering/leaving a Presence Reporting Area. + - SERV_AREA_CH: Service Area Restriction change. The UDM notifies the AMF that the subscribed service area restriction information has changed. + - RFSP_CH: RFSP index change. The UDM notifies the AMF that the subscribed RFSP index has changed. + - ALLOWED_NSSAI_CH: Allowed NSSAI change. The AMF notifies that the set of UE allowed S-NSSAIs has changed. + - UE_AMBR_CH: UE-AMBR change. The UDM notifies the AMF that the subscribed UE-AMBR has changed. + - SMF_SELECT_CH: SMF selection information change. The UE requested for an unsupported DNN or UE requested for a DNN within the list of DNN candidates for replacement per S-NSSAI. + - ACCESS_TYPE_CH: Access Type change. The the AMF notifies that the access type and the RAT type combinations available in the AMF for a UE with simultaneous 3GPP and non-3GPP connectivity has changed. + - RG_TMBR_CH: Subscribed RG-TMBR change. The UDM notifies the AMF that the subscribed RG-TMBR has changed. + PolicyAssociationReleaseCause: + anyOf: + - type: string + enum: + - UNSPECIFIED + - UE_SUBSCRIPTION + - INSUFFICIENT_RES + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - UNSPECIFIED: This value is used for unspecified reasons. + - UE_SUBSCRIPTION: This value is used to indicate that the session needs to be terminated because the subscription of UE has changed (e.g. was removed). + - INSUFFICIENT_RES: This value is used to indicate that the server is overloaded and needs to abort the session. diff --git a/lib/sbi/support/standard/TS29531_Nnssf_NSSAIAvailability.yaml b/lib/sbi/support/standard/TS29531_Nnssf_NSSAIAvailability.yaml new file mode 100644 index 000000000..acd50efbe --- /dev/null +++ b/lib/sbi/support/standard/TS29531_Nnssf_NSSAIAvailability.yaml @@ -0,0 +1,503 @@ +openapi: 3.0.0 + +info: + version: '1.1.0.alpha-2' + title: 'NSSF NSSAI Availability' + description: | + NSSF NSSAI Availability Service. + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +security: + - {} + - oAuth2ClientCredentials: + - nnssf-nssaiavailability +servers: + - url: '{apiRoot}/nnssf-nssaiavailability/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +externalDocs: + description: 3GPP TS 29.531 V16.2.0; 5G System; Network Slice Selection Services; Stage 3 + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.531/ +paths: + /nssai-availability/{nfId}: + put: + summary: Updates/replaces the NSSF with the S-NSSAIs the NF service consumer (e.g AMF)supports per TA + tags: + - NF Instance ID (Document) + operationId: NSSAIAvailabilityPut + parameters: + - name: nfId + in: path + description: Identifier of the NF service consumer instance + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: Content-Encoding + in: header + description: Content-Encoding, described in IETF RFC 7231 + schema: + type: string + - name: Accept-Encoding + in: header + description: Accept-Encoding, described in IETF RFC 7231 + schema: + type: string + requestBody: + description: Parameters to update/replace at the NSSF, the S-NSSAIs supported per TA + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NssaiAvailabilityInfo' + responses: + '200': + description: OK (Successful update of SNSSAI information per TA) + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizedNssaiAvailabilityInfo' + headers: + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + Content-Encoding: + description: Content-Encoding, described in IETF RFC 7231 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + + patch: + summary: Updates an already existing S-NSSAIs per TA provided by the NF service consumer (e.g AMF) + tags: + - NF Instance ID (Document) + operationId: NSSAIAvailabilityPatch + parameters: + - name: nfId + in: path + description: Identifier of the NF service consumer instance + required: true + schema: + type: string + requestBody: + description: JSON Patch instructions to update at the NSSF, the S-NSSAIs supported per TA + required: true + content: + application/json-patch+json:: + schema: + $ref: '#/components/schemas/PatchDocument' + + responses: + '200': + description: OK (Successful update of SNSSAI information per TA) + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizedNssaiAvailabilityInfo' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + + + delete: + summary: Deletes an already existing S-NSSAIs per TA provided by the NF service consumer (e.g AMF) + tags: + - NF Instance ID (Document) + operationId: NSSAIAvailabilityDelete + parameters: + - name: nfId + in: path + description: Identifier of the NF service consumer instance + required: true + schema: + type: string + + responses: + '204': + description: No Content (Successful deletion of SNSSAI information per TA) + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + + default: + description: Unexpected error + + + /nssai-availability/subscriptions: + post: + summary: Creates subscriptions for notification about updates to NSSAI availability information + tags: + - Subscriptions (Collection) + operationId: NSSAIAvailabilityPost + requestBody: + description: Subscription for notification about updates to NSSAI availability information + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NssfEventSubscriptionCreateData' + callbacks: + nssaiAvailabilityNotification: + '{request.body#/nfNssaiAvailabilityUri}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NssfEventNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + + + responses: + '201': + description: Created (Successful creation of subscription for notification) + content: + application/json: + schema: + $ref: '#/components/schemas/NssfEventSubscriptionCreatedData' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnssf-nssaiavailability/v1/nssai-availability/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + + /nssai-availability/subscriptions/{subscriptionId}: + delete: + summary: Deletes an already existing NSSAI availability notification subscription + tags: + - Subscription ID (Document) + operationId: NSSAIAvailabilityUnsubscribe + parameters: + - name: subscriptionId + in: path + description: Identifier of the subscription for notification + required: true + schema: + type: string + + responses: + '204': + description: No Content (Successful deletion of subscription for NSSAI Availability notification) + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + + default: + description: Unexpected error + + /nssai-availability: + options: + summary: Discover communication options supported by NSSF for NSSAI Availability + operationId: NSSAIAvailabilityOptions + tags: + - NSSAI Availability Store + responses: + '200': + description: OK + headers: + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '405': + $ref: 'TS29571_CommonData.yaml#/components/responses/405' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnssf-nssaiavailability: Access to the Nnssf_NSSAIAvailability API + + schemas: + NssaiAvailabilityInfo: + type: object + required: + - supportedNssaiAvailabilityData + properties: + supportedNssaiAvailabilityData: + type: array + items: + $ref: '#/components/schemas/SupportedNssaiAvailabilityData' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + amfSetId: + type: string + pattern: '^[0-9]{3}-[0-9]{2-3}-[A-Fa-f0-9]{2}-[0-3][A-Fa-f0-9]{2}$' + + SupportedNssaiAvailabilityData: + type: object + required: + - tai + - supportedSnssaiList + properties: + tai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + supportedSnssaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + taiRangeList: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/TaiRange' + minItems: 1 + + AuthorizedNssaiAvailabilityData: + type: object + required: + - tai + - supportedSnssaiList + properties: + tai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + supportedSnssaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + restrictedSnssaiList: + type: array + items: + $ref: '#/components/schemas/RestrictedSnssai' + minItems: 1 + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + taiRangeList: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/TaiRange' + minItems: 1 + + RestrictedSnssai: + type: object + required: + - homePlmnId + - sNssaiList + properties: + homePlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + sNssaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + homePlmnIdList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + + AuthorizedNssaiAvailabilityInfo: + type: object + required: + - authorizedNssaiAvailabilityData + properties: + authorizedNssaiAvailabilityData: + type: array + items: + $ref: '#/components/schemas/AuthorizedNssaiAvailabilityData' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + + NssfEventSubscriptionCreateData: + type: object + required: + - nfNssaiAvailabilityUri + - taiList + - event + properties: + nfNssaiAvailabilityUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + event: + $ref: '#/components/schemas/NssfEventType' + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + amfSetId: + type: string + pattern: '^[0-9]{3}-[0-9]{2-3}-[A-Fa-f0-9]{2}-[0-3][A-Fa-f0-9]{2}$' + + NssfEventSubscriptionCreatedData: + type: object + required: + - subscriptionId + properties: + subscriptionId: + type: string + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + authorizedNssaiAvailabilityData: + type: array + items: + $ref: '#/components/schemas/AuthorizedNssaiAvailabilityData' + minItems: 1 + + NssfEventNotification: + type: object + required: + - subscriptionId + - authorizedNssaiAvailabilityData + properties: + subscriptionId: + type: string + authorizedNssaiAvailabilityData: + type: array + items: + $ref: '#/components/schemas/AuthorizedNssaiAvailabilityData' + minItems: 1 + NssfEventType: + anyOf: + - type: string + enum: + - SNSSAI_STATUS_CHANGE_REPORT + - type: string + PatchDocument: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + minItems: 1 diff --git a/lib/sbi/support/standard/TS29531_Nnssf_NSSelection.yaml b/lib/sbi/support/standard/TS29531_Nnssf_NSSelection.yaml new file mode 100644 index 000000000..54d34c0e5 --- /dev/null +++ b/lib/sbi/support/standard/TS29531_Nnssf_NSSelection.yaml @@ -0,0 +1,322 @@ +openapi: 3.0.0 + +info: + version: '2.1.0.alpha-2' + title: 'NSSF NS Selection' + description: | + NSSF Network Slice Selection Service. + © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +security: + - {} + - oAuth2ClientCredentials: + - nnssf-nsselection +servers: + - url: '{apiRoot}/nnssf-nsselection/v2' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +externalDocs: + description: 3GPP TS 29.531 V16.2.0; 5G System; Network Slice Selection Services; Stage 3 + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.531/ +paths: + /network-slice-information: + get: + summary: Retrieve the Network Slice Selection Information + tags: + - Network Slice Information (Document) + operationId: NSSelectionGet + parameters: + - name: nf-type + in: query + description: NF type of the NF service consumer + required: true + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + - name: nf-id + in: query + description: NF Instance ID of the NF service consumer + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: slice-info-request-for-registration + in: query + description: Requested network slice information during Registration procedure + content: + application/json: + schema: + $ref: '#/components/schemas/SliceInfoForRegistration' + - name: slice-info-request-for-pdu-session + in: query + description: Requested network slice information during PDU session establishment procedure + content: + application/json: + schema: + $ref: '#/components/schemas/SliceInfoForPDUSession' + - name: slice-info-request-for-ue-cu + in: query + description: Requested network slice information during UE confuguration update procedure + content: + application/json: + schema: + $ref: '#/components/schemas/SliceInfoForUEConfigurationUpdate' + - name: home-plmn-id + in: query + description: PLMN ID of the HPLMN + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + - name: tai + in: query + description: TAI of the UE + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + - name: supported-features + in: query + description: Features required to be supported by the NFs in the target slice instance + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + + responses: + '200': + description: OK (Successful Network Slice Selection) + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizedNetworkSliceInfo' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnssf-nsselection: Access to the Nnssf_NSSelection API + schemas: + AuthorizedNetworkSliceInfo: + type: object + properties: + allowedNssaiList: + type: array + items: + $ref: '#/components/schemas/AllowedNssai' + minItems: 1 + configuredNssai: + type: array + items: + $ref: '#/components/schemas/ConfiguredSnssai' + minItems: 1 + targetAmfSet: + type: string + pattern: '^[0-9]{3}-[0-9]{2-3}-[A-Fa-f0-9]{2}-[0-3][A-Fa-f0-9]{2}$' + candidateAmfList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + rejectedNssaiInPlmn: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + rejectedNssaiInTa: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + nsiInformation: + $ref: '#/components/schemas/NsiInformation' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + nrfAmfSet: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nrfAmfSetNfMgtUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nrfAmfSetAccessTokenUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + targetAmfServiceSet: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' + + SubscribedSnssai: + type: object + required: + - subscribedSnssai + properties: + subscribedSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + defaultIndication: + type: boolean + + + AllowedSnssai: + type: object + required: + - allowedSnssai + properties: + allowedSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + nsiInformationList: + type: array + items: + $ref: '#/components/schemas/NsiInformation' + minItems: 1 + mappedHomeSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + + AllowedNssai: + type: object + required: + - allowedSnssaiList + - accessType + properties: + allowedSnssaiList: + type: array + items: + $ref: '#/components/schemas/AllowedSnssai' + minItems: 1 + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + + NsiInformation: + type: object + required: + - nrfId + properties: + nrfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nsiId: + $ref: '#/components/schemas/NsiId' + nrfNfMgtUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nrfAccessTokenUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + + MappingOfSnssai: + type: object + required: + - servingSnssai + - homeSnssai + properties: + servingSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + homeSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + + + SliceInfoForRegistration: + type: object + properties: + subscribedNssai: + type: array + items: + $ref: '#/components/schemas/SubscribedSnssai' + minItems: 1 + allowedNssaiCurrentAccess: + $ref: '#/components/schemas/AllowedNssai' + allowedNssaiOtherAccess: + $ref: '#/components/schemas/AllowedNssai' + sNssaiForMapping: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + requestedNssai: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + defaultConfiguredSnssaiInd: + type: boolean + mappingOfNssai: + type: array + items: + $ref: '#/components/schemas/MappingOfSnssai' + minItems: 1 + requestMapping: + type: boolean + + SliceInfoForPDUSession: + type: object + required: + - sNssai + - roamingIndication + properties: + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + roamingIndication: + $ref: '#/components/schemas/RoamingIndication' + homeSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + + SliceInfoForUEConfigurationUpdate: + type: object + properties: + subscribedNssai: + type: array + items: + $ref: '#/components/schemas/SubscribedSnssai' + minItems: 1 + allowedNssaiCurrentAccess: + $ref: '#/components/schemas/AllowedNssai' + allowedNssaiOtherAccess: + $ref: '#/components/schemas/AllowedNssai' + defaultConfiguredSnssaiInd: + type: boolean + requestedNssai: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + mappingOfNssai: + type: array + items: + $ref: '#/components/schemas/MappingOfSnssai' + minItems: 1 + + ConfiguredSnssai: + type: object + required: + - configuredSnssai + properties: + configuredSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + mappedHomeSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + + + RoamingIndication: + anyOf: + - type: string + enum: + - NON_ROAMING + - LOCAL_BREAKOUT + - HOME_ROUTED_ROAMING + - type: string + NsiId: + type: string diff --git a/lib/sbi/support/standard/TS32291_Nchf_ConvergedCharging.yaml b/lib/sbi/support/standard/TS32291_Nchf_ConvergedCharging.yaml new file mode 100644 index 000000000..fdb7fe06e --- /dev/null +++ b/lib/sbi/support/standard/TS32291_Nchf_ConvergedCharging.yaml @@ -0,0 +1,1261 @@ +openapi: 3.0.0 +info: + title: Nchf_ConvergedCharging + version: 3.0.0.alpha-2 + description: | + ConvergedCharging Service © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: > + 3GPP TS 32.291 V16.2.0: Telecommunication management; Charging management; + 5G system, charging service; Stage 3. + url: 'http://www.3gpp.org/ftp/Specs/archive/32_series/32.291/' +servers: + - url: '{apiRoot}/nchf-convergedcharging/v2' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +paths: + /chargingdata: + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + myNotification: + '{$request.body#/notifyUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingNotifyRequest' + responses: + '204': + description: 'No Content, Notification was succesfull' + '400': + description: Bad request + content: + application/json: + schema: + $ref: >- + TS29571_CommonData.yaml#/components/schemas/ProblemDetails + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + '/chargingdata/{ChargingDataRef}/update': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + parameters: + - name: ChargingDataRef + in: path + description: a unique identifier for a charging data resource in a PLMN + required: true + schema: + type: string + responses: + '200': + description: OK. Updated Charging Data resource is returned + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + '/chargingdata/{ChargingDataRef}/release': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + parameters: + - name: ChargingDataRef + in: path + description: a unique identifier for a charging data resource in a PLMN + required: true + schema: + type: string + responses: + '204': + description: No Content. + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + schemas: + ChargingDataRequest: + type: object + properties: + subscriberIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + nfConsumerIdentification: + $ref: '#/components/schemas/NFIdentification' + invocationTimeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + invocationSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + oneTimeEvent: + type: boolean + oneTimeEventType: + $ref: '#/components/schemas/oneTimeEventType' + notifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + serviceSpecificationInfo: + type: string + multipleUnitUsage: + type: array + items: + $ref: '#/components/schemas/MultipleUnitUsage' + minItems: 0 + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + pDUSessionChargingInformation: + $ref: '#/components/schemas/PDUSessionChargingInformation' + roamingQBCInformation: + $ref: '#/components/schemas/RoamingQBCInformation' + sMSChargingInformation: + $ref: '#/components/schemas/SMSChargingInformation' + nEFChargingInformation: + $ref: '#/components/schemas/NEFChargingInformation' + registrationChargingInformation: + $ref: '#/components/schemas/RegistrationChargingInformation' + n2ConnectionChargingInformation: + $ref: '#/components/schemas/N2ConnectionChargingInformation' + locationReportingChargingInformation: + $ref: '#/components/schemas/LocationReportingChargingInformation' + required: + - nfConsumerIdentification + - invocationTimeStamp + - invocationSequenceNumber + ChargingDataResponse: + type: object + properties: + invocationTimeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + invocationSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + invocationResult: + $ref: '#/components/schemas/InvocationResult' + sessionFailover: + $ref: '#/components/schemas/SessionFailover' + multipleUnitInformation: + type: array + items: + $ref: '#/components/schemas/MultipleUnitInformation' + minItems: 0 + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + pDUSessionChargingInformation: + $ref: '#/components/schemas/PDUSessionChargingInformation' + roamingQBCInformation: + $ref: '#/components/schemas/RoamingQBCInformation' + required: + - invocationTimeStamp + - invocationSequenceNumber + ChargingNotifyRequest: + type: object + properties: + notificationType: + $ref: '#/components/schemas/NotificationType' + reauthorizationDetails: + type: array + items: + $ref: '#/components/schemas/ReauthorizationDetails' + minItems: 0 + required: + - notificationType + ChargingNotifyResponse: + type: object + properties: + invocationResult: + $ref: '#/components/schemas/InvocationResult' + NFIdentification: + type: object + properties: + nFName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nFIPv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + nFIPv6Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + nFPLMNID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + nodeFunctionality: + $ref: '#/components/schemas/NodeFunctionality' + nFFqdn: + type: string + required: + - nodeFunctionality + MultipleUnitUsage: + type: object + properties: + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + requestedUnit: + $ref: '#/components/schemas/RequestedUnit' + usedUnitContainer: + type: array + items: + $ref: '#/components/schemas/UsedUnitContainer' + minItems: 0 + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + required: + - ratingGroup + InvocationResult: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + failureHandling: + $ref: '#/components/schemas/FailureHandling' + Trigger: + type: object + properties: + triggerType: + $ref: '#/components/schemas/TriggerType' + triggerCategory: + $ref: '#/components/schemas/TriggerCategory' + timeLimit: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + volumeLimit: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + volumeLimit64: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + maxNumberOfccc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + required: + - triggerType + - triggerCategory + MultipleUnitInformation: + type: object + properties: + resultCode: + $ref: '#/components/schemas/ResultCode' + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + grantedUnit: + $ref: '#/components/schemas/GrantedUnit' + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + validityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + quotaHoldingTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + finalUnitIndication: + $ref: '#/components/schemas/FinalUnitIndication' + timeQuotaThreshold: + type: integer + volumeQuotaThreshold: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + unitQuotaThreshold: + type: integer + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + required: + - ratingGroup + RequestedUnit: + type: object + properties: + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + UsedUnitContainer: + type: object + properties: + serviceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceId' + quotaManagementIndicator: + $ref: '#/components/schemas/QuotaManagementIndicator' + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + triggerTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + eventTimeStamps: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + localSequenceNumber: + type: integer + pDUContainerInformation: + $ref: '#/components/schemas/PDUContainerInformation' + required: + - localSequenceNumber + GrantedUnit: + type: object + properties: + tariffTimeChange: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + FinalUnitIndication: + type: object + properties: + finalUnitAction: + $ref: '#/components/schemas/FinalUnitAction' + restrictionFilterRule: + $ref: '#/components/schemas/IPFilterRule' + filterId: + type: string + redirectServer: + $ref: '#/components/schemas/RedirectServer' + required: + - finalUnitAction + RedirectServer: + type: object + properties: + redirectAddressType: + $ref: '#/components/schemas/RedirectAddressType' + redirectServerAddress: + type: string + required: + - redirectAddressType + - redirectServerAddress + ReauthorizationDetails: + type: object + properties: + serviceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceId' + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + quotaManagementIndicator: + $ref: '#/components/schemas/QuotaManagementIndicator' + PDUSessionChargingInformation: + type: object + properties: + chargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + homeProvidedChargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + pduSessionInformation: + $ref: '#/components/schemas/PDUSessionInformation' + unitCountInactivityTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + rANSecondaryRATUsageReport: + $ref: '#/components/schemas/RANSecondaryRATUsageReport' + required: + - pduSessionInformation + UserInformation: + type: object + properties: + servedGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + servedPEI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + unauthenticatedFlag: + type: boolean + roamerInOut: + $ref: '#/components/schemas/RoamerInOut' + PDUSessionInformation: + type: object + properties: + networkSlicingInfo: + $ref: '#/components/schemas/NetworkSlicingInfo' + pduSessionID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + pduType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + sscMode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SscMode' + hPlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + servingNetworkFunctionID: + $ref: '#/components/schemas/ServingNetworkFunctionID' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + dnnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + dnnSelectionMode: + $ref: '#/components/schemas/dnnSelectionMode' + chargingCharacteristics: + type: string + chargingCharacteristicsSelectionMode: + $ref: '#/components/schemas/ChargingCharacteristicsSelectionMode' + startTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + stopTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + sessionStopIndicator: + type: boolean + pduAddress: + $ref: '#/components/schemas/PDUAddress' + diagnostics: + $ref: '#/components/schemas/Diagnostics' + authorizedQoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/AuthorizedDefaultQos' + subscribedQoSInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SubscribedDefaultQos' + authorizedSessionAMBR: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + subscribedSessionAMBR: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + servingCNPlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + required: + - pduSessionID + - dnnId + PDUContainerInformation: + type: object + properties: + timeofFirstUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofLastUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosData' + qoSCharacteristics: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosCharacteristics' + afChargingIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + userLocationInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + servingNodeID: + type: array + items: + $ref: '#/components/schemas/ServingNetworkFunctionID' + minItems: 0 + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + sponsorIdentity: + type: string + applicationserviceProviderIdentity: + type: string + chargingRuleBaseName: + type: string + NetworkSlicingInfo: + type: object + properties: + sNSSAI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + required: + - sNSSAI + PDUAddress: + type: object + properties: + pduIPv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + pduIPv6AddresswithPrefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + pduAddressprefixlength: + type: integer + iPv4dynamicAddressFlag: + type: boolean + iPv6dynamicPrefixFlag: + type: boolean + ServingNetworkFunctionID: + type: object + properties: + + servingNetworkFunctionInformation: + $ref: '#/components/schemas/NFIdentification' + aMFId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfId' + required: + - servingNetworkFunctionInformation + RoamingQBCInformation: + type: object + properties: + multipleQFIcontainer: + type: array + items: + $ref: '#/components/schemas/MultipleQFIcontainer' + minItems: 0 + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + roamingChargingProfile: + $ref: '#/components/schemas/RoamingChargingProfile' + MultipleQFIcontainer: + type: object + properties: + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + triggerTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + localSequenceNumber: + type: integer + qFIContainerInformation: + $ref: '#/components/schemas/QFIContainerInformation' + required: + - localSequenceNumber + QFIContainerInformation: + type: object + properties: + qFI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + reportTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofFirstUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofLastUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosData' + qoSCharacteristics: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosCharacteristics' + userLocationInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + servingNetworkFunctionID: + type: array + items: + $ref: '#/components/schemas/ServingNetworkFunctionID' + minItems: 0 + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + 3gppChargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + diagnostics: + $ref: '#/components/schemas/Diagnostics' + enhancedDiagnostics: + type: array + items: + type: string + required: + - reportTime + RoamingChargingProfile: + type: object + properties: + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + partialRecordMethod: + $ref: '#/components/schemas/PartialRecordMethod' + SMSChargingInformation: + type: object + properties: + originatorInfo: + $ref: '#/components/schemas/OriginatorInfo' + recipientInfo: + type: array + items: + $ref: '#/components/schemas/RecipientInfo' + minItems: 0 + userEquipmentInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + sMSCAddress: + type: string + sMDataCodingScheme: + type: integer + sMMessageType: + $ref: '#/components/schemas/SMMessageType' + sMReplyPathRequested: + $ref: '#/components/schemas/ReplyPathRequested' + sMUserDataHeader: + type: string + sMStatus: + type: string + sMDischargeTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + numberofMessagesSent: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + sMServiceType: + $ref: '#/components/schemas/SMServiceType' + sMSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + sMSresult: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + submissionTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + sMPriority: + $ref: '#/components/schemas/SMPriority' + messageReference: + type: string + messageSize: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + messageClass: + $ref: '#/components/schemas/MessageClass' + deliveryReportRequested: + $ref: '#/components/schemas/DeliveryReportRequested' + OriginatorInfo: + type: object + properties: + originatorSUPI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + originatorGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + originatorOtherAddress: + $ref: '#/components/schemas/SMAddressInfo' + originatorReceivedAddress: + $ref: '#/components/schemas/SMAddressInfo' + originatorSCCPAddress: + type: string + sMOriginatorInterface: + $ref: '#/components/schemas/SMInterface' + sMOriginatorProtocolId: + type: string + RecipientInfo: + type: object + properties: + recipientSUPI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + recipientGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + recipientOtherAddress: + $ref: '#/components/schemas/SMAddressInfo' + recipientReceivedAddress: + $ref: '#/components/schemas/SMAddressInfo' + recipientSCCPAddress: + type: string + sMDestinationInterface: + $ref: '#/components/schemas/SMInterface' + sMrecipientProtocolId: + type: string + SMAddressInfo: + type: object + properties: + sMaddressType: + $ref: '#/components/schemas/SMAddressType' + sMaddressData: + type: string + sMaddressDomain: + $ref: '#/components/schemas/SMAddressDomain' + RecipientAddress: + type: object + properties: + recipientAddressInfo: + $ref: '#/components/schemas/SMAddressInfo' + sMaddresseeType: + $ref: '#/components/schemas/SMAddresseeType' + MessageClass: + type: object + properties: + classIdentifier: + $ref: '#/components/schemas/ClassIdentifier' + tokenText: + type: string + SMAddressDomain: + type: object + properties: + domainName: + type: string + 3GPPIMSIMCCMNC: + type: string + SMInterface: + type: object + properties: + interfaceId: + type: string + interfaceText: + type: string + interfacePort: + type: string + interfaceType: + $ref: '#/components/schemas/InterfaceType' + RANSecondaryRATUsageReport: + type: object + properties: + rANSecondaryRATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + qosFlowsUsageReports: + type: array + items: + $ref: '#/components/schemas/QosFlowsUsageReport' + Diagnostics: + type: integer + IPFilterRule: + type: string + QosFlowsUsageReport: + type: object + properties: + qFI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + startTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + NEFChargingInformation: + type: object + properties: + groupIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + aPIDirection: + $ref: '#/components/schemas/APIDirection' + aPITargetNetworkFunction: + $ref: '#/components/schemas/NFIdentification' + aPIResultCode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + aPIName: + type: string + aPIReference: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + aPIContent: + type: string + required: + - aPIName + RegistrationChargingInformation: + type: object + properties: + registrationMessagetype: + $ref: '#/components/schemas/RegistrationMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + 5GMMCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + mICOModeIndication: + $ref: '#/components/schemas/MICOModeIndication' + smsIndication: + $ref: '#/components/schemas/SmsIndication' + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 0 + serviceAreaRestriction: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + minItems: 0 + requestedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + allowedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + rejectedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + required: + - registrationMessagetype + N2ConnectionChargingInformation: + type: object + properties: + n2ConnectionMessageType: + $ref: '#/components/schemas/N2ConnectionMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + amfUeNgapId: + type: integer + ranUeNgapId: + type: integer + ranNodeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + restrictedRatList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 0 + forbiddenAreaList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Area' + minItems: 0 + serviceAreaRestriction: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + minItems: 0 + restrictedCnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/CoreNetworkType' + minItems: 0 + allowedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + rrcEstCause: + type: string + pattern: '^[0-9a-fA-F]+$' + required: + - n2ConnectionMessageType + LocationReportingChargingInformation: + type: object + properties: + locationReportingMessageType: + $ref: '#/components/schemas/LocationReportingMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + required: + - locationReportingMessageType + N2ConnectionMessageType: + type: integer + LocationReportingMessageType: + type: integer + NotificationType: + anyOf: + - type: string + enum: + - REAUTHORIZATION + - ABORT_CHARGING + - type: string + NodeFunctionality: + anyOf: + - type: string + enum: + - SMF + - SMSF + - SGW + - I_SMF + - type: string + ChargingCharacteristicsSelectionMode: + anyOf: + - type: string + enum: + - HOME_DEFAULT + - ROAMING_DEFAULT + - VISITING_DEFAULT + - type: string + TriggerType: + anyOf: + - type: string + enum: + - QUOTA_THRESHOLD + - QHT + - FINAL + - QUOTA_EXHAUSTED + - VALIDITY_TIME + - OTHER_QUOTA_TYPE + - FORCED_REAUTHORISATION + - UNUSED_QUOTA_TIMER # Included for backwards compatibility, shall not be used + - UNIT_COUNT_INACTIVITY_TIMER + - ABNORMAL_RELEASE + - QOS_CHANGE + - VOLUME_LIMIT + - TIME_LIMIT + - PLMN_CHANGE + - USER_LOCATION_CHANGE + - RAT_CHANGE + - SESSION_AMBR_CHANGE + - UE_TIMEZONE_CHANGE + - TARIFF_TIME_CHANGE + - MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS + - MANAGEMENT_INTERVENTION + - CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA + - CHANGE_OF_3GPP_PS_DATA_OFF_STATUS + - SERVING_NODE_CHANGE + - REMOVAL_OF_UPF + - ADDITION_OF_UPF + - INSERTION_OF_ISMF + - REMOVAL_OF_ISMF + - CHANGE_OF_ISMF + - START_OF_SERVICE_DATA_FLOW + - ECGI_CHANGE + - TAI_CHANGE + - HANDOVER_CANCEL + - HANDOVER_START + - HANDOVER_COMPLETE + - GFBR_GUARANTEED_STATUS_CHANGE + - type: string + FinalUnitAction: + anyOf: + - type: string + enum: + - TERMINATE + - REDIRECT + - RESTRICT_ACCESS + - type: string + RedirectAddressType: + anyOf: + - type: string + enum: + - IPV4 + - IPV6 + - URL + - type: string + TriggerCategory: + anyOf: + - type: string + enum: + - IMMEDIATE_REPORT + - DEFERRED_REPORT + - type: string + QuotaManagementIndicator: + anyOf: + - type: string + enum: + - ONLINE_CHARGING + - OFFLINE_CHARGING + - type: string + FailureHandling: + anyOf: + - type: string + enum: + - TERMINATE + - CONTINUE + - RETRY_AND_TERMINATE + - type: string + SessionFailover: + anyOf: + - type: string + enum: + - FAILOVER_NOT_SUPPORTED + - FAILOVER_SUPPORTED + - type: string + 3GPPPSDataOffStatus: + anyOf: + - type: string + enum: + - ACTIVE + - INACTIVE + - type: string + ResultCode: + anyOf: + - type: string + enum: + - SUCCESS + - END_USER_SERVICE_DENIED + - QUOTA_MANAGEMENT_NOT_APPLICABLE + - QUOTA_LIMIT_REACHED + - END_USER_SERVICE_REJECTED + - USER_UNKNOWN + - RATING_FAILED + - type: string + PartialRecordMethod: + anyOf: + - type: string + enum: + - DEFAULT + - INDIVIDUAL + - type: string + RoamerInOut: + anyOf: + - type: string + enum: + - IN_BOUND + - OUT_BOUND + - type: string + SMMessageType: + anyOf: + - type: string + enum: + - SUBMISSION + - DELIVERY_REPORT + - SM_SERVICE_REQUEST + - type: string + SMPriority: + anyOf: + - type: string + enum: + - LOW + - NORMAL + - HIGH + - type: string + DeliveryReportRequested: + anyOf: + - type: string + enum: + - YES + - NO + - type: string + InterfaceType: + anyOf: + - type: string + enum: + - UNKNOWN + - MOBILE_ORIGINATING + - MOBILE_TERMINATING + - APPLICATION_ORIGINATING + - APPLICATION_TERMINATING + - type: string + ClassIdentifier: + anyOf: + - type: string + enum: + - PERSONAL + - ADVERTISEMENT + - INFORMATIONAL + - AUTO + - type: string + SMAddressType: + anyOf: + - type: string + enum: + - EMAIL_ADDRESS + - MSISDN + - IPV4_ADDRESS + - IPV6_ADDRESS + - NUMERIC_SHORTCODE + - ALPHANUMERIC_SHORTCODE + - OTHER + - IMSI + - type: string + SMAddresseeType: + anyOf: + - type: string + enum: + - TO + - CC + - BCC + - type: string + SMServiceType: + anyOf: + - type: string + enum: + - VAS4SMS_SHORT_MESSAGE_CONTENT_PROCESSING + - VAS4SMS_SHORT_MESSAGE_FORWARDING + - VAS4SMS_SHORT_MESSAGE_FORWARDING_MULTIPLE_SUBSCRIPTIONS + - VAS4SMS_SHORT_MESSAGE_FILTERING + - VAS4SMS_SHORT_MESSAGE_RECEIPT + - VAS4SMS_SHORT_MESSAGE_NETWORK_STORAGE + - VAS4SMS_SHORT_MESSAGE_TO_MULTIPLE_DESTINATIONS + - VAS4SMS_SHORT_MESSAGE_VIRTUAL_PRIVATE_NETWORK(VPN) + - VAS4SMS_SHORT_MESSAGE_AUTO_REPLY + - VAS4SMS_SHORT_MESSAGE_PERSONAL_SIGNATURE + - VAS4SMS_SHORT_MESSAGE_DEFERRED_DELIVERY + - type: string + ReplyPathRequested: + anyOf: + - type: string + enum: + - NO_REPLY_PATH_SET + - REPLY_PATH_SET + - type: string + oneTimeEventType: + anyOf: + - type: string + enum: + - IEC + - PEC + - type: string + dnnSelectionMode: + anyOf: + - type: string + enum: + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + - type: string + APIDirection: + anyOf: + - type: string + enum: + - INVOCATION + - NOTIFICATION + - type: string + RegistrationMessageType: + anyOf: + - type: string + enum: + - INITIAL + - MOBILITY + - PERIODIC + - EMERGENCY + - DEREGISTRATION + - type: string + MICOModeIndication: + anyOf: + - type: string + enum: + - MICO_MODE + - NO_MICO_MODE + - type: string + SmsIndication: + anyOf: + - type: string + enum: + - SMS_SUPPORTED + - SMS_NOT_SUPPORTED + - type: string diff --git a/src/amf/amf-sm.c b/src/amf/amf-sm.c index 361bed7ce..7902a284a 100644 --- a/src/amf/amf-sm.c +++ b/src/amf/amf-sm.c @@ -20,6 +20,7 @@ #include "sbi-path.h" #include "nas-path.h" #include "nnrf-handler.h" +#include "namf-handler.h" #include "ngap-path.h" #include "nas-security.h" @@ -43,6 +44,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) { int rv; char buf[OGS_ADDRSTRLEN]; + const char *api_version = NULL; ogs_sock_t *sock = NULL; ogs_sockaddr_t *addr = NULL; @@ -56,7 +58,9 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) ogs_nas_5gs_message_t nas_message; ran_ue_t *ran_ue = NULL; amf_ue_t *amf_ue = NULL; + amf_sess_t *sess = NULL; + ogs_sbi_object_t *sbi_object = NULL; ogs_sbi_session_t *session = NULL; ogs_sbi_request_t *sbi_request = NULL; @@ -104,7 +108,16 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) break; } - if (strcmp(sbi_message.h.api.version, OGS_SBI_API_VERSION) != 0) { + SWITCH(sbi_message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + api_version = OGS_SBI_API_V2; + break; + DEFAULT + api_version = OGS_SBI_API_V1; + END + + ogs_assert(api_version); + if (strcmp(sbi_message.h.api.version, api_version) != 0) { ogs_error("Not supported version [%s]", sbi_message.h.api.version); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, "Not supported version", NULL); @@ -126,7 +139,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) ogs_error("Invalid HTTP method [%s]", sbi_message.h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &sbi_message, "Invalid HTTP method", sbi_message.h.method); END @@ -136,8 +149,81 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) ogs_error("Invalid resource name [%s]", sbi_message.h.resource.component[0]); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &sbi_message, - "Unknown resource name", + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "Invalid resource name", + sbi_message.h.resource.component[0]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NUDM_UECM) + SWITCH(sbi_message.h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_DEREG_NOTIFY) + SWITCH(sbi_message.h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + ogs_error("Dereg-notify Not implemented"); + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", + sbi_message.h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_FORBIDDEN, + &sbi_message, + "Invalid HTTP method", sbi_message.h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message.h.resource.component[0]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "Invalid resource name", + sbi_message.h.resource.component[0]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM) + SWITCH(sbi_message.h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXTS) + SWITCH(sbi_message.h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES) + SWITCH(sbi_message.h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + rv = amf_namf_comm_handle_n1_n2_message_transfer( + session, &sbi_message); + if (rv != OGS_OK) { + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "No N1N2MessageTransferReqData", NULL); + } + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", + sbi_message.h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &sbi_message, + "Invalid HTTP method", sbi_message.h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message.h.resource.component[2]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "Invalid resource name", + sbi_message.h.resource.component[2]); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message.h.resource.component[0]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "Invalid resource name", sbi_message.h.resource.component[0]); END break; @@ -145,7 +231,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) DEFAULT ogs_error("Invalid API name [%s]", sbi_message.h.service.name); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &sbi_message, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, "Invalid API name", sbi_message.h.resource.component[0]); END @@ -166,7 +252,16 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) break; } - if (strcmp(sbi_message.h.api.version, OGS_SBI_API_VERSION) != 0) { + SWITCH(sbi_message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + api_version = OGS_SBI_API_V2; + break; + DEFAULT + api_version = OGS_SBI_API_V1; + END + + ogs_assert(api_version); + if (strcmp(sbi_message.h.api.version, api_version) != 0) { ogs_error("Not supported version [%s]", sbi_message.h.api.version); ogs_sbi_message_free(&sbi_message); ogs_sbi_response_free(sbi_response); @@ -232,18 +327,18 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC) SWITCH(sbi_message.h.resource.component[0]) CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) - amf_ue = e->sbi.data; - ogs_assert(amf_ue); + sbi_object = e->sbi.data; + ogs_assert(sbi_object); SWITCH(sbi_message.h.method) CASE(OGS_SBI_HTTP_METHOD_GET) if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) { - ogs_timer_stop(amf_ue->sbi_client_wait.timer); + ogs_timer_stop(sbi_object->client_wait.timer); - amf_nnrf_handle_nf_discover(amf_ue, &sbi_message); + amf_nnrf_handle_nf_discover(sbi_object, &sbi_message); } else { - ogs_error("[%s] HTTP response error [%d]", - amf_ue->suci, sbi_message.res_status); + ogs_error("HTTP response error [%d]", + sbi_message.res_status); } break; @@ -261,6 +356,8 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) break; CASE(OGS_SBI_SERVICE_NAME_NAUSF_AUTH) + CASE(OGS_SBI_SERVICE_NAME_NUDM_UECM) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) amf_ue = e->sbi.data; ogs_assert(amf_ue); ogs_assert(OGS_FSM_STATE(&amf_ue->sm)); @@ -273,43 +370,26 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) amf_ue_remove(amf_ue); } break; -#if 0 - SWITCH(sbi_message.h.resource.component[0]) - CASE(OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS) - amf_ue = e->sbi.data; - ogs_assert(amf_ue); - SWITCH(sbi_message.h.method) - CASE(OGS_SBI_HTTP_METHOD_POST) - if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) { - ogs_timer_stop(amf_ue->sbi_client_wait.timer); + CASE(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION) + sess = e->sbi.data; + ogs_assert(sess); + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + ogs_assert(OGS_FSM_STATE(&amf_ue->sm)); - ogs_fatal("TODO"); - } else { - ogs_error("[%s] HTTP response error [%d]", - amf_ue->suci, sbi_message.res_status); - nas_5gs_send_nas_reject_from_sbi(amf_ue, - sbi_message.res_status); - } - break; + e->amf_ue = amf_ue; + e->sess = sess; + e->sbi.message = &sbi_message;; - DEFAULT - ogs_error("[%s] Invalid HTTP method [%s]", - amf_ue->suci, sbi_message.h.method); - ogs_assert_if_reached(); - END - break; - - DEFAULT - ogs_error("Invalid resource name [%s]", - sbi_message.h.resource.component[0]); - ogs_assert_if_reached(); - END + ogs_fsm_dispatch(&amf_ue->sm, e); + if (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_exception)) { + amf_ue_remove(amf_ue); + } break; -#endif DEFAULT - ogs_error("Invalid API name [%s]", sbi_message.h.service.name); + ogs_error("Invalid service name [%s]", sbi_message.h.service.name); ogs_assert_if_reached(); END @@ -347,12 +427,38 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) break; case AMF_TIMER_SBI_CLIENT_WAIT: - amf_ue = e->sbi.data; - ogs_assert(amf_ue); + sbi_object = e->sbi.data; + ogs_assert(sbi_object); - ogs_error("[%s] Cannot receive SBI message", amf_ue->suci); - nas_5gs_send_nas_reject_from_sbi(amf_ue, - OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + switch(sbi_object->nf_type) { + case OpenAPI_nf_type_AUSF: + case OpenAPI_nf_type_UDM: + amf_ue = (amf_ue_t *)sbi_object; + ogs_assert(amf_ue); + ogs_error("[%s] Cannot receive SBI message", amf_ue->suci); + nas_5gs_send_gmm_reject_from_sbi(amf_ue, + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + break; + + case OpenAPI_nf_type_SMF: + sess = (amf_sess_t *)sbi_object; + ogs_assert(sess); + ogs_error("[%d:%d] Cannot receive SBI message", + sess->psi, sess->pti); + if (sess->payload_container_type) { + nas_5gs_send_back_5gsm_message_from_sbi(sess, + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + } else { + ngap_send_error_indication2(amf_ue, + NGAP_Cause_PR_transport, + NGAP_CauseTransport_transport_resource_unavailable); + } + break; + + default: + ogs_fatal("Not implemented [%s]", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); + } break; default: ogs_error("Unknown timer[%s:%d]", @@ -439,7 +545,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) ogs_assert(gnb); ogs_assert(OGS_FSM_STATE(&gnb->sm)); - rc = ogs_ngap_decode(&ngap_message, pkbuf); + rc = nga_ngap_decode(&ngap_message, pkbuf); if (rc == OGS_OK) { e->gnb = gnb; e->ngap.message = &ngap_message; @@ -451,7 +557,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) NGAP_CauseProtocol_abstract_syntax_error_falsely_constructed_message); } - ogs_ngap_free(&ngap_message); + nga_ngap_free(&ngap_message); ogs_pkbuf_free(pkbuf); break; diff --git a/src/amf/amf-sm.h b/src/amf/amf-sm.h index b9b48e8a7..f98a54cf9 100644 --- a/src/amf/amf-sm.h +++ b/src/amf/amf-sm.h @@ -54,15 +54,6 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e); void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e); void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e); -void gsm_state_initial(ogs_fsm_t *s, amf_event_t *e); -void gsm_state_final(ogs_fsm_t *s, amf_event_t *e); -void gsm_state_inactive(ogs_fsm_t *s, amf_event_t *e); -void gsm_state_active(ogs_fsm_t *s, amf_event_t *e); -void gsm_state_pdn_will_disconnect(ogs_fsm_t *s, amf_event_t *e); -void gsm_state_pdn_did_disconnect(ogs_fsm_t *s, amf_event_t *e); -void gsm_state_bearer_deactivated(ogs_fsm_t *s, amf_event_t *e); -void gsm_state_exception(ogs_fsm_t *s, amf_event_t *e); - #define amf_sm_debug(__pe) \ ogs_debug("%s(): %s", __func__, amf_event_get_name(__pe)) diff --git a/src/amf/context.c b/src/amf/context.c index 0ac125cfd..ad2dfd9ac 100644 --- a/src/amf/context.c +++ b/src/amf/context.c @@ -23,7 +23,6 @@ static amf_context_t self; int __amf_log_domain; int __gmm_log_domain; -int __gsm_log_domain; static OGS_POOL(amf_gnb_pool, amf_gnb_t); static OGS_POOL(amf_ue_pool, amf_ue_t); @@ -45,7 +44,6 @@ void amf_context_init(void) ogs_log_install_domain(&__ogs_nas_domain, "nas", ogs_core()->log.level); ogs_log_install_domain(&__amf_log_domain, "amf", ogs_core()->log.level); ogs_log_install_domain(&__gmm_log_domain, "gmm", ogs_core()->log.level); - ogs_log_install_domain(&__gsm_log_domain, "gsm", ogs_core()->log.level); ogs_list_init(&self.ngap_list); ogs_list_init(&self.ngap_list6); @@ -64,7 +62,6 @@ void amf_context_init(void) self.gnb_addr_hash = ogs_hash_make(); self.gnb_id_hash = ogs_hash_make(); self.amf_ue_ngap_id_hash = ogs_hash_make(); - self.imsi_ue_hash = ogs_hash_make(); self.guti_ue_hash = ogs_hash_make(); self.suci_hash = ogs_hash_make(); self.supi_hash = ogs_hash_make(); @@ -86,8 +83,6 @@ void amf_context_final(void) ogs_assert(self.amf_ue_ngap_id_hash); ogs_hash_destroy(self.amf_ue_ngap_id_hash); - ogs_assert(self.imsi_ue_hash); - ogs_hash_destroy(self.imsi_ue_hash); ogs_assert(self.guti_ue_hash); ogs_hash_destroy(self.guti_ue_hash); ogs_assert(self.suci_hash); @@ -634,14 +629,13 @@ int amf_context_parse_config(void) if (sst) { s_nssai->sst = atoi(sst); - if (sd) { + if (sd) s_nssai->sd = ogs_uint24_from_string( (char*)sd); - } else { + else s_nssai->sd.v = OGS_S_NSSAI_NO_SD_VALUE; - } self.plmn_support[ self.num_of_plmn_support]. @@ -698,21 +692,21 @@ int amf_context_parse_config(void) if (v) { int integrity_index = self.num_of_integrity_order; - if (strcmp(v, "EIA0") == 0) { + if (strcmp(v, "NIA0") == 0) { self.integrity_order[integrity_index] = - OGS_NAS_SECURITY_ALGORITHMS_EIA0; + OGS_NAS_SECURITY_ALGORITHMS_NIA0; self.num_of_integrity_order++; - } else if (strcmp(v, "EIA1") == 0) { + } else if (strcmp(v, "NIA1") == 0) { self.integrity_order[integrity_index] = - OGS_NAS_SECURITY_ALGORITHMS_128_EIA1; + OGS_NAS_SECURITY_ALGORITHMS_128_NIA1; self.num_of_integrity_order++; - } else if (strcmp(v, "EIA2") == 0) { + } else if (strcmp(v, "NIA2") == 0) { self.integrity_order[integrity_index] = - OGS_NAS_SECURITY_ALGORITHMS_128_EIA2; + OGS_NAS_SECURITY_ALGORITHMS_128_NIA2; self.num_of_integrity_order++; - } else if (strcmp(v, "EIA3") == 0) { + } else if (strcmp(v, "NIA3") == 0) { self.integrity_order[integrity_index] = - OGS_NAS_SECURITY_ALGORITHMS_128_EIA3; + OGS_NAS_SECURITY_ALGORITHMS_128_NIA3; self.num_of_integrity_order++; } } @@ -740,21 +734,21 @@ int amf_context_parse_config(void) if (v) { int ciphering_index = self.num_of_ciphering_order; - if (strcmp(v, "EEA0") == 0) { + if (strcmp(v, "NEA0") == 0) { self.ciphering_order[ciphering_index] = - OGS_NAS_SECURITY_ALGORITHMS_EEA0; + OGS_NAS_SECURITY_ALGORITHMS_NEA0; self.num_of_ciphering_order++; - } else if (strcmp(v, "EEA1") == 0) { + } else if (strcmp(v, "NEA1") == 0) { self.ciphering_order[ciphering_index] = - OGS_NAS_SECURITY_ALGORITHMS_128_EEA1; + OGS_NAS_SECURITY_ALGORITHMS_128_NEA1; self.num_of_ciphering_order++; - } else if (strcmp(v, "EEA2") == 0) { + } else if (strcmp(v, "NEA2") == 0) { self.ciphering_order[ciphering_index] = - OGS_NAS_SECURITY_ALGORITHMS_128_EEA2; + OGS_NAS_SECURITY_ALGORITHMS_128_NEA2; self.num_of_ciphering_order++; - } else if (strcmp(v, "EEA3") == 0) { + } else if (strcmp(v, "NEA3") == 0) { self.ciphering_order[ciphering_index] = - OGS_NAS_SECURITY_ALGORITHMS_128_EEA3; + OGS_NAS_SECURITY_ALGORITHMS_128_NEA3; self.num_of_ciphering_order++; } } @@ -1064,18 +1058,6 @@ ran_ue_t *ran_ue_next_in_gnb(ran_ue_t *ran_ue) static int amf_ue_new_guti(amf_ue_t *amf_ue) { -#if 0 - served_guami_t *served_guami = NULL; - - ogs_assert(amf_ue); - ogs_assert(amf_self()->num_of_served_guami > 0); - - served_guami = &amf_self()->served_guami[0]; - - ogs_assert(served_guami->num_of_plmn_id > 0); - ogs_assert(served_guami->num_of_amf_gid > 0); - ogs_assert(served_guami->num_of_amf_code > 0); - if (amf_ue->m_tmsi) { /* AMF has a VALID GUTI * As such, we need to remove previous GUTI in hash table */ @@ -1086,17 +1068,15 @@ static int amf_ue_new_guti(amf_ue_t *amf_ue) memset(&amf_ue->guti, 0, sizeof(ogs_nas_5gs_guti_t)); - /* Use the first configured plmn_id and amf group id */ - ogs_nas_from_plmn_id(&amf_ue->guti.nas_plmn_id, &served_guami->plmn_id[0]); - amf_ue->guti.amf_gid = served_guami->amf_gid[0]; - amf_ue->guti.amf_code = served_guami->amf_code[0]; + ogs_assert(amf_ue->guami); + ogs_nas_from_plmn_id(&amf_ue->guti.nas_plmn_id, &amf_ue->guami->plmn_id); + memcpy(&amf_ue->guti.amf_id, &amf_ue->guami->amf_id, sizeof(ogs_amf_id_t)); amf_ue->m_tmsi = amf_m_tmsi_alloc(); ogs_assert(amf_ue->m_tmsi); amf_ue->guti.m_tmsi = *(amf_ue->m_tmsi); ogs_hash_set(self.guti_ue_hash, &amf_ue->guti, sizeof(ogs_nas_5gs_guti_t), amf_ue); -#endif return OGS_OK; } @@ -1117,11 +1097,9 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue) ogs_list_init(&amf_ue->sess_list); - /* Initialize NAS Context */ - amf_ue->nas.connection_identifier = OGS_NAS_SECURITY_BEARER_3GPP; - amf_ue->nas.ksi = 1; - - /* Initialize Abba */ + /* TODO : Hard-coded */ + amf_ue->guami = &amf_self()->served_guami[0]; + amf_ue->nas.access_type = OGS_ACCESS_TYPE_3GPP; amf_ue->abba_len = 2; /* Create New GUTI */ @@ -1134,7 +1112,7 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue) #endif /* Add All Timers */ - amf_ue->sbi_client_wait.timer = ogs_timer_add( + amf_ue->sbi.client_wait.timer = ogs_timer_add( self.timer_mgr, amf_timer_sbi_client_wait_expire, amf_ue); amf_ue->t3513.timer = ogs_timer_add( @@ -1146,6 +1124,9 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue) amf_ue->t3550.timer = ogs_timer_add( self.timer_mgr, amf_timer_t3550_expire, amf_ue); amf_ue->t3550.pkbuf = NULL; + amf_ue->t3555.timer = ogs_timer_add( + self.timer_mgr, amf_timer_t3555_expire, amf_ue); + amf_ue->t3555.pkbuf = NULL; amf_ue->t3560.timer = ogs_timer_add( self.timer_mgr, amf_timer_t3560_expire, amf_ue); amf_ue->t3560.pkbuf = NULL; @@ -1166,7 +1147,6 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue) void amf_ue_remove(amf_ue_t *amf_ue) { amf_event_t e; - int i; ogs_assert(amf_ue); @@ -1182,8 +1162,6 @@ void amf_ue_remove(amf_ue_t *amf_ue) &amf_ue->guti, sizeof(ogs_nas_5gs_guti_t), NULL); ogs_assert(amf_m_tmsi_free(amf_ue->m_tmsi) == OGS_OK); } - if (amf_ue->imsi_len != 0) - ogs_hash_set(self.imsi_ue_hash, amf_ue->imsi, amf_ue->imsi_len, NULL); if (amf_ue->suci) { ogs_hash_set(self.suci_hash, amf_ue->suci, strlen(amf_ue->suci), NULL); ogs_free(amf_ue->suci); @@ -1193,6 +1171,9 @@ void amf_ue_remove(amf_ue_t *amf_ue) ogs_free(amf_ue->supi); } + if (amf_ue->pei) + ogs_free(amf_ue->pei); + if (amf_ue->confirmation_url_for_5g_aka) ogs_free(amf_ue->confirmation_url_for_5g_aka); @@ -1204,23 +1185,22 @@ void amf_ue_remove(amf_ue_t *amf_ue) /* Delete All Timers */ CLEAR_AMF_UE_ALL_TIMERS(amf_ue); - ogs_timer_delete(amf_ue->sbi_client_wait.timer); ogs_timer_delete(amf_ue->t3513.timer); ogs_timer_delete(amf_ue->t3522.timer); ogs_timer_delete(amf_ue->t3550.timer); + ogs_timer_delete(amf_ue->t3555.timer); ogs_timer_delete(amf_ue->t3560.timer); ogs_timer_delete(amf_ue->t3570.timer); + /* Free SBI object memory */ + ogs_sbi_object_free(&amf_ue->sbi); + ogs_timer_delete(amf_ue->sbi.client_wait.timer); + amf_ue_deassociate(amf_ue); amf_sess_remove_all(amf_ue); amf_pdn_remove_all(amf_ue); - for (i = 0; i < OGS_SBI_MAX_NF_TYPE; i++) { - if (amf_ue->nf_types[i].nf_instance) - ogs_sbi_nf_instance_remove(amf_ue->nf_types[i].nf_instance); - } - ogs_pool_free(&amf_ue_pool, amf_ue); } @@ -1232,25 +1212,6 @@ void amf_ue_remove_all() amf_ue_remove(amf_ue); } -amf_ue_t *amf_ue_find_by_imsi_bcd(char *imsi_bcd) -{ - uint8_t imsi[OGS_MAX_IMSI_LEN]; - int imsi_len = 0; - - ogs_assert(imsi_bcd); - - ogs_bcd_to_buffer(imsi_bcd, imsi, &imsi_len); - - return amf_ue_find_by_imsi(imsi, imsi_len); -} - -amf_ue_t *amf_ue_find_by_imsi(uint8_t *imsi, int imsi_len) -{ - ogs_assert(imsi && imsi_len); - - return (amf_ue_t *)ogs_hash_get(self.imsi_ue_hash, imsi, imsi_len); -} - amf_ue_t *amf_ue_find_by_guti(ogs_nas_5gs_guti_t *guti) { ogs_assert(guti); @@ -1289,8 +1250,7 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message) ogs_nas_5gs_mobile_identity_guti_t *mobile_identity_guti = NULL; ogs_nas_5gs_guti_t nas_guti; - char imsi_bcd[OGS_MAX_IMSI_BCD_LEN+1]; - char *ueid = NULL; + char *suci = NULL; ogs_assert(message); @@ -1306,15 +1266,14 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message) case OGS_NAS_5GS_REGISTRATION_REQUEST: switch (mobile_identity_header->type) { case OGS_NAS_5GS_MOBILE_IDENTITY_SUCI: - ogs_nas_5gs_imsi_to_bcd(mobile_identity, imsi_bcd); - ueid = ogs_nas_5gs_ueid_from_mobile_identity(mobile_identity); - amf_ue = amf_ue_find_by_imsi_bcd(imsi_bcd); + suci = ogs_nas_5gs_suci_from_mobile_identity(mobile_identity); + amf_ue = amf_ue_find_by_suci(suci); if (amf_ue) { - ogs_trace("known UE by IMSI[%s]", imsi_bcd); + ogs_trace("[%s] known UE by SUCI", suci); } else { - ogs_trace("Unknown UE by IMSI[%s]", imsi_bcd); + ogs_trace("[%s] Unknown UE by SUCI", suci); } - ogs_free(ueid); + ogs_free(suci); break; case OGS_NAS_5GS_MOBILE_IDENTITY_GUTI: mobile_identity_guti = @@ -1418,38 +1377,33 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message) void amf_ue_set_suci(amf_ue_t *amf_ue, ogs_nas_5gs_mobile_identity_t *mobile_identity) { - char imsi_bcd[OGS_MAX_IMSI_BCD_LEN+1]; amf_ue_t *old_amf_ue = NULL; + char *suci = NULL; ogs_assert(amf_ue); ogs_assert(mobile_identity); - ogs_nas_5gs_imsi_to_bcd(mobile_identity, imsi_bcd); - - ogs_cpystrn(amf_ue->imsi_bcd, imsi_bcd, OGS_MAX_IMSI_BCD_LEN+1); - ogs_bcd_to_buffer(amf_ue->imsi_bcd, amf_ue->imsi, &amf_ue->imsi_len); + suci = ogs_nas_5gs_suci_from_mobile_identity(mobile_identity); + ogs_assert(suci); /* Check if OLD amf_ue_t is existed */ - old_amf_ue = amf_ue_find_by_imsi(amf_ue->imsi, amf_ue->imsi_len); + old_amf_ue = amf_ue_find_by_suci(suci); if (old_amf_ue) { /* Check if OLD amf_ue_t is different with NEW amf_ue_t */ if (ogs_pool_index(&amf_ue_pool, amf_ue) != ogs_pool_index(&amf_ue_pool, old_amf_ue)) { - ogs_warn("OLD UE Context Release [IMSI:%s]", amf_ue->imsi_bcd); + ogs_warn("[%s] OLD UE Context Release", suci); if (old_amf_ue->ran_ue) ran_ue_deassociate(old_amf_ue->ran_ue); amf_ue_remove(old_amf_ue); } } - ogs_hash_set(self.imsi_ue_hash, amf_ue->imsi, amf_ue->imsi_len, amf_ue); - if (amf_ue->suci) { ogs_hash_set(self.suci_hash, amf_ue->suci, strlen(amf_ue->suci), NULL); ogs_free(amf_ue->suci); } - amf_ue->suci = ogs_nas_5gs_ueid_from_mobile_identity(mobile_identity); - ogs_assert(amf_ue->suci); + amf_ue->suci = suci; ogs_hash_set(self.suci_hash, amf_ue->suci, strlen(amf_ue->suci), amf_ue); amf_ue->guti_present = 1; @@ -1472,9 +1426,9 @@ int amf_ue_have_indirect_tunnel(amf_ue_t *amf_ue) { amf_sess_t *sess = NULL; - sess = amf_sess_first(amf_ue); + sess = ogs_list_first(&amf_ue->sess_list); while (sess) { - amf_bearer_t *bearer = amf_bearer_first(sess); + amf_bearer_t *bearer = ogs_list_first(&sess->bearer_list); while (bearer) { if (AMF_HAVE_GNB_DL_INDIRECT_TUNNEL(bearer) || AMF_HAVE_GNB_UL_INDIRECT_TUNNEL(bearer) || @@ -1483,9 +1437,9 @@ int amf_ue_have_indirect_tunnel(amf_ue_t *amf_ue) return 1; } - bearer = amf_bearer_next(bearer); + bearer = ogs_list_next(bearer); } - sess = amf_sess_next(sess); + sess = ogs_list_next(sess); } return 0; @@ -1497,15 +1451,15 @@ int amf_ue_clear_indirect_tunnel(amf_ue_t *amf_ue) ogs_assert(amf_ue); - sess = amf_sess_first(amf_ue); + sess = ogs_list_first(&amf_ue->sess_list); while (sess) { - amf_bearer_t *bearer = amf_bearer_first(sess); + amf_bearer_t *bearer = ogs_list_first(&sess->bearer_list); while (bearer) { CLEAR_INDIRECT_TUNNEL(bearer); - bearer = amf_bearer_next(bearer); + bearer = ogs_list_next(bearer); } - sess = amf_sess_next(sess); + sess = ogs_list_next(sess); } return OGS_OK; @@ -1572,25 +1526,34 @@ void source_ue_deassociate_target_ue(ran_ue_t *ran_ue) } } -amf_sess_t *amf_sess_add(amf_ue_t *amf_ue, uint8_t pti) +amf_sess_t *amf_sess_add(amf_ue_t *amf_ue, uint8_t psi) { amf_sess_t *sess = NULL; +#if 0 amf_bearer_t *bearer = NULL; +#endif ogs_assert(amf_ue); - ogs_assert(pti != OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED); + ogs_assert(psi != OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED); ogs_pool_alloc(&amf_sess_pool, &sess); ogs_assert(sess); memset(sess, 0, sizeof *sess); +#if 0 ogs_list_init(&sess->bearer_list); +#endif sess->amf_ue = amf_ue; - sess->pti = pti; + sess->psi = psi; + sess->sbi.client_wait.timer = ogs_timer_add( + self.timer_mgr, amf_timer_sbi_client_wait_expire, sess); + +#if 0 bearer = amf_bearer_add(sess); ogs_assert(bearer); +#endif ogs_list_add(&amf_ue->sess_list, sess); @@ -1604,7 +1567,21 @@ void amf_sess_remove(amf_sess_t *sess) ogs_list_remove(&sess->amf_ue->sess_list, sess); +#if 0 amf_bearer_remove_all(sess); +#endif + + /* Free SBI object memory */ + ogs_sbi_object_free(&sess->sbi); + ogs_timer_delete(sess->sbi.client_wait.timer); + + if (sess->sm_context_ref) + ogs_free(sess->sm_context_ref); + + if (sess->payload_container) + ogs_pkbuf_free(sess->payload_container); + if (sess->dnn) + ogs_free(sess->dnn); OGS_NAS_CLEAR_DATA(&sess->ue_pco); OGS_TLV_CLEAR_DATA(&sess->pgw_pco); @@ -1615,32 +1592,24 @@ void amf_sess_remove(amf_sess_t *sess) void amf_sess_remove_all(amf_ue_t *amf_ue) { amf_sess_t *sess = NULL, *next_sess = NULL; - - sess = amf_sess_first(amf_ue); - while (sess) { - next_sess = amf_sess_next(sess); + ogs_assert(amf_ue); + + ogs_list_for_each_safe(&amf_ue->sess_list, next_sess, sess) amf_sess_remove(sess); - - sess = next_sess; - } } -amf_sess_t *amf_sess_find_by_pti(amf_ue_t *amf_ue, uint8_t pti) +amf_sess_t *amf_sess_find_by_psi(amf_ue_t *amf_ue, uint8_t psi) { amf_sess_t *sess = NULL; - sess = amf_sess_first(amf_ue); - while(sess) { - if (pti == sess->pti) - return sess; - - sess = amf_sess_next(sess); - } + ogs_list_for_each(&amf_ue->sess_list, sess) + if (psi == sess->psi) return sess; return NULL; } +#if 0 amf_sess_t *amf_sess_find_by_ebi(amf_ue_t *amf_ue, uint8_t ebi) { amf_bearer_t *bearer = NULL; @@ -1651,9 +1620,11 @@ amf_sess_t *amf_sess_find_by_ebi(amf_ue_t *amf_ue, uint8_t ebi) return NULL; } +#endif amf_sess_t *amf_sess_find_by_dnn(amf_ue_t *amf_ue, char *dnn) { +#if 0 amf_sess_t *sess = NULL; sess = amf_sess_first(amf_ue); @@ -1663,34 +1634,12 @@ amf_sess_t *amf_sess_find_by_dnn(amf_ue_t *amf_ue, char *dnn) sess = amf_sess_next(sess); } +#endif return NULL; } -amf_sess_t *amf_sess_first(amf_ue_t *amf_ue) -{ - return ogs_list_first(&amf_ue->sess_list); -} - -amf_sess_t *amf_sess_next(amf_sess_t *sess) -{ - return ogs_list_next(sess); -} - -unsigned int amf_sess_count(amf_ue_t *amf_ue) -{ - unsigned int count = 0; - amf_sess_t *sess = NULL; - - sess = amf_sess_first(amf_ue); - while (sess) { - sess = amf_sess_next(sess); - count++; - } - - return count; -} - +#if 0 amf_bearer_t *amf_bearer_add(amf_sess_t *sess) { amf_event_t e; @@ -2003,6 +1952,7 @@ int amf_bearer_set_inactive(amf_ue_t *amf_ue) return OGS_OK; } +#endif void amf_pdn_remove_all(amf_ue_t *amf_ue) { @@ -2104,6 +2054,37 @@ int amf_find_served_tai(ogs_5gs_tai_t *tai) return -1; } +ogs_s_nssai_t *amf_find_s_nssai( + ogs_plmn_id_t *served_plmn_id, ogs_nas_s_nssai_t *s_nssai) +{ + int i, j; + + ogs_assert(served_plmn_id); + ogs_assert(s_nssai); + + for (i = 0; i < amf_self()->num_of_plmn_support; i++) { + if (memcmp(&amf_self()->plmn_support[i].plmn_id, + served_plmn_id, OGS_PLMN_ID_LEN) != 0) + continue; + + for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { + if (amf_self()->plmn_support[i].s_nssai[j].sst != s_nssai->sst) + continue; + + if (s_nssai->length > 1 && + s_nssai->sd.v != OGS_S_NSSAI_NO_SD_VALUE) { + if (amf_self()->plmn_support[i].s_nssai[j].sd.v != + s_nssai->sd.v) + continue; + } + + return &amf_self()->plmn_support[i].s_nssai[j]; + } + } + + return NULL; +} + int amf_m_tmsi_pool_generate() { int i, j; diff --git a/src/amf/context.h b/src/amf/context.h index 0954323b1..8931ce855 100644 --- a/src/amf/context.h +++ b/src/amf/context.h @@ -37,7 +37,6 @@ extern "C" { extern int __amf_log_domain; extern int __gmm_log_domain; -extern int __gsm_log_domain; #undef OGS_LOG_DOMAIN #define OGS_LOG_DOMAIN __amf_log_domain @@ -46,7 +45,11 @@ typedef struct ran_ue_s ran_ue_t; typedef struct amf_ue_s amf_ue_t; typedef uint32_t amf_m_tmsi_t; -typedef uint32_t amf_p_tmsi_t; + +typedef struct amf_guami_s { + ogs_plmn_id_t plmn_id; + ogs_amf_id_t amf_id; +} amf_guami_t; typedef struct amf_context_s { ogs_queue_t *queue; /* Queue for processing UPF control */ @@ -57,10 +60,7 @@ typedef struct amf_context_s { /* Served GUAMI */ uint8_t num_of_served_guami; - struct { - ogs_plmn_id_t plmn_id; - ogs_amf_id_t amf_id; - } served_guami[MAX_NUM_OF_SERVED_GUAMI]; + amf_guami_t served_guami[MAX_NUM_OF_SERVED_GUAMI]; /* Served TAI */ uint8_t num_of_served_tai; @@ -111,7 +111,6 @@ typedef struct amf_context_s { ogs_hash_t *gnb_addr_hash; /* hash table for GNB Address */ ogs_hash_t *gnb_id_hash; /* hash table for GNB-ID */ ogs_hash_t *amf_ue_ngap_id_hash; /* hash table for AMF-UE-NGAP-ID */ - ogs_hash_t *imsi_ue_hash; /* hash table (IMSI : AMF_UE) */ ogs_hash_t *guti_ue_hash; /* hash table (GUTI : AMF_UE) */ ogs_hash_t *suci_hash; /* hash table (SUCI) */ ogs_hash_t *supi_hash; /* hash table (SUPI) */ @@ -189,52 +188,69 @@ struct ran_ue_s { amf_ue_t *amf_ue; }; +#define AMF_NF_INSTANCE_CLEAR(_cAUSE, _nFInstance) \ + do { \ + ogs_assert(_nFInstance); \ + if ((_nFInstance)->reference_count == 1) { \ + ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \ + amf_nf_fsm_fini((_nFInstance)); \ + } else { \ + /* There is an assocation with other context */ \ + ogs_info("[%s:%d] (%s) NF suspended", \ + _nFInstance->id, _nFInstance->reference_count, (_cAUSE)); \ + OGS_FSM_TRAN(&_nFInstance->sm, amf_nf_state_de_registered); \ + ogs_fsm_dispatch(&_nFInstance->sm, NULL); \ + } \ + ogs_sbi_nf_instance_remove(_nFInstance); \ + } while(0) + struct amf_ue_s { - ogs_lnode_t lnode; - ogs_fsm_t sm; /* A state machine */ + ogs_sbi_object_t sbi; + ogs_fsm_t sm; struct { -#define OGS_NAS_SECURITY_BEARER_3GPP 1 -#define OGS_NAS_SECURITY_BEARER_NON_3GPP 2 - uint8_t connection_identifier; - uint8_t type; - uint8_t ksi; + uint8_t message_type; /* Type of last NAS message received */ + int access_type; /* 3GPP or Non-3GPP */ + union { + struct { + ED3(uint8_t tsc:1;, + uint8_t ksi:3;, + uint8_t spare:4;) + }; ogs_nas_5gs_registration_type_t registration; #if 0 ogs_5gs_update_type_t update; ogs_5gs_service_type_t service; ogs_5gs_detach_type_t detach; #endif + uint8_t data; }; - } nas; + + } __attribute__ ((packed)) nas; /* UE identity */ - char *suci; /* TS33.501 : SUCI */ - char *supi; /* TS33.501 : SUPI */ - #define AMF_UE_HAVE_SUCI(__aMF) \ ((__aMF) && ((__aMF)->suci)) - uint8_t imsi[OGS_MAX_IMSI_LEN]; - int imsi_len; - char imsi_bcd[OGS_MAX_IMSI_BCD_LEN+1]; + char *suci; /* TS33.501 : SUCI */ + char *supi; /* TS33.501 : SUPI */ ogs_nas_5gs_mobile_identity_imsi_t nas_mobile_identity_imsi; - bool imeisv_presence; + char *pei; uint8_t imeisv[OGS_MAX_IMEISV_LEN]; int imeisv_len; char imeisv_bcd[OGS_MAX_IMEISV_BCD_LEN+1]; ogs_nas_mobile_identity_imeisv_t nas_mobile_identity_imeisv; amf_m_tmsi_t *m_tmsi; - amf_p_tmsi_t p_tmsi; ogs_nas_5gs_guti_t guti; int guti_present; uint16_t vlr_ostream_id; /* SCTP output stream id for VLR */ /* UE Info */ + amf_guami_t *guami; ogs_5gs_tai_t tai; ogs_nr_cgi_t cgi; ogs_plmn_id_t last_visited_plmn_id; @@ -256,6 +272,7 @@ struct amf_ue_s { ogs_assert((__aMF)); \ (__aMF)->security_context_available = 0; \ (__aMF)->mac_failed = 0; \ + (__aMF)->nas.tsc = 0; \ (__aMF)->nas.ksi = 0; \ } while(0) int security_context_available; @@ -311,6 +328,8 @@ struct amf_ue_s { * #define OGS_NAS_SECURITY_ALGORITHMS_128_NIA3 3 */ uint8_t selected_int_algorithm; + ogs_bitrate_t subscribed_ue_ambr; /* UE-AMBR */ + /* ESM Info */ #define MIN_5GS_BEARER_ID 5 #define MAX_5GS_BEARER_ID 15 @@ -331,10 +350,10 @@ struct amf_ue_s { #define CLEAR_AMF_UE_ALL_TIMERS(__aMF) \ do { \ - CLEAR_AMF_UE_TIMER((__aMF)->sbi_client_wait); \ CLEAR_AMF_UE_TIMER((__aMF)->t3513); \ CLEAR_AMF_UE_TIMER((__aMF)->t3522); \ CLEAR_AMF_UE_TIMER((__aMF)->t3550); \ + CLEAR_AMF_UE_TIMER((__aMF)->t3555); \ CLEAR_AMF_UE_TIMER((__aMF)->t3560); \ CLEAR_AMF_UE_TIMER((__aMF)->t3570); \ } while(0); @@ -351,7 +370,7 @@ struct amf_ue_s { ogs_pkbuf_t *pkbuf; ogs_timer_t *timer; uint32_t retry_count;; - } sbi_client_wait, t3513, t3522, t3550, t3560, t3570; + } t3513, t3522, t3550, t3555, t3560, t3570; /* UE Radio Capability */ OCTET_STRING_t ueRadioCapability; @@ -366,28 +385,6 @@ struct amf_ue_s { * session_context_will_deleted = 0 */ int session_context_will_deleted; - -#if 0 - amf_csmap_t *csmap; -#endif - -#define AMF_NF_INSTANCE_CLEAR(_cAUSE, _nFInstance) \ - do { \ - ogs_assert(_nFInstance); \ - if ((_nFInstance)->reference_count == 1) { \ - ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \ - amf_nf_fsm_fini((_nFInstance)); \ - } else { \ - /* There is an assocation with other context */ \ - ogs_info("[%s:%d] (%s) NF suspended", \ - _nFInstance->id, _nFInstance->reference_count, (_cAUSE)); \ - OGS_FSM_TRAN(&_nFInstance->sm, amf_nf_state_de_registered); \ - ogs_fsm_dispatch(&_nFInstance->sm, NULL); \ - } \ - ogs_sbi_nf_instance_remove(_nFInstance); \ - } while(0) - - ogs_sbi_nf_types_t nf_types; }; #define AMF_HAVE_SMF_S1U_PATH(__sESS) \ @@ -414,9 +411,16 @@ struct amf_ue_s { (__aMF)->session_context_will_deleted = 0; \ } while(0) typedef struct amf_sess_s { - ogs_lnode_t lnode; + ogs_sbi_object_t sbi; - uint8_t pti; /* Procedure Trasaction Identity */ + uint8_t psi; /* PDU Session Identity */ + uint8_t pti; /* Procedure Trasaction Identity */ + + char *sm_context_ref; /* smContextRef from SMF */ + + /* last payload for sending back to the UE */ + uint8_t payload_container_type; + ogs_pkbuf_t *payload_container; #if 0 /* PDN Connectivity Request */ @@ -429,10 +433,14 @@ typedef struct amf_sess_s { /* Related Context */ amf_ue_t *amf_ue; +#if 0 #define AMF_UE_HAVE_APN(__aMF) \ ((__aMF) && (amf_sess_first(__aMF)) && \ ((amf_sess_first(__aMF))->pdn)) ogs_pdn_t *pdn; +#endif + ogs_s_nssai_t s_nssai; + char *dnn; /* Save Protocol Configuration Options from UE */ struct { @@ -557,8 +565,6 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue); void amf_ue_remove(amf_ue_t *amf_ue); void amf_ue_remove_all(void); -amf_ue_t *amf_ue_find_by_imsi(uint8_t *imsi, int imsi_len); -amf_ue_t *amf_ue_find_by_imsi_bcd(char *imsi_bcd); amf_ue_t *amf_ue_find_by_guti(ogs_nas_5gs_guti_t *nas_guti); amf_ue_t *amf_ue_find_by_teid(uint32_t teid); amf_ue_t *amf_ue_find_by_suci(char *suci); @@ -626,15 +632,11 @@ void amf_ue_deassociate(amf_ue_t *amf_ue); void source_ue_associate_target_ue(ran_ue_t *source_ue, ran_ue_t *target_ue); void source_ue_deassociate_target_ue(ran_ue_t *ran_ue); -amf_sess_t *amf_sess_add(amf_ue_t *amf_ue, uint8_t pti); +amf_sess_t *amf_sess_add(amf_ue_t *amf_ue, uint8_t psi); void amf_sess_remove(amf_sess_t *sess); void amf_sess_remove_all(amf_ue_t *amf_ue); -amf_sess_t *amf_sess_find_by_pti(amf_ue_t *amf_ue, uint8_t pti); -amf_sess_t *amf_sess_find_by_ebi(amf_ue_t *amf_ue, uint8_t ebi); +amf_sess_t *amf_sess_find_by_psi(amf_ue_t *amf_ue, uint8_t psi); amf_sess_t *amf_sess_find_by_dnn(amf_ue_t *amf_ue, char *dnn); -amf_sess_t *amf_sess_first(amf_ue_t *amf_ue); -amf_sess_t *amf_sess_next(amf_sess_t *sess); -unsigned int amf_sess_count(amf_ue_t *amf_ue); amf_bearer_t *amf_bearer_add(amf_sess_t *sess); void amf_bearer_remove(amf_bearer_t *bearer); @@ -656,6 +658,8 @@ ogs_pdn_t *amf_pdn_find_by_dnn(amf_ue_t *amf_ue, char *dnn); ogs_pdn_t *amf_default_pdn(amf_ue_t *amf_ue); int amf_find_served_tai(ogs_5gs_tai_t *tai); +ogs_s_nssai_t *amf_find_s_nssai( + ogs_plmn_id_t *served_plmn_id, ogs_nas_s_nssai_t *s_nssai); int amf_m_tmsi_pool_generate(void); amf_m_tmsi_t *amf_m_tmsi_alloc(void); diff --git a/src/amf/gmm-build.c b/src/amf/gmm-build.c index 6e21eb821..0e322365c 100644 --- a/src/amf/gmm-build.c +++ b/src/amf/gmm-build.c @@ -24,32 +24,26 @@ #undef OGS_LOG_DOMAIN #define OGS_LOG_DOMAIN __gmm_log_domain -#if 0 -ogs_pkbuf_t *gmm_build_registration_accept( - amf_ue_t *amf_ue, ogs_pkbuf_t *esmbuf) +ogs_pkbuf_t *gmm_build_registration_accept(amf_ue_t *amf_ue) { ogs_nas_5gs_message_t message; ogs_pkbuf_t *pkbuf = NULL; ogs_nas_5gs_registration_accept_t *registration_accept = &message.gmm.registration_accept; - ogs_nas_5gs_registration_result_t *eps_registration_result = - ®istration_accept->eps_registration_result; - ogs_nas_gprs_timer_t *t3412_value = ®istration_accept->t3412_value; + ogs_nas_5gs_registration_result_t *registration_result = + ®istration_accept->registration_result; + ogs_nas_5gs_mobile_identity_t *mobile_identity = ®istration_accept->guti; + ogs_nas_5gs_mobile_identity_guti_t mobile_identity_guti; int served_tai_index = 0; - ogs_nas_5gs_mobile_identity_t *nas_guti = ®istration_accept->guti; - ogs_nas_5gs_network_feature_support_t *eps_network_feature_support = - ®istration_accept->eps_network_feature_support; - ogs_nas_location_area_identification_t *lai = - ®istration_accept->location_area_identification; - ogs_nas_mobile_identity_t *ms_identity = ®istration_accept->ms_identity; - ogs_nas_mobile_identity_tmsi_t *tmsi = &ms_identity->tmsi;; + ogs_nas_nssai_t *allowed_nssai = ®istration_accept->allowed_nssai; + int i, j; + ogs_nas_gprs_timer_3_t *t3512_value = ®istration_accept->t3512_value; ogs_assert(amf_ue); - ogs_assert(esmbuf); - ogs_debug("Registration accept"); + ogs_debug("[%s] Registration accept", amf_ue->supi); memset(&message, 0, sizeof(message)); - message.h.security_header_type = + message.h.security_header_type = OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; message.h.extended_protocol_discriminator = OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; @@ -58,86 +52,105 @@ ogs_pkbuf_t *gmm_build_registration_accept( OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; message.gmm.h.message_type = OGS_NAS_5GS_REGISTRATION_ACCEPT; - /* Set T3412 */ - eps_registration_result->result = amf_ue->nas_5gs.registration.value; - t3412_value->unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; - t3412_value->value = 9; + /* Registration Result */ + registration_result->length = 1; + registration_result->value = amf_ue->nas.access_type; - ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", - ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), - amf_ue->tai.tac); - ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", - ogs_plmn_id_hexdump(&amf_ue->e_cgi.plmn_id), - amf_ue->e_cgi.cell_id); - served_tai_index = amf_find_served_tai(&amf_ue->tai); - ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); - ogs_assert(served_tai_index >= 0 && - served_tai_index < OGS_MAX_NUM_OF_SERVED_TAI); - ogs_nas_tai_list_build(®istration_accept->tai_list, - &amf_self()->served_tai[served_tai_index].list0, - &amf_self()->served_tai[served_tai_index].list2); - - registration_accept->esm_message_container.buffer = esmbuf->data; - registration_accept->esm_message_container.length = esmbuf->len; - - ogs_debug(" %s GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]", + /* Set GUTI */ + ogs_debug("[%s] %s 5G-S_GUTI[AMF_ID:0x%x,M_TMSI:0x%x]", amf_ue->supi, amf_ue->guti_present ? "[V]" : "[N]", - amf_ue->guti.amf_gid, amf_ue->guti.amf_code, - amf_ue->guti.m_tmsi, amf_ue->imsi_bcd); + ogs_amf_id_hexdump(&amf_ue->guti.amf_id), amf_ue->guti.m_tmsi); if (amf_ue->guti_present) { - registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_GUTI_PRESENT; - nas_guti->length = sizeof(ogs_nas_5gs_mobile_identity_guti_t); - nas_guti->guti.odd_even = OGS_NAS_MOBILE_IDENTITY_EVEN; - nas_guti->guti.type = OGS_NAS_5GS_MOBILE_IDENTITY_GUTI; - nas_guti->guti.nas_plmn_id = amf_ue->guti.nas_plmn_id; - nas_guti->guti.amf_gid = amf_ue->guti.amf_gid; - nas_guti->guti.amf_code = amf_ue->guti.amf_code; - nas_guti->guti.m_tmsi = amf_ue->guti.m_tmsi; + registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_5G_GUTI_PRESENT; + memset(&mobile_identity_guti, 0, sizeof(mobile_identity_guti)); + + mobile_identity_guti.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_GUTI; + + memcpy(&mobile_identity_guti.nas_plmn_id, + &amf_ue->guti.nas_plmn_id, OGS_PLMN_ID_LEN); + memcpy(&mobile_identity_guti.amf_id, + &amf_ue->guti.amf_id, sizeof(ogs_amf_id_t)); + mobile_identity_guti.m_tmsi = htobe32(amf_ue->guti.m_tmsi); + + mobile_identity->length = sizeof(mobile_identity_guti); + mobile_identity->buffer = &mobile_identity_guti; } amf_ue->guti_present = 0; -#if 0 /* Need not to include T3402 */ - /* Set T3402 */ - registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_T3402_VALUE_PRESENT; - registration_accept->t3402_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM; - registration_accept->t3402_value.value = 12; -#endif + /* Set TAI List */ + registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_TAI_LIST_PRESENT; - /* Set T3423 */ - registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_T3423_VALUE_PRESENT; - registration_accept->t3423_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; - registration_accept->t3423_value.value = 9; - registration_accept->presencemask |= - OGS_NAS_5GS_REGISTRATION_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT; - eps_network_feature_support->length = 1; - eps_network_feature_support->ims_vops = 1; + ogs_debug("[%s] TAI[PLMN_ID:%06x,TAC:%d]", amf_ue->supi, + ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), amf_ue->tai.tac.v); + ogs_debug("[%s] NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]", amf_ue->supi, + ogs_plmn_id_hexdump(&amf_ue->cgi.plmn_id), + (long long)amf_ue->cgi.cell_id); - if (MME_P_TMSI_IS_AVAILABLE(amf_ue)) { - ogs_assert(amf_ue->csmap); - ogs_assert(amf_ue->p_tmsi); + served_tai_index = amf_find_served_tai(&amf_ue->tai); + ogs_debug("[%s] SERVED_TAI_INDEX[%d]", amf_ue->supi, served_tai_index); + ogs_assert(served_tai_index >= 0 && + served_tai_index < OGS_MAX_NUM_OF_SERVED_TAI); - registration_accept->presencemask |= - OGS_NAS_5GS_REGISTRATION_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT; - lai->nas_plmn_id = amf_ue->csmap->lai.nas_plmn_id; - lai->lac = amf_ue->csmap->lai.lac; - ogs_debug(" LAI[PLMN_ID:%06x,LAC:%d]", - ogs_plmn_id_hexdump(&lai->nas_plmn_id), lai->lac); + ogs_nas_5gs_tai_list_build(®istration_accept->tai_list, + &amf_self()->served_tai[served_tai_index].list0, + &amf_self()->served_tai[served_tai_index].list2); - registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_MS_IDENTITY_PRESENT; - ms_identity->length = 5; - tmsi->spare = 0xf; - tmsi->odd_even = 0; - tmsi->type = OGS_NAS_MOBILE_IDENTITY_TMSI; - tmsi->tmsi = amf_ue->p_tmsi; - ogs_debug(" P-TMSI: 0x%08x", tmsi->tmsi); + /* Set Allowed NSSAI */ + for (i = 0; i < amf_self()->num_of_plmn_support; i++) { + if (memcmp(&amf_ue->tai.plmn_id, + &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) + continue; + + ogs_debug("[%s] NSSAI[PLMN_ID:%06x]", amf_ue->supi, + ogs_plmn_id_hexdump(&amf_self()->plmn_support[i].plmn_id)); + for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { + ogs_debug("[%s] [sst:%d, sd:%06x]", amf_ue->supi, + amf_self()->plmn_support[i].s_nssai[j].sst, + amf_self()->plmn_support[i].s_nssai[j].sd.v); + if (allowed_nssai->length < OGS_NAS_MAX_NSSAI_LEN) { + allowed_nssai->buffer[allowed_nssai->length] = 1; + allowed_nssai->length++; + + allowed_nssai->buffer[allowed_nssai->length] = + amf_self()->plmn_support[i].s_nssai[j].sst; + allowed_nssai->length++; + + if (amf_self()->plmn_support[i].s_nssai[j].sd.v != + OGS_S_NSSAI_NO_SD_VALUE) { + ogs_uint24_t v; + + v = ogs_htobe24(amf_self()->plmn_support[i].s_nssai[j].sd); + memcpy(allowed_nssai->buffer+allowed_nssai->length, &v, 3); + + allowed_nssai->length += 3; + allowed_nssai->buffer[allowed_nssai->length-5] += 3; + } + } + } } + if (allowed_nssai->length) { + registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_ALLOWED_NSSAI_PRESENT; + } + + /* Set T3512 */ + registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_T3512_VALUE_PRESENT; + t3512_value->length = 1; + t3512_value->unit = OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_1_HH; + t3512_value->value = 9; + +#if 0 + /* Set T3502 */ + registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_T3502_VALUE_PRESENT; + registration_accept->t3502_value.length = 1; + registration_accept->t3502_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM; + registration_accept->t3502_value.value = 12; +#endif + pkbuf = nas_5gs_security_encode(amf_ue, &message); - ogs_pkbuf_free(esmbuf); return pkbuf; } -#endif ogs_pkbuf_t *gmm_build_registration_reject(ogs_nas_5gmm_cause_t gmm_cause) { @@ -158,7 +171,7 @@ ogs_pkbuf_t *gmm_build_registration_reject(ogs_nas_5gmm_cause_t gmm_cause) ogs_pkbuf_t *gmm_build_identity_request(amf_ue_t *amf_ue) { ogs_nas_5gs_message_t message; - ogs_nas_5gs_identity_request_t *identity_request = + ogs_nas_5gs_identity_request_t *identity_request = &message.gmm.identity_request; ogs_assert(amf_ue); @@ -178,7 +191,7 @@ ogs_pkbuf_t *gmm_build_identity_request(amf_ue_t *amf_ue) ogs_pkbuf_t *gmm_build_authentication_request(amf_ue_t *amf_ue) { ogs_nas_5gs_message_t message; - ogs_nas_5gs_authentication_request_t *authentication_request = + ogs_nas_5gs_authentication_request_t *authentication_request = &message.gmm.authentication_request; ogs_assert(amf_ue); @@ -188,6 +201,7 @@ ogs_pkbuf_t *gmm_build_authentication_request(amf_ue_t *amf_ue) OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; message.gmm.h.message_type = OGS_NAS_5GS_AUTHENTICATION_REQUEST; + authentication_request->ngksi.tsc = amf_ue->nas.tsc; authentication_request->ngksi.value = amf_ue->nas.ksi; authentication_request->abba.length = amf_ue->abba_len; memcpy(authentication_request->abba.value, amf_ue->abba, amf_ue->abba_len); @@ -201,7 +215,7 @@ ogs_pkbuf_t *gmm_build_authentication_request(amf_ue_t *amf_ue) amf_ue->rand, OGS_RAND_LEN); memcpy(authentication_request->authentication_parameter_autn.autn, amf_ue->autn, OGS_AUTN_LEN); - authentication_request->authentication_parameter_autn.length = + authentication_request->authentication_parameter_autn.length = OGS_AUTN_LEN; return ogs_nas_5gs_plain_encode(&message); @@ -223,12 +237,12 @@ ogs_pkbuf_t *gmm_build_authentication_reject(void) ogs_pkbuf_t *gmm_build_security_mode_command(amf_ue_t *amf_ue) { ogs_nas_5gs_message_t message; - ogs_nas_5gs_security_mode_command_t *security_mode_command = + ogs_nas_5gs_security_mode_command_t *security_mode_command = &message.gmm.security_mode_command; ogs_nas_security_algorithms_t *selected_nas_security_algorithms = &security_mode_command->selected_nas_security_algorithms; ogs_nas_key_set_identifier_t *ngksi = &security_mode_command->ngksi; - ogs_nas_ue_security_capability_t *replayed_ue_security_capabilities = + ogs_nas_ue_security_capability_t *replayed_ue_security_capabilities = &security_mode_command->replayed_ue_security_capabilities; ogs_nas_imeisv_request_t *imeisv_request = &security_mode_command->imeisv_request; @@ -239,7 +253,7 @@ ogs_pkbuf_t *gmm_build_security_mode_command(amf_ue_t *amf_ue) ogs_assert(amf_ue); memset(&message, 0, sizeof(message)); - message.h.security_header_type = + message.h.security_header_type = OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_NEW_SECURITY_CONTEXT; message.h.extended_protocol_discriminator = OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; @@ -256,7 +270,7 @@ ogs_pkbuf_t *gmm_build_security_mode_command(amf_ue_t *amf_ue) selected_nas_security_algorithms->type_of_ciphering_algorithm = amf_ue->selected_enc_algorithm; - ngksi->tsc = 0; + ngksi->tsc = amf_ue->nas.tsc; ngksi->value = amf_ue->nas.ksi; replayed_ue_security_capabilities->nea = amf_ue->ue_security_capability.nea; @@ -289,7 +303,7 @@ ogs_pkbuf_t *gmm_build_security_mode_command(amf_ue_t *amf_ue) security_mode_command->presencemask |= OGS_NAS_5GS_SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT; imeisv_request->type = OGS_NAS_IMEISV_TYPE; - imeisv_request->imeisv_request_value = OGS_NAS_IMEISV_REQUESTED; + imeisv_request->value = OGS_NAS_IMEISV_REQUESTED; security_mode_command->presencemask |= OGS_NAS_5GS_SECURITY_MODE_COMMAND_ADDITIONAL_5G_SECURITY_INFORMATION_PRESENT; @@ -310,6 +324,171 @@ ogs_pkbuf_t *gmm_build_security_mode_command(amf_ue_t *amf_ue) return nas_5gs_security_encode(amf_ue, &message); } +ogs_pkbuf_t *gmm_build_configuration_update_command( + amf_ue_t *amf_ue, int ack, int red) +{ + ogs_nas_5gs_message_t message; + ogs_nas_5gs_configuration_update_command_t *configuration_update_command = + &message.gmm.configuration_update_command; + + ogs_nas_time_zone_and_time_t *universal_time_and_local_time_zone = + &configuration_update_command->universal_time_and_local_time_zone; + ogs_nas_daylight_saving_time_t *network_daylight_saving_time = + &configuration_update_command->network_daylight_saving_time; + + struct timeval tv; + struct tm gmt, local; + + ogs_assert(amf_ue); + + ogs_gettimeofday(&tv); + ogs_gmtime(tv.tv_sec, &gmt); + ogs_localtime(tv.tv_sec, &local); + + ogs_debug(" GMT Time[Y:M:D H:M:S GMT] - %d:%d:%d, %d:%d:%d, %d", + gmt.tm_year, gmt.tm_mon, gmt.tm_mday, + gmt.tm_hour, gmt.tm_min, gmt.tm_sec, + (int)gmt.tm_gmtoff); + ogs_debug(" LOCAL Time[Y:M:D H:M:S GMT] - %d:%d:%d, %d:%d:%d, %d", + local.tm_year, local.tm_mon, local.tm_mday, + local.tm_hour, local.tm_min, local.tm_sec, + (int)local.tm_gmtoff); + + memset(&message, 0, sizeof(message)); + message.h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; + message.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + + message.gmm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + message.gmm.h.message_type = OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND; + + if (ack | red) { + ogs_nas_configuration_update_indication_t + *configuration_update_indication = + &configuration_update_command->configuration_update_indication; + + configuration_update_command->presencemask |= + OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_CONFIGURATION_UPDATE_INDICATION_PRESENT; + + configuration_update_indication->ack = ack; + configuration_update_indication->red = red; + } + + configuration_update_command->presencemask |= + OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT; + universal_time_and_local_time_zone->year = + OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_year % 100); + universal_time_and_local_time_zone->mon = + OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_mon+1); + universal_time_and_local_time_zone->mday = + OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_mday); + universal_time_and_local_time_zone->hour = + OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_hour); + universal_time_and_local_time_zone->min = + OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_min); + universal_time_and_local_time_zone->sec = + OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_sec); + if (local.tm_gmtoff >= 0) { + universal_time_and_local_time_zone->timezone = + OGS_OGS_NAS_TIME_TO_BCD(local.tm_gmtoff / 900); + } else { + universal_time_and_local_time_zone->timezone = + OGS_OGS_NAS_TIME_TO_BCD((-local.tm_gmtoff) / 900); + universal_time_and_local_time_zone->timezone |= 0x08; + } + ogs_debug(" Timezone:0x%x", + universal_time_and_local_time_zone->timezone); + + configuration_update_command->presencemask |= + OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT; + network_daylight_saving_time->length = 1; + + if (amf_self()->full_name.length) { + configuration_update_command->presencemask |= + OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_FULL_NAME_FOR_NETWORK_PRESENT; + memcpy(&configuration_update_command->full_name_for_network, + &amf_self()->full_name, sizeof(ogs_nas_network_name_t)); + } + + if (amf_self()->short_name.length) { + configuration_update_command->presencemask |= + OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND_SHORT_NAME_FOR_NETWORK_PRESENT; + memcpy(&configuration_update_command->short_name_for_network, + &amf_self()->short_name, sizeof(ogs_nas_network_name_t)); + } + + return nas_5gs_security_encode(amf_ue, &message); +} + +ogs_pkbuf_t *gmm_build_dl_nas_transport(amf_sess_t *sess, + uint8_t payload_container_type, ogs_pkbuf_t *payload_container, + ogs_nas_5gmm_cause_t cause, uint8_t backoff_time) +{ + amf_ue_t *amf_ue = NULL; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_nas_5gs_message_t message; + ogs_nas_5gs_dl_nas_transport_t *dl_nas_transport = + &message.gmm.dl_nas_transport; + + ogs_nas_pdu_session_identity_2_t *pdu_session_id = NULL; + ogs_nas_5gmm_cause_t *gmm_cause = NULL; + ogs_nas_gprs_timer_3_t *back_off_timer_value = NULL; + + ogs_assert(sess); + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + ogs_assert(payload_container_type); + ogs_assert(payload_container); + + pdu_session_id = &dl_nas_transport->pdu_session_id; + ogs_assert(pdu_session_id); + gmm_cause = &dl_nas_transport->gmm_cause; + ogs_assert(gmm_cause); + back_off_timer_value = &dl_nas_transport->back_off_timer_value; + ogs_assert(back_off_timer_value); + + memset(&message, 0, sizeof(message)); + message.h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; + message.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + + message.gmm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + message.gmm.h.message_type = OGS_NAS_5GS_DL_NAS_TRANSPORT; + + dl_nas_transport->payload_container_type.value = payload_container_type; + dl_nas_transport->payload_container.length = payload_container->len; + dl_nas_transport->payload_container.buffer = payload_container->data; + + dl_nas_transport->presencemask |= + OGS_NAS_5GS_DL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT; + *pdu_session_id = sess->psi; + + if (cause) { + dl_nas_transport->presencemask |= + OGS_NAS_5GS_DL_NAS_TRANSPORT_5GMM_CAUSE_PRESENT; + *gmm_cause = cause; + } + + if (backoff_time >= 2) { + dl_nas_transport->presencemask |= + OGS_NAS_5GS_DL_NAS_TRANSPORT_BACK_OFF_TIMER_VALUE_PRESENT; + back_off_timer_value->length = 1; + back_off_timer_value->unit = + OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_2_SS; + back_off_timer_value->value = backoff_time / 2; + } + + gmmbuf = nas_5gs_security_encode(amf_ue, &message); + ogs_pkbuf_free(payload_container); + + return gmmbuf; +} + #if 0 ogs_pkbuf_t *gmm_build_detach_accept(amf_ue_t *amf_ue) { @@ -318,7 +497,7 @@ ogs_pkbuf_t *gmm_build_detach_accept(amf_ue_t *amf_ue) ogs_assert(amf_ue); memset(&message, 0, sizeof(message)); - message.h.security_header_type = + message.h.security_header_type = OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; message.h.extended_protocol_discriminator = OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; @@ -336,7 +515,7 @@ ogs_pkbuf_t *gmm_build_detach_accept(amf_ue_t *amf_ue) ogs_pkbuf_t *gmm_build_tau_accept(amf_ue_t *amf_ue) { ogs_nas_5gs_message_t message; - ogs_nas_5gs_tracking_area_update_accept_t *tau_accept = + ogs_nas_5gs_tracking_area_update_accept_t *tau_accept = &message.gmm.tracking_area_update_accept; int served_tai_index = 0; @@ -345,7 +524,7 @@ ogs_pkbuf_t *gmm_build_tau_accept(amf_ue_t *amf_ue) ogs_assert(amf_ue); memset(&message, 0, sizeof(message)); - message.h.security_header_type = + message.h.security_header_type = OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; message.h.extended_protocol_discriminator = OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; @@ -356,11 +535,11 @@ ogs_pkbuf_t *gmm_build_tau_accept(amf_ue_t *amf_ue) tau_accept->eps_update_result.result = amf_ue->nas_5gs.update.value; - /* Set T3412 */ + /* Set T3512 */ tau_accept->presencemask |= - OGS_NAS_5GS_TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT ; - tau_accept->t3412_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; - tau_accept->t3412_value.value = 9; + OGS_NAS_5GS_TRACKING_AREA_UPDATE_ACCEPT_T3512_VALUE_PRESENT ; + tau_accept->t3512_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; + tau_accept->t3512_value.value = 9; /* Set TAI */ tau_accept->presencemask |= @@ -408,19 +587,19 @@ ogs_pkbuf_t *gmm_build_tau_accept(amf_ue_t *amf_ue) sess = amf_sess_next(sess); } -#if 0 /* Need not to include T3402 */ - /* Set T3402 */ +#if 0 /* Need not to include T3502 */ + /* Set T3502 */ tau_accept->presencemask |= - OGS_NAS_5GS_TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT; - tau_accept->t3402_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM; - tau_accept->t3402_value.value = 12; + OGS_NAS_5GS_TRACKING_AREA_UPDATE_ACCEPT_T3502_VALUE_PRESENT; + tau_accept->t3502_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM; + tau_accept->t3502_value.value = 12; #endif - /* Set T3423 */ + /* Set T3523 */ tau_accept->presencemask |= - OGS_NAS_5GS_TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT; - tau_accept->t3423_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; - tau_accept->t3423_value.value = 9; + OGS_NAS_5GS_TRACKING_AREA_UPDATE_ACCEPT_T3523_VALUE_PRESENT; + tau_accept->t3523_value.unit = OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; + tau_accept->t3523_value.value = 9; /* Set EPS network feature support */ tau_accept->presencemask |= @@ -435,7 +614,7 @@ ogs_pkbuf_t *gmm_build_tau_reject( ogs_nas_5gmm_cause_t gmm_cause, amf_ue_t *amf_ue) { ogs_nas_5gs_message_t message; - ogs_nas_5gs_tracking_area_update_reject_t *tau_reject = + ogs_nas_5gs_tracking_area_update_reject_t *tau_reject = &message.gmm.tracking_area_update_reject; ogs_assert(amf_ue); @@ -478,7 +657,7 @@ ogs_pkbuf_t *gmm_build_service_reject( ogs_pkbuf_t *gmm_build_cs_service_notification(amf_ue_t *amf_ue) { ogs_nas_5gs_message_t message; - ogs_nas_5gs_cs_service_notification_t *cs_service_notification = + ogs_nas_5gs_cs_service_notification_t *cs_service_notification = &message.gmm.cs_service_notification; ogs_nas_paging_identity_t *paging_identity = &cs_service_notification->paging_identity; @@ -486,7 +665,7 @@ ogs_pkbuf_t *gmm_build_cs_service_notification(amf_ue_t *amf_ue) ogs_assert(amf_ue); memset(&message, 0, sizeof(message)); - message.h.security_header_type = + message.h.security_header_type = OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; message.h.extended_protocol_discriminator = OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; @@ -508,7 +687,7 @@ ogs_pkbuf_t *gmm_build_downlink_nas_transport( amf_ue_t *amf_ue, uint8_t *buffer, uint8_t length) { ogs_nas_5gs_message_t message; - ogs_nas_5gs_downlink_nas_transport_t *downlink_nas_transport = + ogs_nas_5gs_downlink_nas_transport_t *downlink_nas_transport = &message.gmm.downlink_nas_transport; ogs_nas_5gs_message_container_t *nas_message_container = &downlink_nas_transport->nas_message_container; @@ -516,7 +695,7 @@ ogs_pkbuf_t *gmm_build_downlink_nas_transport( ogs_assert(amf_ue); memset(&message, 0, sizeof(message)); - message.h.security_header_type = + message.h.security_header_type = OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; message.h.extended_protocol_discriminator = OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; @@ -531,3 +710,27 @@ ogs_pkbuf_t *gmm_build_downlink_nas_transport( return nas_5gs_security_encode(amf_ue, &message); } #endif + +ogs_pkbuf_t *gmm_build_status(amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t cause) +{ + ogs_nas_5gs_message_t message; + ogs_nas_5gs_5gmm_status_t *gmm_status = &message.gmm.gmm_status; + ogs_nas_5gmm_cause_t *gmm_cause = &gmm_status->gmm_cause; + + ogs_assert(amf_ue); + ogs_assert(cause); + + memset(&message, 0, sizeof(message)); + message.h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; + message.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + + message.gmm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + message.gmm.h.message_type = OGS_NAS_5GS_5GMM_STATUS; + + *gmm_cause = cause; + + return nas_5gs_security_encode(amf_ue, &message); +} diff --git a/src/amf/gmm-build.h b/src/amf/gmm-build.h index 9e9b756f9..e46692009 100644 --- a/src/amf/gmm-build.h +++ b/src/amf/gmm-build.h @@ -26,8 +26,7 @@ extern "C" { #endif -ogs_pkbuf_t *gmm_build_registration_accept( - amf_ue_t *amf_ue, ogs_pkbuf_t *esmbuf); +ogs_pkbuf_t *gmm_build_registration_accept(amf_ue_t *amf_ue); ogs_pkbuf_t *gmm_build_registration_reject(ogs_nas_5gmm_cause_t gmm_cause); ogs_pkbuf_t *gmm_build_identity_request(amf_ue_t *amf_ue); @@ -36,6 +35,13 @@ ogs_pkbuf_t *gmm_build_security_mode_command(amf_ue_t *amf_ue); ogs_pkbuf_t *gmm_build_authentication_request(amf_ue_t *amf_ue); ogs_pkbuf_t *gmm_build_authentication_reject(void); +ogs_pkbuf_t *gmm_build_configuration_update_command( + amf_ue_t *amf_ue, int ack, int red); + +ogs_pkbuf_t *gmm_build_dl_nas_transport(amf_sess_t *sess, + uint8_t payload_container_type, ogs_pkbuf_t *payload, + ogs_nas_5gmm_cause_t cause, uint8_t backoff_time); + ogs_pkbuf_t *gmm_build_detach_accept(amf_ue_t *amf_ue); ogs_pkbuf_t *gmm_build_tau_accept(amf_ue_t *amf_ue); @@ -49,6 +55,8 @@ ogs_pkbuf_t *gmm_build_cs_service_notification(amf_ue_t *amf_ue); ogs_pkbuf_t *gmm_build_downlink_nas_transport( amf_ue_t *amf_ue, uint8_t *buffer, uint8_t length); +ogs_pkbuf_t *gmm_build_status(amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t cause); + #ifdef __cplusplus } #endif diff --git a/src/amf/gmm-handler.c b/src/amf/gmm-handler.c index a65c3ae3c..5e521e027 100644 --- a/src/amf/gmm-handler.c +++ b/src/amf/gmm-handler.c @@ -82,10 +82,10 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, /* Set 5GS Registration Type */ memcpy(&amf_ue->nas.registration, registration_type, sizeof(ogs_nas_5gs_registration_type_t)); - amf_ue->nas.type = OGS_NAS_5GS_REGISTRATION_REQUEST; - amf_ue->nas.ksi = registration_type->type; - ogs_debug("[%s] OGS_NAS_5GS TYPE[%d] KSI[%d] REGISTRATION[0x%x]", - amf_ue->suci, amf_ue->nas.type, amf_ue->nas.ksi, amf_ue->nas.data); + amf_ue->nas.message_type = OGS_NAS_5GS_REGISTRATION_REQUEST; + ogs_debug("[%s] OGS_NAS_5GS TYPE[%d] TSC[%d] KSI[%d] REGISTRATION[0x%x]", + amf_ue->suci, amf_ue->nas.message_type, + amf_ue->nas.tsc, amf_ue->nas.ksi, amf_ue->nas.data); /* * REGISTRATION_REQUEST * Clear EBI generator @@ -106,7 +106,7 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, if (SECURITY_CONTEXT_IS_VALID(amf_ue)) { ogs_kdf_kgnb_and_kn3iwf( amf_ue->kamf, amf_ue->ul_count.i32, - OGS_KDF_ACCESS_TYPE_3GPP, amf_ue->kgnb); + amf_ue->nas.access_type, amf_ue->kgnb); ogs_kdf_nh_gnb(amf_ue->kamf, amf_ue->kgnb, amf_ue->nh); amf_ue->nhcc = 1; } @@ -194,7 +194,6 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, int gmm_handle_authentication_response(amf_ue_t *amf_ue, ogs_nas_5gs_authentication_response_t *authentication_response) { - int rv; ogs_nas_authentication_response_parameter_t *authentication_response_parameter = NULL; uint8_t hxres_star[OGS_MAX_RES_LEN]; @@ -231,116 +230,13 @@ int gmm_handle_authentication_response(amf_ue_t *amf_ue, memcpy(amf_ue->xres_star, authentication_response_parameter->res, authentication_response_parameter->length); - rv = amf_nausf_auth_discover_and_send_authenticate(amf_ue); - if (rv == OGS_ERROR) { - ogs_error("[%s] Cannot send SBI message", amf_ue->suci); - return OGS_ERROR; - } + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_AUSF, amf_ue, NULL, + amf_nausf_auth_build_authenticate_confirmation); return OGS_OK; } #if 0 -int gmm_handle_registration_complete(amf_ue_t *amf_ue, - ogs_nas_5gs_registration_complete_t *registration_complete) -{ - int rv; - ogs_pkbuf_t *gmmbuf = NULL; - - ogs_nas_5gs_message_t message; - ogs_nas_5gs_gmm_information_t *gmm_information = - &message.gmm.gmm_information; - ogs_nas_time_zone_and_time_t *universal_time_and_local_time_zone = - &gmm_information->universal_time_and_local_time_zone; - ogs_nas_daylight_saving_time_t *network_daylight_saving_time = - &gmm_information->network_daylight_saving_time; - - struct timeval tv; - struct tm gmt, local; - - ogs_gettimeofday(&tv); - ogs_gmtime(tv.tv_sec, &gmt); - ogs_localtime(tv.tv_sec, &local); - - ogs_assert(amf_ue); - - ogs_debug(" GMT Time[Y:M:D H:M:S GMT] - %d:%d:%d, %d:%d:%d, %d", - gmt.tm_year, gmt.tm_mon, gmt.tm_mday, - gmt.tm_hour, gmt.tm_min, gmt.tm_sec, - (int)gmt.tm_gmtoff); - ogs_debug(" LOCAL Time[Y:M:D H:M:S GMT] - %d:%d:%d, %d:%d:%d, %d", - local.tm_year, local.tm_mon, local.tm_mday, - local.tm_hour, local.tm_min, local.tm_sec, - (int)local.tm_gmtoff); - - rv = nas_5gs_send_gmm_to_esm( - amf_ue, ®istration_complete->esm_message_container); - if (rv != OGS_OK) { - ogs_error("nas_5gs_send_gmm_to_esm() failed"); - return OGS_ERROR; - } - - memset(&message, 0, sizeof(message)); - message.h.security_header_type = - OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; - message.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM; - - message.gmm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM; - message.gmm.h.message_type = OGS_NAS_5GS_EMM_INFORMATION; - - gmm_information->presencemask |= - OGS_NAS_5GS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT; - universal_time_and_local_time_zone->year = - OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_year % 100); - universal_time_and_local_time_zone->mon = - OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_mon+1); - universal_time_and_local_time_zone->mday = - OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_mday); - universal_time_and_local_time_zone->hour = - OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_hour); - universal_time_and_local_time_zone->min = - OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_min); - universal_time_and_local_time_zone->sec = - OGS_OGS_NAS_TIME_TO_BCD(gmt.tm_sec); - if (local.tm_gmtoff >= 0) { - universal_time_and_local_time_zone->timezone = - OGS_OGS_NAS_TIME_TO_BCD(local.tm_gmtoff / 900); - } else { - universal_time_and_local_time_zone->timezone = - OGS_OGS_NAS_TIME_TO_BCD((-local.tm_gmtoff) / 900); - universal_time_and_local_time_zone->timezone |= 0x08; - } - ogs_debug(" Timezone:0x%x", - universal_time_and_local_time_zone->timezone); - - gmm_information->presencemask |= - OGS_NAS_5GS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT; - network_daylight_saving_time->length = 1; - - if (amf_self()->full_name.length) { - gmm_information->presencemask |= - OGS_NAS_5GS_EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT; - memcpy(&gmm_information->full_name_for_network, - &amf_self()->full_name, sizeof(ogs_nas_network_name_t)); - } - - if (amf_self()->short_name.length) { - gmm_information->presencemask |= - OGS_NAS_5GS_EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT; - memcpy(&gmm_information->short_name_for_network, - &amf_self()->short_name, sizeof(ogs_nas_network_name_t)); - } - - gmmbuf = nas_5gs_security_encode(amf_ue, &message); - if (gmmbuf) - nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); - - ogs_debug("[EMM] EMM information"); - ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); - - return OGS_OK; -} - int gmm_handle_identity_response(amf_ue_t *amf_ue, ogs_nas_5gs_identity_response_t *identity_response) { @@ -393,10 +289,10 @@ int gmm_handle_deregistration_request(amf_ue_t *amf_ue, /* Set 5GS Attach Type */ memcpy(&amf_ue->nas.deregistration, deregistration_type, sizeof(ogs_nas_deregistration_type_t)); - amf_ue->nas.type = AMF_5GS_TYPE_DETACH_REQUEST_FROM_UE; + amf_ue->nas.message_type = AMF_5GS_TYPE_DETACH_REQUEST_FROM_UE; amf_ue->nas.ksi = deregistration_type->nas_key_set_identifier; - ogs_debug(" OGS_NAS_5GS TYPE[%d] KSI[%d] DETACH[0x%x]", - amf_ue->nas.type, amf_ue->nas.ksi, amf_ue->nas.data); + ogs_debug(" OGS_NAS_5GS TYPE[%d] TSC[%d] KSI[%d] DETACH[0x%x]", + amf_ue->nas.message_type, amf_ue->nas.tsc, amf_ue->nas.ksi, amf_ue->nas.data); switch (deregistration_request->deregistration_type.value) { /* 0 0 1 : 5GS deregistration */ @@ -433,10 +329,10 @@ int gmm_handle_service_request(amf_ue_t *amf_ue, ogs_assert(amf_ue); /* Set 5GS Update Type */ - amf_ue->nas.type = AMF_5GS_TYPE_SERVICE_REQUEST; + amf_ue->nas.message_type = AMF_5GS_TYPE_SERVICE_REQUEST; amf_ue->nas.ksi = ksi_and_sequence_number->ksi; ogs_debug(" OGS_NAS_5GS TYPE[%d] KSI[%d]", - amf_ue->nas.type, amf_ue->nas.ksi); + amf_ue->nas.message_type, amf_ue->nas.ksi); /* * REGISTRATION_REQUEST @@ -492,10 +388,10 @@ int gmm_handle_tau_request(amf_ue_t *amf_ue, /* Set 5GS Update Type */ memcpy(&amf_ue->nas.update, 5gs_update_type, sizeof(ogs_nas_5gs_update_type_t)); - amf_ue->nas.type = AMF_5GS_TYPE_TAU_REQUEST; + amf_ue->nas.message_type = AMF_5GS_TYPE_TAU_REQUEST; amf_ue->nas.ksi = 5gs_update_type->nas_key_set_identifier; ogs_debug(" OGS_NAS_5GS TYPE[%d] KSI[%d] UPDATE[0x%x]", - amf_ue->nas.type, amf_ue->nas.ksi, + amf_ue->nas.message_type, amf_ue->nas.ksi, amf_ue->nas.data); /* @@ -626,10 +522,10 @@ int gmm_handle_extended_service_request(amf_ue_t *amf_ue, /* Set Service Type */ memcpy(&amf_ue->nas.service, service_type, sizeof(ogs_nas_service_type_t)); - amf_ue->nas.type = AMF_5GS_TYPE_EXTENDED_SERVICE_REQUEST; + amf_ue->nas.message_type = AMF_5GS_TYPE_EXTENDED_SERVICE_REQUEST; amf_ue->nas.ksi = service_type->nas_key_set_identifier; ogs_debug(" OGS_NAS_5GS TYPE[%d] KSI[%d] SERVICE[0x%x]", - amf_ue->nas.type, amf_ue->nas.ksi, amf_ue->nas.value); + amf_ue->nas.message_type, amf_ue->nas.ksi, amf_ue->nas.value); /* * REGISTRATION_REQUEST @@ -716,7 +612,9 @@ int gmm_handle_security_mode_complete(amf_ue_t *amf_ue, amf_ue->imeisv_bcd); ogs_bcd_to_buffer(amf_ue->imeisv_bcd, amf_ue->imeisv, &amf_ue->imeisv_len); - amf_ue->imeisv_presence = true; + if (amf_ue->pei) + ogs_free(amf_ue->pei); + amf_ue->pei = ogs_msprintf("imeisv-%s", amf_ue->imeisv_bcd); break; default: ogs_warn("[%s] Invalid IMEISV Type [%d]", @@ -728,3 +626,110 @@ int gmm_handle_security_mode_complete(amf_ue_t *amf_ue, return OGS_OK; } + +int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, + ogs_nas_5gs_ul_nas_transport_t *ul_nas_transport) +{ + ogs_nas_payload_container_type_t *payload_container_type = NULL; + ogs_nas_payload_container_t *payload_container = NULL; + ogs_nas_pdu_session_identity_2_t *pdu_session_id = NULL; + ogs_nas_s_nssai_t *s_nssai = NULL; + ogs_s_nssai_t *selected_s_nssai = NULL; + ogs_nas_dnn_t *dnn = NULL; + + amf_sess_t *sess = NULL; + + ogs_assert(amf_ue); + ogs_assert(ul_nas_transport); + + payload_container_type = &ul_nas_transport->payload_container_type; + ogs_assert(payload_container_type); + payload_container = &ul_nas_transport->payload_container; + ogs_assert(payload_container); + + if (!payload_container_type->value) { + ogs_error("[%s] No Payload container type", amf_ue->supi); + return OGS_ERROR; + } + + if (!payload_container->length) { + ogs_error("[%s] No Payload container length", amf_ue->supi); + return OGS_ERROR; + } + + if (!payload_container->buffer) { + ogs_error("[%s] No Payload container buffer", amf_ue->supi); + return OGS_ERROR; + } + + switch (payload_container_type->value) { + case OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION: + pdu_session_id = &ul_nas_transport->pdu_session_id; + ogs_assert(pdu_session_id); + s_nssai = &ul_nas_transport->s_nssai; + ogs_assert(s_nssai); + dnn = &ul_nas_transport->dnn; + ogs_assert(dnn); + + if ((ul_nas_transport->presencemask & + OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT) == 0) { + ogs_error("[%s] No PDU session ID", amf_ue->supi); + return OGS_ERROR; + } + + pdu_session_id = &ul_nas_transport->pdu_session_id; + if (*pdu_session_id == OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) { + ogs_error("[%s] PDU session identity is unassigned", amf_ue->supi); + return OGS_ERROR; + } + + sess = amf_sess_find_by_psi(amf_ue, *pdu_session_id); + if (!sess) { + sess = amf_sess_add(amf_ue, *pdu_session_id); + ogs_assert(sess); + } + + if (sess->payload_container) + ogs_pkbuf_free(sess->payload_container); + + sess->payload_container_type = payload_container_type->value; + sess->payload_container = + ogs_pkbuf_alloc(NULL, payload_container->length); + ogs_assert(sess->payload_container); + ogs_pkbuf_put_data(sess->payload_container, + payload_container->buffer, payload_container->length); + + if (ul_nas_transport->presencemask & + OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_PRESENT) { + s_nssai->sd = ogs_be24toh(s_nssai->sd); + selected_s_nssai = amf_find_s_nssai(&amf_ue->tai.plmn_id, s_nssai); + } + + if (!selected_s_nssai) { + ogs_warn("No S_NSSAI : Set default S_NSSAI using AMF config"); + selected_s_nssai = &amf_self()->plmn_support[0].s_nssai[0]; + ogs_assert(selected_s_nssai); + } + + memcpy(&sess->s_nssai, selected_s_nssai, sizeof(ogs_s_nssai_t)); + + if (ul_nas_transport->presencemask & + OGS_NAS_5GS_UL_NAS_TRANSPORT_DNN_PRESENT) { + if (sess->dnn) + ogs_free(dnn); + sess->dnn = ogs_strdup(dnn->value); + } + + amf_sess_sbi_discover_and_send( + OpenAPI_nf_type_SMF, sess, NULL, + amf_nsmf_pdu_session_build_create_sm_context); + break; + + default: + ogs_error("[%s] Unknown Payload container type [%d]", + amf_ue->supi, payload_container_type->value); + return OGS_ERROR; + } + + return OGS_OK; +} diff --git a/src/amf/gmm-handler.h b/src/amf/gmm-handler.h index 5dadae59b..5d4fb6ada 100644 --- a/src/amf/gmm-handler.h +++ b/src/amf/gmm-handler.h @@ -30,9 +30,6 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, ogs_nas_5gs_registration_request_t *registration_request); int gmm_handle_authentication_response(amf_ue_t *amf_ue, ogs_nas_5gs_authentication_response_t *authentication_response); -#if 0 -int gmm_handle_registration_complete(amf_ue_t *amf_ue, - ogs_nas_5gs_registration_complete_t *registration_complete); int gmm_handle_identity_response(amf_ue_t *amf_ue, ogs_nas_5gs_identity_response_t *identity_response); @@ -43,6 +40,7 @@ int gmm_handle_deregistration_request(amf_ue_t *amf_ue, int gmm_handle_service_request(amf_ue_t *amf_ue, ogs_nas_5gs_service_request_t *service_request); +#if 0 int gmm_handle_tau_request(amf_ue_t *amf_ue, ogs_nas_5gs_tracking_area_update_request_t *tau_request); @@ -53,6 +51,9 @@ int gmm_handle_extended_service_request(amf_ue_t *amf_ue, int gmm_handle_security_mode_complete(amf_ue_t *amf_ue, ogs_nas_5gs_security_mode_complete_t *security_mode_complete); +int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, + ogs_nas_5gs_ul_nas_transport_t *ul_nas_transport); + #ifdef __cplusplus } #endif diff --git a/src/amf/gmm-sm.c b/src/amf/gmm-sm.c index c777c5f07..5cbc259e5 100644 --- a/src/amf/gmm-sm.c +++ b/src/amf/gmm-sm.c @@ -32,6 +32,7 @@ #include "amf-path.h" #endif #include "nausf-handler.h" +#include "nsmf-handler.h" #include "sbi-path.h" #include "amf-sm.h" @@ -95,16 +96,26 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) int rv; amf_ue_t *amf_ue = NULL; + amf_sess_t *sess = NULL; ran_ue_t *ran_ue = NULL; - ogs_nas_5gs_message_t *message = NULL; + ogs_nas_5gs_message_t *nas_message = NULL; #if 0 NGAP_ProcedureCode_t procedureCode; #endif + + ogs_sbi_response_t *sbi_response = NULL; + ogs_sbi_message_t *sbi_message = NULL; ogs_assert(e); - amf_ue = e->amf_ue; - ogs_assert(amf_ue); + if (e->sess) { + sess = e->sess; + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + } else { + amf_ue = e->amf_ue; + ogs_assert(amf_ue); + } switch (e->id) { case OGS_FSM_ENTRY_SIG: @@ -112,18 +123,18 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) case OGS_FSM_EXIT_SIG: return; case AMF_EVT_5GMM_MESSAGE: - message = e->nas.message; - ogs_assert(message); + nas_message = e->nas.message; + ogs_assert(nas_message); ran_ue = amf_ue->ran_ue; ogs_assert(ran_ue); #if 0 - if (message->gmm.h.security_header_type + if (nas_message->gmm.h.security_header_type == OGS_NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) { ogs_debug("Service request"); rv = gmm_handle_service_request( - amf_ue, &message->gmm.service_request); + amf_ue, &nas_message->gmm.service_request); if (rv != OGS_OK) { ogs_error("gmm_handle_service_request() failed"); OGS_FSM_TRAN(s, gmm_state_exception); @@ -159,14 +170,14 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) } #endif - switch (message->gmm.h.message_type) { + switch (nas_message->gmm.h.message_type) { #if 0 case OGS_NAS_5GS_IDENTITY_RESPONSE: ogs_debug("Identity response"); CLEAR_AMF_UE_TIMER(amf_ue->t3570); rv = gmm_handle_identity_response(amf_ue, - &message->gmm.identity_response); + &nas_message->gmm.identity_response); if (rv != OGS_OK) { ogs_error("gmm_handle_identity_response() failed"); OGS_FSM_TRAN(s, gmm_state_exception); @@ -183,9 +194,9 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) break; #endif case OGS_NAS_5GS_REGISTRATION_REQUEST: - ogs_debug("Registration request[%s]", amf_ue->imsi_bcd); + ogs_debug("Registration request"); rv = gmm_handle_registration_request( - amf_ue, &message->gmm.registration_request); + amf_ue, &nas_message->gmm.registration_request); if (rv != OGS_OK) { ogs_error("gmm_handle_registration_request() failed"); OGS_FSM_TRAN(s, gmm_state_exception); @@ -196,7 +207,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) case OGS_NAS_5GS_TRACKING_AREA_UPDATE_REQUEST: ogs_debug("Tracking area update request"); rv = gmm_handle_tau_request( - amf_ue, &message->gmm.tracking_area_update_request); + amf_ue, &nas_message->gmm.tracking_area_update_request); if (rv != OGS_OK) { ogs_error("gmm_handle_tau_request() failed"); OGS_FSM_TRAN(s, gmm_state_exception); @@ -219,7 +230,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) case OGS_NAS_5GS_EXTENDED_SERVICE_REQUEST: ogs_debug("Extended service request"); rv = gmm_handle_extended_service_request( - amf_ue, &message->gmm.extended_service_request); + amf_ue, &nas_message->gmm.extended_service_request); if (rv != OGS_OK) { ogs_error("gmm_handle_extended_service_request() failed"); OGS_FSM_TRAN(s, gmm_state_exception); @@ -235,17 +246,18 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) } break; +#endif case OGS_NAS_5GS_5GMM_STATUS: - ogs_warn("5GMM STATUS : IMSI[%s] Cause[%d]", - amf_ue->imsi_bcd, - message->gmm.gmm_status.gmm_cause); + ogs_warn("[%s] 5GMM STATUS : Cause[%d]", amf_ue->suci, + nas_message->gmm.gmm_status.gmm_cause); OGS_FSM_TRAN(s, &gmm_state_exception); return; +#if 0 case OGS_NAS_5GS_DEREGISTRATION_REQUEST: ogs_debug("Deregistration request"); ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); rv = gmm_handle_deregistration_request( - amf_ue, &message->gmm.deregistration_request_from_ue); + amf_ue, &nas_message->gmm.deregistration_request_from_ue); if (rv != OGS_OK) { ogs_error("gmm_handle_registration_request() failed"); @@ -260,42 +272,69 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) } OGS_FSM_TRAN(s, &gmm_state_de_registered); - return; - case OGS_NAS_5GS_UPLINK_NAS_TRANSPORT: - ogs_debug("Uplink NAS Transport"); - ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); - if (AMF_SGSAP_IS_CONNECTED(amf_ue)) { - sgsap_send_uplink_unitdata(amf_ue, &message->gmm. - uplink_nas_transport.nas_message_container); - } else { - NGAP_AMF_UE_NGAP_ID_t AMF_UE_NGAP_ID; - NGAP_ENB_UE_NGAP_ID_t ENB_UE_NGAP_ID; - - ogs_warn("No connection of MSC/VLR"); - AMF_UE_NGAP_ID = ran_ue->amf_ue_ngap_id; - ENB_UE_NGAP_ID = ran_ue->ran_ue_ngap_id; - - ngap_send_error_indication(ran_ue->gnb, - &AMF_UE_NGAP_ID, &ENB_UE_NGAP_ID, - NGAP_Cause_PR_transport, - NGAP_CauseTransport_transport_resource_unavailable); - } - return; #endif + case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE: + ogs_debug("[%s] Configuration update complete", amf_ue->supi); + + CLEAR_AMF_UE_TIMER(amf_ue->t3555); + return; + + case OGS_NAS_5GS_UL_NAS_TRANSPORT: + rv = gmm_handle_ul_nas_transport( + amf_ue, &nas_message->gmm.ul_nas_transport); + if (rv != OGS_OK) { + nas_5gs_send_gmm_status( + amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION); + } + return; + default: - ogs_warn("Unknown message[%d]", message->gmm.h.message_type); + ogs_error("Unknown message[%d]", nas_message->gmm.h.message_type); return; } break; + + case AMF_EVT_SBI_CLIENT: + sbi_response = e->sbi.response; + ogs_assert(sbi_response); + sbi_message = e->sbi.message; + ogs_assert(sbi_message); + + SWITCH(sbi_message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION) + + ogs_assert(sess); + ogs_timer_stop(sess->sbi.client_wait.timer); + + SWITCH(sbi_message->h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_MODIFY) + amf_nsmf_pdu_session_handle_update_sm_context( + sess, sbi_message); + break; + CASE(OGS_SBI_RESOURCE_NAME_RELEASE) + ogs_fatal("asdfasdfasdf"); + + break; + DEFAULT + amf_nsmf_pdu_session_handle_create_sm_context( + sess, sbi_message); + END + break; + + DEFAULT + ogs_error("Invalid service name [%s]", sbi_message->h.service.name); + ogs_assert_if_reached(); + END + break; + case AMF_EVT_5GMM_TIMER: switch (e->timer_id) { case AMF_TIMER_T3513: if (amf_ue->t3513.retry_count >= amf_timer_cfg(AMF_TIMER_T3513)->max_count) { /* Paging failed */ - ogs_warn("Paging to IMSI[%s] failed. Stop paging", - amf_ue->imsi_bcd); + ogs_warn("[%s] Paging failed. Stop", amf_ue->supi); CLEAR_AMF_UE_TIMER(amf_ue->t3513); } else { @@ -310,6 +349,24 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) #endif } break; + case AMF_TIMER_T3555: + if (amf_ue->t3555.retry_count >= + amf_timer_cfg(AMF_TIMER_T3555)->max_count) { + /* Configuration update command failed */ + ogs_warn("[%s] Configuration update failed. Stop", + amf_ue->supi); + CLEAR_AMF_UE_TIMER(amf_ue->t3555); + + } else { + amf_ue->t3555.retry_count++; + + /* + * If t3555 is timeout, the saved pkbuf is used. + * In this case, ack should be set to 1 for timer expiration + */ + nas_5gs_send_configuration_update_command(amf_ue, 1, 0); + } + break; case AMF_TIMER_T3570: if (amf_ue->t3570.retry_count >= amf_timer_cfg(AMF_TIMER_T3570)->max_count) { @@ -346,7 +403,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) ran_ue = amf_ue->ran_ue; ogs_assert(ran_ue); - switch (amf_ue->nas.type) { + switch (amf_ue->nas.message_type) { case OGS_NAS_5GS_REGISTRATION_REQUEST: if (SECURITY_CONTEXT_IS_VALID(amf_ue)) { #if 0 @@ -370,14 +427,8 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) amf_sbi_send_authenticate(amf_ue); } #else - rv = amf_nausf_auth_discover_and_send_authenticate(amf_ue); - if (rv == OGS_ERROR) { - ogs_error("[%s] Cannot send SBI message", amf_ue->suci); - nas_5gs_send_registration_reject( - amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED); - OGS_FSM_TRAN(s, &gmm_state_exception); - break; - } + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_AUSF, amf_ue, NULL, + amf_nausf_auth_build_authenticate); #endif OGS_FSM_TRAN(s, &gmm_state_authentication); } @@ -501,7 +552,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) break; #endif default: - ogs_fatal("Invalid NAS-5GS[%d]", amf_ue->nas.type); + ogs_fatal("Invalid NAS-5GS[%d]", amf_ue->nas.message_type); break; } } @@ -510,7 +561,7 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) { int rv; amf_ue_t *amf_ue = NULL; - ogs_nas_5gs_message_t *message = NULL; + ogs_nas_5gs_message_t *nas_message = NULL; ogs_sbi_response_t *sbi_response = NULL; ogs_sbi_message_t *sbi_message = NULL; @@ -529,13 +580,13 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) case OGS_FSM_EXIT_SIG: break; case AMF_EVT_5GMM_MESSAGE: - message = e->nas.message; - ogs_assert(message); + nas_message = e->nas.message; + ogs_assert(nas_message); - switch (message->gmm.h.message_type) { + switch (nas_message->gmm.h.message_type) { case OGS_NAS_5GS_AUTHENTICATION_RESPONSE: rv = gmm_handle_authentication_response( - amf_ue, &message->gmm.authentication_response); + amf_ue, &nas_message->gmm.authentication_response); if (rv != OGS_OK) { nas_5gs_send_authentication_reject(amf_ue); @@ -549,7 +600,7 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) ogs_assert_if_reached(); #if 0 ogs_nas_5gs_authentication_failure_t *authentication_failure = - &message->gmm.authentication_failure; + &nas_message->gmm.authentication_failure; ogs_nas_authentication_failure_parameter_t *authentication_failure_parameter = &authentication_failure-> @@ -588,35 +639,30 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) break; } case OGS_NAS_5GS_REGISTRATION_REQUEST: - ogs_warn("[%s] Registration request", amf_ue->suci); + ogs_warn("Registration request"); rv = gmm_handle_registration_request( - amf_ue, &message->gmm.registration_request); + amf_ue, &nas_message->gmm.registration_request); if (rv != OGS_OK) { - ogs_error("[%s] Cannot handle NGAP message", amf_ue->suci); + ogs_error("[%s] Cannot handle NAS message", amf_ue->suci); OGS_FSM_TRAN(s, gmm_state_exception); break; } - rv = amf_nausf_auth_discover_and_send_authenticate(amf_ue); - if (rv == OGS_ERROR) { - ogs_error("[%s] Cannot send SBI message", amf_ue->suci); - nas_5gs_send_registration_reject( - amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED); - OGS_FSM_TRAN(s, &gmm_state_exception); - break; - } - + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_AUSF, amf_ue, NULL, + amf_nausf_auth_build_authenticate); break; + case OGS_NAS_5GS_5GMM_STATUS: ogs_warn("[%s] 5GMM STATUS : Cause[%d]", - amf_ue->suci, message->gmm.gmm_status.gmm_cause); + amf_ue->suci, nas_message->gmm.gmm_status.gmm_cause); OGS_FSM_TRAN(s, &gmm_state_exception); break; + case OGS_NAS_5GS_DEREGISTRATION_REQUEST: ogs_debug("[%s] Deregistration request", amf_ue->suci); #if 0 rv = gmm_handle_deregistration_request( - amf_ue, &message->gmm.deregistration_request_from_ue); + amf_ue, &nas_message->gmm.deregistration_request_from_ue); if (rv != OGS_OK) { ogs_error("gmm_handle_registration_request() failed"); OGS_FSM_TRAN(s, gmm_state_exception); @@ -628,7 +674,7 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) OGS_FSM_TRAN(s, &gmm_state_de_registered); break; default: - ogs_warn("Unknown message[%d]", message->gmm.h.message_type); + ogs_warn("Unknown message[%d]", nas_message->gmm.h.message_type); break; } break; @@ -660,7 +706,7 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) SWITCH(sbi_message->h.resource.component[0]) CASE(OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS) - ogs_timer_stop(amf_ue->sbi_client_wait.timer); + ogs_timer_stop(amf_ue->sbi.client_wait.timer); if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED && sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) { @@ -714,7 +760,7 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) { int rv; amf_ue_t *amf_ue = NULL; - ogs_nas_5gs_message_t *message = NULL; + ogs_nas_5gs_message_t *nas_message = NULL; ogs_nas_security_header_type_t h; ogs_assert(s); @@ -733,11 +779,11 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) case OGS_FSM_EXIT_SIG: break; case AMF_EVT_5GMM_MESSAGE: - message = e->nas.message; - ogs_assert(message); + nas_message = e->nas.message; + ogs_assert(nas_message); #if 0 - if (message->gmm.h.security_header_type + if (nas_message->gmm.h.security_header_type == OGS_NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) { ogs_debug("Service request"); nas_5gs_send_service_reject(amf_ue, @@ -747,7 +793,7 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) } #endif - switch (message->gmm.h.message_type) { + switch (nas_message->gmm.h.message_type) { case OGS_NAS_5GS_SECURITY_MODE_COMPLETE: ogs_debug("[%s] Security mode complete", amf_ue->supi); @@ -774,54 +820,48 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) } gmm_handle_security_mode_complete( - amf_ue, &message->gmm.security_mode_complete); + amf_ue, &nas_message->gmm.security_mode_complete); ogs_kdf_kgnb_and_kn3iwf( amf_ue->kamf, amf_ue->ul_count.i32, - OGS_KDF_ACCESS_TYPE_3GPP, amf_ue->kgnb); + amf_ue->nas.access_type, amf_ue->kgnb); ogs_kdf_nh_gnb(amf_ue->kamf, amf_ue->kgnb, amf_ue->nh); amf_ue->nhcc = 1; -#if 0 - amf_s6a_send_ulr(amf_ue); -#endif - if (amf_ue->nas.type == OGS_NAS_5GS_REGISTRATION_REQUEST) { + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_UDM, amf_ue, NULL, + amf_nudm_uecm_build_registration); + + if (amf_ue->nas.message_type == OGS_NAS_5GS_REGISTRATION_REQUEST) { OGS_FSM_TRAN(s, &gmm_state_initial_context_setup); #if 0 - } else if (amf_ue->nas.type == + } else if (amf_ue->nas.message_type == AMF_EPS_TYPE_SERVICE_REQUEST || - amf_ue->nas.type == AMF_EPS_TYPE_TAU_REQUEST) { + amf_ue->nas.message_type == AMF_EPS_TYPE_TAU_REQUEST) { OGS_FSM_TRAN(s, &gmm_state_registered); } else { - ogs_fatal("Invalid OGS_NAS_5GS[%d]", amf_ue->nas.type); + ogs_fatal("Invalid OGS_NAS_5GS[%d]", amf_ue->nas.message_type); #endif } break; case OGS_NAS_5GS_SECURITY_MODE_REJECT: ogs_warn("[%s] Security mode reject : Cause[%d]", amf_ue->supi, - message->gmm.security_mode_reject.gmm_cause); + nas_message->gmm.security_mode_reject.gmm_cause); CLEAR_AMF_UE_TIMER(amf_ue->t3560); OGS_FSM_TRAN(s, &gmm_state_exception); break; case OGS_NAS_5GS_REGISTRATION_REQUEST: - ogs_warn("[%s] Registration request", amf_ue->suci); + ogs_warn("Registration request"); rv = gmm_handle_registration_request( - amf_ue, &message->gmm.registration_request); + amf_ue, &nas_message->gmm.registration_request); if (rv != OGS_OK) { ogs_error("[%s] Cannot handle NAS message", amf_ue->suci); OGS_FSM_TRAN(s, gmm_state_exception); break; } - rv = amf_nausf_auth_discover_and_send_authenticate(amf_ue); - if (rv == OGS_ERROR) { - ogs_error("[%s] Cannot send SBI message", amf_ue->suci); - nas_5gs_send_registration_reject( - amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED); - OGS_FSM_TRAN(s, &gmm_state_exception); - break; - } + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_AUSF, amf_ue, NULL, + amf_nausf_auth_build_authenticate); OGS_FSM_TRAN(s, &gmm_state_authentication); break; @@ -833,17 +873,19 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) OGS_FSM_TRAN(s, &gmm_state_exception); break; #endif + case OGS_NAS_5GS_5GMM_STATUS: ogs_warn("[%s] 5GMM STATUS : Cause[%d]", - amf_ue->supi, message->gmm.gmm_status.gmm_cause); + amf_ue->supi, nas_message->gmm.gmm_status.gmm_cause); OGS_FSM_TRAN(s, &gmm_state_exception); break; + case OGS_NAS_5GS_DEREGISTRATION_REQUEST: #if 0 ogs_debug("Deregistration request"); ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); rv = gmm_handle_deregistration_request( - amf_ue, &message->gmm.deregistration_request_from_ue); + amf_ue, &nas_message->gmm.deregistration_request_from_ue); if (rv != OGS_OK) { ogs_error("gmm_handle_registration_request() failed"); OGS_FSM_TRAN(s, gmm_state_exception); @@ -855,7 +897,7 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) #endif break; default: - ogs_warn("Unknown message[%d]", message->gmm.h.message_type); + ogs_warn("Unknown message[%d]", nas_message->gmm.h.message_type); break; } break; @@ -864,9 +906,7 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) case AMF_TIMER_T3560: if (amf_ue->t3560.retry_count >= amf_timer_cfg(AMF_TIMER_T3560)->max_count) { - ogs_warn("Retransmission of IMSI[%s] failed. " - "Stop retransmission", - amf_ue->imsi_bcd); + ogs_warn("[%s] Retransmission failed. Stop", amf_ue->supi); nas_5gs_send_registration_reject(amf_ue, OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED); OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception); @@ -889,11 +929,12 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e) { -#if 0 int rv; -#endif amf_ue_t *amf_ue = NULL; - ogs_nas_5gs_message_t *message = NULL; + ogs_nas_5gs_message_t *nas_message = NULL; + + ogs_sbi_response_t *sbi_response = NULL; + ogs_sbi_message_t *sbi_message = NULL; ogs_assert(s); ogs_assert(e); @@ -905,57 +946,141 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e) switch (e->id) { case OGS_FSM_ENTRY_SIG: - ogs_fatal("Under Development"); break; case OGS_FSM_EXIT_SIG: break; - case AMF_EVT_5GMM_MESSAGE: - message = e->nas.message; - ogs_assert(message); -#if 0 - switch (message->gmm.h.message_type) { - case OGS_NAS_5GS_REGISTRATION_COMPLETE: - ogs_debug("Registration complete"); - ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); + case AMF_EVT_SBI_CLIENT: + sbi_response = e->sbi.response; + ogs_assert(sbi_response); + sbi_message = e->sbi.message; + ogs_assert(sbi_message); - rv = gmm_handle_registration_complete( - amf_ue, &message->gmm.registration_complete); - if (rv != OGS_OK) { - ogs_error("gmm_handle_registration_complete() failed " - "in gmm_state_initial_context_setup"); - OGS_FSM_TRAN(s, gmm_state_exception); + ogs_timer_stop(amf_ue->sbi.client_wait.timer); + + SWITCH(sbi_message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS) + if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED && + sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) { + ogs_error("[%s] HTTP response error [%d]", + amf_ue->supi, sbi_message->res_status); + nas_5gs_send_registration_reject( + amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED); + OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception); break; } - if (AMF_P_TMSI_IS_AVAILABLE(amf_ue)) - sgsap_send_tmsi_reallocation_complete(amf_ue); + + SWITCH(sbi_message->h.method) + CASE(OGS_SBI_HTTP_METHOD_PUT) + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_UDM, amf_ue, + (char *)OGS_SBI_RESOURCE_NAME_AM_DATA, + amf_nudm_sdm_build_get); + break; + + DEFAULT + ogs_error("[%s] Invalid HTTP method [%s]", + amf_ue->suci, sbi_message->h.method); + ogs_assert_if_reached(); + END + break; + + CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) + CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) + if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) { + ogs_error("[%s] HTTP response error [%d]", + amf_ue->supi, sbi_message->res_status); + nas_5gs_send_registration_reject( + amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED); + OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception); + break; + } + + SWITCH(sbi_message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) + if (sbi_message->AccessAndMobilitySubscriptionData) { + OpenAPI_ambr_rm_t *subscribed_ue_ambr = + sbi_message->AccessAndMobilitySubscriptionData-> + subscribed_ue_ambr; + if (subscribed_ue_ambr) { + amf_ue->subscribed_ue_ambr.uplink = + ogs_sbi_bitrate_from_string( + subscribed_ue_ambr->uplink); + amf_ue->subscribed_ue_ambr.downlink = + ogs_sbi_bitrate_from_string( + subscribed_ue_ambr->downlink); + } + } + + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_UDM, amf_ue, + (char *)OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA, + amf_nudm_sdm_build_get); + break; + + CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_UDM, amf_ue, + (char *)OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA, + amf_nudm_sdm_build_get); + break; + + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) + nas_5gs_send_registration_accept(amf_ue); + break; + + DEFAULT + END + + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message->h.resource.component[0]); + ogs_assert_if_reached(); + END + break; + case AMF_EVT_5GMM_MESSAGE: + nas_message = e->nas.message; + ogs_assert(nas_message); + + switch (nas_message->gmm.h.message_type) { + case OGS_NAS_5GS_REGISTRATION_COMPLETE: + ogs_debug("[%s] Registration complete", amf_ue->supi); + + /* Ack/Red to 0 + * - No need to receive configuration update complete */ + nas_5gs_send_configuration_update_command(amf_ue, 0, 0); OGS_FSM_TRAN(s, &gmm_state_registered); break; + case OGS_NAS_5GS_REGISTRATION_REQUEST: - ogs_warn("Registration request[%s]", amf_ue->imsi_bcd); + ogs_warn("Registration request"); rv = gmm_handle_registration_request( - amf_ue, &message->gmm.registration_request); + amf_ue, &nas_message->gmm.registration_request); if (rv != OGS_OK) { - ogs_error("gmm_handle_registration_request() failed"); + ogs_error("[%s] Cannot handle NAS message", amf_ue->suci); OGS_FSM_TRAN(s, gmm_state_exception); - return; + break; } +#if 0 amf_gtp_send_delete_all_sessions(amf_ue); +#endif OGS_FSM_TRAN(s, &gmm_state_authentication); break; + case OGS_NAS_5GS_5GMM_STATUS: - ogs_warn("5GMM STATUS : IMSI[%s] Cause[%d]", - amf_ue->imsi_bcd, - message->gmm.gmm_status.gmm_cause); + ogs_warn("[%s] 5GMM STATUS : Cause[%d]", + amf_ue->supi, nas_message->gmm.gmm_status.gmm_cause); OGS_FSM_TRAN(s, &gmm_state_exception); break; + +#if 0 case OGS_NAS_5GS_DEREGISTRATION_REQUEST: ogs_debug("Deregistration request"); ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); rv = gmm_handle_deregistration_request( - amf_ue, &message->gmm.deregistration_request_from_ue); + amf_ue, &nas_message->gmm.deregistration_request_from_ue); if (rv != OGS_OK) { ogs_error("gmm_handle_registration_request() failed"); OGS_FSM_TRAN(s, gmm_state_exception); @@ -965,12 +1090,11 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e) amf_send_delete_session_or_deregistration(amf_ue); OGS_FSM_TRAN(s, &gmm_state_de_registered); break; +#endif default: - ogs_warn("Unknown message[%d]", - message->gmm.h.message_type); + ogs_warn("Unknown message[%d]", nas_message->gmm.h.message_type); break; } -#endif break; case AMF_EVT_5GMM_TIMER: switch (e->timer_id) { diff --git a/src/amf/gsm-sm.c b/src/amf/gsm-sm.c deleted file mode 100644 index 484b20b51..000000000 --- a/src/amf/gsm-sm.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (C) 2019,2020 by Sukchan Lee - * - * This file is part of Open5GS. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#if 0 -#include "5gmm-handler.h" -#include "5gsm-build.h" -#include "5gsm-handler.h" -#include "nas-path.h" -#endif -#include "context.h" - -#undef OGS_LOG_DOMAIN -#define OGS_LOG_DOMAIN __gsm_log_domain - -void gsm_state_initial(ogs_fsm_t *s, amf_event_t *e) -{ - ogs_assert(s); - - amf_sm_debug(e); - - OGS_FSM_TRAN(s, &gsm_state_inactive); -} - -void gsm_state_final(ogs_fsm_t *s, amf_event_t *e) -{ - ogs_assert(s); - - amf_sm_debug(e); -} - -void gsm_state_inactive(ogs_fsm_t *s, amf_event_t *e) -{ -#if 0 - int rv; - amf_ue_t *amf_ue = NULL; - amf_sess_t *sess = NULL; - amf_bearer_t *bearer = NULL; - ogs_nas_eps_message_t *message = NULL; - - ogs_assert(s); - ogs_assert(e); - - amf_sm_debug(e); - - bearer = e->bearer; - ogs_assert(bearer); - sess = bearer->sess; - ogs_assert(sess); - amf_ue = sess->amf_ue; - ogs_assert(amf_ue); - - switch (e->id) { - case OGS_FSM_ENTRY_SIG: - CLEAR_BEARER_ALL_TIMERS(bearer); - break; - case OGS_FSM_EXIT_SIG: - break; - case MME_EVT_ESM_MESSAGE: - message = e->nas_message; - ogs_assert(message); - - switch (message->gsm.h.message_type) { - case OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST: - ogs_debug("[ESM] PDN Connectivity request"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - rv = gsm_handle_pdn_connectivity_request( - bearer, &message->gsm.pdn_connectivity_request); - if (rv != OGS_OK) { - OGS_FSM_TRAN(s, gsm_state_exception); - break; - } - break; - case OGS_NAS_EPS_ESM_INFORMATION_RESPONSE: - ogs_debug("[ESM] ESM information response"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - - CLEAR_BEARER_TIMER(bearer->t3489); - rv = gsm_handle_information_response( - sess, &message->gsm.esm_information_response); - if (rv != OGS_OK) { - OGS_FSM_TRAN(s, gsm_state_exception); - break; - } - break; - case OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: - ogs_debug("[ESM] Activate default EPS bearer " - "context accept"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - /* Check if Initial Context Setup Response or - * E-RAB Setup Response is received */ - if (MME_HAVE_ENB_S1U_PATH(bearer)) { - amf_gtp_send_modify_bearer_request(bearer, 0); - } - - nas_eps_send_activate_all_dedicated_bearers(bearer); - OGS_FSM_TRAN(s, gsm_state_active); - break; - case OGS_NAS_EPS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: - ogs_debug("[ESM] Activate dedicated EPS bearer " - "context accept"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - /* Check if Initial Context Setup Response or - * E-RAB Setup Response is received */ - if (MME_HAVE_ENB_S1U_PATH(bearer)) { - amf_gtp_send_create_bearer_response(bearer); - } - - OGS_FSM_TRAN(s, gsm_state_active); - break; - default: - ogs_error("Unknown message(type:%d)", - message->gsm.h.message_type); - break; - } - break; - case MME_EVT_ESM_TIMER: - switch (e->timer_id) { - case MME_TIMER_T3489: - if (bearer->t3489.retry_count >= - amf_timer_cfg(MME_TIMER_T3489)->max_count) { - ogs_warn("[EMM] Retransmission of IMSI[%s] failed. " - "Stop retransmission", - amf_ue->imsi_bcd); - OGS_FSM_TRAN(&bearer->sm, &gsm_state_exception); - - nas_eps_send_pdn_connectivity_reject(sess, - ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED); - } else { - bearer->t3489.retry_count++; - nas_eps_send_esm_information_request(bearer); - } - break; - default: - ogs_error("Unknown timer[%s:%d]", - amf_timer_get_name(e->timer_id), e->timer_id); - break; - } - break; - default: - ogs_error("Unknown event %s", amf_event_get_name(e)); - break; - } -#endif -} - -#if 0 -void gsm_state_active(ogs_fsm_t *s, amf_event_t *e) -{ - int rv; - amf_ue_t *amf_ue = NULL; - amf_sess_t *sess = NULL; - amf_bearer_t *bearer = NULL; - ogs_nas_eps_message_t *message = NULL; - - ogs_assert(s); - ogs_assert(e); - - amf_sm_debug(e); - - bearer = e->bearer; - ogs_assert(bearer); - sess = bearer->sess; - ogs_assert(sess); - amf_ue = sess->amf_ue; - ogs_assert(amf_ue); - - switch (e->id) { - case OGS_FSM_ENTRY_SIG: - break; - case OGS_FSM_EXIT_SIG: - break; - case MME_EVT_ESM_MESSAGE: - message = e->nas_message; - ogs_assert(message); - - switch (message->gsm.h.message_type) { - case OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST: - ogs_debug("[ESM] PDN Connectivity request"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - rv = gsm_handle_pdn_connectivity_request( - bearer, &message->gsm.pdn_connectivity_request); - if (rv != OGS_OK) { - OGS_FSM_TRAN(s, gsm_state_exception); - break; - } - - OGS_FSM_TRAN(s, gsm_state_inactive); - break; - case OGS_NAS_EPS_PDN_DISCONNECT_REQUEST: - ogs_debug("[ESM] PDN disconnect request"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - if (MME_HAVE_SGW_S1U_PATH(sess)) { - amf_gtp_send_delete_session_request(sess); - } else { - nas_eps_send_deactivate_bearer_context_request(bearer); - } - OGS_FSM_TRAN(s, gsm_state_pdn_will_disconnect); - break; - case OGS_NAS_EPS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT: - ogs_debug("[ESM] Modify EPS bearer context accept"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - - amf_gtp_send_update_bearer_response(bearer); - break; - case OGS_NAS_EPS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: - ogs_debug("[ESM] Deactivate EPS bearer " - "context accept"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - amf_gtp_send_delete_bearer_response(bearer); - OGS_FSM_TRAN(s, gsm_state_bearer_deactivated); - break; - case OGS_NAS_EPS_BEARER_RESOURCE_ALLOCATION_REQUEST: - ogs_debug("[ESM] Bearer resource allocation request"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - gsm_handle_bearer_resource_allocation_request(bearer, message); - break; - case OGS_NAS_EPS_BEARER_RESOURCE_MODIFICATION_REQUEST: - ogs_debug("[ESM] Bearer resource modification request"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - gsm_handle_bearer_resource_modification_request(bearer, message); - break; - default: - ogs_error("Unknown message(type:%d)", - message->gsm.h.message_type); - break; - } - break; - default: - ogs_error("Unknown event %s", amf_event_get_name(e)); - break; - } -} - -void gsm_state_pdn_will_disconnect(ogs_fsm_t *s, amf_event_t *e) -{ - amf_ue_t *amf_ue = NULL; - amf_sess_t *sess = NULL; - amf_bearer_t *bearer = NULL; - ogs_nas_eps_message_t *message = NULL; - - ogs_assert(s); - ogs_assert(e); - - amf_sm_debug(e); - - bearer = e->bearer; - ogs_assert(bearer); - sess = bearer->sess; - ogs_assert(sess); - amf_ue = sess->amf_ue; - ogs_assert(amf_ue); - - switch (e->id) { - case OGS_FSM_ENTRY_SIG: - break; - case OGS_FSM_EXIT_SIG: - break; - case MME_EVT_ESM_MESSAGE: - message = e->nas_message; - ogs_assert(message); - - switch (message->gsm.h.message_type) { - case OGS_NAS_EPS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: - ogs_debug("[ESM] [D] Deactivate EPS bearer " - "context accept"); - ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", - amf_ue->imsi_bcd, sess->pti, bearer->ebi); - OGS_FSM_TRAN(s, gsm_state_pdn_did_disconnect); - break; - default: - ogs_error("Unknown message(type:%d)", - message->gsm.h.message_type); - break; - } - break; - - default: - ogs_error("Unknown event %s", amf_event_get_name(e)); - break; - } -} - -void gsm_state_pdn_did_disconnect(ogs_fsm_t *s, amf_event_t *e) -{ - ogs_assert(e); - amf_sm_debug(e); - - switch (e->id) { - case OGS_FSM_ENTRY_SIG: - break; - case OGS_FSM_EXIT_SIG: - break; - default: - ogs_error("Unknown event %s", amf_event_get_name(e)); - break; - } -} - -void gsm_state_bearer_deactivated(ogs_fsm_t *s, amf_event_t *e) -{ - ogs_assert(e); - amf_sm_debug(e); - - switch (e->id) { - case OGS_FSM_ENTRY_SIG: - break; - case OGS_FSM_EXIT_SIG: - break; - default: - ogs_error("Unknown event %s", amf_event_get_name(e)); - break; - } -} -#endif - -void gsm_state_exception(ogs_fsm_t *s, amf_event_t *e) -{ - amf_bearer_t *bearer = NULL; - ogs_assert(e); - amf_sm_debug(e); - - bearer = e->bearer; - - switch (e->id) { - case OGS_FSM_ENTRY_SIG: - CLEAR_BEARER_ALL_TIMERS(bearer); - break; - case OGS_FSM_EXIT_SIG: - break; - default: - ogs_error("Unknown event %s", amf_event_get_name(e)); - break; - } -} diff --git a/src/amf/init.c b/src/amf/init.c index 1daef398e..e5a8e8497 100644 --- a/src/amf/init.c +++ b/src/amf/init.c @@ -37,6 +37,9 @@ int amf_initialize() rv = amf_context_parse_config(); if (rv != OGS_OK) return rv; + rv = amf_m_tmsi_pool_generate(); + if (rv != OGS_OK) return rv; + rv = ogs_log_config_domain( ogs_config()->logger.domain, ogs_config()->logger.level); if (rv != OGS_OK) return rv; diff --git a/src/amf/meson.build b/src/amf/meson.build index ddfea5d23..2d85751fc 100644 --- a/src/amf/meson.build +++ b/src/amf/meson.build @@ -23,7 +23,13 @@ libamf_sources = files(''' nausf-build.c nausf-handler.c + nudm-build.c + + nsmf-build.c + nsmf-handler.c + nnrf-handler.c + namf-handler.c sbi-path.c nf-sm.c @@ -41,7 +47,6 @@ libamf_sources = files(''' nas-path.c gmm-sm.c - gsm-sm.c amf-sm.c init.c diff --git a/src/amf/namf-handler.c b/src/amf/namf-handler.c new file mode 100644 index 000000000..be1fac9cc --- /dev/null +++ b/src/amf/namf-handler.c @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "namf-handler.h" + +#include "nas-path.h" +#include "gmm-build.h" + +int amf_namf_comm_handle_n1_n2_message_transfer( + ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg) +{ + int status; + + amf_ue_t *amf_ue = NULL; + amf_sess_t *sess = NULL; + + ogs_pkbuf_t *n1smbuf = NULL; + ogs_pkbuf_t *n2smbuf = NULL; + + char *supi = NULL; + uint8_t pdu_session_id = OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED; + + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + + OpenAPI_n1_n2_message_transfer_req_data_t *N1N2MessageTransferReqData; + OpenAPI_n1_n2_message_transfer_rsp_data_t N1N2MessageTransferRspData; + OpenAPI_n1_message_container_t *n1MessageContainer = NULL; + OpenAPI_ref_to_binary_data_t *n1MessageContent = NULL; + OpenAPI_n2_info_container_t *n2InfoContainer = NULL; + OpenAPI_n2_sm_information_t *smInfo = NULL; + OpenAPI_n2_info_content_t *n2InfoContent = NULL; + OpenAPI_ref_to_binary_data_t *ngapData = NULL; + + ogs_assert(session); + ogs_assert(recvmsg); + + N1N2MessageTransferReqData = recvmsg->N1N2MessageTransferReqData; + if (!N1N2MessageTransferReqData) { + ogs_error("No N1N2MessageTransferReqData"); + return OGS_ERROR; + } + + n1MessageContainer = N1N2MessageTransferReqData->n1_message_container; + if (!n1MessageContainer) { + ogs_error("No n1MessageContainer"); + return OGS_ERROR; + } + n1MessageContent = n1MessageContainer->n1_message_content; + if (!n1MessageContent || !n1MessageContent->content_id) { + ogs_error("No n1MessageContent"); + return OGS_ERROR; + } + + n2InfoContainer = N1N2MessageTransferReqData->n2_info_container; + if (!n2InfoContainer) { + ogs_error("No n2InfoContainer"); + return OGS_ERROR; + } + smInfo = n2InfoContainer->sm_info; + if (!smInfo) { + ogs_error("No smInfo"); + return OGS_ERROR; + } + n2InfoContent = smInfo->n2_info_content; + if (!n2InfoContent) { + ogs_error("No n2InfoContent"); + return OGS_ERROR; + } + ngapData = n2InfoContent->ngap_data; + if (!ngapData || !ngapData->content_id) { + ogs_error("No ngapData"); + return OGS_ERROR; + } + + pdu_session_id = N1N2MessageTransferReqData->pdu_session_id; + if (pdu_session_id == OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) { + ogs_error("No PDU Session Identity"); + return OGS_ERROR; + } + + supi = recvmsg->h.resource.component[1]; + if (!supi) { + ogs_error("No SUPI"); + return OGS_ERROR; + } + + amf_ue = amf_ue_find_by_supi(supi); + if (!amf_ue) { + ogs_error("No UE context [%s]", supi); + return OGS_ERROR; + } + + sess = amf_sess_find_by_psi(amf_ue, pdu_session_id); + if (!sess) { + ogs_error("[%s] No PDU Session Context [%d]", + amf_ue->supi, pdu_session_id); + return OGS_ERROR; + } + + n1smbuf = ogs_sbi_find_part_by_content_id( + recvmsg, n1MessageContent->content_id); + if (!n1smbuf) { + ogs_error("[%s] No N1 SM Content", amf_ue->supi); + return OGS_ERROR; + } + n1smbuf = ogs_pkbuf_copy(n1smbuf); + ogs_assert(n1smbuf); + + n2smbuf = ogs_sbi_find_part_by_content_id(recvmsg, ngapData->content_id); + if (!n2smbuf) { + ogs_error("[%s] No N2 SM Content", amf_ue->supi); + return OGS_ERROR; + } + n2smbuf = ogs_pkbuf_copy(n2smbuf); + ogs_assert(n2smbuf); + + nas_send_pdu_session_establishment_accept(sess, n1smbuf, n2smbuf); + + memset(&N1N2MessageTransferRspData, 0, sizeof(N1N2MessageTransferRspData)); + N1N2MessageTransferRspData.cause = + OpenAPI_n1_n2_message_transfer_cause_N1_N2_TRANSFER_INITIATED; + + memset(&sendmsg, 0, sizeof(sendmsg)); + + sendmsg.N1N2MessageTransferRspData = &N1N2MessageTransferRspData; + + status = OGS_SBI_HTTP_STATUS_OK; + /* TODO : OGS_SBI_HTTP_STATUS_ACCEPTED */ + + response = ogs_sbi_build_response(&sendmsg, status); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + return OGS_OK; +} diff --git a/src/amf/namf-handler.h b/src/amf/namf-handler.h new file mode 100644 index 000000000..fd343790d --- /dev/null +++ b/src/amf/namf-handler.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AMF_NAMF_HANDLER_H +#define AMF_NAMF_HANDLER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "context.h" + +int amf_namf_comm_handle_n1_n2_message_transfer( + ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg); + +#ifdef __cplusplus +} +#endif + +#endif /* AMF_NAMF_HANDLER_H */ diff --git a/src/amf/nas-path.c b/src/amf/nas-path.c index 255d82bc3..d24c821b2 100644 --- a/src/amf/nas-path.c +++ b/src/amf/nas-path.c @@ -20,9 +20,6 @@ #include "ngap-path.h" #include "ngap-build.h" #include "gmm-build.h" -#if 0 -#include "gsm-build.h" -#endif #include "nas-path.h" int nas_5gs_send_to_gnb(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf) @@ -36,34 +33,6 @@ int nas_5gs_send_to_gnb(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf) return ngap_send_to_ran_ue(ran_ue, pkbuf); } -#if 0 -int nas_5gs_send_gmm_to_esm(amf_ue_t *amf_ue, - ogs_nas_esm_message_container_t *esm_message_container) -{ - int rv; - ogs_pkbuf_t *gsmbuf = NULL; - - ogs_assert(amf_ue); - ogs_assert(esm_message_container); - ogs_assert(esm_message_container->length); - - /* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. - * When calculating AES_CMAC, we need to use the headroom of the packet. */ - gsmbuf = ogs_pkbuf_alloc(NULL, - OGS_NAS_HEADROOM+esm_message_container->length); - ogs_pkbuf_reserve(gsmbuf, OGS_NAS_HEADROOM); - ogs_pkbuf_put_data(gsmbuf, - esm_message_container->buffer, esm_message_container->length); - - rv = ngap_send_to_esm(amf_ue, gsmbuf); - if (rv != OGS_OK) { - ogs_error("ngap_send_to_esm() failed"); - } - - return rv; -} -#endif - int nas_5gs_send_to_downlink_nas_transport(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf) { int rv; @@ -94,64 +63,13 @@ int nas_5gs_send_to_downlink_nas_transport(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf) return OGS_OK; } -void nas_5gs_send_nas_reject( - amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause) -{ - ogs_assert(amf_ue); - - switch(amf_ue->nas.type) { - case OGS_NAS_5GS_REGISTRATION_REQUEST: - if (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_authentication)) { - nas_5gs_send_authentication_reject(amf_ue); - } else { - nas_5gs_send_registration_reject(amf_ue, gmm_cause); - } - break; - default: - ogs_fatal("Unknown type : %d", amf_ue->nas.type); - ogs_assert_if_reached(); - break; - } -} - -void nas_5gs_send_nas_reject_from_sbi(amf_ue_t *amf_ue, int status) -{ - ogs_nas_5gmm_cause_t gmm_cause; - - ogs_assert(amf_ue); - - switch(status) { - case OGS_SBI_HTTP_STATUS_NOT_FOUND: - gmm_cause = OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED; - break; - default: - gmm_cause = OGS_5GMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED; - } - - nas_5gs_send_nas_reject(amf_ue, gmm_cause); -} - -#if 0 void nas_5gs_send_registration_accept(amf_ue_t *amf_ue) { int rv; - amf_sess_t *sess = NULL; - amf_bearer_t *bearer = NULL; ogs_pkbuf_t *ngapbuf = NULL; - ogs_pkbuf_t *gsmbuf = NULL, *gmmbuf = NULL; + ogs_pkbuf_t *gmmbuf = NULL; - ogs_assert(amf_ue); - sess = amf_sess_first(amf_ue); - ogs_assert(sess); - ogs_assert(amf_sess_next(sess) == NULL); - bearer = amf_default_bearer_in_sess(sess); - ogs_assert(bearer); - ogs_assert(amf_bearer_next(bearer) == NULL); - - gsmbuf = esm_build_activate_default_bearer_context_request(sess); - ogs_expect_or_return(gsmbuf); - - gmmbuf = gmm_build_registration_accept(amf_ue, gsmbuf); + gmmbuf = gmm_build_registration_accept(amf_ue); ogs_expect_or_return(gmmbuf); ngapbuf = ngap_build_initial_context_setup_request(amf_ue, gmmbuf); @@ -160,7 +78,6 @@ void nas_5gs_send_registration_accept(amf_ue_t *amf_ue) rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); ogs_expect_or_return(rv == OGS_OK); } -#endif void nas_5gs_send_registration_reject( amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause) @@ -267,6 +184,188 @@ void nas_5gs_send_security_mode_command(amf_ue_t *amf_ue) ogs_expect(rv == OGS_OK); } +void nas_5gs_send_configuration_update_command( + amf_ue_t *amf_ue, int ack, int red) +{ + int rv; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_assert(amf_ue); + + ogs_debug("[%s] Configuration update command", amf_ue->supi); + + if (amf_ue->t3555.pkbuf) { + gmmbuf = amf_ue->t3555.pkbuf; + ogs_expect_or_return(gmmbuf); + } else { + gmmbuf = gmm_build_configuration_update_command(amf_ue, ack, red); + ogs_expect_or_return(gmmbuf); + } + + if (ack) { + amf_ue->t3555.pkbuf = ogs_pkbuf_copy(gmmbuf); + ogs_timer_start(amf_ue->t3555.timer, + amf_timer_cfg(AMF_TIMER_T3555)->duration); + } + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_send_pdu_session_establishment_accept(amf_sess_t *sess, + ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf) +{ + int rv; + + amf_ue_t *amf_ue = NULL; + + ogs_pkbuf_t *gmmbuf = NULL; + ogs_pkbuf_t *ngapbuf = NULL; + + ogs_assert(sess); + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + ogs_assert(n1smbuf); + ogs_assert(n2smbuf); + + gmmbuf = gmm_build_dl_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf, 0, 0); + ogs_expect_or_return(gmmbuf); + + ngapbuf = ngap_build_pdu_session_resource_setup_request( + sess, gmmbuf, n2smbuf); + ogs_expect_or_return(ngapbuf); + + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_gmm_status(amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t cause) +{ + int rv; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_assert(amf_ue); + + ogs_debug("[%s] 5GMM status", amf_ue->supi); + + gmmbuf = gmm_build_status(amf_ue, cause); + ogs_expect_or_return(gmmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_gmm_reject( + amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause) +{ + ogs_assert(amf_ue); + + switch(amf_ue->nas.message_type) { + case OGS_NAS_5GS_REGISTRATION_REQUEST: + if (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_authentication)) { + nas_5gs_send_authentication_reject(amf_ue); + } else { + nas_5gs_send_registration_reject(amf_ue, gmm_cause); + } + break; + default: + ogs_fatal("Unknown type : %d", amf_ue->nas.message_type); + ogs_assert_if_reached(); + break; + } +} + +static ogs_nas_5gmm_cause_t gmm_cause_from_sbi(int status) +{ + ogs_nas_5gmm_cause_t gmm_cause; + + switch(status) { + case OGS_SBI_HTTP_STATUS_NOT_FOUND: + gmm_cause = OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED; + break; + case OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT: + gmm_cause = OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED; + break; + case OGS_SBI_HTTP_STATUS_BAD_REQUEST: + gmm_cause = OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; + break; + case OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR: + gmm_cause = + OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK; + break; + default: + gmm_cause = OGS_5GMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED; + } + + return gmm_cause; +} + +void nas_5gs_send_gmm_reject_from_sbi(amf_ue_t *amf_ue, int status) +{ + ogs_assert(amf_ue); + nas_5gs_send_gmm_reject(amf_ue, gmm_cause_from_sbi(status)); +} + +void nas_5gs_send_gsm_reject(amf_sess_t *sess, + uint8_t payload_container_type, ogs_pkbuf_t *payload_container, + ogs_nas_5gmm_cause_t cause, uint8_t backoff_time) +{ + int rv; + + ogs_pkbuf_t *gmmbuf = NULL; + amf_ue_t *amf_ue = NULL; + + ogs_assert(sess); + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + + ogs_assert(payload_container_type); + ogs_assert(payload_container); + + ogs_warn("[%s] 5GSM reject", amf_ue->suci); + + gmmbuf = gmm_build_dl_nas_transport(sess, + payload_container_type, payload_container, cause, backoff_time); + ogs_expect_or_return(gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect_or_return(rv == OGS_OK); +} + +void nas_5gs_send_gsm_reject_from_sbi(amf_sess_t *sess, + uint8_t payload_container_type, ogs_pkbuf_t *payload_container, + int status) +{ + ogs_assert(sess); + ogs_assert(payload_container_type); + ogs_assert(payload_container); + + nas_5gs_send_gsm_reject(sess, payload_container_type, payload_container, + gmm_cause_from_sbi(status), AMF_NAS_BACKOFF_TIME); +} + +void nas_5gs_send_back_5gsm_message( + amf_sess_t *sess, ogs_nas_5gmm_cause_t cause) +{ + ogs_pkbuf_t *pbuf = NULL; + + ogs_assert(sess); + ogs_assert(sess->payload_container_type); + ogs_assert(sess->payload_container); + + pbuf = ogs_pkbuf_copy(sess->payload_container); + ogs_expect_or_return(pbuf); + + nas_5gs_send_gsm_reject(sess, sess->payload_container_type, pbuf, + cause, AMF_NAS_BACKOFF_TIME); +} + +void nas_5gs_send_back_5gsm_message_from_sbi(amf_sess_t *sess, int status) +{ + ogs_assert(sess); + nas_5gs_send_back_5gsm_message(sess, gmm_cause_from_sbi(status)); +} + #if 0 void nas_5gs_send_detach_accept(amf_ue_t *amf_ue) { diff --git a/src/amf/nas-path.h b/src/amf/nas-path.h index c8ee7cb0a..54c16fc3a 100644 --- a/src/amf/nas-path.h +++ b/src/amf/nas-path.h @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -#ifndef NAS_5GS_PATH_H -#define NAS_5GS_PATH_H +#ifndef AMF_NAS_5GS_PATH_H +#define AMF_NAS_5GS_PATH_H #include "context.h" @@ -26,19 +26,12 @@ extern "C" { #endif +#define AMF_NAS_BACKOFF_TIME 6 /* 6 seconds */ + int nas_5gs_send_to_gnb(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf); -#if 0 -int nas_5gs_send_gmm_to_gsm( - amf_ue_t *amf_ue, ogs_nas_5gsm_message_container_t *esm_message_container); -#endif int nas_5gs_send_to_downlink_nas_transport( amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf); -void nas_5gs_send_nas_reject( - amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause); -void nas_5gs_send_nas_reject_from_sbi( - amf_ue_t *amf_ue, int status); - void nas_5gs_send_registration_accept(amf_ue_t *amf_ue); void nas_5gs_send_registration_reject( amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause); @@ -50,6 +43,28 @@ void nas_5gs_send_authentication_reject(amf_ue_t *amf_ue); void nas_5gs_send_security_mode_command(amf_ue_t *amf_ue); +void nas_5gs_send_configuration_update_command( + amf_ue_t *amf_ue, int ack, int red); + +void nas_send_pdu_session_establishment_accept(amf_sess_t *sess, + ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf); + +void nas_5gs_send_gmm_status(amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t cause); + +void nas_5gs_send_gmm_reject( + amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause); +void nas_5gs_send_gmm_reject_from_sbi(amf_ue_t *amf_ue, int status); + +void nas_5gs_send_gsm_reject(amf_sess_t *sess, + uint8_t payload_container_type, ogs_pkbuf_t *payload_container, + ogs_nas_5gmm_cause_t cause, uint8_t backoff_time); +void nas_5gs_send_gsm_reject_from_sbi(amf_sess_t *sess, + uint8_t payload_container_type, ogs_pkbuf_t *payload_container, + int status); +void nas_5gs_send_back_5gsm_message( + amf_sess_t *sess, ogs_nas_5gmm_cause_t gmm_cause); +void nas_5gs_send_back_5gsm_message_from_sbi(amf_sess_t *sess, int status); + #if 0 void nas_5gs_send_detach_accept(amf_ue_t *amf_ue); @@ -84,4 +99,4 @@ void nas_5gs_send_downlink_nas_transport( } #endif -#endif /* NAS_5GS_PATH_H */ +#endif /* AMF_NAS_5GS_PATH_H */ diff --git a/src/amf/nas-security.c b/src/amf/nas-security.c index 731205a29..78e308e93 100644 --- a/src/amf/nas-security.c +++ b/src/amf/nas-security.c @@ -66,8 +66,19 @@ ogs_pkbuf_t *nas_5gs_security_encode( amf_ue->ul_count.i32 = 0; } - if (amf_ue->selected_enc_algorithm == 0) + if (amf_ue->selected_enc_algorithm == 0) { ciphered = 0; +#if 0 /* Wireshark does not support it */ + if (message->h.security_header_type == + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED) + message->h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED; + else if (message->h.security_header_type == + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHTERD_WITH_NEW_INTEGRITY_CONTEXT) + message->h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_NEW_SECURITY_CONTEXT; +#endif + } if (amf_ue->selected_int_algorithm == 0) integrity_protected = 0; @@ -87,7 +98,7 @@ ogs_pkbuf_t *nas_5gs_security_encode( /* encrypt NAS message */ ogs_nas_encrypt(amf_ue->selected_enc_algorithm, amf_ue->knas_enc, amf_ue->dl_count, - amf_ue->nas.connection_identifier, + amf_ue->nas.access_type, NAS_SECURITY_DOWNLINK_DIRECTION, new); } @@ -101,7 +112,7 @@ ogs_pkbuf_t *nas_5gs_security_encode( /* calculate NAS MAC(message authentication code) */ ogs_nas_mac_calculate(amf_ue->selected_int_algorithm, amf_ue->knas_int, amf_ue->dl_count, - amf_ue->nas.connection_identifier, + amf_ue->nas.access_type, NAS_SECURITY_DOWNLINK_DIRECTION, new, mac); memcpy(&h.message_authentication_code, mac, sizeof(mac)); } @@ -164,7 +175,7 @@ int nas_5gs_security_decode(amf_ue_t *amf_ue, /* calculate NAS MAC(message authentication code) */ ogs_nas_mac_calculate(amf_ue->selected_int_algorithm, amf_ue->knas_int, amf_ue->ul_count.i32, - amf_ue->nas.connection_identifier, + amf_ue->nas.access_type, NAS_SECURITY_UPLINK_DIRECTION, pkbuf, mac); h->message_authentication_code = original_mac; @@ -183,7 +194,7 @@ int nas_5gs_security_decode(amf_ue_t *amf_ue, /* decrypt NAS message */ ogs_nas_encrypt(amf_ue->selected_enc_algorithm, amf_ue->knas_enc, amf_ue->ul_count.i32, - amf_ue->nas.connection_identifier, + amf_ue->nas.access_type, NAS_SECURITY_UPLINK_DIRECTION, pkbuf); } } diff --git a/src/amf/nausf-build.c b/src/amf/nausf-build.c index 9800cfda9..f572d1161 100644 --- a/src/amf/nausf-build.c +++ b/src/amf/nausf-build.c @@ -19,7 +19,8 @@ #include "nausf-build.h" -ogs_sbi_request_t *amf_nausf_auth_build_authenticate(amf_ue_t *amf_ue) +ogs_sbi_request_t *amf_nausf_auth_build_authenticate( + amf_ue_t *amf_ue, void *data) { ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; @@ -31,7 +32,7 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate(amf_ue_t *amf_ue) memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NAUSF_AUTH; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS; @@ -44,7 +45,7 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate(amf_ue_t *amf_ue) ogs_assert(amf_ue->suci); AuthenticationInfo->supi_or_suci = amf_ue->suci; AuthenticationInfo->serving_network_name = - ogs_plmn_id_string(&amf_ue->tai.plmn_id); + ogs_serving_network_name_from_plmn_id(&amf_ue->tai.plmn_id); message.AuthenticationInfo = AuthenticationInfo; @@ -58,7 +59,7 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate(amf_ue_t *amf_ue) } ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation( - amf_ue_t *amf_ue) + amf_ue_t *amf_ue, void *data) { ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; @@ -72,7 +73,7 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation( memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT; - message.h.url = amf_ue->confirmation_url_for_5g_aka; + message.h.uri = amf_ue->confirmation_url_for_5g_aka; ConfirmationData = ogs_calloc(1, sizeof(*ConfirmationData)); ogs_assert(ConfirmationData); diff --git a/src/amf/nausf-build.h b/src/amf/nausf-build.h index c59d42b90..2356fb2d3 100644 --- a/src/amf/nausf-build.h +++ b/src/amf/nausf-build.h @@ -26,9 +26,10 @@ extern "C" { #endif -ogs_sbi_request_t *amf_nausf_auth_build_authenticate(amf_ue_t *amf_ue); +ogs_sbi_request_t *amf_nausf_auth_build_authenticate( + amf_ue_t *amf_ue, void *data); ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation( - amf_ue_t *amf_ue); + amf_ue_t *amf_ue, void *data); #ifdef __cplusplus } diff --git a/src/amf/nausf-handler.c b/src/amf/nausf-handler.c index 38ea2fd36..227c37a7b 100644 --- a/src/amf/nausf-handler.c +++ b/src/amf/nausf-handler.c @@ -93,7 +93,6 @@ int amf_nausf_auth_handle_authenticate( if (amf_ue->confirmation_url_for_5g_aka) ogs_free(amf_ue->confirmation_url_for_5g_aka); - amf_ue->confirmation_url_for_5g_aka = ogs_strdup(LinksValueSchemeValue->href); diff --git a/src/amf/ngap-build.c b/src/amf/ngap-build.c index 92fc7bcac..429d82218 100644 --- a/src/amf/ngap-build.c +++ b/src/amf/ngap-build.c @@ -157,7 +157,7 @@ ogs_pkbuf_t *ngap_build_ng_setup_response(void) ASN_SEQUENCE_ADD(&PLMNSupportList->list, NGAP_PLMNSupportItem); } - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_ng_setup_failure( @@ -212,7 +212,7 @@ ogs_pkbuf_t *ngap_build_ng_setup_failure( if (TimeToWait) *TimeToWait = time_to_wait; - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_downlink_nas_transport( @@ -267,7 +267,7 @@ ogs_pkbuf_t *ngap_build_downlink_nas_transport( ie = CALLOC(1, sizeof(NGAP_DownlinkNASTransport_IEs_t)); ASN_SEQUENCE_ADD(&DownlinkNASTransport->protocolIEs, ie); - + ie->id = NGAP_ProtocolIE_ID_id_NAS_PDU; ie->criticality = NGAP_Criticality_reject; ie->value.present = NGAP_DownlinkNASTransport_IEs__value_PR_NAS_PDU; @@ -285,14 +285,13 @@ ogs_pkbuf_t *ngap_build_downlink_nas_transport( memcpy(NAS_PDU->buf, gmmbuf->data, NAS_PDU->size); ogs_pkbuf_free(gmmbuf); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } -#if 0 ogs_pkbuf_t *ngap_build_initial_context_setup_request( amf_ue_t *amf_ue, ogs_pkbuf_t *gmmbuf) { - int rv; + int i, j; NGAP_NGAP_PDU_t pdu; NGAP_InitiatingMessage_t *initiatingMessage = NULL; @@ -301,21 +300,17 @@ ogs_pkbuf_t *ngap_build_initial_context_setup_request( NGAP_InitialContextSetupRequestIEs_t *ie = NULL; NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL; NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; - NGAP_UEAggregateMaximumBitrate_t *UEAggregateMaximumBitrate = NULL; - NGAP_E_RABToBeSetupListCtxtSUReq_t *E_RABToBeSetupListCtxtSUReq = NULL; + NGAP_GUAMI_t *GUAMI = NULL; + NGAP_AllowedNSSAI_t *AllowedNSSAI = NULL; NGAP_UESecurityCapabilities_t *UESecurityCapabilities = NULL; NGAP_SecurityKey_t *SecurityKey = NULL; + NGAP_NAS_PDU_t *NAS_PDU = NULL; ran_ue_t *ran_ue = NULL; - amf_sess_t *sess = NULL; - amf_bearer_t *bearer = NULL; - ogs_diam_s6a_subscription_data_t *subscription_data = NULL; ogs_assert(amf_ue); ran_ue = amf_ue->ran_ue; ogs_assert(ran_ue); - subscription_data = &amf_ue->subscription_data; - ogs_assert(subscription_data); ogs_debug("Initial context setup request"); @@ -357,115 +352,21 @@ ogs_pkbuf_t *ngap_build_initial_context_setup_request( ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); - ie->id = NGAP_ProtocolIE_ID_id_uEaggregateMaximumBitrate; + ie->id = NGAP_ProtocolIE_ID_id_GUAMI; ie->criticality = NGAP_Criticality_reject; - ie->value.present = - NGAP_InitialContextSetupRequestIEs__value_PR_UEAggregateMaximumBitrate; + ie->value.present = NGAP_InitialContextSetupRequestIEs__value_PR_GUAMI; - UEAggregateMaximumBitrate = &ie->value.choice.UEAggregateMaximumBitrate; + GUAMI = &ie->value.choice.GUAMI; ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); - ie->id = NGAP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq; + ie->id = NGAP_ProtocolIE_ID_id_AllowedNSSAI; ie->criticality = NGAP_Criticality_reject; ie->value.present = - NGAP_InitialContextSetupRequestIEs__value_PR_E_RABToBeSetupListCtxtSUReq; + NGAP_InitialContextSetupRequestIEs__value_PR_AllowedNSSAI; - E_RABToBeSetupListCtxtSUReq = &ie->value.choice.E_RABToBeSetupListCtxtSUReq; - - ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%d]", - ran_ue->ran_ue_ngap_id, ran_ue->amf_ue_ngap_id); - - *AMF_UE_NGAP_ID = ran_ue->amf_ue_ngap_id; - *RAN_UE_NGAP_ID = ran_ue->ran_ue_ngap_id; - - asn_uint642INTEGER( - &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateUL, - subscription_data->ambr.uplink); - asn_uint642INTEGER( - &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateDL, - subscription_data->ambr.downlink); - - sess = amf_sess_first(amf_ue); - while (sess) { - bearer = amf_bearer_first(sess); - while (bearer) { - NGAP_E_RABToBeSetupItemCtxtSUReqIEs_t *item = NULL; - NGAP_E_RABToBeSetupItemCtxtSUReq_t *e_rab = NULL; - NGAP_GBR_QosInformation_t *gbrQosInformation = NULL; - NGAP_NAS_PDU_t *nasPdu = NULL; - - item = CALLOC( - 1, sizeof(NGAP_E_RABToBeSetupItemCtxtSUReqIEs_t)); - ASN_SEQUENCE_ADD(&E_RABToBeSetupListCtxtSUReq->list, item); - - item->id = NGAP_ProtocolIE_ID_id_E_RABToBeSetupItemCtxtSUReq; - item->criticality = NGAP_Criticality_reject; - item->value.present = NGAP_E_RABToBeSetupItemCtxtSUReqIEs__value_PR_E_RABToBeSetupItemCtxtSUReq; - - e_rab = &item->value.choice.E_RABToBeSetupItemCtxtSUReq; - - e_rab->e_RAB_ID = bearer->ebi; - e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.qci; - - ogs_debug(" EBI[%d] QCI[%d] SGW-NGU-TEID[%d]", - bearer->ebi, bearer->qos.qci, bearer->sgw_s1u_teid); - - e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. - priorityLevel = bearer->qos.arp.priority_level; - e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. - pre_emptionCapability = - !(bearer->qos.arp.pre_emption_capability); - e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. - pre_emptionVulnerability = - !(bearer->qos.arp.pre_emption_vulnerability); - - if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink || - bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) { - if (bearer->qos.mbr.downlink == 0) - bearer->qos.mbr.downlink = MAX_BIT_RATE; - if (bearer->qos.mbr.uplink == 0) - bearer->qos.mbr.uplink = MAX_BIT_RATE; - if (bearer->qos.gbr.downlink == 0) - bearer->qos.gbr.downlink = MAX_BIT_RATE; - if (bearer->qos.gbr.uplink == 0) - bearer->qos.gbr.uplink = MAX_BIT_RATE; - - gbrQosInformation = - CALLOC(1, sizeof(struct NGAP_GBR_QosInformation)); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, - bearer->qos.mbr.downlink); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, - bearer->qos.mbr.uplink); - asn_uint642INTEGER(&gbrQosInformation-> - e_RAB_GuaranteedBitrateDL, bearer->qos.gbr.downlink); - asn_uint642INTEGER(&gbrQosInformation-> - e_RAB_GuaranteedBitrateUL, bearer->qos.gbr.uplink); - e_rab->e_RABlevelQoSParameters.gbrQosInformation = - gbrQosInformation; - } - - rv = ogs_asn_ip_to_BIT_STRING( - &bearer->sgw_s1u_ip, &e_rab->transportLayerAddress); - ogs_assert(rv == OGS_OK); - ogs_asn_uint32_to_OCTET_STRING( - bearer->sgw_s1u_teid, &e_rab->gTP_TEID); - - if (gmmbuf && gmmbuf->len) { - nasPdu = (NGAP_NAS_PDU_t *)CALLOC( - 1, sizeof(NGAP_NAS_PDU_t)); - nasPdu->size = gmmbuf->len; - nasPdu->buf = CALLOC(nasPdu->size, sizeof(uint8_t)); - memcpy(nasPdu->buf, gmmbuf->data, nasPdu->size); - e_rab->nAS_PDU = nasPdu; - ogs_pkbuf_free(gmmbuf); - } - - bearer = amf_bearer_next(bearer); - } - sess = amf_sess_next(sess); - } + AllowedNSSAI = &ie->value.choice.AllowedNSSAI; ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); @@ -477,22 +378,6 @@ ogs_pkbuf_t *ngap_build_initial_context_setup_request( UESecurityCapabilities = &ie->value.choice.UESecurityCapabilities; - UESecurityCapabilities->encryptionAlgorithms.size = 2; - UESecurityCapabilities->encryptionAlgorithms.buf = - CALLOC(UESecurityCapabilities->encryptionAlgorithms.size, - sizeof(uint8_t)); - UESecurityCapabilities->encryptionAlgorithms.bits_unused = 0; - UESecurityCapabilities->encryptionAlgorithms.buf[0] = - (amf_ue->ue_network_capability.eea << 1); - - UESecurityCapabilities->integrityProtectionAlgorithms.size = 2; - UESecurityCapabilities->integrityProtectionAlgorithms.buf = - CALLOC(UESecurityCapabilities-> - integrityProtectionAlgorithms.size, sizeof(uint8_t)); - UESecurityCapabilities->integrityProtectionAlgorithms.bits_unused = 0; - UESecurityCapabilities->integrityProtectionAlgorithms.buf[0] = - (amf_ue->ue_network_capability.eia << 1); - ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); @@ -503,51 +388,100 @@ ogs_pkbuf_t *ngap_build_initial_context_setup_request( SecurityKey = &ie->value.choice.SecurityKey; + ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t)); + ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_NAS_PDU; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = NGAP_InitialContextSetupRequestIEs__value_PR_NAS_PDU; + + NAS_PDU = &ie->value.choice.NAS_PDU; + + ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]", + ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id); + + asn_uint642INTEGER(AMF_UE_NGAP_ID, ran_ue->amf_ue_ngap_id); + *RAN_UE_NGAP_ID = ran_ue->ran_ue_ngap_id; + + NAS_PDU->size = gmmbuf->len; + NAS_PDU->buf = CALLOC(NAS_PDU->size, sizeof(uint8_t)); + memcpy(NAS_PDU->buf, gmmbuf->data, NAS_PDU->size); + ogs_pkbuf_free(gmmbuf); + + ogs_assert(amf_ue->guami); + ogs_asn_buffer_to_OCTET_STRING(&amf_ue->guami->plmn_id, OGS_PLMN_ID_LEN, + &GUAMI->pLMNIdentity); + ogs_ngap_uint8_to_AMFRegionID(ogs_amf_region_id(&amf_ue->guami->amf_id), + &GUAMI->aMFRegionID); + ogs_ngap_uint16_to_AMFSetID(ogs_amf_set_id(&amf_ue->guami->amf_id), + &GUAMI->aMFSetID); + ogs_ngap_uint8_to_AMFPointer(ogs_amf_pointer(&amf_ue->guami->amf_id), + &GUAMI->aMFPointer); + + for (i = 0; i < amf_self()->num_of_plmn_support; i++) { + if (memcmp(&amf_ue->tai.plmn_id, + &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) + continue; + for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { + NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; + NGAP_S_NSSAI_t *s_NSSAI = NULL; + NGAP_SST_t *sST = NULL; + + NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) + CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); + s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; + sST = &s_NSSAI->sST; + + ogs_asn_uint8_to_OCTET_STRING( + amf_self()->plmn_support[i].s_nssai[j].sst, sST); + if (amf_self()->plmn_support[i].s_nssai[j].sd.v != + OGS_S_NSSAI_NO_SD_VALUE) { + s_NSSAI->sD = CALLOC(1, sizeof(ogs_uint24_t)); + ogs_asn_uint24_to_OCTET_STRING( + amf_self()->plmn_support[i].s_nssai[j].sd, s_NSSAI->sD); + } + + ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); + } + } + + UESecurityCapabilities->nRencryptionAlgorithms.size = 2; + UESecurityCapabilities->nRencryptionAlgorithms.buf = + CALLOC(UESecurityCapabilities-> + nRencryptionAlgorithms.size, sizeof(uint8_t)); + UESecurityCapabilities->nRencryptionAlgorithms.bits_unused = 0; + UESecurityCapabilities->nRencryptionAlgorithms.buf[0] = + (amf_ue->ue_security_capability.nea << 1); + + UESecurityCapabilities->nRintegrityProtectionAlgorithms.size = 2; + UESecurityCapabilities->nRintegrityProtectionAlgorithms.buf = + CALLOC(UESecurityCapabilities-> + nRintegrityProtectionAlgorithms.size, sizeof(uint8_t)); + UESecurityCapabilities->nRintegrityProtectionAlgorithms.bits_unused = 0; + UESecurityCapabilities->nRintegrityProtectionAlgorithms.buf[0] = + (amf_ue->ue_security_capability.nia << 1); + + UESecurityCapabilities->eUTRAencryptionAlgorithms.size = 2; + UESecurityCapabilities->eUTRAencryptionAlgorithms.buf = + CALLOC(UESecurityCapabilities-> + eUTRAencryptionAlgorithms.size, sizeof(uint8_t)); + UESecurityCapabilities->eUTRAencryptionAlgorithms.bits_unused = 0; + UESecurityCapabilities->eUTRAencryptionAlgorithms.buf[0] = + (amf_ue->ue_security_capability.eps_ea << 1); + + UESecurityCapabilities->eUTRAintegrityProtectionAlgorithms.size = 2; + UESecurityCapabilities->eUTRAintegrityProtectionAlgorithms.buf = + CALLOC(UESecurityCapabilities-> + eUTRAintegrityProtectionAlgorithms.size, sizeof(uint8_t)); + UESecurityCapabilities->eUTRAintegrityProtectionAlgorithms.bits_unused = 0; + UESecurityCapabilities->eUTRAintegrityProtectionAlgorithms.buf[0] = + (amf_ue->ue_security_capability.eps_ia << 1); + SecurityKey->size = OGS_SHA256_DIGEST_SIZE; - SecurityKey->buf = - CALLOC(SecurityKey->size, sizeof(uint8_t)); + SecurityKey->buf = CALLOC(SecurityKey->size, sizeof(uint8_t)); SecurityKey->bits_unused = 0; memcpy(SecurityKey->buf, amf_ue->kgnb, SecurityKey->size); - if (amf_ue->nas_eps.type == AMF_EPS_TYPE_EXTENDED_SERVICE_REQUEST && - AMF_P_TMSI_IS_AVAILABLE(amf_ue)) { - - /* Set CS-Fallback */ - NGAP_CSFallbackIndicator_t *CSFallbackIndicator = NULL; - NGAP_LAI_t *LAI = NULL; - - ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t)); - ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); - - ie->id = NGAP_ProtocolIE_ID_id_CSFallbackIndicator; - ie->criticality = NGAP_Criticality_reject; - ie->value.present = - NGAP_InitialContextSetupRequestIEs__value_PR_CSFallbackIndicator; - - CSFallbackIndicator = &ie->value.choice.CSFallbackIndicator; - ogs_assert(CSFallbackIndicator); - - *CSFallbackIndicator = NGAP_CSFallbackIndicator_cs_fallback_required; - - ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t)); - ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); - - ie->id = NGAP_ProtocolIE_ID_id_RegisteredLAI; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = - NGAP_InitialContextSetupRequestIEs__value_PR_LAI; - - LAI = &ie->value.choice.LAI; - ogs_assert(LAI); - - ogs_ngap_buffer_to_OCTET_STRING( - &amf_ue->tai.plmn_id, sizeof(ogs_plmn_id_t), &LAI->pLMNidentity); - ogs_assert(amf_ue->csmap); - ogs_assert(amf_ue->p_tmsi); - ogs_asn_uint16_to_OCTET_STRING(amf_ue->csmap->lai.lac, &LAI->lAC); - - } - if (amf_ue->ueRadioCapability.buf && amf_ue->ueRadioCapability.size) { /* Set UeRadioCapability if exists */ NGAP_UERadioCapability_t *UERadioCapability = NULL; @@ -563,14 +497,15 @@ ogs_pkbuf_t *ngap_build_initial_context_setup_request( UERadioCapability = &ie->value.choice.UERadioCapability; ogs_assert(UERadioCapability); - ogs_ngap_buffer_to_OCTET_STRING( + ogs_asn_buffer_to_OCTET_STRING( amf_ue->ueRadioCapability.buf, amf_ue->ueRadioCapability.size, UERadioCapability); } - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } +#if 0 ogs_pkbuf_t *ngap_build_ue_context_modification_request(amf_ue_t *amf_ue) { NGAP_NGAP_PDU_t pdu; @@ -661,7 +596,7 @@ ogs_pkbuf_t *ngap_build_ue_context_modification_request(amf_ue_t *amf_ue) LAI = &ie->value.choice.LAI; ogs_assert(LAI); - ogs_ngap_buffer_to_OCTET_STRING( + ogs_asn_buffer_to_OCTET_STRING( &amf_ue->tai.plmn_id, sizeof(ogs_plmn_id_t), &LAI->pLMNidentity); ogs_assert(amf_ue->csmap); ogs_assert(amf_ue->p_tmsi); @@ -679,7 +614,7 @@ ogs_pkbuf_t *ngap_build_ue_context_modification_request(amf_ue_t *amf_ue) UESecurityCapabilities->encryptionAlgorithms.size = 2; UESecurityCapabilities->encryptionAlgorithms.buf = - CALLOC(UESecurityCapabilities->encryptionAlgorithms.size, + CALLOC(UESecurityCapabilities->encryptionAlgorithms.size, sizeof(uint8_t)); UESecurityCapabilities->encryptionAlgorithms.bits_unused = 0; UESecurityCapabilities->encryptionAlgorithms.buf[0] = @@ -710,7 +645,7 @@ ogs_pkbuf_t *ngap_build_ue_context_modification_request(amf_ue_t *amf_ue) memcpy(SecurityKey->buf, amf_ue->kgnb, SecurityKey->size); } - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_ue_context_release_command( @@ -779,147 +714,121 @@ ogs_pkbuf_t *ngap_build_ue_context_release_command( Cause->present = group; Cause->choice.radioNetwork = cause; - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } +#endif -ogs_pkbuf_t *ngap_build_e_rab_setup_request( - amf_bearer_t *bearer, ogs_pkbuf_t *gsmbuf) +ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request( + amf_sess_t *sess, ogs_pkbuf_t *gmmbuf, ogs_pkbuf_t *n2smbuf) { - int rv; - NGAP_NGAP_PDU_t pdu; NGAP_InitiatingMessage_t *initiatingMessage = NULL; - NGAP_E_RABSetupRequest_t *E_RABSetupRequest = NULL; + NGAP_PDUSessionResourceSetupRequest_t *PDUSessionResourceSetupRequest; - NGAP_E_RABSetupRequestIEs_t *ie = NULL; + NGAP_PDUSessionResourceSetupRequestIEs_t *ie = NULL; NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL; NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; - NGAP_E_RABToBeSetupListBearerSUReq_t *E_RABToBeSetupListBearerSUReq = NULL; - NGAP_E_RABToBeSetupItemBearerSUReqIEs_t *item = NULL; - NGAP_E_RABToBeSetupItemBearerSUReq_t *e_rab = NULL; - NGAP_GBR_QosInformation_t *gbrQosInformation = NULL; - NGAP_NAS_PDU_t *nasPdu = NULL; + NGAP_PDUSessionResourceSetupListSUReq_t *PDUSessionList = NULL; + NGAP_PDUSessionResourceSetupItemSUReq_t *PDUSessionItem = NULL; + NGAP_NAS_PDU_t *pDUSessionNAS_PDU = NULL; + NGAP_S_NSSAI_t *s_NSSAI = NULL; + NGAP_SST_t *sST = NULL; + OCTET_STRING_t *transfer = NULL; amf_ue_t *amf_ue = NULL; ran_ue_t *ran_ue = NULL; - ogs_assert(gsmbuf); - ogs_assert(bearer); + ogs_assert(gmmbuf); + ogs_assert(n2smbuf); + ogs_assert(sess); - amf_ue = bearer->amf_ue; + amf_ue = sess->amf_ue; ogs_assert(amf_ue); ran_ue = amf_ue->ran_ue; ogs_assert(ran_ue); memset(&pdu, 0, sizeof (NGAP_NGAP_PDU_t)); pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = - CALLOC(1, sizeof(NGAP_InitiatingMessage_t)); + pdu.choice.initiatingMessage = CALLOC(1, sizeof(NGAP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; - initiatingMessage->procedureCode = NGAP_ProcedureCode_id_E_RABSetup; + initiatingMessage->procedureCode = + NGAP_ProcedureCode_id_PDUSessionResourceSetup; initiatingMessage->criticality = NGAP_Criticality_reject; initiatingMessage->value.present = - NGAP_InitiatingMessage__value_PR_E_RABSetupRequest; + NGAP_InitiatingMessage__value_PR_PDUSessionResourceSetupRequest; - E_RABSetupRequest = &initiatingMessage->value.choice.E_RABSetupRequest; + PDUSessionResourceSetupRequest = + &initiatingMessage->value.choice.PDUSessionResourceSetupRequest; - ie = CALLOC(1, sizeof(NGAP_E_RABSetupRequestIEs_t)); - ASN_SEQUENCE_ADD(&E_RABSetupRequest->protocolIEs, ie); + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupRequestIEs_t)); + ASN_SEQUENCE_ADD(&PDUSessionResourceSetupRequest->protocolIEs, ie); ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABSetupRequestIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.present = + NGAP_PDUSessionResourceSetupRequestIEs__value_PR_AMF_UE_NGAP_ID; AMF_UE_NGAP_ID = &ie->value.choice.AMF_UE_NGAP_ID; - ie = CALLOC(1, sizeof(NGAP_E_RABSetupRequestIEs_t)); - ASN_SEQUENCE_ADD(&E_RABSetupRequest->protocolIEs, ie); + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupRequestIEs_t)); + ASN_SEQUENCE_ADD(&PDUSessionResourceSetupRequest->protocolIEs, ie); ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABSetupRequestIEs__value_PR_RAN_UE_NGAP_ID; + ie->value.present = + NGAP_PDUSessionResourceSetupRequestIEs__value_PR_RAN_UE_NGAP_ID; RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; - ie = CALLOC(1, sizeof(NGAP_E_RABSetupRequestIEs_t)); - ASN_SEQUENCE_ADD(&E_RABSetupRequest->protocolIEs, ie); + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupRequestIEs_t)); + ASN_SEQUENCE_ADD(&PDUSessionResourceSetupRequest->protocolIEs, ie); - ie->id = NGAP_ProtocolIE_ID_id_E_RABToBeSetupListBearerSUReq; + ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSUReq; ie->criticality = NGAP_Criticality_reject; - ie->value.present = - NGAP_E_RABSetupRequestIEs__value_PR_E_RABToBeSetupListBearerSUReq; + ie->value.present = NGAP_PDUSessionResourceSetupRequestIEs__value_PR_PDUSessionResourceSetupListSUReq; - E_RABToBeSetupListBearerSUReq = - &ie->value.choice.E_RABToBeSetupListBearerSUReq; + PDUSessionList = &ie->value.choice.PDUSessionResourceSetupListSUReq; - ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%d]", - ran_ue->ran_ue_ngap_id, ran_ue->amf_ue_ngap_id); + ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]", + ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id); - *AMF_UE_NGAP_ID = ran_ue->amf_ue_ngap_id; + asn_uint642INTEGER(AMF_UE_NGAP_ID, ran_ue->amf_ue_ngap_id); *RAN_UE_NGAP_ID = ran_ue->ran_ue_ngap_id; - item = CALLOC(1, sizeof(NGAP_E_RABToBeSetupItemBearerSUReqIEs_t)); - ASN_SEQUENCE_ADD(&E_RABToBeSetupListBearerSUReq->list, item); + PDUSessionItem = + CALLOC(1, sizeof(struct NGAP_PDUSessionResourceSetupItemSUReq)); + ASN_SEQUENCE_ADD(&PDUSessionList->list, PDUSessionItem); - item->id = NGAP_ProtocolIE_ID_id_E_RABToBeSetupItemBearerSUReq; - item->criticality = NGAP_Criticality_reject; - item->value.present = NGAP_E_RABToBeSetupItemBearerSUReqIEs__value_PR_E_RABToBeSetupItemBearerSUReq; + PDUSessionItem->pDUSessionID = sess->psi; - e_rab = &item->value.choice.E_RABToBeSetupItemBearerSUReq; + pDUSessionNAS_PDU = CALLOC(1, sizeof(NGAP_NAS_PDU_t)); + PDUSessionItem->pDUSessionNAS_PDU = pDUSessionNAS_PDU; + pDUSessionNAS_PDU->size = gmmbuf->len; + pDUSessionNAS_PDU->buf = CALLOC(pDUSessionNAS_PDU->size, sizeof(uint8_t)); + memcpy(pDUSessionNAS_PDU->buf, gmmbuf->data, pDUSessionNAS_PDU->size); + ogs_pkbuf_free(gmmbuf); - e_rab->e_RAB_ID = bearer->ebi; - e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.qci; - - ogs_debug(" EBI[%d] QCI[%d]", bearer->ebi, bearer->qos.qci); - - e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. - priorityLevel = bearer->qos.arp.priority_level; - e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. - pre_emptionCapability = !(bearer->qos.arp.pre_emption_capability); - e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. - pre_emptionVulnerability = !(bearer->qos.arp.pre_emption_vulnerability); - - if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink || - bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) { - if (bearer->qos.mbr.downlink == 0) - bearer->qos.mbr.downlink = MAX_BIT_RATE; - if (bearer->qos.mbr.uplink == 0) - bearer->qos.mbr.uplink = MAX_BIT_RATE; - if (bearer->qos.gbr.downlink == 0) - bearer->qos.gbr.downlink = MAX_BIT_RATE; - if (bearer->qos.gbr.uplink == 0) - bearer->qos.gbr.uplink = MAX_BIT_RATE; - - gbrQosInformation = CALLOC(1, sizeof(NGAP_GBR_QosInformation_t)); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, - bearer->qos.mbr.downlink); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, - bearer->qos.mbr.uplink); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_GuaranteedBitrateDL, - bearer->qos.gbr.downlink); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_GuaranteedBitrateUL, - bearer->qos.gbr.uplink); - e_rab->e_RABlevelQoSParameters.gbrQosInformation = gbrQosInformation; + s_NSSAI = &PDUSessionItem->s_NSSAI; + sST = &s_NSSAI->sST; + ogs_asn_uint8_to_OCTET_STRING(sess->s_nssai.sst, sST); + if (sess->s_nssai.sd.v != OGS_S_NSSAI_NO_SD_VALUE) { + s_NSSAI->sD = CALLOC(1, sizeof(ogs_uint24_t)); + ogs_asn_uint24_to_OCTET_STRING(sess->s_nssai.sd, s_NSSAI->sD); } - rv = ogs_asn_ip_to_BIT_STRING( - &bearer->sgw_s1u_ip, &e_rab->transportLayerAddress); - ogs_assert(rv == OGS_OK); - ogs_asn_uint32_to_OCTET_STRING(bearer->sgw_s1u_teid, &e_rab->gTP_TEID); - ogs_debug(" SGW-NGU-TEID[%d]", bearer->sgw_s1u_teid); + transfer = &PDUSessionItem->pDUSessionResourceSetupRequestTransfer; + transfer->size = n2smbuf->len; + transfer->buf = CALLOC(transfer->size, sizeof(uint8_t)); + memcpy(transfer->buf, n2smbuf->data, transfer->size); + ogs_pkbuf_free(n2smbuf); - nasPdu = &e_rab->nAS_PDU; - nasPdu->size = gsmbuf->len; - nasPdu->buf = CALLOC(nasPdu->size, sizeof(uint8_t)); - memcpy(nasPdu->buf, gsmbuf->data, nasPdu->size); - ogs_pkbuf_free(gsmbuf); - - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } +#if 0 ogs_pkbuf_t *ngap_build_e_rab_modify_request( amf_bearer_t *bearer, ogs_pkbuf_t *gsmbuf) { @@ -1049,7 +958,7 @@ ogs_pkbuf_t *ngap_build_e_rab_modify_request( memcpy(nasPdu->buf, gsmbuf->data, nasPdu->size); ogs_pkbuf_free(gsmbuf); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_e_rab_release_command( @@ -1179,7 +1088,7 @@ ogs_pkbuf_t *ngap_build_e_rab_release_command( memcpy(nasPdu->buf, gsmbuf->data, nasPdu->size); ogs_pkbuf_free(gsmbuf); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_paging( @@ -1298,11 +1207,11 @@ ogs_pkbuf_t *ngap_build_paging( tai_item = &item->value.choice.TAIItem; - ogs_ngap_buffer_to_OCTET_STRING(&amf_ue->tai.plmn_id, sizeof(ogs_plmn_id_t), + ogs_asn_buffer_to_OCTET_STRING(&amf_ue->tai.plmn_id, sizeof(ogs_plmn_id_t), &tai_item->tAI.pLMNidentity); ogs_asn_uint16_to_OCTET_STRING(amf_ue->tai.tac, &tai_item->tAI.tAC); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_amf_configuration_transfer( @@ -1350,7 +1259,7 @@ ogs_pkbuf_t *ngap_build_amf_configuration_transfer( son_configuration_transfer, SONConfigurationTransfer); ogs_assert(rv == OGS_OK); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_path_switch_ack(amf_ue_t *amf_ue) @@ -1431,7 +1340,7 @@ ogs_pkbuf_t *ngap_build_path_switch_ack(amf_ue_t *amf_ue) memcpy(SecurityContext->nextHopParameter.buf, amf_ue->nh, SecurityContext->nextHopParameter.size); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_path_switch_failure( @@ -1502,7 +1411,7 @@ ogs_pkbuf_t *ngap_build_path_switch_failure( Cause->present = group; Cause->choice.radioNetwork = cause; - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_handover_command(ran_ue_t *source_ue) @@ -1670,10 +1579,10 @@ ogs_pkbuf_t *ngap_build_handover_command(ran_ue_t *source_ue) Target_ToSource_TransparentContainer = &ie->value.choice.Target_ToSource_TransparentContainer; - ogs_ngap_buffer_to_OCTET_STRING(amf_ue->container.buf, + ogs_asn_buffer_to_OCTET_STRING(amf_ue->container.buf, amf_ue->container.size, Target_ToSource_TransparentContainer); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_handover_preparation_failure( @@ -1747,7 +1656,7 @@ ogs_pkbuf_t *ngap_build_handover_preparation_failure( Cause->present = cause->present; Cause->choice.radioNetwork = cause->choice.radioNetwork; - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_handover_request( @@ -1756,7 +1665,7 @@ ogs_pkbuf_t *ngap_build_handover_request( NGAP_AMF_UE_NGAP_ID_t *amf_ue_ngap_id, NGAP_HandoverType_t *handovertype, NGAP_Cause_t *cause, - NGAP_Source_ToTarget_TransparentContainer_t + NGAP_SourceToTarget_TransparentContainer_t *source_totarget_transparentContainer) { int rv; @@ -1962,7 +1871,7 @@ ogs_pkbuf_t *ngap_build_handover_request( sess = amf_sess_next(sess); } - ogs_ngap_buffer_to_OCTET_STRING( + ogs_asn_buffer_to_OCTET_STRING( source_totarget_transparentContainer->buf, source_totarget_transparentContainer->size, Source_ToTarget_TransparentContainer); @@ -1992,7 +1901,7 @@ ogs_pkbuf_t *ngap_build_handover_request( memcpy(SecurityContext->nextHopParameter.buf, amf_ue->nh, SecurityContext->nextHopParameter.size); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_handover_cancel_ack(ran_ue_t *source_ue) @@ -2049,12 +1958,12 @@ ogs_pkbuf_t *ngap_build_handover_cancel_ack(ran_ue_t *source_ue) ogs_debug(" Source : RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%d]", source_ue->ran_ue_ngap_id, source_ue->amf_ue_ngap_id); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_amf_status_transfer( ran_ue_t *target_ue, - NGAP_RAN_StatusTransfer_TransparentContainer_t + NGAP_RANStatusTransfer_TransparentContainer_t *gnb_statustransfer_transparentContainer) { int rv; @@ -2066,7 +1975,7 @@ ogs_pkbuf_t *ngap_build_amf_status_transfer( NGAP_AMFStatusTransferIEs_t *ie = NULL; NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL; NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; - NGAP_RAN_StatusTransfer_TransparentContainer_t + NGAP_RANStatusTransfer_TransparentContainer_t *RAN_StatusTransfer_TransparentContainer = NULL; ogs_assert(target_ue); @@ -2128,7 +2037,7 @@ ogs_pkbuf_t *ngap_build_amf_status_transfer( RAN_StatusTransfer_TransparentContainer); ogs_assert(rv == OGS_OK); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } #endif @@ -2204,13 +2113,13 @@ ogs_pkbuf_t *ngap_build_error_indication( ogs_debug(" Group[%d] Cause[%d]", Cause->present, (int)Cause->choice.radioNetwork); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } #if 0 ogs_pkbuf_t *ngap_build_s1_reset( NGAP_Cause_PR group, long cause, - NGAP_UE_associatedLogicalNG_ConnectionListRes_t *partOfNG_Interface) + NGAP_UE_associatedLogicalNG_connectionList_t *partOfNG_Interface) { NGAP_NGAP_PDU_t pdu; NGAP_InitiatingMessage_t *initiatingMessage = NULL; @@ -2267,7 +2176,7 @@ ogs_pkbuf_t *ngap_build_s1_reset( ResetType->choice.s1_Interface = NGAP_ResetAll_reset_all; } - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_s1_reset_partial( @@ -2299,7 +2208,7 @@ ogs_pkbuf_t *ngap_build_s1_reset_partial( } ogs_pkbuf_t *ngap_build_s1_reset_ack( - NGAP_UE_associatedLogicalNG_ConnectionListRes_t *partOfNG_Interface) + NGAP_UE_associatedLogicalNG_connectionList_t *partOfNG_Interface) { NGAP_NGAP_PDU_t pdu; NGAP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -2389,7 +2298,7 @@ ogs_pkbuf_t *ngap_build_s1_reset_ack( } } - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_write_replace_warning_request(sbc_pws_data_t *sbc_pws) @@ -2531,7 +2440,7 @@ ogs_pkbuf_t *ngap_build_write_replace_warning_request(sbc_pws_data_t *sbc_pws) SerialNumber->buf[0], SerialNumber->buf[1], (int)*RepetitionPeriod, (int)*NumberofBroadcastRequest); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *ngap_build_kill_request(sbc_pws_data_t *sbc_pws) @@ -2599,6 +2508,6 @@ ogs_pkbuf_t *ngap_build_kill_request(sbc_pws_data_t *sbc_pws) MessageIdentifier->buf[0], MessageIdentifier->buf[1], SerialNumber->buf[0], SerialNumber->buf[1]); - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } #endif diff --git a/src/amf/ngap-build.h b/src/amf/ngap-build.h index 7c46f6ade..db208ec0a 100644 --- a/src/amf/ngap-build.h +++ b/src/amf/ngap-build.h @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -#ifndef NGAP_BUILD_H -#define NGAP_BUILD_H +#ifndef AMF_NGAP_BUILD_H +#define AMF_NGAP_BUILD_H #include "context.h" @@ -33,22 +33,23 @@ ogs_pkbuf_t *ngap_build_ng_setup_failure( ogs_pkbuf_t *ngap_build_downlink_nas_transport( ran_ue_t *ran_ue, ogs_pkbuf_t *gmmbuf); -#if 0 ogs_pkbuf_t *ngap_build_initial_context_setup_request( amf_ue_t *amf_ue, ogs_pkbuf_t *gmmbuf); ogs_pkbuf_t *ngap_build_ue_context_modification_request(amf_ue_t *amf_ue); ogs_pkbuf_t *ngap_build_ue_context_release_command( ran_ue_t *ran_ue, NGAP_Cause_PR group, long cause); -ogs_pkbuf_t *ngap_build_e_rab_setup_request( - amf_bearer_t *bearer, ogs_pkbuf_t *gsmbuf); +ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request( + amf_sess_t *sess, ogs_pkbuf_t *gmmbuf, ogs_pkbuf_t *n2smbuf); ogs_pkbuf_t *ngap_build_e_rab_modify_request( amf_bearer_t *bearer, ogs_pkbuf_t *gsmbuf); ogs_pkbuf_t *ngap_build_e_rab_release_command( amf_bearer_t *bearer, ogs_pkbuf_t *gsmbuf, NGAP_Cause_PR group, long cause); +#if 0 ogs_pkbuf_t *ngap_build_paging( amf_ue_t *amf_ue, NGAP_CNDomain_t cn_domain); +#endif ogs_pkbuf_t *ngap_build_amf_configuration_transfer( NGAP_SONConfigurationTransfer_t *son_configuration_transfer); @@ -68,7 +69,7 @@ ogs_pkbuf_t *ngap_build_handover_request( NGAP_AMF_UE_NGAP_ID_t *amf_ue_ngap_id, NGAP_HandoverType_t *handovertype, NGAP_Cause_t *cause, - NGAP_Source_ToTarget_TransparentContainer_t + NGAP_SourceToTarget_TransparentContainer_t *source_totarget_transparentContainer); ogs_pkbuf_t *ngap_build_handover_cancel_ack( @@ -76,19 +77,17 @@ ogs_pkbuf_t *ngap_build_handover_cancel_ack( ogs_pkbuf_t *ngap_build_amf_status_transfer( ran_ue_t *target_ue, - NGAP_RAN_StatusTransfer_TransparentContainer_t + NGAP_RANStatusTransfer_TransparentContainer_t *gnb_statustransfer_transparentContainer); -#endif ogs_pkbuf_t *ngap_build_error_indication( uint64_t *amf_ue_ngap_id, NGAP_RAN_UE_NGAP_ID_t *ran_ue_ngap_id, NGAP_Cause_PR group, long cause); -#if 0 ogs_pkbuf_t *ngap_build_s1_reset( NGAP_Cause_PR group, long cause, - NGAP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface); + NGAP_UE_associatedLogicalNG_connectionList_t *partOfS1_Interface); ogs_pkbuf_t *ngap_build_s1_reset_partial( NGAP_Cause_PR group, long cause, @@ -96,16 +95,10 @@ ogs_pkbuf_t *ngap_build_s1_reset_partial( NGAP_RAN_UE_NGAP_ID_t *ran_ue_ngap_id); ogs_pkbuf_t *ngap_build_s1_reset_ack( - NGAP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface); - -ogs_pkbuf_t *ngap_build_write_replace_warning_request( - sbc_pws_data_t *sbc_pws); - -ogs_pkbuf_t *ngap_build_kill_request(sbc_pws_data_t *sbc_pws); -#endif + NGAP_UE_associatedLogicalNG_connectionList_t *partOfS1_Interface); #ifdef __cplusplus } #endif -#endif /* NGAP_BUILD_H */ +#endif /* AMF_NGAP_BUILD_H */ diff --git a/src/amf/ngap-handler.c b/src/amf/ngap-handler.c index cf99343b4..e0fa69aab 100644 --- a/src/amf/ngap-handler.c +++ b/src/amf/ngap-handler.c @@ -19,6 +19,7 @@ #include "ngap-handler.h" #include "ngap-path.h" +#include "sbi-path.h" static bool served_tai_is_found(amf_gnb_t *gnb) { @@ -99,7 +100,7 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message) } if (!GlobalRANNodeID) { - ogs_warn("No GlobalRANNodeID"); + ogs_error("No GlobalRANNodeID"); group = NGAP_Cause_PR_protocol; cause = NGAP_CauseProtocol_semantic_error; ngap_send_ng_setup_failure(gnb, group, cause); @@ -108,7 +109,7 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message) globalGNB_ID = GlobalRANNodeID->choice.globalGNB_ID; if (!globalGNB_ID) { - ogs_warn("No globalGNB_ID"); + ogs_error("No globalGNB_ID"); group = NGAP_Cause_PR_protocol; cause = NGAP_CauseProtocol_semantic_error; ngap_send_ng_setup_failure(gnb, group, cause); @@ -116,7 +117,7 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message) } if (!SupportedTAList) { - ogs_warn("No SupportedTAList"); + ogs_error("No SupportedTAList"); group = NGAP_Cause_PR_protocol; cause = NGAP_CauseProtocol_semantic_error; ngap_send_ng_setup_failure(gnb, group, cause); @@ -215,9 +216,6 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message) NGAP_UserLocationInformation_t *UserLocationInformation = NULL; NGAP_FiveG_S_TMSI_t *FiveG_S_TMSI = NULL; - NGAP_Cause_PR group = NGAP_Cause_PR_NOTHING; - long cause = 0; - ran_ue_t *ran_ue = NULL; ogs_assert(gnb); @@ -251,22 +249,12 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message) } } - ogs_debug(" IP[%s] RAN_ID[%d]", - OGS_ADDR(gnb->addr, buf), gnb->gnb_id); + ogs_debug(" IP[%s] RAN_ID[%d]", OGS_ADDR(gnb->addr, buf), gnb->gnb_id); if (!RAN_UE_NGAP_ID) { - ogs_warn("No RAN_UE_NGAP_ID"); - group = NGAP_Cause_PR_protocol; - cause = NGAP_CauseProtocol_semantic_error; - ngap_send_ng_setup_failure(gnb, group, cause); - return; - } - - if (!UserLocationInformation) { - ogs_warn("No UserLocationInformation"); - group = NGAP_Cause_PR_protocol; - cause = NGAP_CauseProtocol_semantic_error; - ngap_send_ng_setup_failure(gnb, group, cause); + ogs_error("No RAN_UE_NGAP_ID"); + ngap_send_error_indication(gnb, NULL, RAN_UE_NGAP_ID, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); return; } @@ -286,10 +274,10 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message) memset(&nas_guti, 0, sizeof(ogs_nas_5gs_guti_t)); - /* Use the first configured plmn_id and amf id */ + ogs_assert(amf_ue->guami); ogs_nas_from_plmn_id(&nas_guti.nas_plmn_id, - &amf_self()->served_guami[0].plmn_id); - region = amf_self()->served_guami[0].amf_id.region; + &amf_ue->guami->plmn_id); + region = amf_ue->guami->amf_id.region; /* Getting from 5G-S_TMSI */ ogs_ngap_AMFSetID_to_uint16(&FiveG_S_TMSI->aMFSetID, &set); @@ -325,6 +313,20 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message) } } + if (!UserLocationInformation) { + ogs_error("No UserLocationInformation"); + ngap_send_error_indication(gnb, &ran_ue->amf_ue_ngap_id, RAN_UE_NGAP_ID, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + + if (!NAS_PDU) { + ogs_error("No NAS_PDU"); + ngap_send_error_indication(gnb, &ran_ue->amf_ue_ngap_id, RAN_UE_NGAP_ID, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + if (UserLocationInformation->present == NGAP_UserLocationInformation_PR_userLocationInformationNR) { NGAP_UserLocationInformationNR_t *userLocationInformationNR = @@ -388,31 +390,49 @@ void ngap_handle_uplink_nas_transport( } } - ogs_debug(" IP[%s] RAN_ID[%d]", - OGS_ADDR(gnb->addr, buf), gnb->gnb_id); + ogs_debug(" IP[%s] RAN_ID[%d]", OGS_ADDR(gnb->addr, buf), gnb->gnb_id); + + if (!RAN_UE_NGAP_ID) { + ogs_error("No RAN_UE_NGAP_ID"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } - ogs_assert(RAN_UE_NGAP_ID); ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID); - ogs_expect_or_return(ran_ue); + if (!ran_ue) { + ogs_error("Cannot find RAN_UE Context [%d]", (int)*RAN_UE_NGAP_ID); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_radioNetwork, + NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID); + return; + } ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]", ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id); + if (!NAS_PDU) { + ogs_error("No NAS_PDU"); + ngap_send_error_indication(gnb, &ran_ue->amf_ue_ngap_id, RAN_UE_NGAP_ID, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + ngap_send_to_nas(ran_ue, - NGAP_ProcedureCode_id_UplinkNASTransport, NAS_PDU); + NGAP_ProcedureCode_id_UplinkNASTransport, NAS_PDU); } -#if 0 -void ngap_handle_ue_capability_info_indication( +void ngap_handle_ue_radio_capability_info_indication( amf_gnb_t *gnb, ogs_ngap_message_t *message) { char buf[OGS_ADDRSTRLEN]; int i; NGAP_InitiatingMessage_t *initiatingMessage = NULL; - NGAP_UECapabilityInfoIndication_t *UECapabilityInfoIndication = NULL; + NGAP_UERadioCapabilityInfoIndication_t + *UERadioCapabilityInfoIndication = NULL; - NGAP_UECapabilityInfoIndicationIEs_t *ie = NULL; + NGAP_UERadioCapabilityInfoIndicationIEs_t *ie = NULL; NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; NGAP_UERadioCapability_t *UERadioCapability = NULL; @@ -424,14 +444,15 @@ void ngap_handle_ue_capability_info_indication( ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; ogs_assert(initiatingMessage); - UECapabilityInfoIndication = - &initiatingMessage->value.choice.UECapabilityInfoIndication; - ogs_assert(UECapabilityInfoIndication); + UERadioCapabilityInfoIndication = + &initiatingMessage->value.choice.UERadioCapabilityInfoIndication; + ogs_assert(UERadioCapabilityInfoIndication); - ogs_debug("[AMF] UE capability info indication"); + ogs_debug("UE radio capability info indication"); - for (i = 0; i < UECapabilityInfoIndication->protocolIEs.list.count; i++) { - ie = UECapabilityInfoIndication->protocolIEs.list.array[i]; + for (i = 0; + i < UERadioCapabilityInfoIndication->protocolIEs.list.count; i++) { + ie = UERadioCapabilityInfoIndication->protocolIEs.list.array[i]; switch (ie->id) { case NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID: RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; @@ -444,27 +465,42 @@ void ngap_handle_ue_capability_info_indication( } } - ogs_debug(" IP[%s] RAN_ID[%d]", - OGS_ADDR(gnb->addr, buf), gnb->gnb_id); + ogs_debug(" IP[%s] RAN_ID[%d]", OGS_ADDR(gnb->addr, buf), gnb->gnb_id); - ogs_assert(RAN_UE_NGAP_ID); - ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID); - ogs_assert(ran_ue); - - ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%d]", - ran_ue->ran_ue_ngap_id, ran_ue->amf_ue_ngap_id); - - if (ran_ue->amf_ue) { - ogs_assert(UERadioCapability); - OGS_NGAP_STORE_DATA(&ran_ue->amf_ue->ueRadioCapability, - UERadioCapability); + if (!RAN_UE_NGAP_ID) { + ogs_error("No RAN_UE_NGAP_ID"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; } + + ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID); + if (!ran_ue) { + ogs_error("Cannot find RAN_UE Context [%d]", (int)*RAN_UE_NGAP_ID); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_radioNetwork, + NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID); + return; + } + + ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]", + ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id); + + if (!UERadioCapability) { + ogs_error("No UERadioCapability"); + ngap_send_error_indication(gnb, &ran_ue->amf_ue_ngap_id, RAN_UE_NGAP_ID, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + + if (ran_ue->amf_ue) + OGS_ASN_STORE_DATA(&ran_ue->amf_ue->ueRadioCapability, + UERadioCapability); } void ngap_handle_initial_context_setup_response( amf_gnb_t *gnb, ogs_ngap_message_t *message) { - int rv; char buf[OGS_ADDRSTRLEN]; int i; @@ -473,9 +509,7 @@ void ngap_handle_initial_context_setup_response( NGAP_InitialContextSetupResponseIEs_t *ie = NULL; NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; - NGAP_E_RABSetupListCtxtSURes_t *E_RABSetupListCtxtSURes = NULL; - amf_ue_t *amf_ue = NULL; ran_ue_t *ran_ue = NULL; ogs_assert(gnb); @@ -488,7 +522,7 @@ void ngap_handle_initial_context_setup_response( &successfulOutcome->value.choice.InitialContextSetupResponse; ogs_assert(InitialContextSetupResponse); - ogs_debug("[AMF] Initial context setup response"); + ogs_debug("Initial context setup response"); for (i = 0; i < InitialContextSetupResponse->protocolIEs.list.count; i++) { ie = InitialContextSetupResponse->protocolIEs.list.array[i]; @@ -496,69 +530,36 @@ void ngap_handle_initial_context_setup_response( case NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID: RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; break; - case NGAP_ProtocolIE_ID_id_E_RABSetupListCtxtSURes: - E_RABSetupListCtxtSURes = - &ie->value.choice.E_RABSetupListCtxtSURes; - break; default: break; } } - ogs_debug(" IP[%s] RAN_ID[%d]", - OGS_ADDR(gnb->addr, buf), gnb->gnb_id); + ogs_debug(" IP[%s] RAN_ID[%d]", OGS_ADDR(gnb->addr, buf), gnb->gnb_id); + + if (!RAN_UE_NGAP_ID) { + ogs_error("No RAN_UE_NGAP_ID"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } - ogs_assert(RAN_UE_NGAP_ID); ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID); - ogs_expect_or_return(ran_ue); + if (!ran_ue) { + ogs_error("Cannot find RAN_UE Context [%d]", (int)*RAN_UE_NGAP_ID); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_radioNetwork, + NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID); + return; + } + + ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]", + ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id); + +#if 0 amf_ue = ran_ue->amf_ue; ogs_assert(amf_ue); - - ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%d]", - ran_ue->ran_ue_ngap_id, ran_ue->amf_ue_ngap_id); - - ogs_assert(E_RABSetupListCtxtSURes); - for (i = 0; i < E_RABSetupListCtxtSURes->list.count; i++) { - NGAP_E_RABSetupItemCtxtSUResIEs_t *ie2 = NULL; - NGAP_E_RABSetupItemCtxtSURes_t *e_rab = NULL; - - amf_bearer_t *bearer = NULL; - - ie2 = (NGAP_E_RABSetupItemCtxtSUResIEs_t *) - E_RABSetupListCtxtSURes->list.array[i]; - ogs_assert(ie2); - - e_rab = &ie2->value.choice.E_RABSetupItemCtxtSURes; - ogs_assert(e_rab); - - bearer = amf_bearer_find_by_ue_ebi(amf_ue, e_rab->e_RAB_ID); - ogs_assert(bearer); - memcpy(&bearer->gnb_s1u_teid, e_rab->gTP_TEID.buf, - sizeof(bearer->gnb_s1u_teid)); - bearer->gnb_s1u_teid = ntohl(bearer->gnb_s1u_teid); - rv = ogs_asn_BIT_STRING_to_ip( - &e_rab->transportLayerAddress, &bearer->gnb_s1u_ip); - ogs_assert(rv == OGS_OK); - - ogs_debug(" EBI[%d] RAN-S1U-TEID[%d]", - bearer->ebi, bearer->gnb_s1u_teid); - - if (OGS_FSM_CHECK(&bearer->sm, esm_state_active)) { - ogs_debug(" NAS_EPS Type[%d]", amf_ue->nas_eps.type); - int uli_presence = 0; - if (amf_ue->nas_eps.type != AMF_EPS_TYPE_ATTACH_REQUEST) { - ogs_debug(" ### ULI PRESENT ###"); - uli_presence = 1; - } - amf_gtp_send_modify_bearer_request(bearer, uli_presence); - } - } - - if (SMS_SERVICE_INDICATOR(amf_ue)) { - sgsap_send_service_request(amf_ue, SGSAP_EMM_CONNECTED_MODE); - } - - CLEAR_SERVICE_INDICATOR(amf_ue); +#endif } void ngap_handle_initial_context_setup_failure( @@ -574,7 +575,9 @@ void ngap_handle_initial_context_setup_failure( NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; NGAP_Cause_t *Cause = NULL; +#if 0 amf_ue_t *amf_ue = NULL; +#endif ran_ue_t *ran_ue = NULL; ogs_assert(gnb); @@ -587,7 +590,7 @@ void ngap_handle_initial_context_setup_failure( &unsuccessfulOutcome->value.choice.InitialContextSetupFailure; ogs_assert(InitialContextSetupFailure); - ogs_debug("[AMF] Initial context setup failure"); + ogs_debug("Initial context setup failure"); for (i = 0; i < InitialContextSetupFailure->protocolIEs.list.count; i++) { ie = InitialContextSetupFailure->protocolIEs.list.array[i]; @@ -603,27 +606,37 @@ void ngap_handle_initial_context_setup_failure( } } - ogs_debug(" IP[%s] RAN_ID[%d]", - OGS_ADDR(gnb->addr, buf), gnb->gnb_id); + ogs_debug(" IP[%s] RAN_ID[%d]", OGS_ADDR(gnb->addr, buf), gnb->gnb_id); - ogs_assert(RAN_UE_NGAP_ID); - ogs_assert(Cause); - - ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID); - if (ran_ue == NULL) { - ogs_warn("Initial context setup failure : " - "cannot find RAN-UE-NGAP-ID[%d]", (int)*RAN_UE_NGAP_ID); + if (!RAN_UE_NGAP_ID) { + ogs_error("No RAN_UE_NGAP_ID"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); return; } - ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%d]", - ran_ue->ran_ue_ngap_id, ran_ue->amf_ue_ngap_id); + ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID); + if (!ran_ue) { + ogs_error("Cannot find RAN_UE Context [%d]", (int)*RAN_UE_NGAP_ID); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_radioNetwork, + NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID); + return; + } + + ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]", + ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id); + + if (!Cause) { + ogs_error("No Cause"); + ngap_send_error_indication(gnb, &ran_ue->amf_ue_ngap_id, RAN_UE_NGAP_ID, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } ogs_debug(" Cause[Group:%d Cause:%d]", Cause->present, (int)Cause->choice.radioNetwork); - if (amf_ue) - CLEAR_SERVICE_INDICATOR(amf_ue); - +#if 0 /* * 19.2.2.3 in Spec 36.300 * @@ -635,8 +648,142 @@ void ngap_handle_initial_context_setup_failure( * that no hanging resources remain at the RAN. */ amf_send_delete_session_or_ran_ue_context_release(ran_ue); +#endif } +void ngap_handle_pdu_session_resource_setup_response( + amf_gnb_t *gnb, ogs_ngap_message_t *message) +{ + char buf[OGS_ADDRSTRLEN]; + int i; + + amf_ue_t *amf_ue = NULL; + ran_ue_t *ran_ue = NULL; + ogs_pkbuf_t *n2smbuf = NULL; + + NGAP_SuccessfulOutcome_t *successfulOutcome = NULL; + NGAP_PDUSessionResourceSetupResponse_t *PDUSessionResourceSetupResponse; + + NGAP_PDUSessionResourceSetupResponseIEs_t *ie = NULL; + NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; + NGAP_PDUSessionResourceSetupListSURes_t *PDUSessionList = NULL; + NGAP_PDUSessionResourceSetupItemSURes_t *PDUSessionItem = NULL; + OCTET_STRING_t *transfer = NULL; + + ogs_assert(gnb); + ogs_assert(gnb->sock); + + ogs_assert(message); + successfulOutcome = message->choice.successfulOutcome; + ogs_assert(successfulOutcome); + PDUSessionResourceSetupResponse = + &successfulOutcome->value.choice.PDUSessionResourceSetupResponse; + ogs_assert(PDUSessionResourceSetupResponse); + + ogs_debug("PDU session resource setup response"); + + for (i = 0; i < PDUSessionResourceSetupResponse->protocolIEs.list.count; + i++) { + ie = PDUSessionResourceSetupResponse->protocolIEs.list.array[i]; + switch (ie->id) { + case NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID: + RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; + break; + case NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSURes: + PDUSessionList = &ie->value.choice.PDUSessionResourceSetupListSURes; + break; + default: + break; + } + } + + ogs_debug(" IP[%s] RAN_ID[%d]", OGS_ADDR(gnb->addr, buf), gnb->gnb_id); + + if (!RAN_UE_NGAP_ID) { + ogs_error("No RAN_UE_NGAP_ID"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + + if (!PDUSessionList) { + ogs_error("No PDUSessionResourceSetupListSURes"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + + ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID); + if (!ran_ue) { + ogs_error("Cannot find RAN-UE Context [%d]", (int)*RAN_UE_NGAP_ID); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_radioNetwork, + NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID); + return; + } + + ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]", + ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id); + + amf_ue = ran_ue->amf_ue; + if (!amf_ue) { + ogs_error("Cannot find AMF-UE Context [%d]", (int)*RAN_UE_NGAP_ID); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_radioNetwork, + NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID); + return; + } + + for (i = 0; i < PDUSessionList->list.count; i++) { + amf_sess_t *sess = NULL; + PDUSessionItem = (NGAP_PDUSessionResourceSetupItemSURes_t *) + PDUSessionList->list.array[i]; + + if (!PDUSessionItem) { + ogs_error("No PDUSessionResourceSetupItemSURes"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + + transfer = &PDUSessionItem->pDUSessionResourceSetupResponseTransfer; + if (!transfer) { + ogs_error("No PDUSessionResourceSetupItemSURes"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + + if (PDUSessionItem->pDUSessionID == + OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) { + ogs_error("PDU Session Identity is unassigned"); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return; + } + + sess = amf_sess_find_by_psi(amf_ue, PDUSessionItem->pDUSessionID); + if (!sess) { + ogs_error("Cannot find PDU Session ID [%d]", + (int)PDUSessionItem->pDUSessionID); + ngap_send_error_indication(gnb, NULL, NULL, + NGAP_Cause_PR_radioNetwork, + NGAP_CauseRadioNetwork_unknown_PDU_session_ID); + return; + } + + n2smbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN); + ogs_pkbuf_put_data(n2smbuf, transfer->buf, transfer->size); + + amf_sess_sbi_discover_and_send( + OpenAPI_nf_type_SMF, sess, n2smbuf, + amf_nsmf_pdu_session_build_update_sm_context); + + ogs_pkbuf_free(n2smbuf); + } +} + +#if 0 void ngap_handle_ue_context_modification_response( amf_gnb_t *gnb, ogs_ngap_message_t *message) { @@ -662,7 +809,7 @@ void ngap_handle_ue_context_modification_response( &successfulOutcome->value.choice.UEContextModificationResponse; ogs_assert(UEContextModificationResponse); - ogs_debug("[AMF] UE context modification response"); + ogs_debug("UE context modification response"); for (i = 0; i < UEContextModificationResponse->protocolIEs.list.count; i++) { ie = UEContextModificationResponse->protocolIEs.list.array[i]; @@ -756,102 +903,6 @@ cleanup: CLEAR_SERVICE_INDICATOR(amf_ue); } - -void ngap_handle_e_rab_setup_response( - amf_gnb_t *gnb, ogs_ngap_message_t *message) -{ - int rv; - char buf[OGS_ADDRSTRLEN]; - int i; - - NGAP_SuccessfulOutcome_t *successfulOutcome = NULL; - NGAP_E_RABSetupResponse_t *E_RABSetupResponse = NULL; - - NGAP_E_RABSetupResponseIEs_t *ie = NULL; - NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; - NGAP_E_RABSetupListBearerSURes_t *E_RABSetupListBearerSURes = NULL; - - ran_ue_t *ran_ue = NULL; - amf_ue_t *amf_ue = NULL; - - ogs_assert(gnb); - ogs_assert(gnb->sock); - - ogs_assert(message); - successfulOutcome = message->choice.successfulOutcome; - ogs_assert(successfulOutcome); - E_RABSetupResponse = &successfulOutcome->value.choice.E_RABSetupResponse; - ogs_assert(E_RABSetupResponse); - - ogs_debug("[AMF] E-RAB setup response"); - - for (i = 0; i < E_RABSetupResponse->protocolIEs.list.count; i++) { - ie = E_RABSetupResponse->protocolIEs.list.array[i]; - switch (ie->id) { - case NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID: - RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; - break; - case NGAP_ProtocolIE_ID_id_E_RABSetupListBearerSURes: - E_RABSetupListBearerSURes = - &ie->value.choice.E_RABSetupListBearerSURes; - break; - default: - break; - } - } - - ogs_debug(" IP[%s] RAN_ID[%d]", - OGS_ADDR(gnb->addr, buf), gnb->gnb_id); - - ogs_assert(RAN_UE_NGAP_ID); - ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID); - ogs_assert(ran_ue); - amf_ue = ran_ue->amf_ue; - ogs_assert(amf_ue); - - ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%d]", - ran_ue->ran_ue_ngap_id, ran_ue->amf_ue_ngap_id); - - ogs_assert(E_RABSetupListBearerSURes); - for (i = 0; i < E_RABSetupListBearerSURes->list.count; i++) { - NGAP_E_RABSetupItemBearerSUResIEs_t *ie2 = NULL; - NGAP_E_RABSetupItemBearerSURes_t *e_rab = NULL; - - amf_bearer_t *bearer = NULL; - - ie2 = (NGAP_E_RABSetupItemBearerSUResIEs_t *) - E_RABSetupListBearerSURes->list.array[i]; - ogs_assert(ie2); - - e_rab = &ie2->value.choice.E_RABSetupItemBearerSURes; - ogs_assert(e_rab); - - bearer = amf_bearer_find_by_ue_ebi(amf_ue, e_rab->e_RAB_ID); - ogs_assert(bearer); - - memcpy(&bearer->gnb_s1u_teid, e_rab->gTP_TEID.buf, - sizeof(bearer->gnb_s1u_teid)); - bearer->gnb_s1u_teid = ntohl(bearer->gnb_s1u_teid); - rv = ogs_asn_BIT_STRING_to_ip( - &e_rab->transportLayerAddress, &bearer->gnb_s1u_ip); - ogs_assert(rv == OGS_OK); - - ogs_debug(" EBI[%d]", bearer->ebi); - - if (OGS_FSM_CHECK(&bearer->sm, esm_state_active)) { - amf_bearer_t *linked_bearer = amf_linked_bearer(bearer); - ogs_assert(linked_bearer); - ogs_debug(" Linked-EBI[%d]", linked_bearer->ebi); - - if (bearer->ebi == linked_bearer->ebi) { - amf_gtp_send_modify_bearer_request(bearer, 0); - } else { - amf_gtp_send_create_bearer_response(bearer); - } - } - } -} - void ngap_handle_ue_context_release_request( amf_gnb_t *gnb, ogs_ngap_message_t *message) { @@ -878,7 +929,7 @@ void ngap_handle_ue_context_release_request( &initiatingMessage->value.choice.UEContextReleaseRequest; ogs_assert(UEContextReleaseRequest); - ogs_debug("[AMF] UE Context release request"); + ogs_debug("UE Context release request"); for (i = 0; i < UEContextReleaseRequest->protocolIEs.list.count; i++) { ie = UEContextReleaseRequest->protocolIEs.list.array[i]; @@ -962,7 +1013,7 @@ void ngap_handle_ue_context_release_complete( &successfulOutcome->value.choice.UEContextReleaseComplete; ogs_assert(UEContextReleaseComplete); - ogs_debug("[AMF] UE Context release complete"); + ogs_debug("UE Context release complete"); for (i = 0; i < UEContextReleaseComplete->protocolIEs.list.count; i++) { ie = UEContextReleaseComplete->protocolIEs.list.array[i]; @@ -1072,7 +1123,7 @@ void ngap_handle_path_switch_request( PathSwitchRequest = &initiatingMessage->value.choice.PathSwitchRequest; ogs_assert(PathSwitchRequest); - ogs_debug("[AMF] Path switch request"); + ogs_debug("Path switch request"); for (i = 0; i < PathSwitchRequest->protocolIEs.list.count; i++) { ie = PathSwitchRequest->protocolIEs.list.array[i]; @@ -1255,7 +1306,7 @@ void ngap_handle_gnb_configuration_transfer( &initiatingMessage->value.choice.RANConfigurationTransfer; ogs_assert(RANConfigurationTransfer); - ogs_debug("[AMF] RAN configuration transfer"); + ogs_debug("RAN configuration transfer"); for (i = 0; i < RANConfigurationTransfer->protocolIEs.list.count; i++) { ie = RANConfigurationTransfer->protocolIEs.list.array[i]; switch (ie->id) { @@ -1349,7 +1400,7 @@ void ngap_handle_handover_required(amf_gnb_t *gnb, ogs_ngap_message_t *message) amf_gnb_t *target_gnb = NULL; uint32_t target_gnb_id = 0; - ogs_debug("[AMF] Handover required"); + ogs_debug("Handover required"); for (i = 0; i < HandoverRequired->protocolIEs.list.count; i++) { ie = HandoverRequired->protocolIEs.list.array[i]; switch (ie->id) { @@ -1461,7 +1512,7 @@ void ngap_handle_handover_request_ack(amf_gnb_t *gnb, ogs_ngap_message_t *messag &successfulOutcome->value.choice.HandoverRequestAcknowledge; ogs_assert(HandoverRequestAcknowledge); - ogs_debug("[AMF] Handover request acknowledge"); + ogs_debug("Handover request acknowledge"); for (i = 0; i < HandoverRequestAcknowledge->protocolIEs.list.count; i++) { ie = HandoverRequestAcknowledge->protocolIEs.list.array[i]; switch (ie->id) { @@ -1550,7 +1601,7 @@ void ngap_handle_handover_request_ack(amf_gnb_t *gnb, ogs_ngap_message_t *messag } } - OGS_NGAP_STORE_DATA(&amf_ue->container, + OGS_ASN_STORE_DATA(&amf_ue->container, Target_ToSource_TransparentContainer); if (amf_ue_have_indirect_tunnel(amf_ue) == 1) { @@ -1585,7 +1636,7 @@ void ngap_handle_handover_failure(amf_gnb_t *gnb, ogs_ngap_message_t *message) HandoverFailure = &unsuccessfulOutcome->value.choice.HandoverFailure; ogs_assert(HandoverFailure); - ogs_debug("[AMF] Handover failure"); + ogs_debug("Handover failure"); for (i = 0; i < HandoverFailure->protocolIEs.list.count; i++) { ie = HandoverFailure->protocolIEs.list.array[i]; switch (ie->id) { @@ -1650,7 +1701,7 @@ void ngap_handle_handover_cancel(amf_gnb_t *gnb, ogs_ngap_message_t *message) HandoverCancel = &initiatingMessage->value.choice.HandoverCancel; ogs_assert(HandoverCancel); - ogs_debug("[AMF] Handover cancel"); + ogs_debug("Handover cancel"); for (i = 0; i < HandoverCancel->protocolIEs.list.count; i++) { ie = HandoverCancel->protocolIEs.list.array[i]; switch (ie->id) { @@ -1694,7 +1745,7 @@ void ngap_handle_handover_cancel(amf_gnb_t *gnb, ogs_ngap_message_t *message) NGAP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, ogs_time_from_msec(300)); - ogs_debug("[AMF] Handover Cancel : " + ogs_debug("Handover Cancel : " "UE[RAN-UE-NGAP-ID(%d)] --> RAN[%s:%d]", source_ue->ran_ue_ngap_id, OGS_ADDR(gnb->addr, buf), gnb->gnb_id); @@ -1725,7 +1776,7 @@ void ngap_handle_gnb_status_transfer(amf_gnb_t *gnb, ogs_ngap_message_t *message RANStatusTransfer = &initiatingMessage->value.choice.RANStatusTransfer; ogs_assert(RANStatusTransfer); - ogs_debug("[AMF] RAN status transfer"); + ogs_debug("RAN status transfer"); for (i = 0; i < RANStatusTransfer->protocolIEs.list.count; i++) { ie = RANStatusTransfer->protocolIEs.list.array[i]; switch (ie->id) { @@ -1799,7 +1850,7 @@ void ngap_handle_handover_notification(amf_gnb_t *gnb, ogs_ngap_message_t *messa HandoverNotify = &initiatingMessage->value.choice.HandoverNotify; ogs_assert(HandoverNotify); - ogs_debug("[AMF] Handover notification"); + ogs_debug("Handover notification"); for (i = 0; i < HandoverNotify->protocolIEs.list.count; i++) { ie = HandoverNotify->protocolIEs.list.array[i]; switch (ie->id) { @@ -1924,7 +1975,7 @@ void ngap_handle_s1_reset( Reset = &initiatingMessage->value.choice.Reset; ogs_assert(Reset); - ogs_debug("[AMF] Reset"); + ogs_debug("Reset"); for (i = 0; i < Reset->protocolIEs.list.count; i++) { ie = Reset->protocolIEs.list.array[i]; @@ -2016,52 +2067,4 @@ void ngap_handle_s1_reset( ngap_send_s1_reset_ack(gnb, partOfS1_Interface); } -void ngap_handle_write_replace_warning_response( - amf_gnb_t *gnb, ogs_ngap_message_t *message) -{ - char buf[OGS_ADDRSTRLEN]; - - NGAP_SuccessfulOutcome_t *successfulOutcome = NULL; - NGAP_WriteReplaceWarningResponse_t *WriteReplaceWarningResponse = NULL; - - ogs_assert(gnb); - ogs_assert(gnb->sock); - - ogs_assert(message); - successfulOutcome = message->choice.successfulOutcome; - ogs_assert(successfulOutcome); - WriteReplaceWarningResponse = - &successfulOutcome->value.choice.WriteReplaceWarningResponse; - ogs_assert(WriteReplaceWarningResponse); - - ogs_debug("[AMF] Write replace warning response"); - - ogs_debug(" IP[%s] RAN_ID[%d]", - OGS_ADDR(gnb->addr, buf), gnb->gnb_id); - -} - -void ngap_handle_kill_response( - amf_gnb_t *gnb, ogs_ngap_message_t *message) -{ - char buf[OGS_ADDRSTRLEN]; - - NGAP_SuccessfulOutcome_t *successfulOutcome = NULL; - NGAP_KillResponse_t *KillResponse = NULL; - - ogs_assert(gnb); - ogs_assert(gnb->sock); - - ogs_assert(message); - successfulOutcome = message->choice.successfulOutcome; - ogs_assert(successfulOutcome); - KillResponse = - &successfulOutcome->value.choice.KillResponse; - ogs_assert(KillResponse); - - ogs_debug("[AMF] Kill response"); - - ogs_debug(" IP[%s] RAN_ID[%d]", - OGS_ADDR(gnb->addr, buf), gnb->gnb_id); -} #endif diff --git a/src/amf/ngap-handler.h b/src/amf/ngap-handler.h index aa88880b4..16f17630b 100644 --- a/src/amf/ngap-handler.h +++ b/src/amf/ngap-handler.h @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -#ifndef NGAP_HANDLER_H -#define NGAP_HANDLER_H +#ifndef AMF_NGAP_HANDLER_H +#define AMF_NGAP_HANDLER_H #include "context.h" @@ -32,14 +32,16 @@ void ngap_handle_initial_ue_message( amf_gnb_t *gnb, ogs_ngap_message_t *message); void ngap_handle_uplink_nas_transport( amf_gnb_t *gnb, ogs_ngap_message_t *message); -#if 0 -void ngap_handle_ue_capability_info_indication( +void ngap_handle_ue_radio_capability_info_indication( amf_gnb_t *gnb, ogs_ngap_message_t *message); void ngap_handle_initial_context_setup_response( amf_gnb_t *gnb, ogs_ngap_message_t *message); void ngap_handle_initial_context_setup_failure( amf_gnb_t *gnb, ogs_ngap_message_t *message); +void ngap_handle_pdu_session_resource_setup_response( + amf_gnb_t *gnb, ogs_ngap_message_t *message); + void ngap_handle_ue_context_modification_response( amf_gnb_t *gnb, ogs_ngap_message_t *message); void ngap_handle_ue_context_modification_failure( @@ -50,9 +52,6 @@ void ngap_handle_ue_context_release_request( void ngap_handle_ue_context_release_complete( amf_gnb_t *gnb, ogs_ngap_message_t *message); -void ngap_handle_e_rab_setup_response( - amf_gnb_t *gnb, ogs_ngap_message_t *message); - void ngap_handle_path_switch_request( amf_gnb_t *gnb, ogs_ngap_message_t *message); @@ -75,14 +74,8 @@ void ngap_handle_handover_notification( void ngap_handle_s1_reset( amf_gnb_t *gnb, ogs_ngap_message_t *message); -void ngap_handle_write_replace_warning_response( - amf_gnb_t *gnb, ogs_ngap_message_t *message); -void ngap_handle_kill_response( - amf_gnb_t *gnb, ogs_ngap_message_t *message); -#endif - #ifdef __cplusplus } #endif -#endif /* NGAP_HANDLER_H */ +#endif /* AMF_NGAP_HANDLER_H */ diff --git a/src/amf/ngap-path.c b/src/amf/ngap-path.c index af76a7ded..15f87cce3 100644 --- a/src/amf/ngap-path.c +++ b/src/amf/ngap-path.c @@ -24,6 +24,7 @@ #include "ngap-build.h" #include "ngap-path.h" #include "nas-security.h" +#include "nas-path.h" int ngap_open(void) { @@ -267,7 +268,6 @@ void ngap_send_ng_setup_failure( ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING)); } -#if 0 void ngap_send_initial_context_setup_request(amf_ue_t *amf_ue) { int rv; @@ -278,10 +278,11 @@ void ngap_send_initial_context_setup_request(amf_ue_t *amf_ue) ngapbuf = ngap_build_initial_context_setup_request(amf_ue, NULL); ogs_expect_or_return(ngapbuf); - rv = nas_eps_send_to_gnb(amf_ue, ngapbuf); + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); ogs_expect(rv == OGS_OK); } +#if 0 void ngap_send_ue_context_modification_request(amf_ue_t *amf_ue) { int rv; @@ -292,7 +293,7 @@ void ngap_send_ue_context_modification_request(amf_ue_t *amf_ue) ngapbuf = ngap_build_ue_context_modification_request(amf_ue); ogs_expect_or_return(ngapbuf); - rv = nas_eps_send_to_gnb(amf_ue, ngapbuf); + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); ogs_expect(rv == OGS_OK); } @@ -397,7 +398,7 @@ void ngap_send_path_switch_ack(amf_ue_t *amf_ue) ngapbuf = ngap_build_path_switch_ack(amf_ue); ogs_expect_or_return(ngapbuf); - rv = nas_eps_send_to_gnb(amf_ue, ngapbuf); + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); ogs_expect(rv == OGS_OK); } @@ -528,6 +529,22 @@ void ngap_send_error_indication( ogs_expect(rv == OGS_OK); } +void ngap_send_error_indication2( + amf_ue_t *amf_ue, NGAP_Cause_PR group, long cause) +{ + amf_gnb_t *gnb; + ran_ue_t *ran_ue; + + ogs_assert(amf_ue); + ran_ue = amf_ue->ran_ue; + ogs_expect_or_return(ran_ue); + gnb = ran_ue->gnb; + ogs_expect_or_return(gnb); + + ngap_send_error_indication(gnb, &ran_ue->amf_ue_ngap_id, + (NGAP_RAN_UE_NGAP_ID_t *)&ran_ue->ran_ue_ngap_id, group, cause); +} + #if 0 void ngap_send_ng_reset_ack( amf_gnb_t *gnb, diff --git a/src/amf/ngap-path.h b/src/amf/ngap-path.h index 5231ad965..78034a499 100644 --- a/src/amf/ngap-path.h +++ b/src/amf/ngap-path.h @@ -51,14 +51,15 @@ void ngap_send_ng_setup_response(amf_gnb_t *gnb); void ngap_send_ng_setup_failure( amf_gnb_t *gnb, NGAP_Cause_PR group, long cause); -#if 0 void ngap_send_initial_context_setup_request(amf_ue_t *amf_ue); void ngap_send_ue_context_modification_request(amf_ue_t *amf_ue); void ngap_send_ue_context_release_command( ran_ue_t *ran_ue, NGAP_Cause_PR group, long cause, uint8_t action, uint32_t delay); +#if 0 void ngap_send_paging(amf_ue_t *amf_ue, NGAP_CNDomain_t cn_domain); +#endif void ngap_send_amf_configuration_transfer( amf_gnb_t *target_gnb, @@ -77,21 +78,22 @@ void ngap_send_handover_request( NGAP_AMF_UE_NGAP_ID_t *amf_ue_ngap_id, NGAP_HandoverType_t *handovertype, NGAP_Cause_t *cause, - NGAP_Source_ToTarget_TransparentContainer_t + NGAP_SourceToTarget_TransparentContainer_t *source_totarget_transparentContainer); void ngap_send_handover_cancel_ack(ran_ue_t *source_ue); void ngap_send_amf_status_transfer( ran_ue_t *target_ue, - NGAP_RAN_StatusTransfer_TransparentContainer_t + NGAP_RANStatusTransfer_TransparentContainer_t *gnb_statustransfer_transparentContainer); -#endif void ngap_send_error_indication( amf_gnb_t *gnb, uint64_t *amf_ue_ngap_id, NGAP_RAN_UE_NGAP_ID_t *ran_ue_ngap_id, NGAP_Cause_PR group, long cause); +void ngap_send_error_indication2( + amf_ue_t *amf_ue, NGAP_Cause_PR group, long cause); #if 0 void ngap_send_ng_reset_ack( amf_gnb_t *gnb, diff --git a/src/amf/ngap-sm.c b/src/amf/ngap-sm.c index db6cd0507..0a04e0b06 100644 --- a/src/amf/ngap-sm.c +++ b/src/amf/ngap-sm.c @@ -81,10 +81,10 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e) case NGAP_ProcedureCode_id_UplinkNASTransport: ngap_handle_uplink_nas_transport(gnb, pdu); break; -#if 0 - case NGAP_ProcedureCode_id_UECapabilityInfoIndication : - ngap_handle_ue_capability_info_indication( gnb, pdu); + case NGAP_ProcedureCode_id_UERadioCapabilityInfoIndication: + ngap_handle_ue_radio_capability_info_indication(gnb, pdu); break; +#if 0 case NGAP_ProcedureCode_id_UEContextReleaseRequest: ngap_handle_ue_context_release_request( gnb, pdu); break; @@ -114,7 +114,7 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e) break; #endif default: - ogs_warn("Not implemented(choice:%d, proc:%d)", + ogs_error("Not implemented(choice:%d, proc:%d)", pdu->present, (int)initiatingMessage->procedureCode); break; } @@ -124,10 +124,13 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e) ogs_assert(successfulOutcome); switch (successfulOutcome->procedureCode) { -#if 0 case NGAP_ProcedureCode_id_InitialContextSetup: ngap_handle_initial_context_setup_response(gnb, pdu); break; + case NGAP_ProcedureCode_id_PDUSessionResourceSetup: + ngap_handle_pdu_session_resource_setup_response(gnb, pdu); + break; +#if 0 case NGAP_ProcedureCode_id_UEContextModification: ngap_handle_ue_context_modification_response(gnb, pdu); break; @@ -135,25 +138,12 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e) ngap_handle_ue_context_release_complete( gnb, pdu); break; - case NGAP_ProcedureCode_id_E_RABSetup: - ngap_handle_e_rab_setup_response(gnb, pdu); - break; - case NGAP_ProcedureCode_id_E_RABModify: - break; - case NGAP_ProcedureCode_id_E_RABRelease: - break; case NGAP_ProcedureCode_id_HandoverResourceAllocation: ngap_handle_handover_request_ack(gnb, pdu); break; - case NGAP_ProcedureCode_id_WriteReplaceWarning: - ngap_handle_write_replace_warning_response(gnb, pdu); - break; - case NGAP_ProcedureCode_id_Kill: - ngap_handle_kill_response(gnb, pdu); - break; #endif default: - ogs_warn("Not implemented(choice:%d, proc:%d)", + ogs_error("Not implemented(choice:%d, proc:%d)", pdu->present, (int)successfulOutcome->procedureCode); break; } @@ -163,10 +153,10 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e) ogs_assert(unsuccessfulOutcome); switch (unsuccessfulOutcome->procedureCode) { -#if 0 case NGAP_ProcedureCode_id_InitialContextSetup : ngap_handle_initial_context_setup_failure(gnb, pdu); break; +#if 0 case NGAP_ProcedureCode_id_UEContextModification: ngap_handle_ue_context_modification_failure(gnb, pdu); break; @@ -175,13 +165,13 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e) break; #endif default: - ogs_warn("Not implemented(choice:%d, proc:%d)", + ogs_error("Not implemented(choice:%d, proc:%d)", pdu->present, (int)unsuccessfulOutcome->procedureCode); break; } break; default: - ogs_warn("Not implemented(choice:%d)", pdu->present); + ogs_error("Not implemented(choice:%d)", pdu->present); break; } diff --git a/src/amf/nnrf-handler.c b/src/amf/nnrf-handler.c index 0462d6015..c7f40b2c9 100644 --- a/src/amf/nnrf-handler.c +++ b/src/amf/nnrf-handler.c @@ -19,6 +19,7 @@ #include "sbi-path.h" #include "nas-path.h" +#include "ngap-path.h" #include "nnrf-handler.h" void amf_nnrf_handle_nf_register( @@ -218,16 +219,19 @@ bool amf_nnrf_handle_nf_status_notify( return true; } -void amf_nnrf_handle_nf_discover(amf_ue_t *amf_ue, ogs_sbi_message_t *message) +void amf_nnrf_handle_nf_discover( + ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message) { - int rv; + bool handled; + + amf_ue_t *amf_ue = NULL; + amf_sess_t *sess = NULL; ogs_sbi_nf_instance_t *nf_instance = NULL; OpenAPI_search_result_t *SearchResult = NULL; OpenAPI_lnode_t *node = NULL; - bool handled; - ogs_assert(amf_ue); + ogs_assert(sbi_object); ogs_assert(message); SearchResult = message->SearchResult; @@ -279,9 +283,9 @@ void amf_nnrf_handle_nf_discover(amf_ue_t *amf_ue, ogs_sbi_message_t *message) amf_sbi_setup_client_callback(nf_instance); if (!OGS_SBI_NF_INSTANCE_GET( - amf_ue->nf_types, nf_instance->nf_type)) - ogs_sbi_nf_types_associate(amf_ue->nf_types, - nf_instance->nf_type, amf_nf_state_registered); + sbi_object->nf_types, nf_instance->nf_type)) + ogs_sbi_nf_types_associate(sbi_object->nf_types, + nf_instance->nf_type, sbi_object->nf_state_registered); /* TIME : Update validity from NRF */ if (SearchResult->validity_period) { @@ -299,25 +303,39 @@ void amf_nnrf_handle_nf_discover(amf_ue_t *amf_ue, ogs_sbi_message_t *message) } } - if (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_authentication)) { - nf_instance = OGS_SBI_NF_INSTANCE_GET( - amf_ue->nf_types, OpenAPI_nf_type_AUSF); - if (!nf_instance) { - ogs_error("[%s] (NF discover) No AUSF", amf_ue->suci); - nas_5gs_send_nas_reject( - amf_ue, OGS_5GMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED); - amf_ue_remove(amf_ue); - } else { - rv = amf_nausf_auth_send_authenticate(amf_ue, nf_instance); - if (rv != OGS_OK) { - ogs_error("[%s] Cannot send SBI message", amf_ue->suci); - nas_5gs_send_nas_reject( - amf_ue, OGS_5GMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED); - amf_ue_remove(amf_ue); + ogs_assert(sbi_object->nf_type); + nf_instance = OGS_SBI_NF_INSTANCE_GET( + sbi_object->nf_types, sbi_object->nf_type); + if (!nf_instance) { + switch(sbi_object->nf_type) { + case OpenAPI_nf_type_AUSF: + case OpenAPI_nf_type_UDM: + amf_ue = (amf_ue_t *)sbi_object; + ogs_assert(amf_ue); + ogs_error("[%s] (NF discover) No [%s]", amf_ue->suci, + OpenAPI_nf_type_ToString(sbi_object->nf_type)); + nas_5gs_send_gmm_reject_from_sbi(amf_ue, + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + break; + case OpenAPI_nf_type_SMF: + sess = (amf_sess_t *)sbi_object; + ogs_assert(sess); + ogs_error("[%d:%d] (NF discover) No [%s]", sess->psi, sess->pti, + OpenAPI_nf_type_ToString(sbi_object->nf_type)); + if (sess->payload_container_type) { + nas_5gs_send_back_5gsm_message_from_sbi(sess, + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + } else { + ngap_send_error_indication2(amf_ue, + NGAP_Cause_PR_transport, + NGAP_CauseTransport_transport_resource_unavailable); } + break; + default: + ogs_fatal("(NF discover) Not implemented [%s]", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); } } else { - ogs_fatal("Should implement other case"); - ogs_assert_if_reached(); + ogs_sbi_send(sbi_object, nf_instance); } } diff --git a/src/amf/nnrf-handler.h b/src/amf/nnrf-handler.h index 2fc49e7dc..bb15c8189 100644 --- a/src/amf/nnrf-handler.h +++ b/src/amf/nnrf-handler.h @@ -34,7 +34,8 @@ void amf_nnrf_handle_nf_status_subscribe( bool amf_nnrf_handle_nf_status_notify( ogs_sbi_session_t *session, ogs_sbi_message_t *message); -void amf_nnrf_handle_nf_discover(amf_ue_t *amf_ue, ogs_sbi_message_t *message); +void amf_nnrf_handle_nf_discover( + ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message); #ifdef __cplusplus } diff --git a/src/amf/nsmf-build.c b/src/amf/nsmf-build.c new file mode 100644 index 000000000..7627d8831 --- /dev/null +++ b/src/amf/nsmf-build.c @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nsmf-build.h" + +ogs_sbi_request_t *amf_nsmf_pdu_session_build_create_sm_context( + amf_sess_t *sess, void *data) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + ogs_sbi_server_t *server = NULL; + ogs_sbi_header_t header; + + char buf[OGS_AMFIDSTRLEN]; + amf_ue_t *amf_ue = NULL; + + OpenAPI_sm_context_create_data_t SmContextCreateData; + OpenAPI_plmn_id_nid_t plmn_id_nid; + OpenAPI_snssai_t s_nssai; + OpenAPI_ref_to_binary_data_t n1_sm_msg; + OpenAPI_guami_t guami; + + ogs_assert(sess); + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + ogs_assert(amf_ue->nas.access_type); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION; + message.h.api.version = (char *)OGS_SBI_API_V1; + message.h.resource.component[0] = + (char *)OGS_SBI_RESOURCE_NAME_SM_CONTEXTS; + + memset(&SmContextCreateData, 0, sizeof(SmContextCreateData)); + + SmContextCreateData.serving_nf_id = ogs_sbi_self()->nf_instance_id; + + plmn_id_nid.mcc = ogs_plmn_id_mcc_string(&amf_ue->tai.plmn_id); + plmn_id_nid.mnc = ogs_plmn_id_mnc_string(&amf_ue->tai.plmn_id); + plmn_id_nid.nid = NULL; + SmContextCreateData.serving_network = &plmn_id_nid; + + SmContextCreateData.supi = amf_ue->supi; + SmContextCreateData.pei = amf_ue->pei; + SmContextCreateData.pdu_session_id = sess->psi; + SmContextCreateData.dnn = sess->dnn; + + memset(&s_nssai, 0, sizeof(s_nssai)); + s_nssai.sst = sess->s_nssai.sst; + s_nssai.sd = ogs_s_nssai_sd_to_string(sess->s_nssai.sd); + SmContextCreateData.s_nssai = &s_nssai; + + ogs_assert(amf_ue->guami); + guami.amf_id = ogs_amf_id_to_string(&amf_ue->guami->amf_id, buf); + guami.plmn_id = (OpenAPI_plmn_id_t *)&plmn_id_nid; + SmContextCreateData.guami = &guami; + + SmContextCreateData.an_type = amf_ue->nas.access_type; + + memset(&header, 0, sizeof(header)); + header.service.name = (char *)OGS_SBI_SERVICE_NAME_NAMF_CALLBACK; + header.api.version = (char *)OGS_SBI_API_V1; + header.resource.component[0] = amf_ue->supi; + header.resource.component[1] = + (char *)OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS; + header.resource.component[2] = ogs_msprintf("%d", sess->psi); + + server = ogs_list_first(&ogs_sbi_self()->server_list); + ogs_assert(server); + SmContextCreateData.sm_context_status_uri = + ogs_sbi_server_uri(server, &header); + + n1_sm_msg.content_id = (char *)OGS_SBI_CONTENT_5GNAS_SM_ID; + SmContextCreateData.n1_sm_msg = &n1_sm_msg; + + message.SmContextCreateData = &SmContextCreateData; + + message.part[message.num_of_part].pkbuf = sess->payload_container; + if (message.part[message.num_of_part].pkbuf) { + message.part[message.num_of_part].content_id = + (char *)OGS_SBI_CONTENT_5GNAS_SM_ID; + message.part[message.num_of_part].content_type = + (char *)OGS_SBI_CONTENT_5GNAS_TYPE; + message.num_of_part++; + } + + message.http.accept = (char *)(OGS_SBI_CONTENT_JSON_TYPE "," + OGS_SBI_CONTENT_NGAP_TYPE "," OGS_SBI_CONTENT_PROBLEM_TYPE); + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + ogs_free(plmn_id_nid.mcc); + ogs_free(plmn_id_nid.mnc); + ogs_free(SmContextCreateData.sm_context_status_uri); + ogs_free(header.resource.component[2]); + if (s_nssai.sd) + ogs_free(s_nssai.sd); + + return request; +} + +ogs_sbi_request_t *amf_nsmf_pdu_session_build_update_sm_context( + amf_sess_t *sess, void *data) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + OpenAPI_sm_context_update_data_t SmContextUpdateData; + OpenAPI_ref_to_binary_data_t n2SmInfo; + + ogs_assert(sess); + ogs_assert(sess->sm_context_ref); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION; + message.h.api.version = (char *)OGS_SBI_API_V1; + message.h.resource.component[0] = + (char *)OGS_SBI_RESOURCE_NAME_SM_CONTEXTS; + message.h.resource.component[1] = sess->sm_context_ref; + message.h.resource.component[2] = (char *)OGS_SBI_RESOURCE_NAME_MODIFY; + + memset(&SmContextUpdateData, 0, sizeof(SmContextUpdateData)); + SmContextUpdateData.n2_sm_info_type = + OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP; + SmContextUpdateData.n2_sm_info = &n2SmInfo; + + memset(&n2SmInfo, 0, sizeof(n2SmInfo)); + n2SmInfo.content_id = (char *)OGS_SBI_CONTENT_NGAP_SM_ID; + + message.SmContextUpdateData = &SmContextUpdateData; + + message.part[message.num_of_part].pkbuf = data; + if (message.part[message.num_of_part].pkbuf) { + message.part[message.num_of_part].content_id = + (char *)OGS_SBI_CONTENT_NGAP_SM_ID; + message.part[message.num_of_part].content_type = + (char *)OGS_SBI_CONTENT_NGAP_TYPE; + message.num_of_part++; + } + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + return request; +} diff --git a/src/amf/nsmf-build.h b/src/amf/nsmf-build.h new file mode 100644 index 000000000..22aaaa8ee --- /dev/null +++ b/src/amf/nsmf-build.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AMF_NSMF_BUILD_H +#define AMF_NSMF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *amf_nsmf_pdu_session_build_create_sm_context( + amf_sess_t *sess, void *data); +ogs_sbi_request_t *amf_nsmf_pdu_session_build_update_sm_context( + amf_sess_t *sess, void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* AMF_NSMF_BUILD_H */ diff --git a/src/amf/nsmf-handler.c b/src/amf/nsmf-handler.c new file mode 100644 index 000000000..ede66db94 --- /dev/null +++ b/src/amf/nsmf-handler.c @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nsmf-handler.h" +#include "nas-path.h" +#include "ngap-path.h" + +#include "gmm-build.h" + +int amf_nsmf_pdu_session_handle_create_sm_context( + amf_sess_t *sess, ogs_sbi_message_t *recvmsg) +{ + ogs_assert(sess); + ogs_assert(recvmsg); + + if (recvmsg->res_status == OGS_SBI_HTTP_STATUS_CREATED) { + int rv; + ogs_sbi_message_t message; + ogs_sbi_header_t header; + + if (!recvmsg->http.location) { + ogs_error("[%d:%d] No http.location", sess->psi, sess->pti); + nas_5gs_send_back_5gsm_message_from_sbi(sess, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR); + return OGS_ERROR; + } + + memset(&header, 0, sizeof(header)); + header.uri = recvmsg->http.location; + + rv = ogs_sbi_parse_header(&message, &header); + if (rv != OGS_OK) { + ogs_error("[%d:%d] Cannot parse http.location [%s]", + sess->psi, sess->pti, recvmsg->http.location); + nas_5gs_send_back_5gsm_message_from_sbi(sess, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR); + return OGS_ERROR; + } + + if (!message.h.resource.component[1]) { + ogs_error("[%d:%d] No SmContextRef [%s]", + sess->psi, sess->pti, recvmsg->http.location); + + ogs_sbi_header_free(&header); + nas_5gs_send_back_5gsm_message_from_sbi(sess, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR); + return OGS_ERROR; + } + + if (sess->sm_context_ref) + ogs_free(sess->sm_context_ref); + sess->sm_context_ref = ogs_strdup(message.h.resource.component[1]); + + ogs_sbi_header_free(&header); + + } else { + OpenAPI_sm_context_create_error_t *SmContextCreateError = NULL; + OpenAPI_ref_to_binary_data_t *n1SmMsg = NULL; + ogs_pkbuf_t *n1smbuf = NULL; + + SmContextCreateError = recvmsg->SmContextCreateError; + if (!SmContextCreateError) { + ogs_error("[%d:%d] No SmContextCreateError", sess->psi, sess->pti); + nas_5gs_send_back_5gsm_message_from_sbi(sess, recvmsg->res_status); + return OGS_ERROR; + } + if (!SmContextCreateError->error) { + ogs_error("[%d:%d] No Error", sess->psi, sess->pti); + nas_5gs_send_back_5gsm_message_from_sbi(sess, recvmsg->res_status); + return OGS_ERROR; + } + n1SmMsg = SmContextCreateError->n1_sm_msg; + if (!n1SmMsg || !n1SmMsg->content_id) { + ogs_error("[%d:%d] No N1 SM Message", sess->psi, sess->pti); + nas_5gs_send_back_5gsm_message_from_sbi(sess, recvmsg->res_status); + return OGS_ERROR; + } + + n1smbuf = ogs_sbi_find_part_by_content_id(recvmsg, n1SmMsg->content_id); + if (!n1smbuf) { + ogs_error("[%d:%d] No N1 SM Content [%s]", + sess->psi, sess->pti, n1SmMsg->content_id); + nas_5gs_send_back_5gsm_message_from_sbi(sess, recvmsg->res_status); + return OGS_ERROR; + } + + n1smbuf = ogs_pkbuf_copy(n1smbuf); + ogs_assert(n1smbuf); + nas_5gs_send_gsm_reject_from_sbi(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, + n1smbuf, recvmsg->res_status); + } + + return OGS_OK; +} + +int amf_nsmf_pdu_session_handle_update_sm_context( + amf_sess_t *sess, ogs_sbi_message_t *recvmsg) +{ + ogs_assert(sess); + ogs_assert(recvmsg); + + if (recvmsg->res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT) { + /* Nothing */ + + } else if (recvmsg->res_status == OGS_SBI_HTTP_STATUS_OK) { + ogs_fatal("TODO"); + + } else { + amf_ue_t *amf_ue = NULL; + + OpenAPI_sm_context_update_error_t *SmContextUpdateError = NULL; +#if 0 /* Is it needed? */ + OpenAPI_ref_to_binary_data_t *n2SmInfo = NULL; + ogs_pkbuf_t *n2smbuf = NULL; +#endif + + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + + SmContextUpdateError = recvmsg->SmContextUpdateError; + if (!SmContextUpdateError) { + ogs_error("[%d:%d] No SmContextUpdateError", sess->psi, sess->pti); + ngap_send_error_indication2(amf_ue, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return OGS_ERROR; + } + if (!SmContextUpdateError->error) { + ogs_error("[%d:%d] No Error", sess->psi, sess->pti); + ngap_send_error_indication2(amf_ue, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return OGS_ERROR; + } +#if 0 /* Is it needed? */ + n2SmInfo = SmContextUpdateError->n2_sm_info; + if (!n2SmInfo || !n2SmInfo->content_id) { + ogs_error("[%d:%d] No N2 SM Message", sess->psi, sess->pti); + ngap_send_error_indication2(amf_ue, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return OGS_ERROR; + } + + n2smbuf = ogs_sbi_find_part_by_content_id( + recvmsg, n2SmInfo->content_id); + if (!n2smbuf) { + ogs_error("[%d:%d] No N2 SM Content [%s]", + sess->psi, sess->pti, n2SmInfo->content_id); + ngap_send_error_indication2(amf_ue, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + return OGS_ERROR; + } +#endif + + ngap_send_error_indication2(amf_ue, + NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error); + } + + return OGS_OK; +} diff --git a/src/amf/nsmf-handler.h b/src/amf/nsmf-handler.h new file mode 100644 index 000000000..c6651d910 --- /dev/null +++ b/src/amf/nsmf-handler.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AMF_NSMF_HANDLER_H +#define AMF_NSMF_HANDLER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "context.h" + +int amf_nsmf_pdu_session_handle_create_sm_context( + amf_sess_t *sess, ogs_sbi_message_t *message); +int amf_nsmf_pdu_session_handle_update_sm_context( + amf_sess_t *sess, ogs_sbi_message_t *message); +int amf_nsmf_pdu_session_handle_release_sm_context( + amf_sess_t *sess, ogs_sbi_message_t *message); + +#ifdef __cplusplus +} +#endif + +#endif /* AMF_NSMF_HANDLER_H */ diff --git a/src/amf/nudm-build.c b/src/amf/nudm-build.c new file mode 100644 index 000000000..42183cf9d --- /dev/null +++ b/src/amf/nudm-build.c @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nudm-build.h" + +ogs_sbi_request_t *amf_nudm_uecm_build_registration( + amf_ue_t *amf_ue, void *data) +{ + ogs_sbi_message_t message; + ogs_sbi_header_t header; + ogs_sbi_request_t *request = NULL; + ogs_sbi_server_t *server = NULL; + + char buf[OGS_AMFIDSTRLEN]; + + OpenAPI_amf3_gpp_access_registration_t Amf3GppAccessRegistration; + OpenAPI_plmn_id_t plmn_id; + OpenAPI_guami_t guami; + + ogs_assert(amf_ue); + ogs_assert(amf_ue->supi); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_UECM; + message.h.api.version = (char *)OGS_SBI_API_V1; + message.h.resource.component[0] = amf_ue->supi; + message.h.resource.component[1] = + (char *)OGS_SBI_RESOURCE_NAME_REGISTRATIONS; + message.h.resource.component[2] = + (char *)OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS; + + memset(&Amf3GppAccessRegistration, 0, sizeof(Amf3GppAccessRegistration)); + + Amf3GppAccessRegistration.amf_instance_id = ogs_sbi_self()->nf_instance_id; + + server = ogs_list_first(&ogs_sbi_self()->server_list); + ogs_assert(server); + + memset(&header, 0, sizeof(header)); + header.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_UECM; + header.api.version = (char *)OGS_SBI_API_V1; + header.resource.component[0] = amf_ue->supi; + header.resource.component[1] = + (char *)OGS_SBI_RESOURCE_NAME_DEREG_NOTIFY; + Amf3GppAccessRegistration.dereg_callback_uri = + ogs_sbi_server_uri(server, &header); + ogs_assert(Amf3GppAccessRegistration.dereg_callback_uri); + + plmn_id.mcc = ogs_plmn_id_mcc_string(&amf_ue->tai.plmn_id); + plmn_id.mnc = ogs_plmn_id_mnc_string(&amf_ue->tai.plmn_id); + + ogs_assert(amf_ue->guami); + guami.amf_id = ogs_amf_id_to_string(&amf_ue->guami->amf_id, buf); + guami.plmn_id = &plmn_id; + Amf3GppAccessRegistration.guami = &guami; + + Amf3GppAccessRegistration.rat_type = OpenAPI_rat_type_NR; + + message.Amf3GppAccessRegistration = &Amf3GppAccessRegistration; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + ogs_free(plmn_id.mcc); + ogs_free(plmn_id.mnc); + ogs_free(Amf3GppAccessRegistration.dereg_callback_uri); + + return request; +} + +ogs_sbi_request_t *amf_nudm_sdm_build_get(amf_ue_t *amf_ue, void *data) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + ogs_assert(amf_ue); + ogs_assert(amf_ue->supi); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_SDM; + message.h.api.version = (char *)OGS_SBI_API_V2; + message.h.resource.component[0] = amf_ue->supi; + message.h.resource.component[1] = data; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + return request; +} diff --git a/src/amf/nudm-build.h b/src/amf/nudm-build.h new file mode 100644 index 000000000..8ccd7405e --- /dev/null +++ b/src/amf/nudm-build.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AMF_NUDM_BUILD_H +#define AMF_NUDM_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *amf_nudm_uecm_build_registration( + amf_ue_t *amf_ue, void *data); +ogs_sbi_request_t *amf_nudm_sdm_build_get(amf_ue_t *amf_ue, void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* AMF_NUDM_BUILD_H */ diff --git a/src/amf/sbi-path.c b/src/amf/sbi-path.c index dc8e89cd7..ad51f16e6 100644 --- a/src/amf/sbi-path.c +++ b/src/amf/sbi-path.c @@ -20,6 +20,7 @@ #include "sbi-path.h" #include "nas-path.h" #include "nausf-build.h" +#include "nudm-build.h" static int server_cb(ogs_sbi_server_t *server, ogs_sbi_session_t *session, ogs_sbi_request_t *request) @@ -81,10 +82,10 @@ int amf_sbi_open(void) ogs_sbi_nf_instance_build_default(nf_instance, amf_self()->nf_type); service = ogs_sbi_nf_service_build_default(nf_instance, - (char*)OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION); + (char*)OGS_SBI_SERVICE_NAME_NAMF_COMM); ogs_assert(service); - ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_VERSION, - (char*)OGS_SBI_API_FULL_VERSION, NULL); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1, + (char*)OGS_SBI_API_V1_0_0, NULL); amf_nf_fsm_init(nf_instance); amf_sbi_setup_client_callback(nf_instance); @@ -116,102 +117,39 @@ void amf_sbi_setup_client_callback(ogs_sbi_nf_instance_t *nf_instance) } } -static ogs_sbi_nf_instance_t *find_or_discover_nf_instance( - amf_ue_t *amf_ue, OpenAPI_nf_type_e nf_type) +void amf_ue_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, amf_ue_t *amf_ue, void *data, + ogs_sbi_request_t *(*build)(amf_ue_t *amf_ue, void *data)) { - bool nrf = true; - bool nf = true; - - if (!OGS_SBI_NF_INSTANCE_GET(amf_ue->nf_types, OpenAPI_nf_type_NRF)) - nrf = ogs_sbi_nf_types_associate( - amf_ue->nf_types, OpenAPI_nf_type_NRF, amf_nf_state_registered); - if (!OGS_SBI_NF_INSTANCE_GET(amf_ue->nf_types, nf_type)) - nf = ogs_sbi_nf_types_associate( - amf_ue->nf_types, nf_type, amf_nf_state_registered); - - if (nrf == false && nf == false) { - ogs_error("[%s] Cannot discover AUSF", amf_ue->suci); - nas_5gs_send_nas_reject( - amf_ue, OGS_5GMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED); - return NULL; - } - - if (nf == false) { - ogs_warn("[%s] Try to discover AUSF", amf_ue->suci); - ogs_timer_start(amf_ue->sbi_client_wait.timer, - amf_timer_cfg(AMF_TIMER_SBI_CLIENT_WAIT)->duration); - - ogs_nnrf_disc_send_nf_discover( - amf_ue->nf_types[OpenAPI_nf_type_NRF].nf_instance, - nf_type, OpenAPI_nf_type_AMF, amf_ue); - - return NULL; - } - - return amf_ue->nf_types[nf_type].nf_instance; -} - -int amf_nausf_auth_send_authenticate( - amf_ue_t *amf_ue, ogs_sbi_nf_instance_t *nf_instance) -{ - ogs_sbi_request_t *request = NULL; - ogs_sbi_client_t *client = NULL; - ogs_sockaddr_t *addr = NULL; - char buf[OGS_ADDRSTRLEN]; - - ogs_assert(amf_ue); - ogs_assert(nf_instance); - - if (amf_ue->confirmation_url_for_5g_aka) { - addr = ogs_sbi_getaddr_from_uri(amf_ue->confirmation_url_for_5g_aka); - if (!addr) { - ogs_error("[%s] Invalid confirmation URL [%s]", amf_ue->suci, - amf_ue->confirmation_url_for_5g_aka); - return OGS_ERROR; - } - client = ogs_sbi_client_find(addr); - if (!client) { - ogs_error("[%s] Cannot find client [%s:%d]", amf_ue->suci, - OGS_ADDR(addr, buf), OGS_PORT(addr)); - ogs_freeaddrinfo(addr); - return OGS_ERROR; - } - ogs_freeaddrinfo(addr); - - request = amf_nausf_auth_build_authenticate_confirmation(amf_ue); - ogs_assert(request); - } else { - client = ogs_sbi_client_find_by_service_name( - nf_instance, (char *)OGS_SBI_SERVICE_NAME_NAUSF_AUTH); - if (!client) { - ogs_error("[%s] Cannot find client [%s:%s]", amf_ue->suci, - nf_instance->id, OGS_SBI_SERVICE_NAME_NAUSF_AUTH); - return OGS_ERROR; - } - - request = amf_nausf_auth_build_authenticate(amf_ue); - ogs_assert(request); - } - - ogs_timer_start(amf_ue->sbi_client_wait.timer, - amf_timer_cfg(AMF_TIMER_SBI_CLIENT_WAIT)->duration); - - ogs_sbi_client_send_request(client, request, amf_ue); - - return OGS_OK; -} - -int amf_nausf_auth_discover_and_send_authenticate(amf_ue_t *amf_ue) -{ - ogs_sbi_nf_instance_t *nf_instance = NULL; - + ogs_assert(nf_type); ogs_assert(amf_ue); - if (!nf_instance) - nf_instance = find_or_discover_nf_instance( - amf_ue, OpenAPI_nf_type_AUSF); + amf_ue->sbi.nf_state_registered = amf_nf_state_registered; + amf_ue->sbi.client_wait.duration = + amf_timer_cfg(AMF_TIMER_SBI_CLIENT_WAIT)->duration; - if (!nf_instance) return OGS_RETRY; - - return amf_nausf_auth_send_authenticate(amf_ue, nf_instance); + if (ogs_sbi_discover_and_send( + nf_type, &amf_ue->sbi, data, (ogs_sbi_build_f)build) != true) { + nas_5gs_send_gmm_reject_from_sbi(amf_ue, + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + } +} + +void amf_sess_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, amf_sess_t *sess, void *data, + ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data)) +{ + ogs_assert(nf_type); + ogs_assert(sess); + ogs_assert(build); + + sess->sbi.nf_state_registered = amf_nf_state_registered; + sess->sbi.client_wait.duration = + amf_timer_cfg(AMF_TIMER_SBI_CLIENT_WAIT)->duration; + + if (ogs_sbi_discover_and_send( + nf_type, &sess->sbi, data, (ogs_sbi_build_f)build) != true) { + nas_5gs_send_back_5gsm_message_from_sbi(sess, + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + } } diff --git a/src/amf/sbi-path.h b/src/amf/sbi-path.h index f1a4ffae2..1312069f0 100644 --- a/src/amf/sbi-path.h +++ b/src/amf/sbi-path.h @@ -21,6 +21,8 @@ #define AMF_SBI_PATH_H #include "nausf-build.h" +#include "nudm-build.h" +#include "nsmf-build.h" #ifdef __cplusplus extern "C" { @@ -31,9 +33,12 @@ void amf_sbi_close(void); void amf_sbi_setup_client_callback(ogs_sbi_nf_instance_t *nf_instance); -int amf_nausf_auth_send_authenticate( - amf_ue_t *amf_ue, ogs_sbi_nf_instance_t *nf_instance); -int amf_nausf_auth_discover_and_send_authenticate(amf_ue_t *amf_ue); +void amf_ue_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, amf_ue_t *amf_ue, void *data, + ogs_sbi_request_t *(*build)(amf_ue_t *amf_ue, void *data)); +void amf_sess_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, amf_sess_t *sess, void *data, + ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data)); #ifdef __cplusplus } diff --git a/src/amf/timer.c b/src/amf/timer.c index 39e3fd013..5dedc6f1e 100644 --- a/src/amf/timer.c +++ b/src/amf/timer.c @@ -23,7 +23,7 @@ static amf_timer_cfg_t g_amf_timer_cfg[MAX_NUM_OF_AMF_TIMER] = { [AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] = { .duration = ogs_time_from_sec(3) }, [AMF_TIMER_SBI_CLIENT_WAIT] = - { .duration = ogs_time_from_sec(2) }, + { .duration = ogs_time_from_msec(500) }, /* Paging procedure for EPS services initiated */ [AMF_TIMER_T3513] = @@ -40,6 +40,10 @@ static amf_timer_cfg_t g_amf_timer_cfg[MAX_NUM_OF_AMF_TIMER] = { [AMF_TIMER_T3550] = { .max_count = 4, .duration = ogs_time_from_sec(6) }, + /* CONFIGURATION UPDATE COMMAND sent */ + [AMF_TIMER_T3555] = + { .max_count = 4, .duration = ogs_time_from_sec(6) }, + /* AUTHENTICATION REQUEST sent * SECURITY MODE COMMAND sent */ [AMF_TIMER_T3560] = @@ -88,6 +92,8 @@ const char *amf_timer_get_name(amf_timer_e id) return "AMF_TIMER_T3522"; case AMF_TIMER_T3550: return "AMF_TIMER_T3550"; + case AMF_TIMER_T3555: + return "AMF_TIMER_T3555"; case AMF_TIMER_T3560: return "AMF_TIMER_T3560"; case AMF_TIMER_T3570: @@ -218,6 +224,10 @@ void amf_timer_t3550_expire(void *data) { gmm_timer_event_send(AMF_TIMER_T3550, data); } +void amf_timer_t3555_expire(void *data) +{ + gmm_timer_event_send(AMF_TIMER_T3555, data); +} void amf_timer_t3560_expire(void *data) { gmm_timer_event_send(AMF_TIMER_T3560, data); diff --git a/src/amf/timer.h b/src/amf/timer.h index f4df7b88d..b691510eb 100644 --- a/src/amf/timer.h +++ b/src/amf/timer.h @@ -42,8 +42,10 @@ typedef enum { AMF_TIMER_T3513, AMF_TIMER_T3522, AMF_TIMER_T3550, + AMF_TIMER_T3555, AMF_TIMER_T3560, AMF_TIMER_T3570, + AMF_TIMER_T3589, MAX_NUM_OF_AMF_TIMER, @@ -71,6 +73,7 @@ void amf_timer_ng_delayed_send(void *data); void amf_timer_t3513_expire(void *data); void amf_timer_t3522_expire(void *data); void amf_timer_t3550_expire(void *data); +void amf_timer_t3555_expire(void *data); void amf_timer_t3560_expire(void *data); void amf_timer_t3570_expire(void *data); void amf_timer_t3589_expire(void *data); diff --git a/src/ausf/ausf-sm.c b/src/ausf/ausf-sm.c index 6350ff6f4..57246ca83 100644 --- a/src/ausf/ausf-sm.c +++ b/src/ausf/ausf-sm.c @@ -45,6 +45,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) ogs_sbi_subscription_t *subscription = NULL; ogs_sbi_response_t *response = NULL; ogs_sbi_message_t message; + ogs_sbi_object_t *sbi_object = NULL; ausf_ue_t *ausf_ue = NULL; @@ -80,7 +81,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) break; } - if (strcmp(message.h.api.version, OGS_SBI_API_VERSION) != 0) { + if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) { ogs_error("Not supported version [%s]", message.h.api.version); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Not supported version", NULL); @@ -102,7 +103,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) ogs_error("Invalid HTTP method [%s]", message.h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &message, "Invalid HTTP method", message.h.method); END @@ -112,7 +113,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) ogs_error("Invalid resource name [%s]", message.h.resource.component[0]); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Unknown resource name", message.h.resource.component[0]); END @@ -151,11 +152,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) ogs_assert(OGS_FSM_STATE(&ausf_ue->sm)); - OGS_SETUP_SBI_SESSION(ausf_ue, session); - - if (ausf_ue->state.method) - ogs_free(ausf_ue->state.method); - ausf_ue->state.method = ogs_strdup(message.h.method); + OGS_SETUP_SBI_SESSION(&ausf_ue->sbi, session); e->ausf_ue = ausf_ue; e->sbi.message = &message; @@ -169,7 +166,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) DEFAULT ogs_error("Invalid API name [%s]", message.h.service.name); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Invalid API name", message.h.resource.component[0]); END @@ -190,7 +187,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) break; } - if (strcmp(message.h.api.version, OGS_SBI_API_VERSION) != 0) { + if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) { ogs_error("Not supported version [%s]", message.h.api.version); ogs_sbi_message_free(&message); ogs_sbi_response_free(response); @@ -257,24 +254,23 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC) SWITCH(message.h.resource.component[0]) CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) - ausf_ue = e->sbi.data; - ogs_assert(ausf_ue); + sbi_object = e->sbi.data; + ogs_assert(sbi_object); SWITCH(message.h.method) CASE(OGS_SBI_HTTP_METHOD_GET) if (message.res_status == OGS_SBI_HTTP_STATUS_OK) { - ogs_timer_stop(ausf_ue->sbi_client_wait.timer); + ogs_timer_stop(sbi_object->client_wait.timer); - ausf_nnrf_handle_nf_discover(ausf_ue, &message); + ausf_nnrf_handle_nf_discover(sbi_object, &message); } else { - ogs_error("[%s] HTTP response error [%d]", - ausf_ue->suci, message.res_status); + ogs_error("HTTP response error [%d]", + message.res_status); } break; DEFAULT - ogs_error("[%s] Invalid HTTP method [%s]", - ausf_ue->suci, message.h.method); + ogs_error("Invalid HTTP method [%s]", message.h.method); ogs_assert_if_reached(); END break; @@ -339,15 +335,15 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e) break; case AUSF_TIMER_SBI_CLIENT_WAIT: - ausf_ue = e->sbi.data; - ogs_assert(ausf_ue); - session = ausf_ue->session; + sbi_object = e->sbi.data; + ogs_assert(sbi_object); + session = sbi_object->session; ogs_assert(session); - ogs_error("[%s] Cannot receive SBI message", ausf_ue->suci); + ogs_error("Cannot receive SBI message"); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, - "Cannot receive SBI message", ausf_ue->suci); + "Cannot receive SBI message", NULL); break; default: ogs_error("Unknown timer[%s:%d]", diff --git a/src/ausf/context.c b/src/ausf/context.c index 54d29a641..5cec22011 100644 --- a/src/ausf/context.c +++ b/src/ausf/context.c @@ -127,7 +127,7 @@ ausf_ue_t *ausf_ue_add(char *suci) memset(ausf_ue, 0, sizeof *ausf_ue); ausf_ue->ctx_id = - ogs_msprintf("%ld", ogs_pool_index(&ausf_ue_pool, ausf_ue)); + ogs_msprintf("%d", (int)ogs_pool_index(&ausf_ue_pool, ausf_ue)); ogs_assert(ausf_ue->ctx_id); ausf_ue->suci = ogs_strdup(suci); @@ -138,7 +138,7 @@ ausf_ue_t *ausf_ue_add(char *suci) ogs_assert(ausf_ue->supi); ogs_hash_set(self.supi_hash, ausf_ue->supi, strlen(ausf_ue->supi), ausf_ue); - ausf_ue->sbi_client_wait.timer = ogs_timer_add( + ausf_ue->sbi.client_wait.timer = ogs_timer_add( self.timer_mgr, ausf_timer_sbi_client_wait_expire, ausf_ue); e.ausf_ue = ausf_ue; @@ -153,7 +153,6 @@ ausf_ue_t *ausf_ue_add(char *suci) void ausf_ue_remove(ausf_ue_t *ausf_ue) { ausf_event_t e; - int i; ogs_assert(ausf_ue); @@ -163,7 +162,9 @@ void ausf_ue_remove(ausf_ue_t *ausf_ue) ogs_fsm_fini(&ausf_ue->sm, &e); ogs_fsm_delete(&ausf_ue->sm); - ogs_timer_delete(ausf_ue->sbi_client_wait.timer); + /* Free SBI object memory */ + ogs_sbi_object_free(&ausf_ue->sbi); + ogs_timer_delete(ausf_ue->sbi.client_wait.timer); ogs_assert(ausf_ue->ctx_id); ogs_free(ausf_ue->ctx_id); @@ -176,20 +177,12 @@ void ausf_ue_remove(ausf_ue_t *ausf_ue) ogs_hash_set(self.supi_hash, ausf_ue->supi, strlen(ausf_ue->supi), NULL); ogs_free(ausf_ue->supi); - if (ausf_ue->state.method) - ogs_free(ausf_ue->state.method); - if (ausf_ue->auth_events_url) ogs_free(ausf_ue->auth_events_url); if (ausf_ue->serving_network_name) ogs_free(ausf_ue->serving_network_name); - for (i = 0; i < OGS_SBI_MAX_NF_TYPE; i++) { - if (ausf_ue->nf_types[i].nf_instance) - ogs_sbi_nf_instance_remove(ausf_ue->nf_types[i].nf_instance); - } - ogs_pool_free(&ausf_ue_pool, ausf_ue); } diff --git a/src/ausf/context.h b/src/ausf/context.h index 3f77c12de..213ab0cb8 100644 --- a/src/ausf/context.h +++ b/src/ausf/context.h @@ -52,12 +52,8 @@ typedef struct ausf_context_s { } ausf_context_t; struct ausf_ue_s { - ogs_lnode_t lnode; - ogs_fsm_t sm; /* A state machine */ - - struct { - char *method; - } state; + ogs_sbi_object_t sbi; + ogs_fsm_t sm; char *ctx_id; char *suci; @@ -74,10 +70,6 @@ struct ausf_ue_s { uint8_t kausf[OGS_SHA256_DIGEST_SIZE]; uint8_t kseaf[OGS_SHA256_DIGEST_SIZE]; - struct { - ogs_timer_t *timer; - } sbi_client_wait; - #define AUSF_NF_INSTANCE_CLEAR(_cAUSE, _nFInstance) \ do { \ ogs_assert(_nFInstance); \ @@ -93,10 +85,6 @@ struct ausf_ue_s { } \ ogs_sbi_nf_instance_remove(_nFInstance); \ } while(0) - - ogs_sbi_nf_types_t nf_types; - - ogs_sbi_session_t *session; }; void ausf_context_init(void); diff --git a/src/ausf/nausf-handler.c b/src/ausf/nausf-handler.c index c5c54ceb3..b30eca32f 100644 --- a/src/ausf/nausf-handler.c +++ b/src/ausf/nausf-handler.c @@ -30,7 +30,7 @@ bool ausf_nausf_auth_handle_authenticate( char *serving_network_name = NULL; ogs_assert(ausf_ue); - session = ausf_ue->session; + session = ausf_ue->sbi.session; ogs_assert(session); ogs_assert(recvmsg); @@ -50,10 +50,12 @@ bool ausf_nausf_auth_handle_authenticate( return false; } + if (ausf_ue->serving_network_name) + ogs_free(ausf_ue->serving_network_name); ausf_ue->serving_network_name = ogs_strdup(serving_network_name); - ogs_assert(ausf_ue->serving_network_name); - ausf_nudm_ueau_discover_and_send_get(ausf_ue); + ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, NULL, + ausf_nudm_ueau_build_get); return true; } @@ -68,7 +70,7 @@ bool ausf_nausf_auth_handle_authenticate_confirmation( uint8_t res_star[OGS_KEYSTRLEN(OGS_MAX_RES_LEN)]; ogs_assert(ausf_ue); - session = ausf_ue->session; + session = ausf_ue->sbi.session; ogs_assert(session); ogs_assert(recvmsg); @@ -100,7 +102,8 @@ bool ausf_nausf_auth_handle_authenticate_confirmation( ausf_ue->auth_result = OpenAPI_auth_result_AUTHENTICATION_SUCCESS; } - ausf_nudm_ueau_discover_and_send_result_confirmation_inform(ausf_ue); + ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, NULL, + ausf_nudm_ueau_build_result_confirmation_inform); return true; } diff --git a/src/ausf/nnrf-handler.c b/src/ausf/nnrf-handler.c index f54387a74..3c94eaa52 100644 --- a/src/ausf/nnrf-handler.c +++ b/src/ausf/nnrf-handler.c @@ -218,7 +218,7 @@ bool ausf_nnrf_handle_nf_status_notify( } void ausf_nnrf_handle_nf_discover( - ausf_ue_t *ausf_ue, ogs_sbi_message_t *message) + ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message) { ogs_sbi_nf_instance_t *nf_instance = NULL; ogs_sbi_session_t *session = NULL; @@ -227,8 +227,8 @@ void ausf_nnrf_handle_nf_discover( OpenAPI_lnode_t *node = NULL; bool handled; - ogs_assert(ausf_ue); - session = ausf_ue->session; + ogs_assert(sbi_object); + session = sbi_object->session; ogs_assert(session); ogs_assert(message); @@ -281,9 +281,9 @@ void ausf_nnrf_handle_nf_discover( ausf_sbi_setup_client_callback(nf_instance); if (!OGS_SBI_NF_INSTANCE_GET( - ausf_ue->nf_types, nf_instance->nf_type)) - ogs_sbi_nf_types_associate(ausf_ue->nf_types, - nf_instance->nf_type, ausf_nf_state_registered); + sbi_object->nf_types, nf_instance->nf_type)) + ogs_sbi_nf_types_associate(sbi_object->nf_types, + nf_instance->nf_type, sbi_object->nf_state_registered); /* TIME : Update validity from NRF */ if (SearchResult->validity_period) { @@ -301,28 +301,17 @@ void ausf_nnrf_handle_nf_discover( } } + ogs_assert(sbi_object->nf_type); nf_instance = OGS_SBI_NF_INSTANCE_GET( - ausf_ue->nf_types, OpenAPI_nf_type_UDM); + sbi_object->nf_types, sbi_object->nf_type); if (!nf_instance) { - ogs_error("[%s] (NF discover) No UDM", ausf_ue->suci); + ogs_error("(NF discover) No [%s]", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_SERVICE_UNAVAILABLE, NULL, - "(NF discover) No UDM", ausf_ue->suci); - ausf_ue_remove(ausf_ue); + "(NF discover) No NF", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); } else { - ogs_assert(ausf_ue->state.method); - SWITCH(ausf_ue->state.method) - CASE(OGS_SBI_HTTP_METHOD_POST) - ausf_nudm_ueau_send_get(ausf_ue, nf_instance); - break; - CASE(OGS_SBI_HTTP_METHOD_PUT) - ausf_nudm_ueau_send_result_confirmation_inform( - ausf_ue, nf_instance); - break; - DEFAULT - ogs_fatal("[%s] Unknown state [%s]", - ausf_ue->suci, ausf_ue->state.method); - ogs_assert_if_reached(); - END + ogs_sbi_send(sbi_object, nf_instance); } } diff --git a/src/ausf/nnrf-handler.h b/src/ausf/nnrf-handler.h index bdcbad408..0d414739f 100644 --- a/src/ausf/nnrf-handler.h +++ b/src/ausf/nnrf-handler.h @@ -35,7 +35,7 @@ bool ausf_nnrf_handle_nf_status_notify( ogs_sbi_session_t *session, ogs_sbi_message_t *message); void ausf_nnrf_handle_nf_discover( - ausf_ue_t *ausf_ue, ogs_sbi_message_t *message); + ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message); #ifdef __cplusplus } diff --git a/src/ausf/nudm-build.c b/src/ausf/nudm-build.c index 80b380164..68743d4cb 100644 --- a/src/ausf/nudm-build.c +++ b/src/ausf/nudm-build.c @@ -19,7 +19,7 @@ #include "nudm-build.h" -ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue) +ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue, void *data) { ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; @@ -31,7 +31,7 @@ ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue) memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_UEAU; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = ausf_ue->suci; message.h.resource.component[1] = (char *)OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION; @@ -58,7 +58,7 @@ ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue) } ogs_sbi_request_t *ausf_nudm_ueau_build_result_confirmation_inform( - ausf_ue_t *ausf_ue) + ausf_ue_t *ausf_ue, void *data) { ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; @@ -74,7 +74,7 @@ ogs_sbi_request_t *ausf_nudm_ueau_build_result_confirmation_inform( memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_UEAU; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = ausf_ue->supi; message.h.resource.component[1] = (char *)OGS_SBI_RESOURCE_NAME_AUTH_EVENTS; diff --git a/src/ausf/nudm-build.h b/src/ausf/nudm-build.h index ca8da1361..70bed018c 100644 --- a/src/ausf/nudm-build.h +++ b/src/ausf/nudm-build.h @@ -26,9 +26,9 @@ extern "C" { #endif -ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue); +ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue, void *data); ogs_sbi_request_t *ausf_nudm_ueau_build_result_confirmation_inform( - ausf_ue_t *ausf_ue); + ausf_ue_t *ausf_ue, void *data); #ifdef __cplusplus } diff --git a/src/ausf/nudm-handler.c b/src/ausf/nudm-handler.c index 15680b524..b30dc3560 100644 --- a/src/ausf/nudm-handler.c +++ b/src/ausf/nudm-handler.c @@ -51,7 +51,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg) OpenAPI_links_value_schema_t LinksValueSchemeValue; ogs_assert(ausf_ue); - session = ausf_ue->session; + session = ausf_ue->sbi.session; ogs_assert(session); server = ogs_sbi_session_get_server(session); ogs_assert(server); @@ -164,7 +164,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg) memset(&header, 0, sizeof(header)); header.service.name = (char *)OGS_SBI_SERVICE_NAME_NAUSF_AUTH; - header.api.version = (char *)OGS_SBI_API_VERSION; + header.api.version = (char *)OGS_SBI_API_V1; header.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS; header.resource.component[1] = ausf_ue->ctx_id; @@ -182,7 +182,7 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg) memset(&header, 0, sizeof(header)); header.service.name = (char *)OGS_SBI_SERVICE_NAME_NAUSF_AUTH; - header.api.version = (char *)OGS_SBI_API_VERSION; + header.api.version = (char *)OGS_SBI_API_V1; header.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS; header.resource.component[1] = ausf_ue->ctx_id; @@ -220,7 +220,7 @@ bool ausf_nudm_ueau_handle_result_confirmation_inform( OpenAPI_auth_event_t *AuthEvent = NULL; ogs_assert(ausf_ue); - session = ausf_ue->session; + session = ausf_ue->sbi.session; ogs_assert(session); ogs_assert(recvmsg); diff --git a/src/ausf/sbi-path.c b/src/ausf/sbi-path.c index 4d61b34b8..a4e96c773 100644 --- a/src/ausf/sbi-path.c +++ b/src/ausf/sbi-path.c @@ -81,8 +81,8 @@ int ausf_sbi_open(void) service = ogs_sbi_nf_service_build_default(nf_instance, (char*)OGS_SBI_SERVICE_NAME_NAUSF_AUTH); ogs_assert(service); - ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_VERSION, - (char*)OGS_SBI_API_FULL_VERSION, NULL); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1, + (char*)OGS_SBI_API_V1_0_0, NULL); ausf_nf_fsm_init(nf_instance); ausf_sbi_setup_client_callback(nf_instance); @@ -114,125 +114,25 @@ void ausf_sbi_setup_client_callback(ogs_sbi_nf_instance_t *nf_instance) } } -static ogs_sbi_nf_instance_t *find_or_discover_nf_instance( - ausf_ue_t *ausf_ue, OpenAPI_nf_type_e nf_type) +void ausf_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, ausf_ue_t *ausf_ue, void *data, + ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data)) { ogs_sbi_session_t *session = NULL; - bool nrf = true; - bool nf = true; ogs_assert(ausf_ue); - session = ausf_ue->session; - ogs_assert(session); + session = ausf_ue->sbi.session; ogs_assert(nf_type); + ogs_assert(build); - if (!OGS_SBI_NF_INSTANCE_GET(ausf_ue->nf_types, OpenAPI_nf_type_NRF)) - nrf = ogs_sbi_nf_types_associate( - ausf_ue->nf_types, OpenAPI_nf_type_NRF, ausf_nf_state_registered); - if (!OGS_SBI_NF_INSTANCE_GET(ausf_ue->nf_types, nf_type)) - nf = ogs_sbi_nf_types_associate( - ausf_ue->nf_types, nf_type, ausf_nf_state_registered); - - if (nrf == false && nf == false) { - ogs_error("[%s] Cannot discover UDM", ausf_ue->suci); + ausf_ue->sbi.nf_state_registered = ausf_nf_state_registered; + ausf_ue->sbi.client_wait.duration = + ausf_timer_cfg(AUSF_TIMER_SBI_CLIENT_WAIT)->duration; + if (ogs_sbi_discover_and_send( + nf_type, &ausf_ue->sbi, data, (ogs_sbi_build_f)build) != true) { ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_SERVICE_UNAVAILABLE, NULL, - "Cannot discover UDM", ausf_ue->suci); - - return NULL; + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, + "Cannot discover", ausf_ue->suci); } - - if (nf == false) { - ogs_warn("[%s] Try to discover UDM", ausf_ue->suci); - ogs_timer_start(ausf_ue->sbi_client_wait.timer, - ausf_timer_cfg(AUSF_TIMER_SBI_CLIENT_WAIT)->duration); - - ogs_nnrf_disc_send_nf_discover( - ausf_ue->nf_types[OpenAPI_nf_type_NRF].nf_instance, - nf_type, OpenAPI_nf_type_AUSF, ausf_ue); - - return NULL; - } - - return ausf_ue->nf_types[nf_type].nf_instance; -} - -void ausf_nudm_ueau_send_get( - ausf_ue_t *ausf_ue, ogs_sbi_nf_instance_t *nf_instance) -{ - ogs_sbi_session_t *session = NULL; - ogs_sbi_request_t *request = NULL; - ogs_sbi_client_t *client = NULL; - - ogs_assert(ausf_ue); - session = ausf_ue->session; - ogs_assert(session); - ogs_assert(nf_instance); - - client = ogs_sbi_client_find_by_service_name( - nf_instance, (char *)OGS_SBI_SERVICE_NAME_NUDM_UEAU); - ogs_assert(client); - - ogs_timer_start(ausf_ue->sbi_client_wait.timer, - ausf_timer_cfg(AUSF_TIMER_SBI_CLIENT_WAIT)->duration); - - request = ausf_nudm_ueau_build_get(ausf_ue); - ogs_assert(request); - ogs_sbi_client_send_request(client, request, ausf_ue); -} - -void ausf_nudm_ueau_discover_and_send_get(ausf_ue_t *ausf_ue) -{ - ogs_sbi_nf_instance_t *nf_instance = NULL; - - ogs_assert(ausf_ue); - - if (!nf_instance) - nf_instance = find_or_discover_nf_instance( - ausf_ue, OpenAPI_nf_type_UDM); - - if (!nf_instance) return; - - ausf_nudm_ueau_send_get(ausf_ue, nf_instance); -} - -void ausf_nudm_ueau_send_result_confirmation_inform( - ausf_ue_t *ausf_ue, ogs_sbi_nf_instance_t *nf_instance) -{ - ogs_sbi_session_t *session = NULL; - ogs_sbi_request_t *request = NULL; - ogs_sbi_client_t *client = NULL; - - ogs_assert(ausf_ue); - session = ausf_ue->session; - ogs_assert(session); - ogs_assert(nf_instance); - - client = ogs_sbi_client_find_by_service_name( - nf_instance, (char *)OGS_SBI_SERVICE_NAME_NUDM_UEAU); - ogs_assert(client); - - ogs_timer_start(ausf_ue->sbi_client_wait.timer, - ausf_timer_cfg(AUSF_TIMER_SBI_CLIENT_WAIT)->duration); - - request = ausf_nudm_ueau_build_result_confirmation_inform(ausf_ue); - ogs_assert(request); - ogs_sbi_client_send_request(client, request, ausf_ue); -} - -void ausf_nudm_ueau_discover_and_send_result_confirmation_inform( - ausf_ue_t *ausf_ue) -{ - ogs_sbi_nf_instance_t *nf_instance = NULL; - - ogs_assert(ausf_ue); - - if (!nf_instance) - nf_instance = find_or_discover_nf_instance( - ausf_ue, OpenAPI_nf_type_UDM); - - if (!nf_instance) return; - - ausf_nudm_ueau_send_result_confirmation_inform(ausf_ue, nf_instance); } diff --git a/src/ausf/sbi-path.h b/src/ausf/sbi-path.h index c43699267..a1e564ff7 100644 --- a/src/ausf/sbi-path.h +++ b/src/ausf/sbi-path.h @@ -31,14 +31,9 @@ void ausf_sbi_close(void); void ausf_sbi_setup_client_callback(ogs_sbi_nf_instance_t *nf_instance); -void ausf_nudm_ueau_send_get( - ausf_ue_t *ausf_ue, ogs_sbi_nf_instance_t *nf_instance); -void ausf_nudm_ueau_discover_and_send_get(ausf_ue_t *ausf_ue); - -void ausf_nudm_ueau_send_result_confirmation_inform( - ausf_ue_t *ausf_ue, ogs_sbi_nf_instance_t *nf_instance); -void ausf_nudm_ueau_discover_and_send_result_confirmation_inform( - ausf_ue_t *ausf_ue); +void ausf_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, ausf_ue_t *ausf_ue, void *data, + ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data)); #ifdef __cplusplus } diff --git a/src/ausf/timer.c b/src/ausf/timer.c index 5c6afff77..af904b3b1 100644 --- a/src/ausf/timer.c +++ b/src/ausf/timer.c @@ -23,7 +23,7 @@ static ausf_timer_cfg_t g_ausf_timer_cfg[MAX_NUM_OF_AUSF_TIMER] = { [AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] = { .duration = ogs_time_from_sec(3) }, [AUSF_TIMER_SBI_CLIENT_WAIT] = - { .duration = ogs_time_from_sec(2) }, + { .duration = ogs_time_from_msec(500) }, }; ausf_timer_cfg_t *ausf_timer_cfg(ausf_timer_e id) diff --git a/src/ausf/ue-sm.c b/src/ausf/ue-sm.c index 94c830a89..a1c43e27c 100644 --- a/src/ausf/ue-sm.c +++ b/src/ausf/ue-sm.c @@ -105,7 +105,7 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e) ogs_error("[%s] Invalid HTTP method [%s]", ausf_ue->suci, message->h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + OGS_SBI_HTTP_STATUS_FORBIDDEN, message, "Invalid HTTP method", message->h.method); END @@ -116,12 +116,12 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e) ogs_assert(message); ausf_ue = e->sbi.data; ogs_assert(ausf_ue); - session = ausf_ue->session; + session = ausf_ue->sbi.session; ogs_assert(session); SWITCH(message->h.service.name) CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU) - ogs_timer_stop(ausf_ue->sbi_client_wait.timer); + ogs_timer_stop(ausf_ue->sbi.client_wait.timer); if (message->res_status != OGS_SBI_HTTP_STATUS_OK && message->res_status != OGS_SBI_HTTP_STATUS_CREATED) { diff --git a/src/mme/emm-build.c b/src/mme/emm-build.c index 927ac75eb..2ce92dea5 100644 --- a/src/mme/emm-build.c +++ b/src/mme/emm-build.c @@ -290,7 +290,7 @@ ogs_pkbuf_t *emm_build_security_mode_command(mme_ue_t *mme_ue) security_mode_command->presencemask |= OGS_NAS_EPS_SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT; imeisv_request->type = OGS_NAS_IMEISV_TYPE; - imeisv_request->imeisv_request_value = OGS_NAS_IMEISV_REQUESTED; + imeisv_request->value = OGS_NAS_IMEISV_REQUESTED; if (mme_ue->selected_int_algorithm == OGS_NAS_SECURITY_ALGORITHMS_EIA0) { ogs_error("Encrypt[0x%x] can be skipped with EEA0, " diff --git a/src/mme/esm-build.c b/src/mme/esm-build.c index ae1ffe058..2dc14cd84 100644 --- a/src/mme/esm-build.c +++ b/src/mme/esm-build.c @@ -200,18 +200,18 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( if (pdn_address->pdn_type == OGS_GTP_PDN_TYPE_IPV4) { pdn_address->addr = pdn->paa.addr; - pdn_address->length = OGS_NAS_PDN_ADDRESS_IPV4_LEN; + pdn_address->length = OGS_NAS_PDU_ADDRESS_IPV4_LEN; ogs_debug(" IPv4"); } else if (pdn_address->pdn_type == OGS_GTP_PDN_TYPE_IPV6) { memcpy(pdn_address->addr6, pdn->paa.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); - pdn_address->length = OGS_NAS_PDN_ADDRESS_IPV6_LEN; + pdn_address->length = OGS_NAS_PDU_ADDRESS_IPV6_LEN; ogs_debug(" IPv6"); } else if (pdn_address->pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { pdn_address->both.addr = pdn->paa.both.addr; memcpy(pdn_address->both.addr6, pdn->paa.both.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); - pdn_address->length = OGS_NAS_PDN_ADDRESS_IPV4V6_LEN; + pdn_address->length = OGS_NAS_PDU_ADDRESS_IPV4V6_LEN; ogs_debug(" IPv4v6"); } else { ogs_error("Unexpected PDN Type %u", pdn_address->pdn_type); diff --git a/src/mme/s1ap-sm.c b/src/mme/s1ap-sm.c index a18a04f60..8a13a52fa 100644 --- a/src/mme/s1ap-sm.c +++ b/src/mme/s1ap-sm.c @@ -117,7 +117,7 @@ void s1ap_state_operational(ogs_fsm_t *s, mme_event_t *e) s1ap_handle_s1_reset(enb, pdu); break; default: - ogs_warn("Not implemented(choice:%d, proc:%d)", + ogs_error("Not implemented(choice:%d, proc:%d)", pdu->present, (int)initiatingMessage->procedureCode); break; } @@ -154,7 +154,7 @@ void s1ap_state_operational(ogs_fsm_t *s, mme_event_t *e) s1ap_handle_kill_response(enb, pdu); break; default: - ogs_warn("Not implemented(choice:%d, proc:%d)", + ogs_error("Not implemented(choice:%d, proc:%d)", pdu->present, (int)successfulOutcome->procedureCode); break; } @@ -174,13 +174,13 @@ void s1ap_state_operational(ogs_fsm_t *s, mme_event_t *e) s1ap_handle_handover_failure(enb, pdu); break; default: - ogs_warn("Not implemented(choice:%d, proc:%d)", + ogs_error("Not implemented(choice:%d, proc:%d)", pdu->present, (int)unsuccessfulOutcome->procedureCode); break; } break; default: - ogs_warn("Not implemented(choice:%d)", pdu->present); + ogs_error("Not implemented(choice:%d)", pdu->present); break; } diff --git a/src/nrf/nnrf-build.c b/src/nrf/nnrf-build.c index 70cb06cdb..957c3249b 100644 --- a/src/nrf/nnrf-build.c +++ b/src/nrf/nnrf-build.c @@ -39,7 +39,7 @@ ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify( memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; - message.h.url = subscription->notification_uri; + message.h.uri = subscription->notification_uri; message.http.accept = (char *)OGS_SBI_CONTENT_PROBLEM_TYPE; @@ -47,7 +47,7 @@ ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify( ogs_assert(NotificationData); NotificationData->event = event; - NotificationData->nf_instance_uri = message.h.url; + NotificationData->nf_instance_uri = message.h.uri; NFProfile = ogs_nnrf_nfm_build_nf_profile(nf_instance); ogs_assert(NFProfile); diff --git a/src/nrf/nnrf-handler.c b/src/nrf/nnrf-handler.c index ebe2210ad..19a7225cc 100644 --- a/src/nrf/nnrf-handler.c +++ b/src/nrf/nnrf-handler.c @@ -46,7 +46,7 @@ bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance, if (!handled) return false; if (OGS_FSM_CHECK(&nf_instance->sm, nrf_nf_state_will_register)) { - message->http.location = message->h.url; + message->http.location = message->h.uri; status = OGS_SBI_HTTP_STATUS_CREATED; } else if (OGS_FSM_CHECK(&nf_instance->sm, nrf_nf_state_registered)) { status = OGS_SBI_HTTP_STATUS_OK; @@ -199,7 +199,7 @@ bool nrf_nnrf_handle_nf_status_subscribe( ogs_time_from_sec(subscription->time.validity)); } - message->http.location = message->h.url; + message->http.location = message->h.uri; status = OGS_SBI_HTTP_STATUS_CREATED; response = ogs_sbi_build_response(message, status); @@ -348,13 +348,13 @@ bool nrf_nnrf_handle_nf_discover( ogs_assert(recvmsg); if (!recvmsg->param.target_nf_type) { - ogs_error("No target-nf-type [%s]", recvmsg->h.url); + ogs_error("No target-nf-type [%s]", recvmsg->h.uri); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, recvmsg, "No target-nf-type", NULL); return false; } if (!recvmsg->param.requester_nf_type) { - ogs_error("No requester-nf-type [%s]", recvmsg->h.url); + ogs_error("No requester-nf-type [%s]", recvmsg->h.uri); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, recvmsg, "No requester-nf-type", NULL); return false; diff --git a/src/nrf/nrf-sm.c b/src/nrf/nrf-sm.c index 6aff6c5ae..1aef80a7e 100644 --- a/src/nrf/nrf-sm.c +++ b/src/nrf/nrf-sm.c @@ -78,7 +78,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e) break; } - if (strcmp(message.h.api.version, OGS_SBI_API_VERSION) != 0) { + if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) { ogs_error("Not supported version [%s]", message.h.api.version); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Not supported version", NULL); @@ -158,7 +158,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e) ogs_error("Invalid HTTP method [%s]", message.h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &message, "Invalid HTTP method", message.h.method); END break; @@ -167,8 +167,8 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e) ogs_error("Invalid resource name [%s]", message.h.resource.component[0]); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, - "Unknown resource name", + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, + "Invalid resource name", message.h.resource.component[0]); END break; @@ -187,8 +187,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e) ogs_error("Invalid HTTP method [%s]", message.h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, - &message, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &message, "Invalid HTTP method", message.h.method); END @@ -198,8 +197,8 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e) ogs_error("Invalid resource name [%s]", message.h.resource.component[0]); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, - "Unknown resource name", + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, + "Invalid resource name", message.h.resource.component[0]); END break; @@ -207,7 +206,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e) DEFAULT ogs_error("Invalid API name [%s]", message.h.service.name); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Invalid API name", message.h.resource.component[0]); END diff --git a/src/nrf/sbi-path.c b/src/nrf/sbi-path.c index 5816ec0da..095fa75af 100644 --- a/src/nrf/sbi-path.c +++ b/src/nrf/sbi-path.c @@ -100,6 +100,7 @@ void nrf_nnrf_nfm_send_nf_status_notify(ogs_sbi_subscription_t *subscription, client, subscription, event, nf_instance); ogs_assert(request); ogs_sbi_client_send_request(client, request, client); + ogs_sbi_request_free(request); } void nrf_nnrf_nfm_send_nf_status_notify_all( diff --git a/src/pcrf/pcrf-rx-path.c b/src/pcrf/pcrf-rx-path.c index 49e69e341..cd5f8442f 100644 --- a/src/pcrf/pcrf-rx-path.c +++ b/src/pcrf/pcrf-rx-path.c @@ -159,7 +159,7 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, gx_sid = (os0_t)pcrf_sess_find_by_ipv4(hdr->avp_value->os.data); if (!gx_sid) { ogs_warn("Cannot find Gx Sesson for IPv4:%s", - INET_NTOP(hdr->avp_value->os.data, buf)); + OGS_INET_NTOP(hdr->avp_value->os.data, buf)); } } @@ -178,7 +178,7 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, gx_sid = (os0_t)pcrf_sess_find_by_ipv6(paa->addr6); if (!gx_sid) { ogs_warn("Cannot find Gx Sesson for IPv6:%s", - INET6_NTOP(hdr->avp_value->os.data, buf)); + OGS_INET6_NTOP(hdr->avp_value->os.data, buf)); } } } diff --git a/src/pgw/pgw-context.c b/src/pgw/pgw-context.c index a0f193a46..3d5c9f841 100644 --- a/src/pgw/pgw-context.c +++ b/src/pgw/pgw-context.c @@ -841,8 +841,8 @@ pgw_sess_t *pgw_sess_add( ogs_info("UE IMSI:[%s] APN:[%s] IPv4:[%s] IPv6:[%s]", sess->imsi_bcd, apn, - sess->ipv4 ? INET_NTOP(&sess->ipv4->addr, buf1) : "", - sess->ipv6 ? INET6_NTOP(&sess->ipv6->addr, buf2) : ""); + sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", + sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); /* Generate Hash Key : IMSI + APN */ sess_hash_keygen(sess->hash_keybuf, &sess->hash_keylen, diff --git a/src/pgw/pgw-ipfw.c b/src/pgw/pgw-ipfw.c index e13e271c7..caa48310f 100644 --- a/src/pgw/pgw-ipfw.c +++ b/src/pgw/pgw-ipfw.c @@ -291,10 +291,10 @@ pgw_bearer_t *pgw_bearer_find_by_packet(ogs_pkbuf_t *pkt) if (ip_h && sess->ipv4) ogs_debug("[PGW] PAA IPv4:%s", - INET_NTOP(&sess->ipv4->addr, buf)); + OGS_INET_NTOP(&sess->ipv4->addr, buf)); if (ip6_h && sess->ipv6) ogs_debug("[PGW] PAA IPv6:%s", - INET6_NTOP(&sess->ipv6->addr, buf)); + OGS_INET6_NTOP(&sess->ipv6->addr, buf)); /* Save the default bearer */ default_bearer = pgw_default_bearer_in_sess(sess); diff --git a/src/smf/context.c b/src/smf/context.c index 073864bc5..893246cc9 100644 --- a/src/smf/context.c +++ b/src/smf/context.c @@ -23,6 +23,7 @@ static smf_context_t self; static ogs_diam_config_t g_diam_conf; int __smf_log_domain; +int __gsm_log_domain; static OGS_POOL(smf_sess_pool, smf_sess_t); static OGS_POOL(smf_bearer_pool, smf_bearer_t); @@ -31,19 +32,6 @@ static OGS_POOL(smf_pf_pool, smf_pf_t); static int context_initialized = 0; -int num_sessions = 0; -void stats_add_session(void) { - num_sessions = num_sessions + 1; - ogs_info("Added a session. Number of active sessions is now %d", - num_sessions); -} - -void stats_remove_session(void) { - num_sessions = num_sessions - 1; - ogs_info("Removed a session. Number of active sessions is now %d", - num_sessions); -} - void smf_context_init(void) { ogs_assert(context_initialized == 0); @@ -55,9 +43,12 @@ void smf_context_init(void) memset(&self, 0, sizeof(smf_context_t)); self.diam_config = &g_diam_conf; + ogs_log_install_domain(&__ogs_ngap_domain, "ngap", ogs_core()->log.level); + ogs_log_install_domain(&__ogs_nas_domain, "nas", ogs_core()->log.level); ogs_log_install_domain(&__ogs_gtp_domain, "gtp", ogs_core()->log.level); ogs_log_install_domain(&__ogs_diam_domain, "diam", ogs_core()->log.level); ogs_log_install_domain(&__smf_log_domain, "smf", ogs_core()->log.level); + ogs_log_install_domain(&__gsm_log_domain, "gsm", ogs_core()->log.level); ogs_gtp_node_init(512); @@ -73,7 +64,8 @@ void smf_context_init(void) ogs_pool_init(&smf_pf_pool, ogs_config()->pool.pf); - self.sess_hash = ogs_hash_make(); + self.imsi_apn_hash = ogs_hash_make(); + self.supi_psi_hash = ogs_hash_make(); self.ipv4_hash = ogs_hash_make(); self.ipv6_hash = ogs_hash_make(); @@ -86,8 +78,10 @@ void smf_context_final(void) smf_sess_remove_all(); - ogs_assert(self.sess_hash); - ogs_hash_destroy(self.sess_hash); + ogs_assert(self.imsi_apn_hash); + ogs_hash_destroy(self.imsi_apn_hash); + ogs_assert(self.supi_psi_hash); + ogs_hash_destroy(self.supi_psi_hash); ogs_assert(self.ipv4_hash); ogs_hash_destroy(self.ipv4_hash); ogs_assert(self.ipv6_hash); @@ -516,7 +510,7 @@ int smf_context_parse_config(void) return OGS_OK; } -static void *sess_hash_keygen(uint8_t *out, int *out_len, +static void *imsi_apn_keygen(uint8_t *out, int *out_len, uint8_t *imsi, int imsi_len, char *apn) { memcpy(out, imsi, imsi_len); @@ -526,10 +520,20 @@ static void *sess_hash_keygen(uint8_t *out, int *out_len, return out; } -smf_sess_t *smf_sess_add( +static char *supi_psi_keygen(char *supi, uint8_t psi) +{ + ogs_assert(supi); + ogs_assert(psi != OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED); + + return ogs_mstrcatf(supi, "%03d", psi); +} + +smf_sess_t *smf_sess_add_by_imsi_apn( uint8_t *imsi, int imsi_len, char *apn, uint8_t pdn_type, uint8_t ebi, ogs_paa_t *paa) { + smf_event_t e; + char buf1[OGS_ADDRSTRLEN]; char buf2[OGS_ADDRSTRLEN]; smf_sess_t *sess = NULL; @@ -606,13 +610,14 @@ smf_sess_t *smf_sess_add( ogs_info("UE IMSI:[%s] APN:[%s] IPv4:[%s] IPv6:[%s]", sess->imsi_bcd, apn, - sess->ipv4 ? INET_NTOP(&sess->ipv4->addr, buf1) : "", - sess->ipv6 ? INET6_NTOP(&sess->ipv6->addr, buf2) : ""); + sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", + sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); /* Generate Hash Key : IMSI + APN */ - sess_hash_keygen(sess->hash_keybuf, &sess->hash_keylen, + imsi_apn_keygen(sess->imsi_apn_keybuf, &sess->imsi_apn_keylen, imsi, imsi_len, apn); - ogs_hash_set(self.sess_hash, sess->hash_keybuf, sess->hash_keylen, sess); + ogs_hash_set(self.imsi_apn_hash, + sess->imsi_apn_keybuf, sess->imsi_apn_keylen, sess); /* Select UPF with round-robin manner */ if (ogs_pfcp_self()->node == NULL) @@ -639,99 +644,20 @@ smf_sess_t *smf_sess_add( ogs_list_for_each(&bearer->pfcp.pdr_list, pdr) pdr->precedence = 0xffffffff; + /* Setup SBI */ + sess->sbi.client_wait.timer = ogs_timer_add( + self.timer_mgr, smf_timer_sbi_client_wait_expire, sess); + + e.sess = sess; + ogs_fsm_create(&sess->sm, smf_gsm_state_initial, smf_gsm_state_final); + ogs_fsm_init(&sess->sm, &e); + ogs_list_add(&self.sess_list, sess); - - stats_add_session(); return sess; } -int smf_sess_remove(smf_sess_t *sess) -{ - int i; - - ogs_assert(sess); - - ogs_list_remove(&self.sess_list, sess); - - OGS_TLV_CLEAR_DATA(&sess->ue_pco); - OGS_TLV_CLEAR_DATA(&sess->user_location_information); - OGS_TLV_CLEAR_DATA(&sess->ue_timezone); - - for (i = 0; i < sess->num_of_pcc_rule; i++) - OGS_PCC_RULE_FREE(&sess->pcc_rule[i]); - sess->num_of_pcc_rule = 0; - - ogs_hash_set(self.sess_hash, sess->hash_keybuf, sess->hash_keylen, NULL); - - if (sess->ipv4) { - ogs_hash_set(self.ipv4_hash, sess->ipv4->addr, OGS_IPV4_LEN, NULL); - ogs_pfcp_ue_ip_free(sess->ipv4); - } - if (sess->ipv6) { - ogs_hash_set(self.ipv6_hash, sess->ipv6->addr, OGS_IPV6_LEN, NULL); - ogs_pfcp_ue_ip_free(sess->ipv6); - } - - smf_bearer_remove_all(sess); - - ogs_pool_free(&smf_sess_pool, sess); - - stats_remove_session(); - - return OGS_OK; -} - -void smf_sess_remove_all(void) -{ - smf_sess_t *sess = NULL, *next = NULL;; - - ogs_list_for_each_safe(&self.sess_list, next, sess) - smf_sess_remove(sess); -} - -smf_sess_t *smf_sess_find(uint32_t index) -{ - ogs_assert(index); - return ogs_pool_find(&smf_sess_pool, index); -} - -smf_sess_t *smf_sess_find_by_teid(uint32_t teid) -{ - return smf_sess_find(teid); -} - -smf_sess_t *smf_sess_find_by_seid(uint64_t seid) -{ - return smf_sess_find(seid); -} - -smf_sess_t *smf_sess_find_by_imsi_apn( - uint8_t *imsi, int imsi_len, char *apn) -{ - uint8_t keybuf[OGS_MAX_IMSI_LEN+OGS_MAX_APN_LEN+1]; - int keylen = 0; - - ogs_assert(self.sess_hash); - - sess_hash_keygen(keybuf, &keylen, imsi, imsi_len, apn); - return (smf_sess_t *)ogs_hash_get(self.sess_hash, keybuf, keylen); -} - -smf_sess_t *smf_sess_find_by_ipv4(uint32_t addr) -{ - ogs_assert(self.ipv4_hash); - return (smf_sess_t *)ogs_hash_get(self.ipv4_hash, &addr, OGS_IPV4_LEN); -} - -smf_sess_t *smf_sess_find_by_ipv6(uint32_t *addr6) -{ - ogs_assert(self.ipv6_hash); - ogs_assert(addr6); - return (smf_sess_t *)ogs_hash_get(self.ipv6_hash, addr6, OGS_IPV6_LEN); -} - -smf_sess_t *smf_sess_add_by_message(ogs_gtp_message_t *message) +smf_sess_t *smf_sess_add_by_gtp_message(ogs_gtp_message_t *message) { smf_sess_t *sess = NULL; ogs_paa_t *paa = NULL; @@ -798,12 +724,303 @@ smf_sess_t *smf_sess_add_by_message(ogs_gtp_message_t *message) sess->imsi_bcd, sess->pdn.apn); smf_sess_remove(sess); } - sess = smf_sess_add(req->imsi.data, req->imsi.len, apn, + sess = smf_sess_add_by_imsi_apn(req->imsi.data, req->imsi.len, apn, req->pdn_type.u8, req->bearer_contexts_to_be_created.eps_bearer_id.u8, paa); return sess; } +void smf_sess_set_ue_ip(smf_sess_t *sess) +{ + char buf1[OGS_ADDRSTRLEN]; + char buf2[OGS_ADDRSTRLEN]; + ogs_pfcp_subnet_t *subnet6 = NULL; + + ogs_assert(sess); + + sess->pdn.paa.pdn_type = sess->pdn.pdn_type; + ogs_assert(sess->pdn.pdn_type); + + if (sess->pdn.pdn_type == OGS_PDU_SESSION_TYPE_IPV4) { + sess->ipv4 = ogs_pfcp_ue_ip_alloc( + AF_INET, sess->pdn.apn, (uint8_t *)&sess->pdn.ue_ip.addr); + ogs_assert(sess->ipv4); + sess->pdn.paa.addr = sess->ipv4->addr[0]; + ogs_hash_set(self.ipv4_hash, sess->ipv4->addr, OGS_IPV4_LEN, sess); + } else if (sess->pdn.pdn_type == OGS_PDU_SESSION_TYPE_IPV6) { + sess->ipv6 = ogs_pfcp_ue_ip_alloc( + AF_INET6, sess->pdn.apn, sess->pdn.ue_ip.addr6); + ogs_assert(sess->ipv6); + + subnet6 = sess->ipv6->subnet; + ogs_assert(subnet6); + + sess->pdn.paa.len = subnet6->prefixlen; + memcpy(sess->pdn.paa.addr6, sess->ipv6->addr, OGS_IPV6_LEN); + ogs_hash_set(self.ipv6_hash, sess->ipv6->addr, OGS_IPV6_LEN, sess); + } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + sess->ipv4 = ogs_pfcp_ue_ip_alloc( + AF_INET, sess->pdn.apn, (uint8_t *)&sess->pdn.ue_ip.addr); + ogs_assert(sess->ipv4); + sess->ipv6 = ogs_pfcp_ue_ip_alloc( + AF_INET6, sess->pdn.apn, sess->pdn.ue_ip.addr6); + ogs_assert(sess->ipv6); + + subnet6 = sess->ipv6->subnet; + ogs_assert(subnet6); + + sess->pdn.paa.both.addr = sess->ipv4->addr[0]; + sess->pdn.paa.both.len = subnet6->prefixlen; + memcpy(sess->pdn.paa.both.addr6, sess->ipv6->addr, OGS_IPV6_LEN); + ogs_hash_set(self.ipv4_hash, sess->ipv4->addr, OGS_IPV4_LEN, sess); + ogs_hash_set(self.ipv6_hash, sess->ipv6->addr, OGS_IPV6_LEN, sess); + } else + ogs_assert_if_reached(); + + ogs_info("UE SUPI:[%s] DNN:[%s] IPv4:[%s] IPv6:[%s]", + sess->supi, sess->pdn.apn, + sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", + sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); +} + +smf_sess_t *smf_sess_add_by_supi_psi(char *supi, uint8_t psi) +{ + smf_event_t e; + + smf_sess_t *sess = NULL; + smf_bearer_t *bearer = NULL; + ogs_pfcp_pdr_t *pdr = NULL; + + ogs_assert(supi); + ogs_assert(psi != OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED); + + ogs_pool_alloc(&smf_sess_pool, &sess); + if (!sess) { + ogs_error("Maximum number of session[%d] reached", + ogs_config()->pool.sess); + return NULL; + } + memset(sess, 0, sizeof *sess); + + sess->index = ogs_pool_index(&smf_sess_pool, sess); + ogs_assert(sess->index > 0 && sess->index <= ogs_config()->pool.sess); + + sess->sm_context_ref = ogs_msprintf("%d", + (int)ogs_pool_index(&smf_sess_pool, sess)); + ogs_assert(sess->sm_context_ref); + + /* Set TEID & SEID */ + sess->smf_n4_teid = sess->index; + sess->smf_n4_seid = sess->index; + + /* Set SUPI & PSI */ + sess->supi = ogs_strdup(supi); + ogs_assert(sess->supi); + sess->psi = psi; + + sess->supi_psi_keybuf = supi_psi_keygen(supi, psi); + ogs_assert(sess->supi_psi_keybuf); + ogs_hash_set(self.supi_psi_hash, + sess->supi_psi_keybuf, strlen(sess->supi_psi_keybuf), sess); + + /* Select UPF with round-robin manner */ + if (ogs_pfcp_self()->node == NULL) + ogs_pfcp_self()->node = ogs_list_first(&ogs_pfcp_self()->n4_list); + + for (; ogs_pfcp_self()->node; + ogs_pfcp_self()->node = ogs_list_next(ogs_pfcp_self()->node)) { + if (OGS_FSM_CHECK( + &ogs_pfcp_self()->node->sm, smf_pfcp_state_associated)) { + OGS_SETUP_PFCP_NODE(sess, ogs_pfcp_self()->node); + break; + } + } + + /* Set Default Bearer */ + ogs_list_init(&sess->bearer_list); + + bearer = smf_bearer_add(sess); + ogs_assert(bearer); + + /* Default PDRs is set to lowest precedence(highest precedence value). */ + ogs_list_for_each(&bearer->pfcp.pdr_list, pdr) + pdr->precedence = 0xffffffff; + + /* Setup SBI */ + sess->sbi.client_wait.timer = ogs_timer_add( + self.timer_mgr, smf_timer_sbi_client_wait_expire, sess); + + e.sess = sess; + ogs_fsm_create(&sess->sm, smf_gsm_state_initial, smf_gsm_state_final); + ogs_fsm_init(&sess->sm, &e); + + ogs_list_add(&self.sess_list, sess); + + return sess; +} + +smf_sess_t *smf_sess_add_by_sbi_message(ogs_sbi_message_t *message) +{ + smf_sess_t *sess = NULL; + + OpenAPI_sm_context_create_data_t *SmContextCreateData = NULL; + + ogs_assert(message); + SmContextCreateData = message->SmContextCreateData; + ogs_assert(SmContextCreateData); + + if (!SmContextCreateData->supi) { + ogs_error("No SUPI"); + return NULL; + } + + if (SmContextCreateData->pdu_session_id == + OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) { + ogs_error("PDU session identitiy is unassigned"); + return NULL; + } + + sess = smf_sess_find_by_supi_psi( + SmContextCreateData->supi, SmContextCreateData->pdu_session_id); + if (sess) { + ogs_warn("OLD Session Release [SUPI:%s,PDU Session identity:%d]", + SmContextCreateData->supi, SmContextCreateData->pdu_session_id); + smf_sess_remove(sess); + } + + sess = smf_sess_add_by_supi_psi( + SmContextCreateData->supi, SmContextCreateData->pdu_session_id); + + return sess; +} + +int smf_sess_remove(smf_sess_t *sess) +{ + int i; + smf_event_t e; + + ogs_assert(sess); + + ogs_list_remove(&self.sess_list, sess); + + e.sess = sess; + ogs_fsm_fini(&sess->sm, &e); + ogs_fsm_delete(&sess->sm); + + OGS_TLV_CLEAR_DATA(&sess->ue_pco); + OGS_TLV_CLEAR_DATA(&sess->user_location_information); + OGS_TLV_CLEAR_DATA(&sess->ue_timezone); + + for (i = 0; i < sess->num_of_pcc_rule; i++) + OGS_PCC_RULE_FREE(&sess->pcc_rule[i]); + sess->num_of_pcc_rule = 0; + + ogs_hash_set(self.imsi_apn_hash, + sess->imsi_apn_keybuf, sess->imsi_apn_keylen, NULL); + + if (sess->ipv4) { + ogs_hash_set(self.ipv4_hash, sess->ipv4->addr, OGS_IPV4_LEN, NULL); + ogs_pfcp_ue_ip_free(sess->ipv4); + } + if (sess->ipv6) { + ogs_hash_set(self.ipv6_hash, sess->ipv6->addr, OGS_IPV6_LEN, NULL); + ogs_pfcp_ue_ip_free(sess->ipv6); + } + + if (sess->sm_context_ref) + ogs_free(sess->sm_context_ref); + + if (sess->supi_psi_keybuf) + ogs_free(sess->supi_psi_keybuf); + if (sess->supi) + ogs_free(sess->supi); + if (sess->dnn) + ogs_free(sess->dnn); + + /* Free SBI object memory */ + ogs_sbi_object_free(&sess->sbi); + ogs_timer_delete(sess->sbi.client_wait.timer); + + smf_bearer_remove_all(sess); + + ogs_pool_free(&smf_sess_pool, sess); + + return OGS_OK; +} + +void smf_sess_remove_all(void) +{ + smf_sess_t *sess = NULL, *next = NULL;; + + ogs_list_for_each_safe(&self.sess_list, next, sess) + smf_sess_remove(sess); +} + +smf_sess_t *smf_sess_find(uint32_t index) +{ + ogs_assert(index); + return ogs_pool_find(&smf_sess_pool, index); +} + +smf_sess_t *smf_sess_find_by_teid(uint32_t teid) +{ + return smf_sess_find(teid); +} + +smf_sess_t *smf_sess_find_by_seid(uint64_t seid) +{ + return smf_sess_find(seid); +} + +smf_sess_t *smf_sess_find_by_imsi_apn( + uint8_t *imsi, int imsi_len, char *apn) +{ + uint8_t keybuf[OGS_MAX_IMSI_LEN+OGS_MAX_APN_LEN+1]; + int keylen = 0; + + ogs_assert(self.imsi_apn_hash); + + imsi_apn_keygen(keybuf, &keylen, imsi, imsi_len, apn); + return (smf_sess_t *)ogs_hash_get(self.imsi_apn_hash, keybuf, keylen); +} + +smf_sess_t *smf_sess_find_by_supi_psi(char *supi, uint8_t psi) +{ + smf_sess_t *sess = NULL; + char *keybuf = NULL; + + ogs_assert(supi); + ogs_assert(psi != OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED); + + keybuf = supi_psi_keygen(supi, psi); + ogs_assert(keybuf); + + sess = (smf_sess_t *)ogs_hash_get(self.supi_psi_hash, + keybuf, strlen(keybuf)); + ogs_free(keybuf); + + return sess; +} + +smf_sess_t *smf_sess_find_by_sm_context_ref(char *sm_context_ref) +{ + ogs_assert(sm_context_ref); + return smf_sess_find(atoll(sm_context_ref)); +} + +smf_sess_t *smf_sess_find_by_ipv4(uint32_t addr) +{ + ogs_assert(self.ipv4_hash); + return (smf_sess_t *)ogs_hash_get(self.ipv4_hash, &addr, OGS_IPV4_LEN); +} + +smf_sess_t *smf_sess_find_by_ipv6(uint32_t *addr6) +{ + ogs_assert(self.ipv6_hash); + ogs_assert(addr6); + return (smf_sess_t *)ogs_hash_get(self.ipv6_hash, addr6, OGS_IPV6_LEN); +} + smf_bearer_t *smf_bearer_add(smf_sess_t *sess) { smf_bearer_t *bearer = NULL; diff --git a/src/smf/context.h b/src/smf/context.h index ffd4158a3..27c564504 100644 --- a/src/smf/context.h +++ b/src/smf/context.h @@ -31,6 +31,8 @@ #include "ogs-pfcp.h" #include "ogs-sbi.h" #include "ogs-app.h" +#include "ogs-ngap.h" +#include "ogs-nas-5gs.h" #include "ipfw/ogs-ipfw.h" #include "timer.h" @@ -41,6 +43,7 @@ extern "C" { #endif extern int __smf_log_domain; +extern int __gsm_log_domain; #undef OGS_LOG_DOMAIN #define OGS_LOG_DOMAIN __smf_log_domain @@ -81,36 +84,23 @@ typedef struct smf_context_s { ogs_list_t sgw_s5c_list; /* SGW GTPC Node List */ ogs_list_t ip_pool_list; - ogs_hash_t *sess_hash; /* hash table (IMSI+APN) */ + ogs_hash_t *imsi_apn_hash; /* hash table (IMSI+APN) */ + ogs_hash_t *supi_psi_hash; /* hash table (SUPI+PSI) */ ogs_hash_t *ipv4_hash; /* hash table (IPv4 Address) */ ogs_hash_t *ipv6_hash; /* hash table (IPv6 Address) */ uint16_t mtu; /* MTU to advertise in PCO */ ogs_list_t sess_list; - -#define SMF_NF_INSTANCE_CLEAR(_cAUSE, _nFInstance) \ - do { \ - ogs_assert(_nFInstance); \ - if ((_nFInstance)->reference_count == 1) { \ - ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \ - smf_nf_fsm_fini((_nFInstance)); \ - } else { \ - /* There is an assocation with other context */ \ - ogs_info("[%s:%d] (%s) NF suspended", \ - _nFInstance->id, _nFInstance->reference_count, (_cAUSE)); \ - OGS_FSM_TRAN(&_nFInstance->sm, smf_nf_state_de_registered); \ - ogs_fsm_dispatch(&_nFInstance->sm, NULL); \ - } \ - ogs_sbi_nf_instance_remove(_nFInstance); \ - } while(0) } smf_context_t; typedef struct smf_sess_s { - ogs_lnode_t lnode; + ogs_sbi_object_t sbi; uint32_t index; /**< An index of this node */ + ogs_fsm_t sm; /* A state machine */ uint32_t smf_n4_teid; /* SMF-N4-TEID is derived from INDEX */ +#define SMF_5GC_SESS(__sESS) ((__sESS)->sgw_s5c_teid == 0) uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is received from SGW */ uint64_t smf_n4_seid; /* SMF SEID is dervied from INDEX */ @@ -129,14 +119,40 @@ typedef struct smf_sess_s { int imsi_len; char imsi_bcd[OGS_MAX_IMSI_BCD_LEN+1]; - /* APN Configuration */ - ogs_pdn_t pdn; + uint8_t imsi_apn_keybuf[OGS_MAX_IMSI_LEN+OGS_MAX_APN_LEN+1]; + int imsi_apn_keylen; + + /* SUPI */ + char *sm_context_ref; + char *supi; + uint8_t psi; /* PDU session identity */ + char *supi_psi_keybuf; + + /* Procedure transaction identity */ + uint8_t pti; + + /* PLMN ID & NID */ + ogs_plmn_id_t plmn_id; + char *nid; + + /* S_NSSAI & DNN */ + ogs_s_nssai_t s_nssai; + char *dnn; + + /* Integrity protection maximum data rate */ + struct { + uint8_t mbr_dl; + uint8_t mbr_ul; + } integrity_protection; + + /* PDN Configuration */ + ogs_pdn_t pdn; + uint8_t ue_pdu_session_type; + uint8_t ue_ssc_mode; + ogs_pfcp_ue_ip_t *ipv4; ogs_pfcp_ue_ip_t *ipv6; - uint8_t hash_keybuf[OGS_MAX_IMSI_LEN+OGS_MAX_APN_LEN+1]; - int hash_keylen; - ogs_tlv_octet_t ue_pco; /* Saved from S5-C */ ogs_tlv_octet_t user_location_information; /* Saved from S5-C */ ogs_tlv_octet_t ue_timezone; /* Saved from S5-C */ @@ -149,6 +165,22 @@ typedef struct smf_sess_s { /* Related Context */ ogs_gtp_node_t *gnode; ogs_pfcp_node_t *pfcp_node; + +#define SMF_NF_INSTANCE_CLEAR(_cAUSE, _nFInstance) \ + do { \ + ogs_assert(_nFInstance); \ + if ((_nFInstance)->reference_count == 1) { \ + ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \ + smf_nf_fsm_fini((_nFInstance)); \ + } else { \ + /* There is an assocation with other context */ \ + ogs_info("[%s:%d] (%s) NF suspended", \ + _nFInstance->id, _nFInstance->reference_count, (_cAUSE)); \ + OGS_FSM_TRAN(&_nFInstance->sm, smf_nf_state_de_registered); \ + ogs_fsm_dispatch(&_nFInstance->sm, NULL); \ + } \ + ogs_sbi_nf_instance_remove(_nFInstance); \ + } while(0) } smf_sess_t; #define SMF_BEARER(pfcp_sess) ogs_container_of(pfcp_sess, smf_bearer_t, pfcp) @@ -187,6 +219,7 @@ typedef struct smf_bearer_s { bool tft_updated; bool qos_updated; bool removed; + bool outer_header_creation_updated; } state; smf_sess_t *sess; @@ -209,18 +242,23 @@ smf_context_t *smf_self(void); int smf_context_parse_config(void); -smf_sess_t *smf_sess_add_by_message(ogs_gtp_message_t *message); - -smf_sess_t *smf_sess_add( +smf_sess_t *smf_sess_add_by_gtp_message(ogs_gtp_message_t *message); +smf_sess_t *smf_sess_add_by_imsi_apn( uint8_t *imsi, int imsi_len, char *apn, uint8_t pdn_type, uint8_t ebi, ogs_paa_t *addr); +smf_sess_t *smf_sess_add_by_sbi_message(ogs_sbi_message_t *message); +smf_sess_t *smf_sess_add_by_supi_psi(char *supi, uint8_t psi); +void smf_sess_set_ue_ip(smf_sess_t *sess); + int smf_sess_remove(smf_sess_t *sess); void smf_sess_remove_all(void); smf_sess_t *smf_sess_find(uint32_t index); smf_sess_t *smf_sess_find_by_teid(uint32_t teid); smf_sess_t *smf_sess_find_by_seid(uint64_t seid); smf_sess_t *smf_sess_find_by_imsi_apn(uint8_t *imsi, int imsi_len, char *apn); +smf_sess_t *smf_sess_find_by_supi_psi(char *supi, uint8_t psi); +smf_sess_t *smf_sess_find_by_sm_context_ref(char *sm_context_ref); smf_sess_t *smf_sess_find_by_ipv4(uint32_t addr); smf_sess_t *smf_sess_find_by_ipv6(uint32_t *addr6); diff --git a/src/smf/event.c b/src/smf/event.c index 14c2701e1..51154e36c 100644 --- a/src/smf/event.c +++ b/src/smf/event.c @@ -95,6 +95,16 @@ const char *smf_event_get_name(smf_event_t *e) case SMF_EVT_SBI_TIMER: return "SMF_EVT_SBI_TIMER"; + case SMF_EVT_NGAP_MESSAGE: + return "SMF_EVT_NGAP_MESSAGE"; + case SMF_EVT_NGAP_TIMER: + return "SMF_EVT_NGAP_TIMER"; + + case SMF_EVT_5GSM_MESSAGE: + return "SMF_EVT_5GSM_MESSAGE"; + case SMF_EVT_5GSM_TIMER: + return "SMF_EVT_5GSM_TIMER"; + default: break; } diff --git a/src/smf/event.h b/src/smf/event.h index 2cc59babc..2f89cdf73 100644 --- a/src/smf/event.h +++ b/src/smf/event.h @@ -39,6 +39,9 @@ typedef struct ogs_sbi_request_s ogs_sbi_request_t; typedef struct ogs_sbi_response_s ogs_sbi_response_t; typedef struct ogs_sbi_message_s ogs_sbi_message_t; typedef struct ogs_sbi_subscription_s ogs_sbi_subscription_t; +typedef struct ogs_nas_5gs_message_s ogs_nas_5gs_message_t; +typedef struct NGAP_NGAP_PDU ogs_ngap_message_t; +typedef long NGAP_ProcedureCode_t; typedef enum { SMF_EVT_BASE = OGS_FSM_USER_SIG, @@ -54,6 +57,12 @@ typedef enum { SMF_EVT_SBI_CLIENT, SMF_EVT_SBI_TIMER, + SMF_EVT_NGAP_MESSAGE, + SMF_EVT_NGAP_TIMER, + + SMF_EVT_5GSM_MESSAGE, + SMF_EVT_5GSM_TIMER, + SMF_EVT_TOP, } smf_event_e; @@ -83,6 +92,16 @@ typedef struct smf_event_s { ogs_sbi_message_t *message; } sbi; + struct { + int type; + ogs_ngap_message_t *message; + } ngap; + + struct { + uint8_t type; + ogs_nas_5gs_message_t *message; + } nas; + smf_sess_t *sess; } smf_event_t; diff --git a/src/smf/gsm-build.c b/src/smf/gsm-build.c new file mode 100644 index 000000000..5f9e18623 --- /dev/null +++ b/src/smf/gsm-build.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "gsm-build.h" + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __gsm_log_domain + +ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess) +{ + ogs_pkbuf_t *pkbuf = NULL; + ogs_nas_5gs_message_t message; + ogs_nas_5gs_pdu_session_establishment_accept_t * + pdu_session_establishment_accept = + &message.gsm.pdu_session_establishment_accept; + + ogs_nas_pdu_session_type_t *selected_pdu_session_type = NULL; + ogs_nas_qos_rules_t *authorized_qos_rules = NULL; + ogs_nas_session_ambr_t *session_ambr = NULL; + ogs_nas_pdu_address_t *pdu_address = NULL; + + ogs_nas_qos_rule_t qos_rule[OGS_NAS_MAX_NUM_OF_QOS_RULE]; + + selected_pdu_session_type = &pdu_session_establishment_accept-> + selected_pdu_session_type; + ogs_assert(selected_pdu_session_type); + authorized_qos_rules = &pdu_session_establishment_accept-> + authorized_qos_rules; + ogs_assert(authorized_qos_rules); + session_ambr = &pdu_session_establishment_accept->session_ambr; + ogs_assert(session_ambr); + pdu_address = &pdu_session_establishment_accept->pdu_address; + ogs_assert(pdu_address); + + memset(&message, 0, sizeof(message)); + message.gsm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM; + message.gsm.h.pdu_session_identity = sess->psi; + message.gsm.h.procedure_transaction_identity = sess->pti; + message.gsm.h.message_type = OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT; + + selected_pdu_session_type->type = sess->pdn.ssc_mode; + selected_pdu_session_type->value = sess->pdn.pdn_type; + + /* Default QoS Rule */ + memset(qos_rule, 0, sizeof(qos_rule)); + qos_rule[0].identifier = 1; + qos_rule[0].length = 6; + qos_rule[0].code = OGS_NAS_QOS_CODE_CREATE_NEW_QOS_RULE; + qos_rule[0].DQR_bit = 1; + qos_rule[0].num_of_packet_filter = 1; + qos_rule[0].pf[0].direction = OGS_NAS_QOS_DIRECTION_UPLINK; + qos_rule[0].pf[0].pf_identifier = 1; + qos_rule[0].pf[0].length = 1; + qos_rule[0].pf[0].num_of_component = 1; + qos_rule[0].pf[0].component[0].type = OGS_PACKET_FILTER_MATCH_ALL; + qos_rule[0].precedence = 1; /* lowest precedence */ + qos_rule[0].flow.segregation = 0; + qos_rule[0].flow.identifier = 1; + + ogs_nas_build_qos_rules(authorized_qos_rules, qos_rule, 1); + + /* Session-AMBR */ + session_ambr->length = 6; + ogs_nas_bitrate_from_uint64( + &session_ambr->downlink, sess->pdn.ambr.downlink); + ogs_nas_bitrate_from_uint64( + &session_ambr->uplink, sess->pdn.ambr.uplink); + + /* PDU Address */ + pdu_session_establishment_accept->presencemask |= + OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_PRESENT; + pdu_address->pdn_type = sess->pdn.paa.pdn_type; + + if (pdu_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV4) { + pdu_address->addr = sess->pdn.paa.addr; + pdu_address->length = OGS_NAS_PDU_ADDRESS_IPV4_LEN; + } else if (pdu_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV6) { + memcpy(pdu_address->addr6, + sess->pdn.paa.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); + pdu_address->length = OGS_NAS_PDU_ADDRESS_IPV6_LEN; + } else if (pdu_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV4V6) { + pdu_address->both.addr = sess->pdn.paa.both.addr; + memcpy(pdu_address->both.addr6, + sess->pdn.paa.both.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); + pdu_address->length = OGS_NAS_PDU_ADDRESS_IPV4V6_LEN; + } else { + ogs_error("Unexpected PDN Type %u", pdu_address->pdn_type); + return NULL; + } + + pkbuf = ogs_nas_5gs_plain_encode(&message); + ogs_assert(pkbuf); + + ogs_free(authorized_qos_rules->buffer); + + return pkbuf; +} + +ogs_pkbuf_t *gsm_build_pdu_session_establishment_reject( + smf_sess_t *sess, ogs_nas_5gsm_cause_t gsm_cause) +{ + ogs_nas_5gs_message_t message; + ogs_nas_5gs_pdu_session_establishment_reject_t * + pdu_session_establishment_reject = + &message.gsm.pdu_session_establishment_reject; + + memset(&message, 0, sizeof(message)); + message.gsm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM; + message.gsm.h.pdu_session_identity = sess->psi; + message.gsm.h.procedure_transaction_identity = sess->pti; + message.gsm.h.message_type = OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REJECT; + + pdu_session_establishment_reject->gsm_cause = gsm_cause; + + return ogs_nas_5gs_plain_encode(&message); +} diff --git a/src/smf/gsm-build.h b/src/smf/gsm-build.h new file mode 100644 index 000000000..df36ab90e --- /dev/null +++ b/src/smf/gsm-build.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GSM_BUILD_H +#define GSM_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess); +ogs_pkbuf_t *gsm_build_pdu_session_establishment_reject( + smf_sess_t *sess, ogs_nas_5gsm_cause_t gsm_cause); + +ogs_pkbuf_t *gsm_build_status(smf_sess_t *sess, ogs_nas_5gsm_cause_t cause); + +#ifdef __cplusplus +} +#endif + +#endif /* GSM_BUILD_H */ diff --git a/src/smf/gsm-handler.c b/src/smf/gsm-handler.c new file mode 100644 index 000000000..4ca04c078 --- /dev/null +++ b/src/smf/gsm-handler.c @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "gsm-handler.h" +#include "sbi-path.h" + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __gsm_log_domain + +int gsm_handle_pdu_session_establishment_request(smf_sess_t *sess, + ogs_nas_5gs_pdu_session_establishment_request_t * + pdu_session_establishment_request) +{ + ogs_nas_integrity_protection_maximum_data_rate_t * + integrity_protection_maximum_data_rate = + &pdu_session_establishment_request-> + integrity_protection_maximum_data_rate; + ogs_nas_pdu_session_type_t *pdu_session_type = NULL; + ogs_nas_ssc_mode_t *ssc_mode = NULL; + ogs_sbi_session_t *session = NULL; + + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(session); + ogs_assert(pdu_session_establishment_request); + + pdu_session_type = &pdu_session_establishment_request->pdu_session_type; + ogs_assert(pdu_session_type); + ssc_mode = &pdu_session_establishment_request->ssc_mode; + + sess->integrity_protection.mbr_dl = + integrity_protection_maximum_data_rate->dl; + sess->integrity_protection.mbr_ul = + integrity_protection_maximum_data_rate->ul; + + if (pdu_session_establishment_request->presencemask & + OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_PRESENT) + sess->ue_pdu_session_type = pdu_session_type->value; + + if (pdu_session_establishment_request->presencemask & + OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_PRESENT) + sess->ue_ssc_mode = ssc_mode->value; + + smf_sbi_discover_and_send(OpenAPI_nf_type_UDM, sess, + (char *)OGS_SBI_RESOURCE_NAME_SM_DATA, smf_nudm_sdm_build_get); + + return OGS_OK; +} diff --git a/src/smf/gsm-handler.h b/src/smf/gsm-handler.h new file mode 100644 index 000000000..7a5bc7db7 --- /dev/null +++ b/src/smf/gsm-handler.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GSM_HANDLER_H +#define GSM_HANDLER_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int gsm_handle_pdu_session_establishment_request(smf_sess_t *sess, + ogs_nas_5gs_pdu_session_establishment_request_t * + pdu_session_establishment_request); + +#ifdef __cplusplus +} +#endif + +#endif /* GSM_HANDLER_H */ diff --git a/src/smf/gsm-sm.c b/src/smf/gsm-sm.c new file mode 100644 index 000000000..68b7a60af --- /dev/null +++ b/src/smf/gsm-sm.c @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "sbi-path.h" +#include "nnrf-handler.h" +#include "nsmf-handler.h" +#include "nudm-handler.h" +#include "gsm-handler.h" +#include "ngap-handler.h" +#include "pfcp-path.h" + +void smf_gsm_state_initial(ogs_fsm_t *s, smf_event_t *e) +{ + ogs_assert(s); + + OGS_FSM_TRAN(s, &smf_gsm_state_operational); +} + +void smf_gsm_state_final(ogs_fsm_t *s, smf_event_t *e) +{ +} + +void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e) +{ + int rv; + smf_sess_t *sess = NULL; + ogs_pkbuf_t *pkbuf = NULL; + + ogs_nas_5gs_message_t *nas_message = NULL; + + ogs_sbi_session_t *session = NULL; + ogs_sbi_message_t *sbi_message = NULL; + + ogs_assert(s); + ogs_assert(e); + + smf_sm_debug(e); + + sess = e->sess; + ogs_assert(sess); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + break; + + case OGS_FSM_EXIT_SIG: + break; + + case SMF_EVT_SBI_SERVER: + sbi_message = e->sbi.message; + ogs_assert(sbi_message); + session = e->sbi.session; + ogs_assert(session); + + SWITCH(sbi_message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION) + SWITCH(sbi_message->h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_MODIFY) + smf_nsmf_handle_update_sm_context(sess, sbi_message); + break; + CASE(OGS_SBI_RESOURCE_NAME_RELEASE) + smf_nsmf_handle_release_sm_context(sess, sbi_message); + break; + DEFAULT + smf_nsmf_handle_create_sm_context(sess, sbi_message); + break; + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", sbi_message->h.service.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, sbi_message, + "Invalid API name", sbi_message->h.service.name); + END + break; + + case SMF_EVT_SBI_CLIENT: + sbi_message = e->sbi.message; + ogs_assert(sbi_message); + sess = e->sbi.data; + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(session); + + ogs_timer_stop(sess->sbi.client_wait.timer); + + SWITCH(sbi_message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + SWITCH(sbi_message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) + if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) { + ogs_error("[%s] HTTP response error [%d]", + sess->supi, sbi_message->res_status); + ogs_sbi_server_send_error( + session, sbi_message->res_status, + NULL, "HTTP response error", sess->supi); + break; + } + + if (smf_nudm_sdm_handle_get(sess, sbi_message) != true) { + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, + sbi_message, "HTTP response error", sess->supi); + break; + } + + smf_sess_set_ue_ip(sess); + + smf_5gc_pfcp_send_session_establishment_request(sess); + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message->h.resource.component[1]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, sbi_message, + "Invalid resource name", + sbi_message->h.resource.component[1]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM) + SWITCH(sbi_message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXTS) + if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK && + sbi_message->res_status != OGS_SBI_HTTP_STATUS_ACCEPTED) { + ogs_error("[%s] HTTP response error [%d]", + sess->supi, sbi_message->res_status); + break; + } + + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message->h.resource.component[0]); + ogs_assert_if_reached(); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", sbi_message->h.service.name); + + END + break; + + case SMF_EVT_5GSM_MESSAGE: + nas_message = e->nas.message; + ogs_assert(nas_message); + sess = e->sess; + ogs_assert(sess); + + switch (nas_message->gsm.h.message_type) { + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST: + rv = gsm_handle_pdu_session_establishment_request( + sess, &nas_message->gsm.pdu_session_establishment_request); + if (rv != OGS_OK) { + ogs_error("[%s:%d] Cannot handle NAS message", + sess->supi, sess->psi); + OGS_FSM_TRAN(s, smf_gsm_state_exception); + break; + } + break; + default: + ogs_error("Unknown message[%d]", nas_message->gsm.h.message_type); + break; + } + + break; + + case SMF_EVT_NGAP_MESSAGE: + sess = e->sess; + ogs_assert(sess); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); + ogs_assert(e->ngap.type); + + switch (e->ngap.type) { + case OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP: + rv = ngap_handle_pdu_session_resource_setup_response_transfer( + sess, pkbuf); + if (rv != OGS_OK) { + ogs_error("[%s:%d] Cannot handle NGAP message", + sess->supi, sess->psi); + OGS_FSM_TRAN(s, smf_gsm_state_exception); + } + break; + + default: + ogs_error("Unknown message[%d]", e->ngap.type); + } + + break; + + default: + ogs_error("[%s:%d] Unknown event %s", + sess->supi, sess->psi, smf_event_get_name(e)); + break; + } +} + +void smf_gsm_state_exception(ogs_fsm_t *s, smf_event_t *e) +{ + smf_sess_t *sess = NULL; + ogs_assert(s); + ogs_assert(e); + + smf_sm_debug(e); + + sess = e->sess; + ogs_assert(sess); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + break; + + case OGS_FSM_EXIT_SIG: + break; + + default: + ogs_error("[%s] Unknown event %s", sess->imsi_bcd, smf_event_get_name(e)); + break; + } +} diff --git a/src/smf/gx-handler.c b/src/smf/gx-handler.c index 52a4ac8a5..0c5100e67 100644 --- a/src/smf/gx-handler.c +++ b/src/smf/gx-handler.c @@ -88,7 +88,7 @@ void smf_gx_handle_cca_initial_request( for (i = 0; i < gx_message->num_of_pcc_rule; i++) OGS_STORE_PCC_RULE(&sess->pcc_rule[i], &gx_message->pcc_rule[i]); - smf_pfcp_send_session_establishment_request(sess, gtp_xact); + smf_epc_pfcp_send_session_establishment_request(sess, gtp_xact); } void smf_gx_handle_cca_termination_request( diff --git a/src/smf/meson.build b/src/smf/meson.build index 82b9543f4..ea2a9597d 100644 --- a/src/smf/meson.build +++ b/src/smf/meson.build @@ -46,13 +46,24 @@ libsmf_sources = files(''' bearer-binding.h nnrf-build.h nnrf-handler.h + nudm-build.h + nudm-handler.h + namf-build.h sbi-path.h + gsm-build.h + gsm-handler.h + nas-path.h + ngap-build.h + ngap-handler.h + ngap-path.h init.c event.c timer.c context.c smf-sm.c + nf-sm.c + gsm-sm.c pfcp-sm.c gtp-path.c s5c-build.c @@ -65,8 +76,17 @@ libsmf_sources = files(''' bearer-binding.c nnrf-build.c nnrf-handler.c + nudm-build.c + nudm-handler.c + nsmf-handler.c + namf-build.c sbi-path.c - nf-sm.c + gsm-build.c + gsm-handler.c + nas-path.c + ngap-build.c + ngap-handler.c + ngap-path.c '''.split()) libsmf = static_library('smf', @@ -74,6 +94,8 @@ libsmf = static_library('smf', link_with : libipfw, dependencies : [libapp_dep, libsbi_dep, + libngap_dep, + libnas_5gs_dep, libdiameter_gx_dep, libgtp_dep, libpfcp_dep, @@ -84,6 +106,8 @@ libsmf_dep = declare_dependency( link_with : libsmf, dependencies : [libapp_dep, libsbi_dep, + libngap_dep, + libnas_5gs_dep, libdiameter_gx_dep, libgtp_dep, libpfcp_dep, diff --git a/src/smf/n4-build.c b/src/smf/n4-build.c index ebbe03375..012be24bd 100644 --- a/src/smf/n4-build.c +++ b/src/smf/n4-build.c @@ -28,7 +28,7 @@ ogs_pkbuf_t *smf_n4_build_association_setup_request(uint8_t type) ogs_pfcp_node_id_t node_id; int node_id_len = 0; - ogs_debug("[SMF] Association Setup Request"); + ogs_debug("Association Setup Request"); req = &pfcp_message.pfcp_association_setup_request; memset(&pfcp_message, 0, sizeof(ogs_pfcp_message_t)); @@ -60,7 +60,7 @@ ogs_pkbuf_t *smf_n4_build_association_setup_response(uint8_t type, ogs_pfcp_node_id_t node_id; int node_id_len = 0; - ogs_debug("[SMF] Association Setup Response"); + ogs_debug("Association Setup Response"); rsp = &pfcp_message.pfcp_association_setup_response; memset(&pfcp_message, 0, sizeof(ogs_pfcp_message_t)); @@ -92,19 +92,19 @@ static struct { ogs_pfcp_f_teid_t f_teid; char apn[OGS_MAX_APN_LEN]; char *sdf_filter[OGS_MAX_NUM_OF_RULE]; -} create_pdr_buf[OGS_MAX_NUM_OF_PDR]; +} pdrbuf[OGS_MAX_NUM_OF_PDR]; -static void create_pdr_buf_init(void) +static void pdrbuf_init(void) { - memset(create_pdr_buf, 0, sizeof(create_pdr_buf)); + memset(pdrbuf, 0, sizeof(pdrbuf)); } -static void create_pdr_buf_clear(void) +static void pdrbuf_clear(void) { int i, j; for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) { for (j = 0; j < OGS_MAX_NUM_OF_RULE; j++) { - if (create_pdr_buf[i].sdf_filter[j]) - ogs_free(create_pdr_buf[i].sdf_filter[j]); + if (pdrbuf[i].sdf_filter[j]) + ogs_free(pdrbuf[i].sdf_filter[j]); } } } @@ -145,8 +145,8 @@ static void build_create_pdr( message->pdi.network_instance.presence = 1; message->pdi.network_instance.len = ogs_fqdn_build( - create_pdr_buf[i].apn, sess->pdn.apn, strlen(sess->pdn.apn)); - message->pdi.network_instance.data = create_pdr_buf[i].apn; + pdrbuf[i].apn, sess->pdn.apn, strlen(sess->pdn.apn)); + message->pdi.network_instance.data = pdrbuf[i].apn; for (j = 0; j < pdr->num_of_flow; j++) { ogs_pfcp_sdf_filter_t pfcp_sdf_filter[OGS_MAX_NUM_OF_RULE]; @@ -158,49 +158,47 @@ static void build_create_pdr( pfcp_sdf_filter[j].flow_description_len; message->pdi.sdf_filter[j].presence = 1; - create_pdr_buf[i].sdf_filter[j] = ogs_calloc(1, len); + pdrbuf[i].sdf_filter[j] = ogs_calloc(1, len); ogs_pfcp_build_sdf_filter(&message->pdi.sdf_filter[j], - &pfcp_sdf_filter[j], create_pdr_buf[i].sdf_filter[j], len); + &pfcp_sdf_filter[j], pdrbuf[i].sdf_filter[j], len); } - if (pdr->src_if == OGS_PFCP_INTERFACE_CORE && - far->dst_if == OGS_PFCP_INTERFACE_ACCESS) { /* Dowklink */ + if (pdr->src_if == OGS_PFCP_INTERFACE_CORE) { /* Downlink */ if (smf_bearer_is_default(bearer)) { /* Default Bearer */ ogs_pfcp_paa_to_ue_ip_addr(&sess->pdn.paa, - &create_pdr_buf[i].addr, &len); - create_pdr_buf[i].addr.sd = OGS_PFCP_UE_IP_DST; + &pdrbuf[i].addr, &len); + pdrbuf[i].addr.sd = OGS_PFCP_UE_IP_DST; message->pdi.ue_ip_address.presence = 1; - message->pdi.ue_ip_address.data = &create_pdr_buf[i].addr; + message->pdi.ue_ip_address.data = &pdrbuf[i].addr; message->pdi.ue_ip_address.len = len; } - } else if (pdr->src_if == OGS_PFCP_INTERFACE_ACCESS && - far->dst_if == OGS_PFCP_INTERFACE_CORE) { /* Uplink */ + } else if (pdr->src_if == OGS_PFCP_INTERFACE_ACCESS) { /* Uplink */ ogs_pfcp_sockaddr_to_f_teid( bearer->upf_addr, bearer->upf_addr6, - &create_pdr_buf[i].f_teid, &len); - create_pdr_buf[i].f_teid.teid = htobe32(bearer->upf_n3_teid); + &pdrbuf[i].f_teid, &len); + pdrbuf[i].f_teid.teid = htobe32(bearer->upf_n3_teid); message->pdi.local_f_teid.presence = 1; - message->pdi.local_f_teid.data = &create_pdr_buf[i].f_teid; + message->pdi.local_f_teid.data = &pdrbuf[i].f_teid; message->pdi.local_f_teid.len = len; if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) { - create_pdr_buf[i].outer_header_removal.description = + pdrbuf[i].outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4; } else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) { - create_pdr_buf[i].outer_header_removal.description = + pdrbuf[i].outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6; } else if (sess->pdn.paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { - create_pdr_buf[i].outer_header_removal.description = + pdrbuf[i].outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP; } else ogs_assert_if_reached(); message->outer_header_removal.presence = 1; message->outer_header_removal.data = - &create_pdr_buf[i].outer_header_removal.description; + &pdrbuf[i].outer_header_removal.description; message->outer_header_removal.len = 1; } @@ -222,7 +220,7 @@ static void build_create_pdr( static struct { ogs_pfcp_outer_header_creation_t outer_header_creation; -} create_far_buf[OGS_MAX_NUM_OF_FAR]; +} farbuf[OGS_MAX_NUM_OF_FAR]; static void build_create_far( ogs_pfcp_tlv_create_far_t *message, int i, ogs_pfcp_far_t *far) @@ -247,18 +245,21 @@ static void build_create_far( message->forwarding_parameters.presence = 1; message->forwarding_parameters.destination_interface.presence = 1; - message->forwarding_parameters.destination_interface.u8 = far->dst_if; + message->forwarding_parameters.destination_interface.u8 = + far->dst_if; if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) { /* Downlink */ - ogs_pfcp_ip_to_outer_header_creation(&bearer->gnb_ip, - &create_far_buf[i].outer_header_creation, &len); - create_far_buf[i].outer_header_creation.teid = - htobe32(bearer->gnb_n3_teid); + if (bearer->gnb_ip.ipv4 || bearer->gnb_ip.ipv6) { + ogs_pfcp_ip_to_outer_header_creation(&bearer->gnb_ip, + &farbuf[i].outer_header_creation, &len); + farbuf[i].outer_header_creation.teid = + htobe32(bearer->gnb_n3_teid); - message->forwarding_parameters.outer_header_creation.presence = 1; - message->forwarding_parameters.outer_header_creation.data = - &create_far_buf[i].outer_header_creation; - message->forwarding_parameters.outer_header_creation.len = len; + message->forwarding_parameters.outer_header_creation.presence = 1; + message->forwarding_parameters.outer_header_creation.data = + &farbuf[i].outer_header_creation; + message->forwarding_parameters.outer_header_creation.len = len; + } } } @@ -329,6 +330,39 @@ static void build_update_qer( } } +static void build_update_outer_header_creation( + ogs_pfcp_tlv_update_far_t *message, int i, ogs_pfcp_far_t *far) +{ + ogs_pfcp_sess_t *pfcp_sess = NULL; + smf_bearer_t *bearer = NULL; + int len; + + ogs_assert(message); + ogs_assert(far); + pfcp_sess = far->sess; + ogs_assert(pfcp_sess); + bearer = SMF_BEARER(pfcp_sess); + ogs_assert(bearer); + + ogs_assert(far->dst_if == OGS_PFCP_INTERFACE_ACCESS); + ogs_assert(bearer->gnb_ip.ipv4 || bearer->gnb_ip.ipv6); + + message->presence = 1; + message->far_id.presence = 1; + message->far_id.u32 = far->id; + + ogs_pfcp_ip_to_outer_header_creation(&bearer->gnb_ip, + &farbuf[i].outer_header_creation, &len); + farbuf[i].outer_header_creation.teid = + htobe32(bearer->gnb_n3_teid); + + message->update_forwarding_parameters.presence = 1; + message->update_forwarding_parameters.outer_header_creation.presence = 1; + message->update_forwarding_parameters.outer_header_creation.data = + &farbuf[i].outer_header_creation; + message->update_forwarding_parameters.outer_header_creation.len = len; +} + ogs_pkbuf_t *smf_n4_build_session_establishment_request( uint8_t type, smf_sess_t *sess) { @@ -348,7 +382,7 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request( ogs_pfcp_f_seid_t f_seid; int len; - ogs_debug("[SMF] Session Establishment Request"); + ogs_debug("Session Establishment Request"); ogs_assert(sess); req = &pfcp_message.pfcp_session_establishment_request; @@ -372,7 +406,7 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request( req->cp_f_seid.data = &f_seid; req->cp_f_seid.len = len; - create_pdr_buf_init(); + pdrbuf_init(); /* Create PDR */ i = 0; @@ -417,7 +451,7 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request( pfcp_message.h.type = type; pkbuf = ogs_pfcp_build_msg(&pfcp_message); - create_pdr_buf_clear(); + pdrbuf_clear(); return pkbuf; } @@ -435,7 +469,7 @@ ogs_pkbuf_t *smf_n4_build_session_modification_request( smf_sess_t *sess = NULL; - ogs_debug("[SMF] Session Modification Request"); + ogs_debug("Session Modification Request"); ogs_assert(bearer); sess = bearer->sess; ogs_assert(sess); @@ -443,6 +477,15 @@ ogs_pkbuf_t *smf_n4_build_session_modification_request( req = &pfcp_message.pfcp_session_modification_request; memset(&pfcp_message, 0, sizeof(ogs_pfcp_message_t)); + if (!bearer->state.created && + !bearer->state.tft_updated && + !bearer->state.qos_updated && + !bearer->state.outer_header_creation_updated && + !bearer->state.removed) { + ogs_error("No Session Modification"); + return NULL; + } + if (bearer->state.removed) { /* Remove PDR */ i = 0; @@ -478,7 +521,7 @@ ogs_pkbuf_t *smf_n4_build_session_modification_request( } } else { if (bearer->state.created) { - create_pdr_buf_init(); + pdrbuf_init(); /* Create PDR */ i = 0; @@ -509,13 +552,22 @@ ogs_pkbuf_t *smf_n4_build_session_modification_request( i++; } } + if (bearer->state.outer_header_creation_updated) { + i = 0; + ogs_list_for_each(&bearer->pfcp.far_list, far) { + if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) + build_update_outer_header_creation( + &req->update_far[i], i, far); + i++; + } + } } pfcp_message.h.type = type; pkbuf = ogs_pfcp_build_msg(&pfcp_message); if (bearer->state.created) { - create_pdr_buf_clear(); + pdrbuf_clear(); } return pkbuf; @@ -526,7 +578,7 @@ ogs_pkbuf_t *smf_n4_build_session_deletion_request( { ogs_pfcp_message_t pfcp_message; - ogs_debug("[SMF] Session Deletion Request"); + ogs_debug("Session Deletion Request"); ogs_assert(sess); pfcp_message.h.type = type; diff --git a/src/smf/n4-handler.c b/src/smf/n4-handler.c index fda17e124..71affdc79 100644 --- a/src/smf/n4-handler.c +++ b/src/smf/n4-handler.c @@ -23,6 +23,7 @@ #include "gtp-path.h" #include "n4-handler.h" #include "bearer-binding.h" +#include "sbi-path.h" static uint8_t gtp_cause_from_pfcp(uint8_t pfcp_cause) { @@ -137,7 +138,98 @@ void smf_n4_handle_heartbeat_response( smf_timer_cfg(SMF_TIMER_PFCP_HEARTBEAT)->duration); } -void smf_n4_handle_session_establishment_response( +void smf_5gc_n4_handle_session_establishment_response( + smf_sess_t *sess, ogs_pfcp_xact_t *xact, + ogs_pfcp_session_establishment_response_t *rsp) +{ + ogs_pfcp_f_seid_t *up_f_seid = NULL; + + ogs_assert(sess); + ogs_assert(xact); + ogs_assert(rsp); + + ogs_pfcp_xact_commit(xact); + + if (rsp->up_f_seid.presence == 0) { + ogs_error("No UP F-SEID"); + return; + } + + if (rsp->cause.presence) { + if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) { + ogs_error("Cause[%d] : No Accepted", rsp->cause.u8); + return; + } + } else { + ogs_error("No Cause"); + return; + } + + /* UP F-SEID */ + up_f_seid = rsp->up_f_seid.data; + ogs_assert(up_f_seid); + sess->upf_n4_seid = be64toh(up_f_seid->seid); + + smf_sbi_discover_and_send(OpenAPI_nf_type_AMF, sess, NULL, + smf_namf_comm_build_n1_n2_message_transfer); + +#if 0 + smf_bearer_binding(sess); +#endif +} + +void smf_5gc_n4_handle_session_modification_response( + smf_sess_t *sess, ogs_pfcp_xact_t *xact, + ogs_pfcp_session_modification_response_t *rsp) +{ + ogs_sbi_session_t *session = NULL; + smf_bearer_t *bearer = NULL; + + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(session); + ogs_assert(xact); + ogs_assert(rsp); + + bearer = smf_default_bearer_in_sess(sess); + ogs_assert(bearer); + + ogs_pfcp_xact_commit(xact); + + if (rsp->cause.presence) { + if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) { + ogs_error("Cause[%d] : No Accepted", rsp->cause.u8); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, + "[PFCP] No Accepted", sess->supi_psi_keybuf, NULL); + return; + } + } else { + ogs_error("No Cause"); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, + "[PFCP] No Cause", sess->supi_psi_keybuf, NULL); + return; + } + + memset(&sendmsg, 0, sizeof(sendmsg)); + + response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); +} + +void smf_5gc_n4_handle_session_deletion_response( + smf_sess_t *sess, ogs_pfcp_xact_t *xact, + ogs_pfcp_session_deletion_response_t *rsp) +{ + ogs_fatal("TODO"); +} + +void smf_epc_n4_handle_session_establishment_response( smf_sess_t *sess, ogs_pfcp_xact_t *xact, ogs_pfcp_session_establishment_response_t *rsp) { @@ -193,7 +285,7 @@ void smf_n4_handle_session_establishment_response( smf_bearer_binding(sess); } -void smf_n4_handle_session_modification_response( +void smf_epc_n4_handle_session_modification_response( smf_sess_t *sess, ogs_pfcp_xact_t *xact, ogs_pfcp_session_modification_response_t *rsp) { @@ -211,7 +303,7 @@ void smf_n4_handle_session_modification_response( smf_bearer_remove(bearer); } -void smf_n4_handle_session_deletion_response( +void smf_epc_n4_handle_session_deletion_response( smf_sess_t *sess, ogs_pfcp_xact_t *xact, ogs_pfcp_session_deletion_response_t *rsp) { diff --git a/src/smf/n4-handler.h b/src/smf/n4-handler.h index 8176d6162..cfcbab68e 100644 --- a/src/smf/n4-handler.h +++ b/src/smf/n4-handler.h @@ -39,13 +39,23 @@ void smf_n4_handle_heartbeat_response( ogs_pfcp_node_t *node, ogs_pfcp_xact_t *xact, ogs_pfcp_heartbeat_response_t *req); -void smf_n4_handle_session_establishment_response( +void smf_5gc_n4_handle_session_establishment_response( smf_sess_t *sess, ogs_pfcp_xact_t *xact, ogs_pfcp_session_establishment_response_t *rsp); -void smf_n4_handle_session_modification_response( +void smf_5gc_n4_handle_session_modification_response( smf_sess_t *sess, ogs_pfcp_xact_t *xact, ogs_pfcp_session_modification_response_t *rsp); -void smf_n4_handle_session_deletion_response( +void smf_5gc_n4_handle_session_deletion_response( + smf_sess_t *sess, ogs_pfcp_xact_t *xact, + ogs_pfcp_session_deletion_response_t *rsp); + +void smf_epc_n4_handle_session_establishment_response( + smf_sess_t *sess, ogs_pfcp_xact_t *xact, + ogs_pfcp_session_establishment_response_t *rsp); +void smf_epc_n4_handle_session_modification_response( + smf_sess_t *sess, ogs_pfcp_xact_t *xact, + ogs_pfcp_session_modification_response_t *rsp); +void smf_epc_n4_handle_session_deletion_response( smf_sess_t *sess, ogs_pfcp_xact_t *xact, ogs_pfcp_session_deletion_response_t *rsp); diff --git a/src/smf/namf-build.c b/src/smf/namf-build.c new file mode 100644 index 000000000..f75718577 --- /dev/null +++ b/src/smf/namf-build.c @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "namf-build.h" +#include "gsm-build.h" +#include "ngap-build.h" + +ogs_sbi_request_t *smf_namf_comm_build_n1_n2_message_transfer( + smf_sess_t *sess, void *data) +{ + int i; + + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + OpenAPI_n1_n2_message_transfer_req_data_t N1N2MessageTransferReqData; + + OpenAPI_n1_message_container_t n1MessageContainer; + OpenAPI_ref_to_binary_data_t n1MessageContent; + + OpenAPI_n2_info_container_t n2InfoContainer; + OpenAPI_n2_sm_information_t smInfo; + OpenAPI_n2_info_content_t n2InfoContent; + OpenAPI_ref_to_binary_data_t ngapData; + + ogs_assert(sess); + ogs_assert(sess->supi); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NAMF_COMM; + message.h.api.version = (char *)OGS_SBI_API_V1; + message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_UE_CONTEXTS; + message.h.resource.component[1] = sess->supi; + message.h.resource.component[2] = + (char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES; + message.N1N2MessageTransferReqData = &N1N2MessageTransferReqData; + + memset(&N1N2MessageTransferReqData, 0, sizeof(N1N2MessageTransferReqData)); + N1N2MessageTransferReqData.pdu_session_id = sess->psi; + N1N2MessageTransferReqData.n1_message_container = &n1MessageContainer; + N1N2MessageTransferReqData.n2_info_container = &n2InfoContainer; + + memset(&n1MessageContainer, 0, sizeof(n1MessageContainer)); + n1MessageContainer.n1_message_class = OpenAPI_n1_message_class_SM; + n1MessageContainer.n1_message_content = &n1MessageContent; + + memset(&n1MessageContent, 0, sizeof(n1MessageContent)); + n1MessageContent.content_id = (char *)OGS_SBI_CONTENT_5GNAS_SM_ID; + + memset(&n2InfoContainer, 0, sizeof(n2InfoContainer)); + n2InfoContainer.n2_information_class = OpenAPI_n2_information_class_SM; + n2InfoContainer.sm_info = &smInfo; + + memset(&smInfo, 0, sizeof(smInfo)); + smInfo.pdu_session_id = sess->psi; + smInfo.n2_info_content = &n2InfoContent; + + memset(&n2InfoContent, 0, sizeof(n2InfoContent)); + n2InfoContent.ngap_ie_type = OpenAPI_ngap_ie_type_PDU_RES_SETUP_REQ; + n2InfoContent.ngap_data = &ngapData; + + memset(&ngapData, 0, sizeof(ngapData)); + ngapData.content_id = (char *)OGS_SBI_CONTENT_NGAP_SM_ID; + + message.num_of_part = 0; + + message.part[message.num_of_part].pkbuf = + gsm_build_pdu_session_establishment_accept(sess); + if (message.part[message.num_of_part].pkbuf) { + message.part[message.num_of_part].content_id = + (char *)OGS_SBI_CONTENT_5GNAS_SM_ID; + message.part[message.num_of_part].content_type = + (char *)OGS_SBI_CONTENT_5GNAS_TYPE; + message.num_of_part++; + } + + message.part[message.num_of_part].pkbuf = + ngap_build_pdu_session_resource_setup_request_transfer(sess); + if (message.part[message.num_of_part].pkbuf) { + message.part[message.num_of_part].content_id = + (char *)OGS_SBI_CONTENT_NGAP_SM_ID; + message.part[message.num_of_part].content_type = + (char *)OGS_SBI_CONTENT_NGAP_TYPE; + message.num_of_part++; + } + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + for (i = 0; i < message.num_of_part; i++) + if (message.part[i].pkbuf) + ogs_pkbuf_free(message.part[i].pkbuf); + + return request; +} diff --git a/src/smf/namf-build.h b/src/smf/namf-build.h new file mode 100644 index 000000000..0f34398b4 --- /dev/null +++ b/src/smf/namf-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NAMF_BUILD_H +#define SMF_NAMF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *smf_namf_comm_build_n1_n2_message_transfer( + smf_sess_t *sess, void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NAMF_BUILD_H */ diff --git a/src/smf/nas-path.c b/src/smf/nas-path.c new file mode 100644 index 000000000..6fd10d46b --- /dev/null +++ b/src/smf/nas-path.c @@ -0,0 +1,364 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if 0 +#include "ngap-path.h" +#include "ngap-build.h" +#include "gsm-build.h" +#endif +#include "nas-path.h" + +void nas_5gs_send_to_gsm(smf_sess_t *sess, ogs_pkbuf_t *pkbuf) +{ + int rv; + smf_event_t *e = NULL; + + ogs_assert(sess); + ogs_assert(pkbuf); + + e = smf_event_new(SMF_EVT_5GSM_MESSAGE); + ogs_assert(e); + e->sess = sess; + e->pkbuf = pkbuf; + rv = ogs_queue_push(smf_self()->queue, e); + if (rv != OGS_OK) { + ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_pkbuf_free(e->pkbuf); + smf_event_free(e); + } +} + +#if 0 +void nas_5gs_send_detach_accept(amf_ue_t *amf_ue) +{ + ran_ue_t *ran_ue = NULL; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_assert(amf_ue); + ran_ue = amf_ue->ran_ue; + ogs_assert(ran_ue); + + /* reply with detach accept */ + if (amf_ue->nas_5gs.detach.switch_off == 0) { + int rv; + gmmbuf = gmm_build_detach_accept(amf_ue); + ogs_expect_or_return(gmmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect_or_return(rv == OGS_OK); + } + + ngap_send_ue_context_release_command(ran_ue, + NGAP_Cause_PR_nas, NGAP_CauseNas_detach, + NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0); +} + + +void nas_5gs_send_pdn_connectivity_reject( + amf_sess_t *sess, ogs_nas_gsm_cause_t gsm_cause) +{ + int rv; + amf_ue_t *amf_ue; + ogs_pkbuf_t *gsmbuf = NULL; + + ogs_assert(sess); + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + + if (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_registered)) { + gsmbuf = esm_build_pdn_connectivity_reject(sess, gsm_cause); + ogs_expect_or_return(gsmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gsmbuf); + ogs_expect(rv == OGS_OK); + } else { + /* During the UE-registration process, we'll send Registration-Reject + * with pyggybacking PDN-connectivity-Reject */ + nas_5gs_send_registration_reject(amf_ue, + EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED, gsm_cause); + } +} + +void nas_5gs_send_esm_information_request(amf_bearer_t *bearer) +{ + int rv; + amf_ue_t *amf_ue = NULL; + ogs_pkbuf_t *gsmbuf = NULL; + + ogs_assert(bearer); + amf_ue = bearer->amf_ue; + ogs_assert(amf_ue); + + if (bearer->t3589.pkbuf) { + gsmbuf = bearer->t3589.pkbuf; + ogs_expect_or_return(gsmbuf); + } else { + gsmbuf = esm_build_information_request(bearer); + ogs_expect_or_return(gsmbuf); + } + + bearer->t3589.pkbuf = ogs_pkbuf_copy(gsmbuf); + ogs_timer_start(bearer->t3589.timer, + amf_timer_cfg(AMF_TIMER_T3589)->duration); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gsmbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_activate_default_bearer_context_request(amf_bearer_t *bearer) +{ + int rv; + ogs_pkbuf_t *ngapbuf = NULL; + ogs_pkbuf_t *gsmbuf = NULL; + amf_sess_t *sess = NULL; + amf_ue_t *amf_ue = NULL; + + ogs_assert(bearer); + sess = bearer->sess; + ogs_assert(sess); + amf_ue = bearer->amf_ue; + ogs_assert(amf_ue); + + gsmbuf = esm_build_activate_default_bearer_context_request(sess); + ogs_expect_or_return(gsmbuf); + + ngapbuf = ngap_build_e_rab_setup_request(bearer, gsmbuf); + ogs_expect_or_return(ngapbuf); + + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_activate_dedicated_bearer_context_request( + amf_bearer_t *bearer) +{ + int rv; + ogs_pkbuf_t *ngapbuf = NULL; + ogs_pkbuf_t *gsmbuf = NULL; + amf_ue_t *amf_ue = NULL; + + ogs_assert(bearer); + amf_ue = bearer->amf_ue; + ogs_assert(amf_ue); + + gsmbuf = esm_build_activate_dedicated_bearer_context_request(bearer); + ogs_expect_or_return(gsmbuf); + + ngapbuf = ngap_build_e_rab_setup_request(bearer, gsmbuf); + ogs_expect_or_return(ngapbuf); + + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_activate_all_dedicated_bearers(amf_bearer_t *default_bearer) +{ + ogs_assert(default_bearer); + + amf_bearer_t *dedicated_bearer = amf_bearer_next(default_bearer); + while (dedicated_bearer) { + nas_5gs_send_activate_dedicated_bearer_context_request( + dedicated_bearer); + dedicated_bearer = amf_bearer_next(dedicated_bearer); + } +} + +void nas_5gs_send_modify_bearer_context_request( + amf_bearer_t *bearer, int qos_presence, int tft_presence) +{ + int rv; + ogs_pkbuf_t *ngapbuf = NULL; + ogs_pkbuf_t *gsmbuf = NULL; + amf_ue_t *amf_ue = NULL; + + ogs_assert(bearer); + amf_ue = bearer->amf_ue; + ogs_assert(amf_ue); + + gsmbuf = esm_build_modify_bearer_context_request( + bearer, qos_presence, tft_presence); + ogs_expect_or_return(gsmbuf); + + if (qos_presence == 1) { + ngapbuf = ngap_build_e_rab_modify_request(bearer, gsmbuf); + ogs_expect_or_return(ngapbuf); + + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); + ogs_expect(rv == OGS_OK); + } else { + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gsmbuf); + ogs_expect(rv == OGS_OK); + } +} + +void nas_5gs_send_deactivate_bearer_context_request(amf_bearer_t *bearer) +{ + int rv; + ogs_pkbuf_t *ngapbuf = NULL; + ogs_pkbuf_t *gsmbuf = NULL; + amf_ue_t *amf_ue = NULL; + + ogs_assert(bearer); + amf_ue = bearer->amf_ue; + ogs_assert(amf_ue); + + gsmbuf = esm_build_deactivate_bearer_context_request( + bearer, ESM_CAUSE_REGULAR_DEACTIVATION); + ogs_expect_or_return(gsmbuf); + + ngapbuf = ngap_build_e_rab_release_command(bearer, gsmbuf, + NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release); + ogs_expect_or_return(ngapbuf); + + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_bearer_resource_allocation_reject( + amf_bearer_t *bearer, ogs_nas_gsm_cause_t gsm_cause) +{ + int rv; + amf_ue_t *amf_ue; + ogs_pkbuf_t *gsmbuf = NULL; + + ogs_assert(bearer); + amf_ue = bearer->amf_ue; + ogs_assert(bearer); + + gsmbuf = esm_build_bearer_resource_allocation_reject(bearer, gsm_cause); + ogs_expect_or_return(gsmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gsmbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_bearer_resource_modification_reject( + amf_bearer_t *bearer, ogs_nas_gsm_cause_t gsm_cause) +{ + int rv; + amf_ue_t *amf_ue; + ogs_pkbuf_t *gsmbuf = NULL; + + ogs_assert(bearer); + amf_ue = bearer->amf_ue; + ogs_assert(bearer); + + gsmbuf = esm_build_bearer_resource_modification_reject(bearer, gsm_cause); + ogs_expect_or_return(gsmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gsmbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_tau_accept( + amf_ue_t *amf_ue, NGAP_ProcedureCode_t procedureCode) +{ + int rv; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_assert(amf_ue); + + ogs_debug("Tracking area update accept"); + ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); + + gmmbuf = gmm_build_tau_accept(amf_ue); + ogs_expect_or_return(gmmbuf); + + if (procedureCode == NGAP_ProcedureCode_id_InitialContextSetup) { + ogs_pkbuf_t *ngapbuf = NULL; + ngapbuf = ngap_build_initial_context_setup_request(amf_ue, gmmbuf); + ogs_expect_or_return(ngapbuf); + + rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); + ogs_expect(rv == OGS_OK); + } else if (procedureCode == NGAP_ProcedureCode_id_downlinkNASTransport) { + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect(rv == OGS_OK); + } else + ogs_assert_if_reached(); +} + +void nas_5gs_send_tau_reject(amf_ue_t *amf_ue, ogs_nas_gmm_cause_t gmm_cause) +{ + int rv; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_assert(amf_ue); + + /* Build TAU reject */ + gmmbuf = gmm_build_tau_reject(gmm_cause, amf_ue); + ogs_expect_or_return(gmmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_service_reject(amf_ue_t *amf_ue, + ogs_nas_gmm_cause_t gmm_cause) +{ + int rv; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_assert(amf_ue); + + /* Build Service Reject */ + gmmbuf = gmm_build_service_reject(gmm_cause, amf_ue); + ogs_expect_or_return(gmmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_cs_service_notification(amf_ue_t *amf_ue) +{ + int rv; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_assert(amf_ue); + + ogs_debug("CS Service Notification"); + ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); + + gmmbuf = gmm_build_cs_service_notification(amf_ue); + ogs_expect_or_return(gmmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect(rv == OGS_OK); +} + +void nas_5gs_send_downlink_nas_transport( + amf_ue_t *amf_ue, uint8_t *buffer, uint8_t length) +{ + int rv; + ogs_pkbuf_t *gmmbuf = NULL; + + ogs_assert(amf_ue); + ogs_assert(buffer); + ogs_assert(length); + + ogs_debug("Downlink NAS transport"); + ogs_debug(" IMSI[%s]", amf_ue->imsi_bcd); + + gmmbuf = gmm_build_downlink_nas_transport(amf_ue, buffer, length); + ogs_expect_or_return(gmmbuf); + + rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf); + ogs_expect(rv == OGS_OK); +} +#endif diff --git a/src/smf/nas-path.h b/src/smf/nas-path.h new file mode 100644 index 000000000..0dad665e0 --- /dev/null +++ b/src/smf/nas-path.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NAS_5GS_PATH_H +#define SMF_NAS_5GS_PATH_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void nas_5gs_send_to_gsm(smf_sess_t *sess, ogs_pkbuf_t *pkbuf); + +#if 0 +void nas_5gs_send_detach_accept(amf_ue_t *amf_ue); + +void nas_5gs_send_pdn_connectivity_reject( + amf_sess_t *sess, ogs_nas_5gsm_cause_t gsm_cause); +void nas_5gs_send_gsm_information_request(amf_bearer_t *bearer); +void nas_5gs_send_activate_default_bearer_context_request(amf_bearer_t *bearer); +void nas_5gs_send_activate_dedicated_bearer_context_request( + amf_bearer_t *bearer); +void nas_5gs_send_activate_all_dedicated_bearers(amf_bearer_t *default_bearer); +void nas_5gs_send_modify_bearer_context_request( + amf_bearer_t *bearer, int qos_presence, int tft_presence); +void nas_5gs_send_deactivate_bearer_context_request(amf_bearer_t *bearer); +void nas_5gs_send_bearer_resource_allocation_reject( + amf_bearer_t *bearer, ogs_nas_5gsm_cause_t gsm_cause); +void nas_5gs_send_bearer_resource_modification_reject( + amf_bearer_t *bearer, ogs_nas_5gsm_cause_t gsm_cause); + +void nas_5gs_send_tau_accept( + amf_ue_t *amf_ue, S1AP_ProcedureCode_t procedureCode); +void nas_5gs_send_tau_reject(amf_ue_t *amf_ue, ogs_nas_5gsm_cause_t gmm_cause); + +void nas_5gs_send_service_reject( + amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause); + +void nas_5gs_send_cs_service_notification(amf_ue_t *amf_ue); +void nas_5gs_send_downlink_nas_transport( + amf_ue_t *amf_ue, uint8_t *buffer, uint8_t length); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NAS_5GS_PATH_H */ diff --git a/src/smf/ngap-build.c b/src/smf/ngap-build.c new file mode 100644 index 000000000..57e5a823d --- /dev/null +++ b/src/smf/ngap-build.c @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ngap-build.h" + +ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request_transfer( + smf_sess_t *sess) +{ + smf_bearer_t *bearer = NULL; + ogs_ip_t upf_n3_ip; + + NGAP_PDUSessionResourceSetupRequestTransfer_t message; + + NGAP_PDUSessionResourceSetupRequestTransferIEs_t *ie = NULL; + NGAP_UPTransportLayerInformation_t *UPTransportLayerInformation = NULL; + NGAP_GTPTunnel_t *gTPTunnel = NULL; + NGAP_PDUSessionType_t *PDUSessionType = NULL; + NGAP_QosFlowSetupRequestList_t *QosFlowSetupRequestList = NULL; + NGAP_QosFlowSetupRequestItem_t *QosFlowSetupRequestItem = NULL; + NGAP_QosFlowIdentifier_t *qosFlowIdentifier = NULL; + NGAP_QosFlowLevelQosParameters_t *qosFlowLevelQosParameters = NULL; + NGAP_QosCharacteristics_t *qosCharacteristics = NULL; + NGAP_NonDynamic5QIDescriptor_t *nonDynamic5QI = NULL; + NGAP_AllocationAndRetentionPriority_t *allocationAndRetentionPriority; + + ogs_assert(sess); + bearer = smf_default_bearer_in_sess(sess); + ogs_assert(bearer); + + ogs_debug("PDUSessionResourceSetupRequestTransfer"); + + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupRequestTransferIEs_t)); + ASN_SEQUENCE_ADD(&message.protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLInformation; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = NGAP_PDUSessionResourceSetupRequestTransferIEs__value_PR_UPTransportLayerInformation; + + UPTransportLayerInformation = &ie->value.choice.UPTransportLayerInformation; + + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupRequestTransferIEs_t)); + ASN_SEQUENCE_ADD(&message.protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_PDUSessionType; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = NGAP_PDUSessionResourceSetupRequestTransferIEs__value_PR_PDUSessionType; + + PDUSessionType = &ie->value.choice.PDUSessionType; + + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupRequestTransferIEs_t)); + ASN_SEQUENCE_ADD(&message.protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_QosFlowSetupRequestList; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = NGAP_PDUSessionResourceSetupRequestTransferIEs__value_PR_QosFlowSetupRequestList; + + QosFlowSetupRequestList = &ie->value.choice.QosFlowSetupRequestList; + + gTPTunnel = CALLOC(1, sizeof(struct NGAP_GTPTunnel)); + UPTransportLayerInformation->present = + NGAP_UPTransportLayerInformation_PR_gTPTunnel; + UPTransportLayerInformation->choice.gTPTunnel = gTPTunnel; + + ogs_sockaddr_to_ip(bearer->upf_addr, bearer->upf_addr6, &upf_n3_ip); + ogs_asn_ip_to_BIT_STRING(&upf_n3_ip, &gTPTunnel->transportLayerAddress); + ogs_asn_uint32_to_OCTET_STRING(bearer->upf_n3_teid, &gTPTunnel->gTP_TEID); + + *PDUSessionType = OGS_PDU_SESSION_TYPE_IPV4; + switch (sess->pdn.pdn_type) { + case OGS_PDU_SESSION_TYPE_IPV4 : + *PDUSessionType = NGAP_PDUSessionType_ipv4; + break; + case OGS_PDU_SESSION_TYPE_IPV6 : + *PDUSessionType = NGAP_PDUSessionType_ipv6; + break; + case OGS_PDU_SESSION_TYPE_IPV4V6 : + *PDUSessionType = NGAP_PDUSessionType_ipv4v6; + break; + default: + ogs_fatal("Unknown PDU Session Type [%d]", sess->pdn.pdn_type); + ogs_assert_if_reached(); + } + + QosFlowSetupRequestItem = + CALLOC(1, sizeof(struct NGAP_QosFlowSetupRequestItem)); + ASN_SEQUENCE_ADD(&QosFlowSetupRequestList->list, QosFlowSetupRequestItem); + + qosFlowIdentifier = &QosFlowSetupRequestItem->qosFlowIdentifier; + qosFlowLevelQosParameters = + &QosFlowSetupRequestItem->qosFlowLevelQosParameters; + + allocationAndRetentionPriority = + &qosFlowLevelQosParameters->allocationAndRetentionPriority; + qosCharacteristics = &qosFlowLevelQosParameters->qosCharacteristics; + nonDynamic5QI = CALLOC(1, sizeof(struct NGAP_NonDynamic5QIDescriptor)); + qosCharacteristics->choice.nonDynamic5QI = nonDynamic5QI; + qosCharacteristics->present = NGAP_QosCharacteristics_PR_nonDynamic5QI; + + *qosFlowIdentifier = 1; + + nonDynamic5QI->fiveQI = sess->pdn.qos.qci; + + allocationAndRetentionPriority->priorityLevelARP = + sess->pdn.qos.arp.priority_level;; + if (sess->pdn.qos.arp.pre_emption_capability == + OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED) + allocationAndRetentionPriority->pre_emptionCapability = + NGAP_Pre_emptionCapability_shall_not_trigger_pre_emption; + else + allocationAndRetentionPriority->pre_emptionCapability = + NGAP_Pre_emptionCapability_may_trigger_pre_emption; + + if (sess->pdn.qos.arp.pre_emption_vulnerability == + OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED) + allocationAndRetentionPriority->pre_emptionVulnerability = + NGAP_Pre_emptionVulnerability_not_pre_emptable; + else + allocationAndRetentionPriority->pre_emptionVulnerability = + NGAP_Pre_emptionVulnerability_pre_emptable; + + return ogs_asn_encode( + &asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer, &message); +} diff --git a/src/smf/ngap-build.h b/src/smf/ngap-build.h new file mode 100644 index 000000000..72a7aecde --- /dev/null +++ b/src/smf/ngap-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NGAP_BUILD_H +#define SMF_NGAP_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request_transfer( + smf_sess_t *sess); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NGAP_BUILD_H */ diff --git a/src/smf/ngap-handler.c b/src/smf/ngap-handler.c new file mode 100644 index 000000000..8ab676f18 --- /dev/null +++ b/src/smf/ngap-handler.c @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ngap-handler.h" +#include "sbi-path.h" +#include "pfcp-path.h" + +int ngap_handle_pdu_session_resource_setup_response_transfer( + smf_sess_t *sess, ogs_pkbuf_t *pkbuf) +{ + ogs_sbi_session_t *session = NULL; + smf_bearer_t *bearer = NULL; + int rv, i; + + NGAP_PDUSessionResourceSetupResponseTransfer_t message; + + NGAP_QosFlowPerTNLInformation_t *dLQosFlowPerTNLInformation = NULL; + + NGAP_UPTransportLayerInformation_t *uPTransportLayerInformation = NULL; + NGAP_GTPTunnel_t *gTPTunnel = NULL; + + NGAP_AssociatedQosFlowList_t *associatedQosFlowList = NULL; + + ogs_assert(pkbuf); + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(session); + bearer = smf_default_bearer_in_sess(sess); + ogs_assert(bearer); + + rv = ogs_asn_decode( + &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, + &message, sizeof(message), pkbuf); + if (rv != OGS_OK) { + ogs_error("[%s:%d] Cannot decode NGAP message", sess->supi, sess->psi); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No N2 SM Info Type", sess->supi_psi_keybuf, NULL); + goto cleanup; + } + + rv = OGS_ERROR; + + dLQosFlowPerTNLInformation = &message.dLQosFlowPerTNLInformation; + uPTransportLayerInformation = + &dLQosFlowPerTNLInformation->uPTransportLayerInformation; + + if (uPTransportLayerInformation->present != + NGAP_UPTransportLayerInformation_PR_gTPTunnel) { + ogs_error( + "[%s:%d] Unknown NGAP_UPTransportLayerInformation.present [%d]", + sess->supi, sess->psi, uPTransportLayerInformation->present); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "Unknown NGAP_UPTransportLayerInformation.present", + sess->supi_psi_keybuf, NULL); + goto cleanup; + } + + associatedQosFlowList = &dLQosFlowPerTNLInformation->associatedQosFlowList; + for (i = 0; i < associatedQosFlowList->list.count; i++) { + NGAP_AssociatedQosFlowItem_t *associatedQosFlowItem = NULL; + associatedQosFlowItem = (NGAP_AssociatedQosFlowItem_t *) + associatedQosFlowList->list.array[i]; + if (associatedQosFlowItem) { + /* TODO : associatedQosFlowItem->qosFlowIdentifier */ + } + } + + gTPTunnel = uPTransportLayerInformation->choice.gTPTunnel; + if (!gTPTunnel) { + ogs_error("[%s:%d] No GTPTunnel", sess->supi, sess->psi); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No GTPTunnel", sess->supi_psi_keybuf, NULL); + goto cleanup; + } + + ogs_asn_BIT_STRING_to_ip( + &gTPTunnel->transportLayerAddress, &bearer->gnb_ip); + ogs_asn_OCTET_STRING_to_uint32(&gTPTunnel->gTP_TEID, &bearer->gnb_n3_teid); + + bearer->state.outer_header_creation_updated = true; + smf_pfcp_send_session_modification_request(bearer); + + rv = OGS_OK; +cleanup: + ogs_asn_free( + &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, &message); + return rv; +} diff --git a/src/smf/ngap-handler.h b/src/smf/ngap-handler.h new file mode 100644 index 000000000..41d421239 --- /dev/null +++ b/src/smf/ngap-handler.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NGAP_HANDLER_H +#define SMF_NGAP_HANDLER_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int ngap_handle_pdu_session_resource_setup_response_transfer( + smf_sess_t *sess, ogs_pkbuf_t *pkbuf); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NGAP_HANDLER_H */ diff --git a/src/smf/ngap-path.c b/src/smf/ngap-path.c new file mode 100644 index 000000000..d3f163788 --- /dev/null +++ b/src/smf/ngap-path.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ngap-path.h" + +void ngap_send_to_n2sm(smf_sess_t *sess, int type, ogs_pkbuf_t *pkbuf) +{ + int rv; + smf_event_t *e = NULL; + + ogs_assert(sess); + ogs_assert(pkbuf); + + e = smf_event_new(SMF_EVT_NGAP_MESSAGE); + ogs_assert(e); + e->sess = sess; + e->pkbuf = pkbuf; + e->ngap.type = type; + rv = ogs_queue_push(smf_self()->queue, e); + if (rv != OGS_OK) { + ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_pkbuf_free(e->pkbuf); + smf_event_free(e); + } +} diff --git a/src/smf/ngap-path.h b/src/smf/ngap-path.h new file mode 100644 index 000000000..39bc3f1b9 --- /dev/null +++ b/src/smf/ngap-path.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NGAP_PATH_H +#define SMF_NGAP_PATH_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void ngap_send_to_n2sm(smf_sess_t *sess, int type, ogs_pkbuf_t *pkbuf); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NGAP_PATH_H */ diff --git a/src/smf/nnrf-handler.c b/src/smf/nnrf-handler.c index b213d0156..f8d52e3d4 100644 --- a/src/smf/nnrf-handler.c +++ b/src/smf/nnrf-handler.c @@ -139,7 +139,7 @@ bool smf_nnrf_handle_nf_status_notify( } if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) { - ogs_error("The notification is not allowed [%s]", + ogs_error("[%s] The notification is not allowed", NFProfile->nf_instance_id); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN, message, "The notification is not allowed", @@ -217,12 +217,19 @@ bool smf_nnrf_handle_nf_status_notify( return true; } -void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message) +void smf_nnrf_handle_nf_discover( + ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message) { + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_session_t *session = NULL; + OpenAPI_search_result_t *SearchResult = NULL; OpenAPI_lnode_t *node = NULL; bool handled; + ogs_assert(sbi_object); + session = sbi_object->session; + ogs_assert(session); ogs_assert(message); SearchResult = message->SearchResult; @@ -233,7 +240,6 @@ void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message) OpenAPI_list_for_each(SearchResult->nf_instances, node) { OpenAPI_nf_profile_t *NFProfile = NULL; - ogs_sbi_nf_instance_t *nf_instance = NULL; if (!node->data) continue; @@ -245,6 +251,7 @@ void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message) ogs_assert(nf_instance); smf_nf_fsm_init(nf_instance); + ogs_info("[%s] (NF-discover) NF registered", nf_instance->id); } else { OGS_FSM_TRAN(&nf_instance->sm, smf_nf_state_registered); @@ -258,7 +265,7 @@ void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message) handled = ogs_sbi_nnrf_handle_nf_profile( nf_instance, NFProfile, NULL, NULL); if (!handled) { - ogs_error("[%s] ogs_sbi_nnrf_handle_nf_profile() failed", + ogs_error("ogs_sbi_nnrf_handle_nf_profile() failed [%s]", nf_instance->id); SMF_NF_INSTANCE_CLEAR("NRF-discover", nf_instance); continue; @@ -273,15 +280,10 @@ void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message) smf_sbi_setup_client_callback(nf_instance); -#if 0 if (!OGS_SBI_NF_INSTANCE_GET( - amf_ue->nf_types, nf_instance->nf_type)) - ogs_sbi_nf_types_associate(amf_ue->nf_types, - nf_instance->nf_type, amf_nf_state_registered); -#else - ogs_assert_if_reached(); /* TODO implement */ -#endif - + sbi_object->nf_types, nf_instance->nf_type)) + ogs_sbi_nf_types_associate(sbi_object->nf_types, + nf_instance->nf_type, sbi_object->nf_state_registered); /* TIME : Update validity from NRF */ if (SearchResult->validity_period) { @@ -298,4 +300,18 @@ void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message) ogs_info("[%s] (NF-discover) NF Profile updated", nf_instance->id); } } + + ogs_assert(sbi_object->nf_type); + nf_instance = OGS_SBI_NF_INSTANCE_GET( + sbi_object->nf_types, sbi_object->nf_type); + if (!nf_instance) { + ogs_error("(NF discover) No [%s]", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_SERVICE_UNAVAILABLE, NULL, + "(NF discover) No NF", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); + } else { + ogs_sbi_send(sbi_object, nf_instance); + } } diff --git a/src/smf/nnrf-handler.h b/src/smf/nnrf-handler.h index 2dede5132..0a01b6e1c 100644 --- a/src/smf/nnrf-handler.h +++ b/src/smf/nnrf-handler.h @@ -34,7 +34,8 @@ void smf_nnrf_handle_nf_status_subscribe( bool smf_nnrf_handle_nf_status_notify( ogs_sbi_session_t *session, ogs_sbi_message_t *message); -void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message); +void smf_nnrf_handle_nf_discover( + ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message); #ifdef __cplusplus } diff --git a/src/smf/nsmf-handler.c b/src/smf/nsmf-handler.c new file mode 100644 index 000000000..470d889c8 --- /dev/null +++ b/src/smf/nsmf-handler.c @@ -0,0 +1,258 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "sbi-path.h" +#include "nas-path.h" +#include "ngap-path.h" +#include "nsmf-handler.h" + +bool smf_nsmf_handle_create_sm_context( + smf_sess_t *sess, ogs_sbi_message_t *message) +{ + ogs_sbi_session_t *session = NULL; + + OpenAPI_sm_context_create_data_t *SmContextCreateData = NULL; + OpenAPI_snssai_t *sNssai = NULL; + OpenAPI_plmn_id_nid_t *servingNetwork = NULL; + OpenAPI_ref_to_binary_data_t *n1SmMsg = NULL; + + ogs_pkbuf_t *n1smbuf = NULL; + + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(session); + + ogs_assert(message); + + SmContextCreateData = message->SmContextCreateData; + if (!SmContextCreateData) { + ogs_error("[%s:%d] No SmContextCreateData", sess->supi, sess->psi); + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_create_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No SmContextCreateData", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + sNssai = SmContextCreateData->s_nssai; + if (!sNssai) { + ogs_error("[%s:%d] No sNssai", sess->supi, sess->psi); + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_create_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No sNssai", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + servingNetwork = SmContextCreateData->serving_network; + if (!servingNetwork || !servingNetwork->mnc || !servingNetwork->mcc) { + ogs_error("[%s:%d] No servingNetwork", sess->supi, sess->psi); + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_create_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No servingNetwork", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + n1SmMsg = SmContextCreateData->n1_sm_msg; + if (!n1SmMsg || !n1SmMsg->content_id) { + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_create_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No N1 SM Message", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + n1smbuf = ogs_sbi_find_part_by_content_id(message, n1SmMsg->content_id); + if (!n1smbuf) { + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_create_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No N1 SM Content", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + ogs_plmn_id_build(&sess->plmn_id, + atoi(servingNetwork->mcc), atoi(servingNetwork->mnc), + strlen(servingNetwork->mnc)); + sess->nid = servingNetwork->nid; + + sess->s_nssai.sst = sNssai->sst; + sess->s_nssai.sd = ogs_s_nssai_sd_from_string(sNssai->sd); + + if (SmContextCreateData->dnn) { + if (sess->dnn) ogs_free(sess->dnn); + sess->dnn = ogs_strdup(SmContextCreateData->dnn); + } + + nas_5gs_send_to_gsm(sess, n1smbuf); + + return true; +} + +bool smf_nsmf_handle_update_sm_context( + smf_sess_t *sess, ogs_sbi_message_t *message) +{ + ogs_sbi_session_t *session = NULL; + + OpenAPI_sm_context_update_data_t *SmContextUpdateData = NULL; + OpenAPI_ref_to_binary_data_t *n2SmMsg = NULL; + + ogs_pkbuf_t *n2smbuf = NULL; + + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(session); + + ogs_assert(message); + + SmContextUpdateData = message->SmContextUpdateData; + if (!SmContextUpdateData) { + ogs_error("[%s:%d] No SmContextUpdateData", sess->supi, sess->psi); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No SmContextUpdateData", sess->supi_psi_keybuf, NULL); + return false; + } + + if (!SmContextUpdateData->n2_sm_info_type) { + ogs_error("[%s:%d] No n2SmInfoType", sess->supi, sess->psi); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No N2 SM Info Type", sess->supi_psi_keybuf, NULL); + return false; + } + + n2SmMsg = SmContextUpdateData->n2_sm_info; + if (!n2SmMsg || !n2SmMsg->content_id) { + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No n2SmInfo", sess->supi_psi_keybuf, NULL); + return false; + } + + n2smbuf = ogs_sbi_find_part_by_content_id(message, n2SmMsg->content_id); + if (!n2smbuf) { + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No N2 SM Content", sess->supi_psi_keybuf, NULL); + return false; + } + + ngap_send_to_n2sm(sess, SmContextUpdateData->n2_sm_info_type, n2smbuf); + + return true; +} + +bool smf_nsmf_handle_release_sm_context( + smf_sess_t *sess, ogs_sbi_message_t *message) +{ + ogs_fatal("TODO"); +#if 0 + ogs_sbi_session_t *session = NULL; + + OpenAPI_sm_context_release_data_t *SmContextReleaseData = NULL; + OpenAPI_snssai_t *sNssai = NULL; + OpenAPI_plmn_id_nid_t *servingNetwork = NULL; + OpenAPI_ref_to_binary_data_t *n1SmMsg = NULL; + + ogs_pkbuf_t *n1smbuf = NULL; + + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(session); + + ogs_assert(message); + + SmContextReleaseData = message->SmContextReleaseData; + if (!SmContextReleaseData) { + ogs_error("[%s:%d] No SmContextReleaseData", sess->supi, sess->psi); + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_release_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No SmContextReleaseData", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + sNssai = SmContextReleaseData->s_nssai; + if (!sNssai) { + ogs_error("[%s:%d] No sNssai", sess->supi, sess->psi); + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_release_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No sNssai", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + servingNetwork = SmContextReleaseData->serving_network; + if (!servingNetwork || !servingNetwork->mnc || !servingNetwork->mcc) { + ogs_error("[%s:%d] No servingNetwork", sess->supi, sess->psi); + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_release_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No servingNetwork", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + n1SmMsg = SmContextReleaseData->n1_sm_msg; + if (!n1SmMsg || !n1SmMsg->content_id) { + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_release_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No N1 SM Message", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + n1smbuf = ogs_sbi_find_part_by_content_id(message, n1SmMsg->content_id); + if (!n1smbuf) { + n1smbuf = gsm_build_pdu_session_establishment_reject(sess, + OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION); + smf_sbi_send_sm_context_release_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No N1 SM Content", sess->supi_psi_keybuf, n1smbuf); + return false; + } + + ogs_plmn_id_build(&sess->plmn_id, + atoi(servingNetwork->mcc), atoi(servingNetwork->mnc), + strlen(servingNetwork->mnc)); + sess->nid = servingNetwork->nid; + + sess->s_nssai.sst = sNssai->sst; + sess->s_nssai.sd = ogs_s_nssai_sd_from_string(sNssai->sd); + + if (SmContextReleaseData->dnn) { + if (sess->dnn) ogs_free(sess->dnn); + sess->dnn = ogs_strdup(SmContextReleaseData->dnn); + } + + nas_5gs_send_to_gsm(sess, n1smbuf); +#endif + + return true; +} diff --git a/src/smf/nsmf-handler.h b/src/smf/nsmf-handler.h new file mode 100644 index 000000000..03f4f6e59 --- /dev/null +++ b/src/smf/nsmf-handler.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NSMF_HANDLER_H +#define SMF_NSMF_HANDLER_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +bool smf_nsmf_handle_create_sm_context( + smf_sess_t *sess, ogs_sbi_message_t *message); +bool smf_nsmf_handle_update_sm_context( + smf_sess_t *sess, ogs_sbi_message_t *message); +bool smf_nsmf_handle_release_sm_context( + smf_sess_t *sess, ogs_sbi_message_t *message); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NSMF_HANDLER_H */ diff --git a/src/smf/nudm-build.c b/src/smf/nudm-build.c new file mode 100644 index 000000000..46f5744bb --- /dev/null +++ b/src/smf/nudm-build.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nudm-build.h" + +ogs_sbi_request_t *smf_nudm_sdm_build_get(smf_sess_t *sess, void *data) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + ogs_assert(sess); + ogs_assert(sess->supi); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_SDM; + message.h.api.version = (char *)OGS_SBI_API_V2; + message.h.resource.component[0] = sess->supi; + message.h.resource.component[1] = data; + + message.param.s_nssai_presence = true; + memcpy(&message.param.s_nssai, &sess->s_nssai, sizeof(sess->s_nssai)); + + if (sess->dnn) + message.param.dnn = sess->dnn; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + return request; +} diff --git a/src/smf/nudm-build.h b/src/smf/nudm-build.h new file mode 100644 index 000000000..bbc8648a5 --- /dev/null +++ b/src/smf/nudm-build.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NUDM_BUILD_H +#define SMF_NUDM_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *smf_nudm_sdm_build_get(smf_sess_t *sess, void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NUDM_BUILD_H */ diff --git a/src/smf/nudm-handler.c b/src/smf/nudm-handler.c new file mode 100644 index 000000000..1d86806f9 --- /dev/null +++ b/src/smf/nudm-handler.c @@ -0,0 +1,242 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nudm-handler.h" + +bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_message_t *recvmsg) +{ + ogs_sbi_server_t *server = NULL; + ogs_sbi_session_t *session = NULL; + + ogs_sbi_message_t sendmsg; + ogs_sbi_header_t header; + ogs_sbi_response_t *response = NULL; + + OpenAPI_sm_context_created_data_t SmContextCreatedData; + OpenAPI_session_management_subscription_data_t + *SessionManagementSubscriptionData = NULL; + OpenAPI_list_t *dnnConfigurationList = NULL; + OpenAPI_map_t *dnnConfigurationMap = NULL; + OpenAPI_dnn_configuration_t *dnnConfiguration = NULL; + OpenAPI_pdu_session_types_t *pduSessionTypeList = NULL; + OpenAPI_ssc_modes_t *sscModeList = NULL; + OpenAPI_subscribed_default_qos_t *_5gQoSProfile = NULL; + OpenAPI_ambr_t *sessionAmbr = NULL; + OpenAPI_list_t *staticIpAddress = NULL; + OpenAPI_ip_address_t *ipAddress = NULL; + OpenAPI_lnode_t *node = NULL, *node2 = NULL; + + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(session); + server = ogs_sbi_session_get_server(session); + ogs_assert(server); + + ogs_assert(recvmsg); + + SessionManagementSubscriptionData = + recvmsg->SessionManagementSubscriptionData; + if (!SessionManagementSubscriptionData) { + ogs_error("[%s] No SessionManagementSubscriptionData", sess->supi); + return false; + } + + dnnConfigurationList = + SessionManagementSubscriptionData->dnn_configurations; + if (!dnnConfigurationList) { + ogs_error("[%s] No dnnConfigurations", sess->supi); + return false; + } + + OpenAPI_list_for_each(dnnConfigurationList, node) { + dnnConfigurationMap = node->data; + if (dnnConfigurationMap) { + if (!dnnConfigurationMap->key) { + ogs_error("No dnnConfigurationMap->key"); + continue; + } + + dnnConfiguration = dnnConfigurationMap->value; + if (!dnnConfiguration) { + ogs_error("No dnnConfiguration"); + continue; + } + + pduSessionTypeList = dnnConfiguration->pdu_session_types; + if (!pduSessionTypeList) { + ogs_error("No pduSessionTypes"); + continue; + } + + sscModeList = dnnConfiguration->ssc_modes; + if (!sscModeList) { + ogs_error("No sscModes"); + continue; + } + + if (sess->dnn && strcmp(sess->dnn, dnnConfigurationMap->key) != 0) + continue; + + if (sess->ue_pdu_session_type) { + OpenAPI_list_for_each( + pduSessionTypeList->allowed_session_types, node2) { + if (node2->data) { + uint8_t allowed_session_type = (uintptr_t)node2->data; + if (sess->ue_pdu_session_type == allowed_session_type) { + sess->pdn.pdn_type = sess->ue_pdu_session_type; + break; + } + } + } + } else { + sess->pdn.pdn_type = + pduSessionTypeList->default_session_type; + } + + if (!sess->pdn.pdn_type) { + ogs_error("PDU Session Type is not allowed"); + continue; + } + + if (sess->ue_ssc_mode) { + OpenAPI_list_for_each(sscModeList->allowed_ssc_modes, node2) { + if (node2->data) { + uint8_t allowed_ssc_mode = (uintptr_t)node2->data; + if (sess->ue_ssc_mode == allowed_ssc_mode) { + sess->pdn.ssc_mode = sess->ue_ssc_mode; + break; + } + } + } + } else { + sess->pdn.ssc_mode = sscModeList->default_ssc_mode; + } + + if (!sess->pdn.ssc_mode) { + ogs_error("SSCMode is not allowed"); + continue; + } + + sessionAmbr = dnnConfiguration->session_ambr; + if (!sessionAmbr) { + ogs_error("No Session-AMBR"); + continue; + } + + sess->pdn.ambr.uplink = + ogs_sbi_bitrate_from_string(sessionAmbr->uplink); + sess->pdn.ambr.downlink = + ogs_sbi_bitrate_from_string(sessionAmbr->downlink); + + _5gQoSProfile = dnnConfiguration->_5g_qos_profile; + if (_5gQoSProfile) { + sess->pdn.qos.qci = _5gQoSProfile->_5qi; + sess->pdn.qos.arp.priority_level = + _5gQoSProfile->priority_level; + sess->pdn.qos.arp.pre_emption_capability = + OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED; + sess->pdn.qos.arp.pre_emption_vulnerability = + OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED; + if (_5gQoSProfile->arp) { + sess->pdn.qos.arp.priority_level = + _5gQoSProfile->arp->priority_level; + if (_5gQoSProfile->arp->preempt_cap == + OpenAPI_preemption_capability_MAY_PREEMPT) + sess->pdn.qos.arp.pre_emption_capability = + OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED; + if (_5gQoSProfile->arp->preempt_vuln == + OpenAPI_preemption_vulnerability_PREEMPTABLE) { + sess->pdn.qos.arp.pre_emption_vulnerability = + OGS_PDN_PRE_EMPTION_VULNERABILITY_ENABLED; + } + } + } + + staticIpAddress = dnnConfiguration->static_ip_address; + if (staticIpAddress) { + OpenAPI_list_for_each(staticIpAddress, node2) { + if (node2->data) { + ipAddress = node2->data; + if (ipAddress) { + int rv; + bool ipv4 = false, ipv6 = false; + ogs_ipsubnet_t ipsub4, ipsub6; + if (ipAddress->ipv4_addr) { + rv = ogs_ipsubnet(&ipsub4, + ipAddress->ipv4_addr, NULL); + if (rv == OGS_OK) ipv4 = true; + } + if (ipAddress->ipv6_addr) { + rv = ogs_ipsubnet(&ipsub6, + ipAddress->ipv6_addr, NULL); + if (rv == OGS_OK) ipv6 = true; + } + + if (ipv4 && ipv6) { + sess->pdn.ue_ip.addr = ipsub4.sub[0]; + memcpy(sess->pdn.ue_ip.addr6, + ipsub6.sub, OGS_IPV6_LEN); + } else if (ipv4) { + sess->pdn.ue_ip.addr = ipsub4.sub[0]; + } else if (ipv6) { + memcpy(sess->pdn.ue_ip.addr6, + ipsub6.sub, OGS_IPV6_LEN); + } + } + } + } + } + + /* Succeeded to get PDU Session */ + ogs_cpystrn(sess->pdn.apn, dnnConfigurationMap->key, + ogs_min(strlen(dnnConfigurationMap->key), + OGS_MAX_APN_LEN)+1); + + break; + } + } + + if (!strlen(sess->pdn.apn)) { + ogs_error("[%s] No dnnConfiguration", sess->supi); + return false; + } + + memset(&SmContextCreatedData, 0, sizeof(SmContextCreatedData)); + + memset(&sendmsg, 0, sizeof(sendmsg)); + + memset(&header, 0, sizeof(header)); + header.service.name = (char *)OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION; + header.api.version = (char *)OGS_SBI_API_V1; + header.resource.component[0] = + (char *)OGS_SBI_RESOURCE_NAME_SM_CONTEXTS; + header.resource.component[1] = sess->sm_context_ref; + + sendmsg.http.location = ogs_sbi_server_uri(server, &header); + + sendmsg.SmContextCreatedData = &SmContextCreatedData; + + response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_CREATED); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + ogs_free(sendmsg.http.location); + + return true; +} diff --git a/src/smf/nudm-handler.h b/src/smf/nudm-handler.h new file mode 100644 index 000000000..5f651fa42 --- /dev/null +++ b/src/smf/nudm-handler.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NUDM_HANDLER_H +#define SMF_NUDM_HANDLER_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_message_t *recvmsg); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NUDM_HANDLER_H */ diff --git a/src/smf/pfcp-path.c b/src/smf/pfcp-path.c index 65955d942..ae1bef913 100644 --- a/src/smf/pfcp-path.c +++ b/src/smf/pfcp-path.c @@ -264,7 +264,12 @@ void smf_pfcp_send_heartbeat_request(ogs_pfcp_node_t *node) ogs_expect(rv == OGS_OK); } -void smf_pfcp_send_session_establishment_request( +void smf_5gc_pfcp_send_session_establishment_request(smf_sess_t *sess) +{ + smf_epc_pfcp_send_session_establishment_request(sess, NULL); +} + +void smf_epc_pfcp_send_session_establishment_request( smf_sess_t *sess, void *gtp_xact) { int rv; diff --git a/src/smf/pfcp-path.h b/src/smf/pfcp-path.h index 255a04e39..bdcdb5bec 100644 --- a/src/smf/pfcp-path.h +++ b/src/smf/pfcp-path.h @@ -34,7 +34,8 @@ void smf_pfcp_send_association_setup_response(ogs_pfcp_xact_t *xact, uint8_t cause); void smf_pfcp_send_heartbeat_request(ogs_pfcp_node_t *node); -void smf_pfcp_send_session_establishment_request( +void smf_5gc_pfcp_send_session_establishment_request(smf_sess_t *sess); +void smf_epc_pfcp_send_session_establishment_request( smf_sess_t *sess, void *gtp_xact); void smf_pfcp_send_session_modification_request(smf_bearer_t *bearer); void smf_pfcp_send_session_deletion_request( diff --git a/src/smf/pfcp-sm.c b/src/smf/pfcp-sm.c index ec06b7f13..b2b114e41 100644 --- a/src/smf/pfcp-sm.c +++ b/src/smf/pfcp-sm.c @@ -207,15 +207,27 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e) &message->pfcp_association_setup_response); break; case OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE: - smf_n4_handle_session_establishment_response( + if (SMF_5GC_SESS(sess)) + smf_5gc_n4_handle_session_establishment_response( + sess, xact, &message->pfcp_session_establishment_response); + else + smf_epc_n4_handle_session_establishment_response( sess, xact, &message->pfcp_session_establishment_response); break; case OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE: - smf_n4_handle_session_modification_response( + if (SMF_5GC_SESS(sess)) + smf_5gc_n4_handle_session_modification_response( + sess, xact, &message->pfcp_session_modification_response); + else + smf_epc_n4_handle_session_modification_response( sess, xact, &message->pfcp_session_modification_response); break; case OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE: - smf_n4_handle_session_deletion_response( + if (SMF_5GC_SESS(sess)) + smf_5gc_n4_handle_session_deletion_response( + sess, xact, &message->pfcp_session_deletion_response); + else + smf_epc_n4_handle_session_deletion_response( sess, xact, &message->pfcp_session_deletion_response); break; default: diff --git a/src/smf/sbi-path.c b/src/smf/sbi-path.c index 16a5296ee..fd99a7c4d 100644 --- a/src/smf/sbi-path.c +++ b/src/smf/sbi-path.c @@ -82,8 +82,8 @@ int smf_sbi_open(void) service = ogs_sbi_nf_service_build_default(nf_instance, (char*)OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION); ogs_assert(service); - ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_VERSION, - (char*)OGS_SBI_API_FULL_VERSION, NULL); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1, + (char*)OGS_SBI_API_V1_0_0, NULL); smf_nf_fsm_init(nf_instance); smf_sbi_setup_client_callback(nf_instance); @@ -114,3 +114,112 @@ void smf_sbi_setup_client_callback(ogs_sbi_nf_instance_t *nf_instance) client->cb = client_cb; } } + +void smf_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, smf_sess_t *sess, void *data, + ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data)) +{ + ogs_sbi_session_t *session = NULL; + + ogs_assert(sess); + session = sess->sbi.session; + ogs_assert(nf_type); + ogs_assert(build); + + sess->sbi.nf_state_registered = smf_nf_state_registered; + sess->sbi.client_wait.duration = + smf_timer_cfg(SMF_TIMER_SBI_CLIENT_WAIT)->duration; + + if (ogs_sbi_discover_and_send( + nf_type, &sess->sbi, data, (ogs_sbi_build_f)build) != true) { + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, + "Cannot discover", sess->supi); + } +} + +void smf_sbi_send_sm_context_create_error( + ogs_sbi_session_t *session, + int status, const char *title, const char *detail, + ogs_pkbuf_t *n1smbuf) +{ + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + + OpenAPI_sm_context_create_error_t SmContextCreateError; + OpenAPI_problem_details_t problem; + OpenAPI_ref_to_binary_data_t n1_sm_msg; + + ogs_assert(session); + + memset(&problem, 0, sizeof(problem)); + problem.status = status; + problem.title = (char*)title; + problem.detail = (char*)detail; + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.SmContextCreateError = &SmContextCreateError; + + memset(&SmContextCreateError, 0, sizeof(SmContextCreateError)); + SmContextCreateError.error = &problem; + + if (n1smbuf) { + SmContextCreateError.n1_sm_msg = &n1_sm_msg; + n1_sm_msg.content_id = (char *)OGS_SBI_CONTENT_5GNAS_SM_ID; + sendmsg.part[0].content_id = (char *)OGS_SBI_CONTENT_5GNAS_SM_ID; + sendmsg.part[0].content_type = (char *)OGS_SBI_CONTENT_5GNAS_TYPE; + sendmsg.part[0].pkbuf = n1smbuf; + sendmsg.num_of_part = 1; + } + + response = ogs_sbi_build_response(&sendmsg, problem.status); + ogs_assert(response); + + ogs_sbi_server_send_response(session, response); + + if (n1smbuf) + ogs_pkbuf_free(n1smbuf); +} + +void smf_sbi_send_sm_context_update_error( + ogs_sbi_session_t *session, + int status, const char *title, const char *detail, + ogs_pkbuf_t *n2smbuf) +{ + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + + OpenAPI_sm_context_update_error_t SmContextUpdateError; + OpenAPI_problem_details_t problem; + OpenAPI_ref_to_binary_data_t n2_sm_info; + + ogs_assert(session); + + memset(&problem, 0, sizeof(problem)); + problem.status = status; + problem.title = (char*)title; + problem.detail = (char*)detail; + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.SmContextUpdateError = &SmContextUpdateError; + + memset(&SmContextUpdateError, 0, sizeof(SmContextUpdateError)); + SmContextUpdateError.error = &problem; + + if (n2smbuf) { + SmContextUpdateError.n2_sm_info = &n2_sm_info; + n2_sm_info.content_id = (char *)OGS_SBI_CONTENT_NGAP_SM_ID; + sendmsg.part[0].content_id = (char *)OGS_SBI_CONTENT_NGAP_SM_ID; + sendmsg.part[0].content_type = (char *)OGS_SBI_CONTENT_NGAP_TYPE; + sendmsg.part[0].pkbuf = n2smbuf; + sendmsg.num_of_part = 1; + } + + response = ogs_sbi_build_response(&sendmsg, problem.status); + ogs_assert(response); + + ogs_sbi_server_send_response(session, response); + + if (n2smbuf) + ogs_pkbuf_free(n2smbuf); +} diff --git a/src/smf/sbi-path.h b/src/smf/sbi-path.h index 8abab2251..aa29732e5 100644 --- a/src/smf/sbi-path.h +++ b/src/smf/sbi-path.h @@ -21,6 +21,9 @@ #define SMF_SBI_PATH_H #include "nnrf-build.h" +#include "nudm-build.h" +#include "namf-build.h" +#include "gsm-build.h" #ifdef __cplusplus extern "C" { @@ -30,6 +33,19 @@ int smf_sbi_open(void); void smf_sbi_close(void); void smf_sbi_setup_client_callback(ogs_sbi_nf_instance_t *nf_instance); +void smf_sbi_send(smf_sess_t *sess, ogs_sbi_nf_instance_t *nf_instance); +void smf_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, smf_sess_t *sess, void *data, + ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data)); + +void smf_sbi_send_sm_context_create_error( + ogs_sbi_session_t *session, + int status, const char *title, const char *detail, + ogs_pkbuf_t *n1smbuf); +void smf_sbi_send_sm_context_update_error( + ogs_sbi_session_t *session, + int status, const char *title, const char *detail, + ogs_pkbuf_t *n2smbuf); #ifdef __cplusplus } diff --git a/src/smf/smf-sm.c b/src/smf/smf-sm.c index 5ec4c0023..1356f00b8 100644 --- a/src/smf/smf-sm.c +++ b/src/smf/smf-sm.c @@ -45,6 +45,8 @@ void smf_state_final(ogs_fsm_t *s, smf_event_t *e) void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) { int rv; + const char *api_version = NULL; + ogs_pkbuf_t *recvbuf = NULL; smf_sess_t *sess = NULL; @@ -65,6 +67,10 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) ogs_sbi_subscription_t *subscription = NULL; ogs_sbi_response_t *sbi_response = NULL; ogs_sbi_message_t sbi_message; + ogs_sbi_object_t *sbi_object = NULL; + + ogs_nas_5gs_message_t nas_message; + ogs_pkbuf_t *pkbuf = NULL; smf_sm_debug(e); @@ -133,7 +139,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) case OGS_GTP_CREATE_SESSION_REQUEST_TYPE: if (gtp_message.h.teid == 0) { ogs_expect(!sess); - sess = smf_sess_add_by_message(>p_message); + sess = smf_sess_add_by_gtp_message(>p_message); if (sess) OGS_SETUP_GTP_NODE(sess, gnode); } @@ -264,7 +270,16 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) break; } - if (strcmp(sbi_message.h.api.version, OGS_SBI_API_VERSION) != 0) { + SWITCH(sbi_message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + api_version = OGS_SBI_API_V2; + break; + DEFAULT + api_version = OGS_SBI_API_V1; + END + + ogs_assert(api_version); + if (strcmp(sbi_message.h.api.version, api_version) != 0) { ogs_error("Not supported version [%s]", sbi_message.h.api.version); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, "Not supported version", NULL); @@ -286,7 +301,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) ogs_error("Invalid HTTP method [%s]", sbi_message.h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &sbi_message, "Invalid HTTP method", sbi_message.h.method); END @@ -296,8 +311,76 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) ogs_error("Invalid resource name [%s]", sbi_message.h.resource.component[0]); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &sbi_message, - "Unknown resource name", + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "Invalid resource name", + sbi_message.h.resource.component[0]); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION) + SWITCH(sbi_message.h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_SM_CONTEXTS) + SWITCH(sbi_message.h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + SWITCH(sbi_message.h.resource.component[2]) + CASE(OGS_SBI_RESOURCE_NAME_MODIFY) + CASE(OGS_SBI_RESOURCE_NAME_RELEASE) + if (!sbi_message.h.resource.component[1]) { + ogs_error("No smContextRef [%s]", + sbi_message.h.resource.component[2]); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + "No smContextRef", + sbi_message.h.resource.component[2], NULL); + break; + } + + sess = smf_sess_find_by_sm_context_ref( + sbi_message.h.resource.component[1]); + + if (!sess) { + ogs_error("Not found [%s]", sbi_message.h.method); + smf_sbi_send_sm_context_update_error(session, + OGS_SBI_HTTP_STATUS_NOT_FOUND, + "Not found", sbi_message.h.method, NULL); + } + break; + + DEFAULT + sess = smf_sess_add_by_sbi_message(&sbi_message); + ogs_assert(sess); + END + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", sbi_message.h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "Invalid HTTP method", sbi_message.h.method); + break; + END + + if (sess) { + ogs_assert(OGS_FSM_STATE(&sess->sm)); + + OGS_SETUP_SBI_SESSION(&sess->sbi, session); + + e->sess = sess; + e->sbi.message = &sbi_message; + ogs_fsm_dispatch(&sess->sm, e); + if (OGS_FSM_CHECK(&sess->sm, smf_gsm_state_exception)) { + ogs_error("[%s] State machine exception", sess->supi); + smf_sess_remove(sess); + } + } + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message.h.resource.component[0]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "Invalid resource name", sbi_message.h.resource.component[0]); END break; @@ -305,8 +388,8 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) DEFAULT ogs_error("Invalid API name [%s]", sbi_message.h.service.name); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &sbi_message, - "Invalid API name", sbi_message.h.resource.component[0]); + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &sbi_message, + "Invalid API name", sbi_message.h.service.name); END /* In lib/sbi/server.c, notify_completed() releases 'request' buffer. */ @@ -326,7 +409,16 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) break; } - if (strcmp(sbi_message.h.api.version, OGS_SBI_API_VERSION) != 0) { + SWITCH(sbi_message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + api_version = OGS_SBI_API_V2; + break; + DEFAULT + api_version = OGS_SBI_API_V1; + END + + ogs_assert(api_version); + if (strcmp(sbi_message.h.api.version, api_version) != 0) { ogs_error("Not supported version [%s]", sbi_message.h.api.version); ogs_sbi_message_free(&sbi_message); ogs_sbi_response_free(sbi_response); @@ -392,12 +484,25 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC) SWITCH(sbi_message.h.resource.component[0]) CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) - if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) { - smf_nnrf_handle_nf_discover(&sbi_message); - } else { - ogs_error("HTTP response error : %d", - sbi_message.res_status); - } + sbi_object = e->sbi.data; + ogs_assert(sbi_object); + + SWITCH(sbi_message.h.method) + CASE(OGS_SBI_HTTP_METHOD_GET) + if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) { + ogs_timer_stop(sbi_object->client_wait.timer); + + smf_nnrf_handle_nf_discover(sbi_object, &sbi_message); + } else { + ogs_error("HTTP response error [%d]", + sbi_message.res_status); + } + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", sbi_message.h.method); + ogs_assert_if_reached(); + END break; DEFAULT @@ -407,6 +512,21 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) END break; + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM) + sess = e->sbi.data; + ogs_assert(sess); + ogs_assert(OGS_FSM_STATE(&sess->sm)); + + e->sess = sess; + e->sbi.message = &sbi_message;; + ogs_fsm_dispatch(&sess->sm, e); + if (OGS_FSM_CHECK(&sess->sm, smf_gsm_state_exception)) { + ogs_error("[%s] State machine exception", sess->supi); + smf_sess_remove(sess); + } + break; + DEFAULT ogs_error("Invalid API name [%s]", sbi_message.h.service.name); ogs_assert_if_reached(); @@ -444,12 +564,70 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) smf_self()->nf_type, subscription->nf_instance_id); break; + case SMF_TIMER_SBI_CLIENT_WAIT: + sbi_object = e->sbi.data; + ogs_assert(sbi_object); + session = sbi_object->session; + ogs_assert(session); + + ogs_error("Cannot receive SBI message"); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, + "Cannot receive SBI message", NULL); + break; + default: ogs_error("Unknown timer[%s:%d]", smf_timer_get_name(e->timer_id), e->timer_id); } break; + case SMF_EVT_5GSM_MESSAGE: + sess = e->sess; + ogs_assert(sess); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); + + if (ogs_nas_5gsm_decode(&nas_message, pkbuf) != OGS_OK) { + ogs_error("ogs_nas_5gsm_decode() failed"); + ogs_pkbuf_free(pkbuf); + return; + } + + ogs_assert(sess); + ogs_assert(OGS_FSM_STATE(&sess->sm)); + + sess->pti = nas_message.gsm.h.procedure_transaction_identity; + + e->nas.message = &nas_message; + ogs_fsm_dispatch(&sess->sm, e); + if (OGS_FSM_CHECK(&sess->sm, smf_gsm_state_exception)) { + ogs_error("State machine exception"); + smf_sess_remove(sess); + } + + ogs_pkbuf_free(pkbuf); + break; + + case SMF_EVT_NGAP_MESSAGE: + sess = e->sess; + ogs_assert(sess); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); + ogs_assert(e->ngap.type); + + ogs_assert(sess); + ogs_assert(OGS_FSM_STATE(&sess->sm)); + + ogs_fsm_dispatch(&sess->sm, e); + if (OGS_FSM_CHECK(&sess->sm, smf_gsm_state_exception)) { + ogs_error("State machine exception"); + smf_sess_remove(sess); + } + + ogs_pkbuf_free(pkbuf); + break; + default: ogs_error("No handler for event %s", smf_event_get_name(e)); break; diff --git a/src/smf/smf-sm.h b/src/smf/smf-sm.h index d769a536d..3369ac935 100644 --- a/src/smf/smf-sm.h +++ b/src/smf/smf-sm.h @@ -41,6 +41,11 @@ void smf_nf_state_registered(ogs_fsm_t *s, smf_event_t *e); void smf_nf_state_de_registered(ogs_fsm_t *s, smf_event_t *e); void smf_nf_state_exception(ogs_fsm_t *s, smf_event_t *e); +void smf_gsm_state_initial(ogs_fsm_t *s, smf_event_t *e); +void smf_gsm_state_final(ogs_fsm_t *s, smf_event_t *e); +void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e); +void smf_gsm_state_exception(ogs_fsm_t *s, smf_event_t *e); + void smf_pfcp_state_initial(ogs_fsm_t *s, smf_event_t *e); void smf_pfcp_state_final(ogs_fsm_t *s, smf_event_t *e); void smf_pfcp_state_will_associate(ogs_fsm_t *s, smf_event_t *e); diff --git a/src/smf/timer.c b/src/smf/timer.c index f35f43df7..b40e525a6 100644 --- a/src/smf/timer.c +++ b/src/smf/timer.c @@ -29,7 +29,7 @@ static smf_timer_cfg_t g_smf_timer_cfg[MAX_NUM_OF_SMF_TIMER] = { [SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] = { .duration = ogs_time_from_sec(3) }, [SMF_TIMER_SBI_CLIENT_WAIT] = - { .duration = ogs_time_from_sec(2) }, + { .duration = ogs_time_from_msec(500) }, }; smf_timer_cfg_t *smf_timer_cfg(smf_timer_e id) diff --git a/src/udm/context.c b/src/udm/context.c index 2f1b4fef1..7e5b52771 100644 --- a/src/udm/context.c +++ b/src/udm/context.c @@ -126,7 +126,8 @@ udm_ue_t *udm_ue_add(char *suci) ogs_assert(udm_ue); memset(udm_ue, 0, sizeof *udm_ue); - udm_ue->ctx_id = ogs_msprintf("%ld", ogs_pool_index(&udm_ue_pool, udm_ue)); + udm_ue->ctx_id = ogs_msprintf("%d", + (int)ogs_pool_index(&udm_ue_pool, udm_ue)); ogs_assert(udm_ue->ctx_id); udm_ue->suci = ogs_strdup(suci); @@ -137,7 +138,7 @@ udm_ue_t *udm_ue_add(char *suci) ogs_assert(udm_ue->supi); ogs_hash_set(self.supi_hash, udm_ue->supi, strlen(udm_ue->supi), udm_ue); - udm_ue->sbi_client_wait.timer = ogs_timer_add(udm_self()->timer_mgr, + udm_ue->sbi.client_wait.timer = ogs_timer_add(udm_self()->timer_mgr, udm_timer_sbi_client_wait_expire, udm_ue); e.udm_ue = udm_ue; @@ -152,7 +153,6 @@ udm_ue_t *udm_ue_add(char *suci) void udm_ue_remove(udm_ue_t *udm_ue) { udm_event_t e; - int i; ogs_assert(udm_ue); @@ -162,7 +162,12 @@ void udm_ue_remove(udm_ue_t *udm_ue) ogs_fsm_fini(&udm_ue->sm, &e); ogs_fsm_delete(&udm_ue->sm); - ogs_timer_delete(udm_ue->sbi_client_wait.timer); + /* Free SBI object memory */ + ogs_sbi_object_free(&udm_ue->sbi); + ogs_timer_delete(udm_ue->sbi.client_wait.timer); + OpenAPI_auth_event_free(udm_ue->auth_event); + OpenAPI_amf3_gpp_access_registration_free( + udm_ue->amf_3gpp_access_registration); ogs_assert(udm_ue->ctx_id); ogs_free(udm_ue->ctx_id); @@ -175,20 +180,14 @@ void udm_ue_remove(udm_ue_t *udm_ue) ogs_hash_set(self.supi_hash, udm_ue->supi, strlen(udm_ue->supi), NULL); ogs_free(udm_ue->supi); - if (udm_ue->state.component1) - ogs_free(udm_ue->state.component1); - if (udm_ue->serving_network_name) ogs_free(udm_ue->serving_network_name); if (udm_ue->ausf_instance_id) ogs_free(udm_ue->ausf_instance_id); - if (udm_ue->auth_timestamp) - ogs_free(udm_ue->auth_timestamp); - - for (i = 0; i < OGS_SBI_MAX_NF_TYPE; i++) { - if (udm_ue->nf_types[i].nf_instance) - ogs_sbi_nf_instance_remove(udm_ue->nf_types[i].nf_instance); - } + if (udm_ue->amf_instance_id) + ogs_free(udm_ue->amf_instance_id); + if (udm_ue->dereg_callback_uri) + ogs_free(udm_ue->dereg_callback_uri); ogs_pool_free(&udm_ue_pool, udm_ue); } diff --git a/src/udm/context.h b/src/udm/context.h index 03a5a56f9..0e165b265 100644 --- a/src/udm/context.h +++ b/src/udm/context.h @@ -52,26 +52,26 @@ typedef struct udm_context_s { } udm_context_t; struct udm_ue_s { - ogs_lnode_t lnode; - ogs_fsm_t sm; /* A state machine */ + ogs_sbi_object_t sbi; + ogs_fsm_t sm; - struct { - char *component1; - } state; + OpenAPI_auth_event_t *auth_event; + OpenAPI_amf3_gpp_access_registration_t *amf_3gpp_access_registration; char *ctx_id; char *suci; char *supi; char *serving_network_name; + char *ausf_instance_id; + char *amf_instance_id; + + char *dereg_callback_uri; + + ogs_amf_id_t amf_id; + ogs_plmn_id_t serving_plmn_id; OpenAPI_auth_type_e auth_type; - int auth_success; - char *auth_timestamp; - - struct { - ogs_timer_t *timer; - } sbi_client_wait; #define UDM_NF_INSTANCE_CLEAR(_cAUSE, _nFInstance) \ do { \ @@ -88,10 +88,6 @@ struct udm_ue_s { } \ ogs_sbi_nf_instance_remove(_nFInstance); \ } while(0) - - ogs_sbi_nf_types_t nf_types; - - ogs_sbi_session_t *session; }; void udm_context_init(void); diff --git a/src/udm/nnrf-handler.c b/src/udm/nnrf-handler.c index 28c7fbe74..98785200c 100644 --- a/src/udm/nnrf-handler.c +++ b/src/udm/nnrf-handler.c @@ -217,7 +217,8 @@ bool udm_nnrf_handle_nf_status_notify( return true; } -void udm_nnrf_handle_nf_discover(udm_ue_t *udm_ue, ogs_sbi_message_t *message) +void udm_nnrf_handle_nf_discover( + ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message) { ogs_sbi_nf_instance_t *nf_instance = NULL; ogs_sbi_session_t *session = NULL; @@ -226,8 +227,8 @@ void udm_nnrf_handle_nf_discover(udm_ue_t *udm_ue, ogs_sbi_message_t *message) OpenAPI_lnode_t *node = NULL; bool handled; - ogs_assert(udm_ue); - session = udm_ue->session; + ogs_assert(sbi_object); + session = sbi_object->session; ogs_assert(session); ogs_assert(message); @@ -280,9 +281,9 @@ void udm_nnrf_handle_nf_discover(udm_ue_t *udm_ue, ogs_sbi_message_t *message) udm_sbi_setup_client_callback(nf_instance); if (!OGS_SBI_NF_INSTANCE_GET( - udm_ue->nf_types, nf_instance->nf_type)) - ogs_sbi_nf_types_associate(udm_ue->nf_types, - nf_instance->nf_type, udm_nf_state_registered); + sbi_object->nf_types, nf_instance->nf_type)) + ogs_sbi_nf_types_associate(sbi_object->nf_types, + nf_instance->nf_type, sbi_object->nf_state_registered); /* TIME : Update validity from NRF */ if (SearchResult->validity_period) { @@ -300,26 +301,17 @@ void udm_nnrf_handle_nf_discover(udm_ue_t *udm_ue, ogs_sbi_message_t *message) } } + ogs_assert(sbi_object->nf_type); nf_instance = OGS_SBI_NF_INSTANCE_GET( - udm_ue->nf_types, OpenAPI_nf_type_UDR); + sbi_object->nf_types, sbi_object->nf_type); if (!nf_instance) { - ogs_error("[%s] (NF discover) No UDR", udm_ue->suci); + ogs_error("(NF discover) No [%s]", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_SERVICE_UNAVAILABLE, NULL, - "(NF discover) No UDR", udm_ue->suci); + "(NF discover) No NF", + OpenAPI_nf_type_ToString(sbi_object->nf_type)); } else { - ogs_assert(udm_ue->state.component1); - SWITCH(udm_ue->state.component1) - CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION) - udm_nudr_dr_send_query(udm_ue, nf_instance); - break; - CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS) - udm_nudr_dr_send_update(udm_ue, nf_instance); - break; - DEFAULT - ogs_fatal("[%s] Unknown state [%s]", - udm_ue->suci, udm_ue->state.component1); - ogs_assert_if_reached(); - END + ogs_sbi_send(sbi_object, nf_instance); } } diff --git a/src/udm/nnrf-handler.h b/src/udm/nnrf-handler.h index 6573d82d8..a14a841b9 100644 --- a/src/udm/nnrf-handler.h +++ b/src/udm/nnrf-handler.h @@ -34,7 +34,8 @@ void udm_nnrf_handle_nf_status_subscribe( bool udm_nnrf_handle_nf_status_notify( ogs_sbi_session_t *session, ogs_sbi_message_t *message); -void udm_nnrf_handle_nf_discover(udm_ue_t *udm_ue, ogs_sbi_message_t *message); +void udm_nnrf_handle_nf_discover( + ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message); #ifdef __cplusplus } diff --git a/src/udm/nudm-handler.c b/src/udm/nudm-handler.c index 7218c5009..40ee6aeb9 100644 --- a/src/udm/nudm-handler.c +++ b/src/udm/nudm-handler.c @@ -21,7 +21,7 @@ #include "nnrf-handler.h" #include "nudm-handler.h" -bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg) +bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *message) { ogs_sbi_session_t *session = NULL; @@ -30,16 +30,16 @@ bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg) char *ausf_instance_id = NULL; ogs_assert(udm_ue); - session = udm_ue->session; + session = udm_ue->sbi.session; ogs_assert(session); - ogs_assert(recvmsg); + ogs_assert(message); - AuthenticationInfoRequest = recvmsg->AuthenticationInfoRequest; + AuthenticationInfoRequest = message->AuthenticationInfoRequest; if (!AuthenticationInfoRequest) { ogs_error("[%s] No AuthenticationInfoRequest", udm_ue->suci); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No AuthenticationInfoRequest", udm_ue->suci); + message, "No AuthenticationInfoRequest", udm_ue->suci); return false; } @@ -47,7 +47,7 @@ bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg) if (!AuthenticationInfoRequest) { ogs_error("[%s] No servingNetworkName", udm_ue->suci); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No servingNetworkName", udm_ue->suci); + message, "No servingNetworkName", udm_ue->suci); return false; } @@ -55,55 +55,168 @@ bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg) if (!AuthenticationInfoRequest) { ogs_error("[%s] No ausfInstanceId", udm_ue->suci); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No ausfInstanceId", udm_ue->suci); + message, "No ausfInstanceId", udm_ue->suci); return false; } + if (udm_ue->serving_network_name) + ogs_free(udm_ue->serving_network_name); udm_ue->serving_network_name = ogs_strdup(serving_network_name); - ogs_assert(udm_ue->serving_network_name); - udm_ue->ausf_instance_id = ogs_strdup(ausf_instance_id); - ogs_assert(udm_ue->ausf_instance_id); - udm_nudr_dr_discover_and_send_query(udm_ue); + if (udm_ue->ausf_instance_id) + ogs_free(udm_ue->ausf_instance_id); + udm_ue->ausf_instance_id = ogs_strdup(ausf_instance_id); + + udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, NULL, + udm_nudr_dr_build_query_authentication); return true; } bool udm_nudm_ueau_handle_result_confirmation_inform( + udm_ue_t *udm_ue, ogs_sbi_message_t *message) +{ + ogs_sbi_session_t *session = NULL; + + ogs_assert(udm_ue); + session = udm_ue->sbi.session; + ogs_assert(session); + + ogs_assert(message); + + if (!message->AuthEvent) { + ogs_error("[%s] No AuthEvent", udm_ue->suci); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No AuthEvent", udm_ue->suci); + return false; + } + + udm_ue->auth_event = OpenAPI_auth_event_copy( + udm_ue->auth_event, message->AuthEvent); + + udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, NULL, + udm_nudr_dr_build_update_authentication); + + return true; +} + +bool udm_nudm_uecm_handle_registration( + udm_ue_t *udm_ue, ogs_sbi_message_t *message) +{ + ogs_sbi_session_t *session = NULL; + + OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL; + OpenAPI_guami_t *guami = NULL; + OpenAPI_plmn_id_t *serving_plmn_id = NULL; + + ogs_assert(udm_ue); + session = udm_ue->sbi.session; + ogs_assert(session); + + ogs_assert(message); + + Amf3GppAccessRegistration = message->Amf3GppAccessRegistration; + if (!Amf3GppAccessRegistration) { + ogs_error("[%s] No Amf3GppAccessRegistration", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No Amf3GppAccessRegistration", udm_ue->supi); + return false; + } + + if (!Amf3GppAccessRegistration->dereg_callback_uri) { + ogs_error("[%s] No dregCallbackUri", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No dregCallbackUri", udm_ue->supi); + return false; + } + + guami = Amf3GppAccessRegistration->guami; + if (!guami) { + ogs_error("[%s] No Guami", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No Guami", udm_ue->supi); + return false; + } + + if (!guami->amf_id) { + ogs_error("[%s] No Guami.AmfId", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No Guami.AmfId", udm_ue->supi); + return false; + } + + serving_plmn_id = guami->plmn_id; + if (!serving_plmn_id) { + ogs_error("[%s] No PlmnId", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No PlmnId", udm_ue->supi); + return false; + } + + if (!serving_plmn_id->mnc) { + ogs_error("[%s] No PlmnId.Mnc", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No PlmnId.Mnc", udm_ue->supi); + return false; + } + + if (!serving_plmn_id->mcc) { + ogs_error("[%s] No PlmnId.Mcc", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No PlmnId.Mcc", udm_ue->supi); + return false; + } + + if (udm_ue->dereg_callback_uri) + ogs_free(udm_ue->dereg_callback_uri); + udm_ue->dereg_callback_uri = ogs_strdup( + Amf3GppAccessRegistration->dereg_callback_uri); + + ogs_amf_id_from_string(&udm_ue->amf_id, guami->amf_id); + ogs_plmn_id_build(&udm_ue->serving_plmn_id, + atoi(serving_plmn_id->mcc), atoi(serving_plmn_id->mnc), + strlen(serving_plmn_id->mnc)); + + udm_ue->amf_3gpp_access_registration = + OpenAPI_amf3_gpp_access_registration_copy( + udm_ue->amf_3gpp_access_registration, + message->Amf3GppAccessRegistration); + + udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, NULL, + udm_nudr_dr_build_update_context); + + return true; +} + +bool udm_nudm_sdm_handle_subscription_provisioned( udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg) { ogs_sbi_session_t *session = NULL; - OpenAPI_auth_event_t *AuthEvent = NULL; - char *timestamp = NULL; + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; ogs_assert(udm_ue); - session = udm_ue->session; + session = udm_ue->sbi.session; ogs_assert(session); ogs_assert(recvmsg); - AuthEvent = recvmsg->AuthEvent; - if (!AuthEvent) { - ogs_error("[%s] No AuthEvent", udm_ue->suci); - ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No AuthEvent", udm_ue->suci); + SWITCH(recvmsg->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) + memset(&sendmsg, 0, sizeof(sendmsg)); + + response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + recvmsg->h.resource.component[3]); return false; - } - - timestamp = AuthEvent->time_stamp; - if (!AuthEvent) { - ogs_error("[%s] No timeStamp", udm_ue->suci); - ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No timeStamp", udm_ue->suci); - return false; - } - - udm_ue->auth_success = AuthEvent->success; - udm_ue->auth_timestamp = ogs_strdup(timestamp); - ogs_assert(udm_ue->auth_timestamp); - - udm_nudr_dr_discover_and_send_update(udm_ue); + END return true; } diff --git a/src/udm/nudm-handler.h b/src/udm/nudm-handler.h index 6f2e08634..8b88cfe71 100644 --- a/src/udm/nudm-handler.h +++ b/src/udm/nudm-handler.h @@ -26,8 +26,14 @@ extern "C" { #endif -bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg); +bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *message); bool udm_nudm_ueau_handle_result_confirmation_inform( + udm_ue_t *udm_ue, ogs_sbi_message_t *message); + +bool udm_nudm_uecm_handle_registration( + udm_ue_t *udm_ue, ogs_sbi_message_t *message); + +bool udm_nudm_sdm_handle_subscription_provisioned( udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg); #ifdef __cplusplus diff --git a/src/udm/nudr-build.c b/src/udm/nudr-build.c index a362eebd9..0530f1e36 100644 --- a/src/udm/nudr-build.c +++ b/src/udm/nudr-build.c @@ -19,7 +19,8 @@ #include "nudr-build.h" -ogs_sbi_request_t *udm_nudr_dr_build_query(udm_ue_t *udm_ue) +ogs_sbi_request_t *udm_nudr_dr_build_query_authentication( + udm_ue_t *udm_ue, void *data) { ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; @@ -29,7 +30,7 @@ ogs_sbi_request_t *udm_nudr_dr_build_query(udm_ue_t *udm_ue) memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDR_DR; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA; message.h.resource.component[1] = udm_ue->supi; @@ -44,19 +45,19 @@ ogs_sbi_request_t *udm_nudr_dr_build_query(udm_ue_t *udm_ue) return request; } -ogs_sbi_request_t *udm_nudr_dr_build_update(udm_ue_t *udm_ue) +ogs_sbi_request_t *udm_nudr_dr_build_update_authentication( + udm_ue_t *udm_ue, void *data) { ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; - OpenAPI_auth_event_t *AuthEvent = NULL; - ogs_assert(udm_ue); + ogs_assert(udm_ue->auth_event); memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDR_DR; - message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA; message.h.resource.component[1] = udm_ue->supi; @@ -65,21 +66,92 @@ ogs_sbi_request_t *udm_nudr_dr_build_update(udm_ue_t *udm_ue) message.h.resource.component[3] = (char *)OGS_SBI_RESOURCE_NAME_AUTHENTICATION_STATUS; - AuthEvent = ogs_calloc(1, sizeof(*AuthEvent)); - ogs_assert(AuthEvent); - - AuthEvent->nf_instance_id = udm_ue->ausf_instance_id; - AuthEvent->success = udm_ue->auth_success; - AuthEvent->auth_type = udm_ue->auth_type; - AuthEvent->serving_network_name = udm_ue->serving_network_name; - AuthEvent->time_stamp = udm_ue->auth_timestamp; - - message.AuthEvent = AuthEvent; + message.AuthEvent = OpenAPI_auth_event_copy( + message.AuthEvent, udm_ue->auth_event); request = ogs_sbi_build_request(&message); ogs_assert(request); - ogs_free(AuthEvent); + OpenAPI_auth_event_free(message.AuthEvent); + + return request; +} + +ogs_sbi_request_t *udm_nudr_dr_build_update_context( + udm_ue_t *udm_ue, void *data) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + ogs_assert(udm_ue); + ogs_assert(udm_ue->amf_3gpp_access_registration); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDR_DR; + message.h.api.version = (char *)OGS_SBI_API_V1; + message.h.resource.component[0] = + (char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA; + message.h.resource.component[1] = udm_ue->supi; + message.h.resource.component[2] = + (char *)OGS_SBI_RESOURCE_NAME_CONTEXT_DATA; + message.h.resource.component[3] = + (char *)OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS; + + message.Amf3GppAccessRegistration = + OpenAPI_amf3_gpp_access_registration_copy( + message.Amf3GppAccessRegistration, + udm_ue->amf_3gpp_access_registration); + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + OpenAPI_amf3_gpp_access_registration_free( + message.Amf3GppAccessRegistration); + + return request; +} + +ogs_sbi_request_t *udm_nudr_dr_build_query_provisioned( + udm_ue_t *udm_ue, void *data) +{ + char buf[OGS_PLMNIDSTRLEN]; + + ogs_sbi_message_t *recvmsg = NULL; + ogs_sbi_message_t sendmsg; + ogs_sbi_request_t *request = NULL; + + ogs_assert(udm_ue); + recvmsg = data; + ogs_assert(recvmsg); + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; + sendmsg.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDR_DR; + sendmsg.h.api.version = (char *)OGS_SBI_API_V1; + sendmsg.h.resource.component[0] = + (char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA; + sendmsg.h.resource.component[1] = udm_ue->supi; + sendmsg.h.resource.component[2] = + (char *)ogs_plmn_id_to_string(&udm_ue->serving_plmn_id, buf); + sendmsg.h.resource.component[3] = + (char *)OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA; + sendmsg.h.resource.component[4] = recvmsg->h.resource.component[1]; + + SWITCH(recvmsg->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) + if (recvmsg->param.dnn) + sendmsg.param.dnn = recvmsg->param.dnn; + if (recvmsg->param.s_nssai_presence) { + sendmsg.param.s_nssai_presence = true; + memcpy(&sendmsg.param.s_nssai, + &recvmsg->param.s_nssai, sizeof(recvmsg->param.s_nssai)); + } + DEFAULT + END + + request = ogs_sbi_build_request(&sendmsg); + ogs_assert(request); return request; } diff --git a/src/udm/nudr-build.h b/src/udm/nudr-build.h index 20f25f66a..9d0516762 100644 --- a/src/udm/nudr-build.h +++ b/src/udm/nudr-build.h @@ -26,8 +26,14 @@ extern "C" { #endif -ogs_sbi_request_t *udm_nudr_dr_build_query(udm_ue_t *udm_ue); -ogs_sbi_request_t *udm_nudr_dr_build_update(udm_ue_t *udm_ue); +ogs_sbi_request_t *udm_nudr_dr_build_query_authentication( + udm_ue_t *udm_ue, void *data); +ogs_sbi_request_t *udm_nudr_dr_build_query_provisioned( + udm_ue_t *udm_ue, void *data); +ogs_sbi_request_t *udm_nudr_dr_build_update_authentication( + udm_ue_t *udm_ue, void *data); +ogs_sbi_request_t *udm_nudr_dr_build_update_context( + udm_ue_t *udm_ue, void *data); #ifdef __cplusplus } diff --git a/src/udm/nudr-handler.c b/src/udm/nudr-handler.c index 60e0467b8..f24983775 100644 --- a/src/udm/nudr-handler.c +++ b/src/udm/nudr-handler.c @@ -30,7 +30,8 @@ bool udm_nudr_dr_handle_subscription_authentication( ogs_sbi_response_t *response = NULL; #if 0 - const char *tmp = "4d45b0eeb8386b629f136968837a7b0b"; /* For test */ + const char *tmp = "de8ca9df474091fe4e9263c5daa907e9"; + const char *tmp = "cc3766b98a8031a7286a68c7f577ed2e"; /* For test */ #endif uint8_t k[OGS_KEY_LEN]; uint8_t opc[OGS_KEY_LEN]; @@ -54,10 +55,9 @@ bool udm_nudr_dr_handle_subscription_authentication( OpenAPI_authentication_subscription_t *AuthenticationSubscription = NULL; OpenAPI_authentication_info_result_t AuthenticationInfoResult; OpenAPI_authentication_vector_t AuthenticationVector; - OpenAPI_auth_event_t *AuthEvent = NULL; ogs_assert(udm_ue); - session = udm_ue->session; + session = udm_ue->sbi.session; ogs_assert(session); server = ogs_sbi_session_get_server(session); ogs_assert(server); @@ -212,37 +212,27 @@ bool udm_nudr_dr_handle_subscription_authentication( return true; CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_STATUS) - memset(&sendmsg, 0, sizeof(sendmsg)); - AuthEvent = ogs_calloc(1, sizeof(*AuthEvent)); - ogs_assert(AuthEvent); - - AuthEvent->nf_instance_id = udm_ue->ausf_instance_id; - AuthEvent->success = udm_ue->auth_success; - AuthEvent->auth_type = udm_ue->auth_type; - AuthEvent->serving_network_name = udm_ue->serving_network_name; - AuthEvent->time_stamp = udm_ue->auth_timestamp; - - sendmsg.AuthEvent = AuthEvent; - memset(&header, 0, sizeof(header)); header.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_UEAU; - header.api.version = (char *)OGS_SBI_API_VERSION; + header.api.version = (char *)OGS_SBI_API_V1; header.resource.component[0] = udm_ue->supi; header.resource.component[1] = (char *)OGS_SBI_RESOURCE_NAME_AUTH_EVENTS; header.resource.component[2] = udm_ue->ctx_id; sendmsg.http.location = ogs_sbi_server_uri(server, &header); + sendmsg.AuthEvent = OpenAPI_auth_event_copy( + sendmsg.AuthEvent, udm_ue->auth_event); response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_CREATED); ogs_assert(response); ogs_sbi_server_send_response(session, response); - ogs_free(AuthEvent); ogs_free(sendmsg.http.location); + OpenAPI_auth_event_free(sendmsg.AuthEvent); return true; @@ -253,3 +243,156 @@ bool udm_nudr_dr_handle_subscription_authentication( return false; } + +bool udm_nudr_dr_handle_subscription_context( + udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg) +{ + ogs_sbi_server_t *server = NULL; + ogs_sbi_session_t *session = NULL; + + ogs_sbi_message_t sendmsg; + ogs_sbi_header_t header; + ogs_sbi_response_t *response = NULL; + + int status; + + OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL; + + ogs_assert(udm_ue); + session = udm_ue->sbi.session; + ogs_assert(session); + server = ogs_sbi_session_get_server(session); + ogs_assert(server); + + ogs_assert(recvmsg); + + SWITCH(recvmsg->h.resource.component[3]) + CASE(OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS) + Amf3GppAccessRegistration = udm_ue->amf_3gpp_access_registration; + if (!Amf3GppAccessRegistration) { + ogs_error("[%s] No Amf3GppAccessRegistration", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No Amf3GppAccessRegistration", udm_ue->supi); + return false; + } + + if (!Amf3GppAccessRegistration->amf_instance_id) { + ogs_error("[%s] No amfInstanceId", udm_ue->supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No amfInstanceId", udm_ue->supi); + return false; + } + + memset(&sendmsg, 0, sizeof(sendmsg)); + + memset(&header, 0, sizeof(header)); + header.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_UECM; + header.api.version = (char *)OGS_SBI_API_V1; + header.resource.component[0] = udm_ue->supi; + header.resource.component[1] = + (char *)OGS_SBI_RESOURCE_NAME_REGISTRATIONS; + header.resource.component[2] = + (char *)OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS; + + if (udm_ue->amf_instance_id && + strcmp(udm_ue->amf_instance_id, + Amf3GppAccessRegistration->amf_instance_id) == 0) + status = OGS_SBI_HTTP_STATUS_OK; + else + status = OGS_SBI_HTTP_STATUS_CREATED; + + if (status == OGS_SBI_HTTP_STATUS_CREATED) + sendmsg.http.location = ogs_sbi_server_uri(server, &header); + + sendmsg.Amf3GppAccessRegistration = + OpenAPI_amf3_gpp_access_registration_copy( + sendmsg.Amf3GppAccessRegistration, + udm_ue->amf_3gpp_access_registration); + + response = ogs_sbi_build_response(&sendmsg, status); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + ogs_free(sendmsg.http.location); + OpenAPI_amf3_gpp_access_registration_free( + sendmsg.Amf3GppAccessRegistration); + return true; + + DEFAULT + ogs_error("Invalid resource name [%s]", + recvmsg->h.resource.component[3]); + END + + return false; +} + +bool udm_nudr_dr_handle_subscription_provisioned( + udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg) +{ + ogs_sbi_server_t *server = NULL; + ogs_sbi_session_t *session = NULL; + + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + + ogs_assert(udm_ue); + session = udm_ue->sbi.session; + ogs_assert(session); + server = ogs_sbi_session_get_server(session); + ogs_assert(server); + + ogs_assert(recvmsg); + + SWITCH(recvmsg->h.resource.component[4]) + CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) + memset(&sendmsg, 0, sizeof(sendmsg)); + + if (recvmsg->AccessAndMobilitySubscriptionData) + sendmsg.AccessAndMobilitySubscriptionData = + OpenAPI_access_and_mobility_subscription_data_copy( + sendmsg.AccessAndMobilitySubscriptionData, + recvmsg->AccessAndMobilitySubscriptionData); + + response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + OpenAPI_access_and_mobility_subscription_data_free( + sendmsg.AccessAndMobilitySubscriptionData); + break; + + CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) + memset(&sendmsg, 0, sizeof(sendmsg)); + + response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + break; + + CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) + memset(&sendmsg, 0, sizeof(sendmsg)); + + if (recvmsg->SessionManagementSubscriptionData) + sendmsg.SessionManagementSubscriptionData = + OpenAPI_session_management_subscription_data_copy( + sendmsg.SessionManagementSubscriptionData, + recvmsg->SessionManagementSubscriptionData); + + response = ogs_sbi_build_response(&sendmsg, recvmsg->res_status); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + OpenAPI_session_management_subscription_data_free( + sendmsg.SessionManagementSubscriptionData); + + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + recvmsg->h.resource.component[3]); + return false; + END + + return true; +} diff --git a/src/udm/nudr-handler.h b/src/udm/nudr-handler.h index 5d0093c45..3ba802834 100644 --- a/src/udm/nudr-handler.h +++ b/src/udm/nudr-handler.h @@ -28,6 +28,10 @@ extern "C" { bool udm_nudr_dr_handle_subscription_authentication( udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg); +bool udm_nudr_dr_handle_subscription_context( + udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg); +bool udm_nudr_dr_handle_subscription_provisioned( + udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg); #ifdef __cplusplus } diff --git a/src/udm/sbi-path.c b/src/udm/sbi-path.c index 9697b09ae..29ce90a7b 100644 --- a/src/udm/sbi-path.c +++ b/src/udm/sbi-path.c @@ -81,8 +81,18 @@ int udm_sbi_open(void) service = ogs_sbi_nf_service_build_default(nf_instance, (char*)OGS_SBI_SERVICE_NAME_NUDM_UEAU); ogs_assert(service); - ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_VERSION, - (char*)OGS_SBI_API_FULL_VERSION, NULL); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1, + (char*)OGS_SBI_API_V1_0_0, NULL); + service = ogs_sbi_nf_service_build_default(nf_instance, + (char*)OGS_SBI_SERVICE_NAME_NUDM_UECM); + ogs_assert(service); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1, + (char*)OGS_SBI_API_V1_0_0, NULL); + service = ogs_sbi_nf_service_build_default(nf_instance, + (char*)OGS_SBI_SERVICE_NAME_NUDM_SDM); + ogs_assert(service); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V2, + (char*)OGS_SBI_API_V2_0_0, NULL); udm_nf_fsm_init(nf_instance); udm_sbi_setup_client_callback(nf_instance); @@ -114,116 +124,25 @@ void udm_sbi_setup_client_callback(ogs_sbi_nf_instance_t *nf_instance) } } -static ogs_sbi_nf_instance_t *find_or_discover_nf_instance( - udm_ue_t *udm_ue, OpenAPI_nf_type_e nf_type) +void udm_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, udm_ue_t *udm_ue, void *data, + ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data)) { ogs_sbi_session_t *session = NULL; - bool nrf = true; - bool nf = true; ogs_assert(udm_ue); - session = udm_ue->session; - ogs_assert(session); + session = udm_ue->sbi.session; ogs_assert(nf_type); + ogs_assert(build); - if (!OGS_SBI_NF_INSTANCE_GET(udm_ue->nf_types, OpenAPI_nf_type_NRF)) - nrf = ogs_sbi_nf_types_associate( - udm_ue->nf_types, OpenAPI_nf_type_NRF, udm_nf_state_registered); - if (!OGS_SBI_NF_INSTANCE_GET(udm_ue->nf_types, nf_type)) - nf = ogs_sbi_nf_types_associate( - udm_ue->nf_types, nf_type, udm_nf_state_registered); - - if (nrf == false && nf == false) { - ogs_error("[%s] Cannot discover UDR", udm_ue->suci); + udm_ue->sbi.nf_state_registered = udm_nf_state_registered; + udm_ue->sbi.client_wait.duration = + udm_timer_cfg(UDM_TIMER_SBI_CLIENT_WAIT)->duration; + if (ogs_sbi_discover_and_send( + nf_type, &udm_ue->sbi, data, (ogs_sbi_build_f)build) != true) { ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_SERVICE_UNAVAILABLE, NULL, - "Cannot discover UDR", udm_ue->suci); - - return NULL; + OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, + "Cannot discover", udm_ue->suci); } - - if (nf == false) { - ogs_warn("[%s] Try to discover UDR", udm_ue->suci); - ogs_timer_start(udm_ue->sbi_client_wait.timer, - udm_timer_cfg(UDM_TIMER_SBI_CLIENT_WAIT)->duration); - - ogs_nnrf_disc_send_nf_discover( - udm_ue->nf_types[OpenAPI_nf_type_NRF].nf_instance, - nf_type, OpenAPI_nf_type_UDM, udm_ue); - - return NULL; - } - - return udm_ue->nf_types[nf_type].nf_instance; -} - -void udm_nudr_dr_send_query( - udm_ue_t *udm_ue, ogs_sbi_nf_instance_t *nf_instance) -{ - ogs_sbi_request_t *request = NULL; - ogs_sbi_client_t *client = NULL; - - ogs_assert(udm_ue); - ogs_assert(nf_instance); - - client = ogs_sbi_client_find_by_service_name( - nf_instance, (char *)OGS_SBI_SERVICE_NAME_NUDR_DR); - ogs_assert(client); - - ogs_timer_start(udm_ue->sbi_client_wait.timer, - udm_timer_cfg(UDM_TIMER_SBI_CLIENT_WAIT)->duration); - - request = udm_nudr_dr_build_query(udm_ue); - ogs_assert(request); - ogs_sbi_client_send_request(client, request, udm_ue); -} - -void udm_nudr_dr_discover_and_send_query(udm_ue_t *udm_ue) -{ - ogs_sbi_nf_instance_t *nf_instance = NULL; - - ogs_assert(udm_ue); - - if (!nf_instance) - nf_instance = find_or_discover_nf_instance(udm_ue, OpenAPI_nf_type_UDR); - - if (!nf_instance) return; - - udm_nudr_dr_send_query(udm_ue, nf_instance); -} - -void udm_nudr_dr_send_update( - udm_ue_t *udm_ue, ogs_sbi_nf_instance_t *nf_instance) -{ - ogs_sbi_request_t *request = NULL; - ogs_sbi_client_t *client = NULL; - - ogs_assert(udm_ue); - ogs_assert(nf_instance); - - client = ogs_sbi_client_find_by_service_name( - nf_instance, (char *)OGS_SBI_SERVICE_NAME_NUDR_DR); - ogs_assert(client); - - ogs_timer_start(udm_ue->sbi_client_wait.timer, - udm_timer_cfg(UDM_TIMER_SBI_CLIENT_WAIT)->duration); - - request = udm_nudr_dr_build_update(udm_ue); - ogs_assert(request); - ogs_sbi_client_send_request(client, request, udm_ue); -} - -void udm_nudr_dr_discover_and_send_update(udm_ue_t *udm_ue) -{ - ogs_sbi_nf_instance_t *nf_instance = NULL; - - ogs_assert(udm_ue); - - if (!nf_instance) - nf_instance = find_or_discover_nf_instance(udm_ue, OpenAPI_nf_type_UDR); - - if (!nf_instance) return; - - udm_nudr_dr_send_update(udm_ue, nf_instance); } diff --git a/src/udm/sbi-path.h b/src/udm/sbi-path.h index 710448380..7faeb5b46 100644 --- a/src/udm/sbi-path.h +++ b/src/udm/sbi-path.h @@ -33,13 +33,9 @@ void udm_sbi_close(void); void udm_sbi_setup_client_callback(ogs_sbi_nf_instance_t *nf_instance); -void udm_nudr_dr_send_query( - udm_ue_t *udm_ue, ogs_sbi_nf_instance_t *nf_instance); -void udm_nudr_dr_discover_and_send_query(udm_ue_t *udm_ue); - -void udm_nudr_dr_send_update( - udm_ue_t *udm_ue, ogs_sbi_nf_instance_t *nf_instance); -void udm_nudr_dr_discover_and_send_update(udm_ue_t *udm_ue); +void udm_sbi_discover_and_send( + OpenAPI_nf_type_e nf_type, udm_ue_t *udm_ue, void *data, + ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data)); #ifdef __cplusplus } diff --git a/src/udm/timer.c b/src/udm/timer.c index d9b032e6f..606ab2fb3 100644 --- a/src/udm/timer.c +++ b/src/udm/timer.c @@ -23,7 +23,7 @@ static udm_timer_cfg_t g_udm_timer_cfg[MAX_NUM_OF_UDM_TIMER] = { [UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] = { .duration = ogs_time_from_sec(3) }, [UDM_TIMER_SBI_CLIENT_WAIT] = - { .duration = ogs_time_from_sec(2) }, + { .duration = ogs_time_from_msec(500) }, }; udm_timer_cfg_t *udm_timer_cfg(udm_timer_e id) diff --git a/src/udm/udm-sm.c b/src/udm/udm-sm.c index f68a69555..e612b8aa4 100644 --- a/src/udm/udm-sm.c +++ b/src/udm/udm-sm.c @@ -37,6 +37,7 @@ void udm_state_final(ogs_fsm_t *s, udm_event_t *e) void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) { int rv; + const char *api_version = NULL; ogs_sbi_session_t *session = NULL; ogs_sbi_request_t *request = NULL; @@ -45,6 +46,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) ogs_sbi_subscription_t *subscription = NULL; ogs_sbi_response_t *response = NULL; ogs_sbi_message_t message; + ogs_sbi_object_t *sbi_object = NULL; udm_ue_t *udm_ue = NULL; @@ -80,7 +82,15 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) break; } - if (strcmp(message.h.api.version, OGS_SBI_API_VERSION) != 0) { + SWITCH(message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + api_version = OGS_SBI_API_V2; + break; + DEFAULT + api_version = OGS_SBI_API_V1; + END + + if (strcmp(message.h.api.version, api_version) != 0) { ogs_error("Not supported version [%s]", message.h.api.version); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Not supported version", NULL); @@ -102,8 +112,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) ogs_error("Invalid HTTP method [%s]", message.h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, - &message, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &message, "Invalid HTTP method", message.h.method); END break; @@ -112,13 +121,15 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) ogs_error("Invalid resource name [%s]", message.h.resource.component[0]); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Unknown resource name", message.h.resource.component[0]); END break; CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU) + CASE(OGS_SBI_SERVICE_NAME_NUDM_UECM) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) if (!message.h.resource.component[0]) { ogs_error("Not found [%s]", message.h.method); ogs_sbi_server_send_error(session, @@ -130,7 +141,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) if (!message.h.resource.component[1]) { ogs_error("Invalid resource name [%s]", message.h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Invalid resource name", message.h.method); break; } @@ -160,12 +171,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) ogs_assert(OGS_FSM_STATE(&udm_ue->sm)); - OGS_SETUP_SBI_SESSION(udm_ue, session); - - if (udm_ue->state.component1) - ogs_free(udm_ue->state.component1); - udm_ue->state.component1 = ogs_strdup( - message.h.resource.component[1]); + OGS_SETUP_SBI_SESSION(&udm_ue->sbi, session); e->udm_ue = udm_ue; e->sbi.message = &message; @@ -179,8 +185,8 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) DEFAULT ogs_error("Invalid API name [%s]", message.h.service.name); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, - "Invalid API name", message.h.resource.component[0]); + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, + "Invalid API name", message.h.service.name); END /* In lib/sbi/server.c, notify_completed() releases 'request' buffer. */ @@ -200,7 +206,15 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) break; } - if (strcmp(message.h.api.version, OGS_SBI_API_VERSION) != 0) { + SWITCH(message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + api_version = OGS_SBI_API_V2; + break; + DEFAULT + api_version = OGS_SBI_API_V1; + END + + if (strcmp(message.h.api.version, api_version) != 0) { ogs_error("Not supported version [%s]", message.h.api.version); ogs_sbi_message_free(&message); ogs_sbi_response_free(response); @@ -267,24 +281,23 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC) SWITCH(message.h.resource.component[0]) CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) - udm_ue = e->sbi.data; - ogs_assert(udm_ue); + sbi_object = e->sbi.data; + ogs_assert(sbi_object); SWITCH(message.h.method) CASE(OGS_SBI_HTTP_METHOD_GET) if (message.res_status == OGS_SBI_HTTP_STATUS_OK) { - ogs_timer_stop(udm_ue->sbi_client_wait.timer); + ogs_timer_stop(sbi_object->client_wait.timer); - udm_nnrf_handle_nf_discover(udm_ue, &message); + udm_nnrf_handle_nf_discover(sbi_object, &message); } else { - ogs_error("[%s] HTTP response error [%d]", - udm_ue->suci, message.res_status); + ogs_error("HTTP response error [%d]", + message.res_status); } break; DEFAULT - ogs_error("[%s] Invalid HTTP method [%s]", - udm_ue->suci, message.h.method); + ogs_error("Invalid HTTP method [%s]", message.h.method); ogs_assert_if_reached(); END break; @@ -357,15 +370,15 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e) break; case UDM_TIMER_SBI_CLIENT_WAIT: - udm_ue = e->sbi.data; - ogs_assert(udm_ue); - session = udm_ue->session; + sbi_object = e->sbi.data; + ogs_assert(sbi_object); + session = sbi_object->session; ogs_assert(session); - ogs_error("[%s] Cannot receive SBI message", udm_ue->suci); + ogs_error("Cannot receive SBI message"); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, - "Cannot receive SBI message", udm_ue->suci); + "Cannot receive SBI message", NULL); break; default: diff --git a/src/udm/ue-sm.c b/src/udm/ue-sm.c index 819baba28..1a40d9cfe 100644 --- a/src/udm/ue-sm.c +++ b/src/udm/ue-sm.c @@ -35,6 +35,7 @@ void udm_ue_state_final(ogs_fsm_t *s, udm_event_t *e) void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e) { + bool handled; udm_ue_t *udm_ue = NULL; ogs_sbi_session_t *session = NULL; @@ -61,30 +62,99 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e) session = e->sbi.session; ogs_assert(session); - SWITCH(message->h.method) - CASE(OGS_SBI_HTTP_METHOD_POST) - SWITCH(message->h.resource.component[1]) - CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION) - udm_nudm_ueau_handle_get(udm_ue, message); - break; - CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS) - udm_nudm_ueau_handle_result_confirmation_inform( - udm_ue, message); + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU) + SWITCH(message->h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + SWITCH(message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION) + udm_nudm_ueau_handle_get(udm_ue, message); + break; + CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS) + udm_nudm_ueau_handle_result_confirmation_inform( + udm_ue, message); + break; + DEFAULT + ogs_error("[%s] Invalid resource name [%s]", + udm_ue->suci, message->h.resource.component[1]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, message, + "Invalid resource name", message->h.method); + END break; + DEFAULT - ogs_error("[%s] Invalid resource name [%s]", - udm_ue->suci, message->h.resource.component[1]); + ogs_error("[%s] Invalid HTTP method [%s]", + udm_ue->suci, message->h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + OGS_SBI_HTTP_STATUS_FORBIDDEN, message, "Invalid HTTP method", message->h.method); END break; + + CASE(OGS_SBI_SERVICE_NAME_NUDM_UECM) + SWITCH(message->h.method) + CASE(OGS_SBI_HTTP_METHOD_PUT) + SWITCH(message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS) + udm_nudm_uecm_handle_registration(udm_ue, message); + break; + + DEFAULT + ogs_error("[%s] Invalid resource name [%s]", + udm_ue->suci, message->h.resource.component[1]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, message, + "Invalid HTTP method", message->h.method); + END + break; + DEFAULT + ogs_error("[%s] Invalid HTTP method [%s]", + udm_ue->suci, message->h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_FORBIDDEN, message, + "Invalid HTTP method", message->h.method); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + SWITCH(message->h.method) + CASE(OGS_SBI_HTTP_METHOD_GET) + SWITCH(message->h.resource.component[1]) + CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) + CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) + CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) + udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, + message, udm_nudr_dr_build_query_provisioned); + break; + + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) + udm_nudm_sdm_handle_subscription_provisioned( + udm_ue, message); + break; + + DEFAULT + ogs_error("[%s] Invalid resource name [%s]", + udm_ue->suci, message->h.resource.component[1]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, message, + "Invalid resource name", message->h.method); + END + break; + DEFAULT + ogs_error("[%s] Invalid HTTP method [%s]", + udm_ue->supi, message->h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_NOT_FOUND, message, + "Invalid HTTP method", message->h.method); + END + break; + DEFAULT - ogs_error("[%s] Invalid HTTP method [%s]", - udm_ue->suci, message->h.method); + ogs_error("Invalid API name [%s]", message->h.service.name); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, - "Invalid HTTP method", message->h.method); + OGS_SBI_HTTP_STATUS_BAD_REQUEST, message, + "Invalid API name", message->h.service.name); END break; @@ -93,17 +163,17 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e) ogs_assert(message); udm_ue = e->sbi.data; ogs_assert(udm_ue); - session = udm_ue->session; + session = udm_ue->sbi.session; ogs_assert(session); + ogs_timer_stop(udm_ue->sbi.client_wait.timer); + SWITCH(message->h.service.name) CASE(OGS_SBI_SERVICE_NAME_NUDR_DR) SWITCH(message->h.resource.component[0]) CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA) SWITCH(message->h.resource.component[2]) CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_DATA) - ogs_timer_stop(udm_ue->sbi_client_wait.timer); - if (message->res_status != OGS_SBI_HTTP_STATUS_OK && message->res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT) { ogs_error("[%s] HTTP response error [%d]", @@ -118,10 +188,36 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e) udm_ue, message); break; + CASE(OGS_SBI_RESOURCE_NAME_CONTEXT_DATA) + if (message->res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT) { + ogs_error("[%s] HTTP response error [%d]", + udm_ue->suci, message->res_status); + ogs_sbi_server_send_error( + session, message->res_status, + NULL, "HTTP response error", udm_ue->suci); + break; + } + + udm_nudr_dr_handle_subscription_context(udm_ue, message); + break; + DEFAULT - ogs_error("Invalid resource name [%s]", - message->h.resource.component[2]); - ogs_assert_if_reached(); + SWITCH(message->h.resource.component[3]) + CASE(OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA) + handled = udm_nudr_dr_handle_subscription_provisioned( + udm_ue, message); + if (!handled) { + ogs_sbi_server_send_error( + session, message->res_status, + NULL, "HTTP response error", udm_ue->suci); + } + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message->h.resource.component[2]); + ogs_assert_if_reached(); + END END break; DEFAULT @@ -134,7 +230,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e) DEFAULT ogs_error("Invalid API name [%s]", message->h.service.name); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, message, "Invalid API name", message->h.resource.component[0]); END break; diff --git a/src/udr/nudr-handler.c b/src/udr/nudr-handler.c index 856cfa25f..11a214884 100644 --- a/src/udr/nudr-handler.c +++ b/src/udr/nudr-handler.c @@ -30,15 +30,13 @@ bool udr_nudr_dr_handle_subscription_authentication( ogs_sbi_response_t *response = NULL; ogs_dbi_auth_info_t auth_info; - const char *id_type = NULL; - const char *ue_id = NULL; - char k_string[OGS_KEYSTRLEN(OGS_KEY_LEN)]; char opc_string[OGS_KEYSTRLEN(OGS_KEY_LEN)]; char amf_string[OGS_KEYSTRLEN(OGS_AMF_LEN)]; char sqn_string[OGS_KEYSTRLEN(OGS_SQN_LEN)]; char sqn[OGS_SQN_LEN]; + char *supi = NULL; OpenAPI_authentication_subscription_t AuthenticationSubscription; OpenAPI_sequence_number_t SequenceNumber; @@ -47,31 +45,27 @@ bool udr_nudr_dr_handle_subscription_authentication( ogs_assert(session); ogs_assert(recvmsg); - if (!recvmsg->h.resource.component[1]) { - ogs_error("No ueId"); + supi = recvmsg->h.resource.component[1]; + if (!supi) { + ogs_error("No SUPI"); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No ueId", NULL); + recvmsg, "No SUPI", NULL); return false; } - if (strncmp(recvmsg->h.resource.component[1], - OGS_DBI_UE_ID_TYPE_IMSI, strlen(OGS_DBI_UE_ID_TYPE_IMSI)) == 0) { - id_type = OGS_DBI_UE_ID_TYPE_IMSI; - ue_id = recvmsg->h.resource.component[1] + - strlen(OGS_DBI_UE_ID_TYPE_IMSI) + 1; - } else { - ogs_error("Unknown ueId Type"); + if (strncmp(supi, + OGS_DBI_SUPI_TYPE_IMSI, strlen(OGS_DBI_SUPI_TYPE_IMSI)) != 0) { + ogs_error("[%s] Unknown SUPI Type", supi); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN, - recvmsg, "Unknwon ueId Type", NULL); + recvmsg, "Unknwon SUPI Type", supi); return false; } - rv = ogs_dbi_auth_info(id_type, ue_id, &auth_info); + rv = ogs_dbi_auth_info(supi, &auth_info); if (rv != OGS_OK) { - ogs_fatal("Cannot find IMSI in DB : %s-%s", id_type, ue_id); - ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_NOT_FOUND, - recvmsg, "Unknwon ueId Type", ue_id); + ogs_fatal("[%s] Cannot find SUPI in DB", supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_NOT_FOUND, + recvmsg, "Cannot find SUPI Type", supi); return false; } @@ -135,20 +129,20 @@ bool udr_nudr_dr_handle_subscription_authentication( CASE(OGS_SBI_HTTP_METHOD_PUT) AuthEvent = recvmsg->AuthEvent; if (!AuthEvent) { - ogs_error("[%s-%s] No AuthEvent", id_type, ue_id); + ogs_error("[%s] No AuthEvent", supi); ogs_sbi_server_send_error( session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No AuthEvent", ue_id); + recvmsg, "No AuthEvent", supi); return false; } memset(&sendmsg, 0, sizeof(sendmsg)); - rv = ogs_dbi_increment_sqn(id_type, ue_id); + rv = ogs_dbi_increment_sqn(supi); if (rv != OGS_OK) { - ogs_fatal("Cannot increment SQN : %s-%s", id_type, ue_id); + ogs_fatal("[%s] Cannot increment SQN", supi); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, - recvmsg, "Cannot increment SQN", ue_id); + recvmsg, "Cannot increment SQN", supi); return false; } @@ -178,3 +172,423 @@ bool udr_nudr_dr_handle_subscription_authentication( return false; } + +bool udr_nudr_dr_handle_subscription_context( + ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg) +{ + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + + char *supi = NULL; + + ogs_assert(session); + ogs_assert(recvmsg); + + supi = recvmsg->h.resource.component[1]; + if (!supi) { + ogs_error("No SUPI"); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No SUPI", NULL); + return false; + } + + if (strncmp(supi, + OGS_DBI_SUPI_TYPE_IMSI, strlen(OGS_DBI_SUPI_TYPE_IMSI)) != 0) { + ogs_error("[%s] Unknown SUPI Type", supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN, + recvmsg, "Unknwon SUPI Type", supi); + return false; + } + + SWITCH(recvmsg->h.resource.component[3]) + CASE(OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS) + SWITCH(recvmsg->h.method) + CASE(OGS_SBI_HTTP_METHOD_PUT) + memset(&sendmsg, 0, sizeof(sendmsg)); + + response = ogs_sbi_build_response( + &sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + return true; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", recvmsg->h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + recvmsg, "Invalid HTTP method", recvmsg->h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + recvmsg->h.resource.component[3]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + recvmsg, "Unknown resource name", + recvmsg->h.resource.component[3]); + END + + return false; +} + +static OpenAPI_pdu_session_type_e pdu_session_type_from_dbi(uint8_t pdn_type) +{ + if (pdn_type == OGS_DIAM_PDN_TYPE_IPV4) + return OpenAPI_pdu_session_type_IPV4; + else if (pdn_type == OGS_DIAM_PDN_TYPE_IPV6) + return OpenAPI_pdu_session_type_IPV6; + else if (pdn_type == OGS_DIAM_PDN_TYPE_IPV4V6) + return OpenAPI_pdu_session_type_IPV4V6; + else { + ogs_fatal("Unsupported PDN_TYPE[%d]", pdn_type); + ogs_assert_if_reached(); + } +} + +bool udr_nudr_dr_handle_subscription_provisioned( + ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg) +{ + int rv, i; + + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + ogs_dbi_subscription_data_t subscription_data; + + char *supi = NULL; + + ogs_assert(session); + ogs_assert(recvmsg); + + supi = recvmsg->h.resource.component[1]; + if (!supi) { + ogs_error("No SUPI"); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No SUPI", NULL); + return false; + } + + if (strncmp(supi, + OGS_DBI_SUPI_TYPE_IMSI, strlen(OGS_DBI_SUPI_TYPE_IMSI)) != 0) { + ogs_error("[%s] Unknown SUPI Type", supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN, + recvmsg, "Unknwon SUPI Type", supi); + return false; + } + + rv = ogs_dbi_subscription_data(supi, &subscription_data); + if (rv != OGS_OK) { + ogs_error("[%s] Cannot find SUPI in DB", supi); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_NOT_FOUND, + recvmsg, "Cannot find SUPI Type", supi); + return false; + } + + SWITCH(recvmsg->h.resource.component[4]) + CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) + OpenAPI_access_and_mobility_subscription_data_t + AccessAndMobilitySubscriptionData; + OpenAPI_ambr_rm_t subscribed_ue_ambr; + + subscribed_ue_ambr.uplink = ogs_sbi_bitrate_to_string( + subscription_data.ambr.uplink, OGS_SBI_BITRATE_KBPS); + subscribed_ue_ambr.downlink = ogs_sbi_bitrate_to_string( + subscription_data.ambr.downlink, OGS_SBI_BITRATE_KBPS); + + memset(&AccessAndMobilitySubscriptionData, 0, + sizeof(AccessAndMobilitySubscriptionData)); + AccessAndMobilitySubscriptionData.subscribed_ue_ambr = + &subscribed_ue_ambr; + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.AccessAndMobilitySubscriptionData = + &AccessAndMobilitySubscriptionData; + + response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + ogs_free(subscribed_ue_ambr.uplink); + ogs_free(subscribed_ue_ambr.downlink); + + break; + + CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) + memset(&sendmsg, 0, sizeof(sendmsg)); + + response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + break; + + CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) + OpenAPI_session_management_subscription_data_t + SessionManagementSubscriptionData; + OpenAPI_snssai_t singleNSSAI; + OpenAPI_list_t *dnnConfigurationList = NULL; + OpenAPI_map_t *dnnConfigurationMap = NULL; + OpenAPI_dnn_configuration_t *dnnConfiguration = NULL; + OpenAPI_pdu_session_types_t *pduSessionTypeList = NULL; + OpenAPI_ssc_modes_t *sscModeList = NULL; + OpenAPI_subscribed_default_qos_t *_5gQoSProfile = NULL; + OpenAPI_ambr_t *sessionAmbr = NULL; + OpenAPI_list_t *staticIpAddress = NULL; + OpenAPI_ip_address_t *ipAddress = NULL; + OpenAPI_lnode_t *node = NULL, *node2 = NULL; + + if (!recvmsg->param.s_nssai_presence) { + ogs_error("[%s] Cannot find S_NSSAI", supi); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_NOT_FOUND, + recvmsg, "Cannot find S_NSSAI", supi); + return false; + } + + singleNSSAI.sst = recvmsg->param.s_nssai.sst; + singleNSSAI.sd = ogs_s_nssai_sd_to_string(recvmsg->param.s_nssai.sd); + + dnnConfigurationList = OpenAPI_list_create(); + + for (i = 0; i < subscription_data.num_of_pdn; i++) { + ogs_pdn_t *pdn = &subscription_data.pdn[i]; + ogs_assert(pdn); + + if (recvmsg->param.dnn && + strcmp(recvmsg->param.dnn, pdn->apn) != 0) continue; + + if (!pdn->qos.qci) { + ogs_error("No QCI"); + continue; + } + if (!pdn->qos.arp.priority_level) { + ogs_error("No Priority Level"); + continue; + } + + if (!pdn->ambr.uplink && !pdn->ambr.downlink) { + if (!subscription_data.ambr.uplink && + subscription_data.ambr.downlink) { + ogs_error("No Session-AMBR"); + ogs_error("No UE-AMBR"); + continue; + } + + pdn->ambr.uplink = subscription_data.ambr.uplink; + pdn->ambr.downlink = subscription_data.ambr.downlink; + ogs_warn("No Session-AMBR : Set UE-AMBR to Session-AMBR " + "[DL-%lld:UL-%lld]", + (long long)pdn->ambr.downlink, + (long long)pdn->ambr.uplink); + } + + dnnConfiguration = ogs_calloc(1, sizeof(*dnnConfiguration)); + ogs_assert(dnnConfiguration); + + pduSessionTypeList = ogs_calloc(1, sizeof(*pduSessionTypeList)); + ogs_assert(pduSessionTypeList); + pduSessionTypeList->default_session_type = + pdu_session_type_from_dbi(pdn->pdn_type); + + pduSessionTypeList->allowed_session_types = OpenAPI_list_create(); + ogs_assert(pduSessionTypeList->allowed_session_types); + switch (pduSessionTypeList->default_session_type) { + case OpenAPI_pdu_session_type_IPV4: + OpenAPI_list_add(pduSessionTypeList->allowed_session_types, + (void *)OpenAPI_pdu_session_type_IPV4); + break; + case OpenAPI_pdu_session_type_IPV6: + OpenAPI_list_add(pduSessionTypeList->allowed_session_types, + (void *)OpenAPI_pdu_session_type_IPV6); + break; + case OpenAPI_pdu_session_type_IPV4V6: + OpenAPI_list_add(pduSessionTypeList->allowed_session_types, + (void *)OpenAPI_pdu_session_type_IPV4); + OpenAPI_list_add(pduSessionTypeList->allowed_session_types, + (void *)OpenAPI_pdu_session_type_IPV6); + OpenAPI_list_add(pduSessionTypeList->allowed_session_types, + (void *)OpenAPI_pdu_session_type_IPV4V6); + break; + default: + ogs_fatal("Unsupported PDN_TYPE[%d]", + pduSessionTypeList->default_session_type); + ogs_assert_if_reached(); + } + + dnnConfiguration->pdu_session_types = pduSessionTypeList; + + sscModeList = ogs_calloc(1, sizeof(*sscModeList)); + ogs_assert(sscModeList); + sscModeList->default_ssc_mode = OpenAPI_ssc_mode_SSC_MODE_1; + + sscModeList->allowed_ssc_modes = OpenAPI_list_create(); + ogs_assert(sscModeList->allowed_ssc_modes); + OpenAPI_list_add(sscModeList->allowed_ssc_modes, + (void *)OpenAPI_ssc_mode_SSC_MODE_1); + OpenAPI_list_add(sscModeList->allowed_ssc_modes, + (void *)OpenAPI_ssc_mode_SSC_MODE_2); + OpenAPI_list_add(sscModeList->allowed_ssc_modes, + (void *)OpenAPI_ssc_mode_SSC_MODE_3); + + dnnConfiguration->ssc_modes = sscModeList; + + _5gQoSProfile = ogs_calloc(1, sizeof(*_5gQoSProfile)); + ogs_assert(_5gQoSProfile); + _5gQoSProfile->_5qi = pdn->qos.qci; + _5gQoSProfile->priority_level = pdn->qos.arp.priority_level; + _5gQoSProfile->arp = ogs_calloc(1, sizeof(OpenAPI_arp_t)); + ogs_assert(_5gQoSProfile->arp); + _5gQoSProfile->arp->priority_level = pdn->qos.arp.priority_level; + if (pdn->qos.arp.pre_emption_capability == + OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED) + _5gQoSProfile->arp->preempt_cap = + OpenAPI_preemption_capability_NOT_PREEMPT; + else + _5gQoSProfile->arp->preempt_cap = + OpenAPI_preemption_capability_MAY_PREEMPT; + if (pdn->qos.arp.pre_emption_vulnerability == + OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED) + _5gQoSProfile->arp->preempt_vuln = + OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE; + else + _5gQoSProfile->arp->preempt_vuln = + OpenAPI_preemption_vulnerability_PREEMPTABLE; + + dnnConfiguration->_5g_qos_profile = _5gQoSProfile; + + ogs_assert(pdn->ambr.uplink || pdn->ambr.downlink); + sessionAmbr = ogs_calloc(1, sizeof(*sessionAmbr)); + ogs_assert(sessionAmbr); + sessionAmbr->uplink = ogs_sbi_bitrate_to_string( + pdn->ambr.uplink, OGS_SBI_BITRATE_KBPS); + sessionAmbr->downlink = ogs_sbi_bitrate_to_string( + pdn->ambr.downlink, OGS_SBI_BITRATE_KBPS); + + dnnConfiguration->session_ambr = sessionAmbr; + + staticIpAddress = OpenAPI_list_create(); + ogs_assert(staticIpAddress); + + if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4 || + pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6 || + pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + ipAddress = ogs_calloc(1, sizeof(*ipAddress)); + ogs_assert(ipAddress); + + if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4 || + pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + ipAddress->ipv4_addr = ogs_ipv4_to_string(pdn->ue_ip.addr); + } + if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6 || + pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + ipAddress->ipv6_addr = ogs_ipv6_to_string(pdn->ue_ip.addr6); + } + + if (ipAddress->ipv4_addr || ipAddress->ipv6_addr) + OpenAPI_list_add(staticIpAddress, ipAddress); + else + ogs_free(ipAddress); + } + + if (staticIpAddress->count) + dnnConfiguration->static_ip_address = staticIpAddress; + else + OpenAPI_list_free(staticIpAddress); + + dnnConfigurationMap = OpenAPI_map_create( + pdn->apn, dnnConfiguration); + ogs_assert(dnnConfigurationMap); + OpenAPI_list_add(dnnConfigurationList, dnnConfigurationMap); + } + + memset(&SessionManagementSubscriptionData, 0, + sizeof(SessionManagementSubscriptionData)); + SessionManagementSubscriptionData.single_nssai = &singleNSSAI; + if (dnnConfigurationList->count) + SessionManagementSubscriptionData.dnn_configurations = + dnnConfigurationList; + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.SessionManagementSubscriptionData = + &SessionManagementSubscriptionData; + + response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK); + ogs_assert(response); + ogs_sbi_server_send_response(session, response); + + if (singleNSSAI.sd) + ogs_free(singleNSSAI.sd); + + OpenAPI_list_for_each(dnnConfigurationList, node) { + dnnConfigurationMap = node->data; + if (dnnConfigurationMap) { + dnnConfiguration = dnnConfigurationMap->value; + if (dnnConfiguration) { + pduSessionTypeList = dnnConfiguration->pdu_session_types; + if (pduSessionTypeList) { + if (pduSessionTypeList->allowed_session_types) + OpenAPI_list_free( + pduSessionTypeList->allowed_session_types); + ogs_free(pduSessionTypeList); + } + sscModeList = dnnConfiguration->ssc_modes;; + if (sscModeList) { + if (sscModeList->allowed_ssc_modes) + OpenAPI_list_free(sscModeList->allowed_ssc_modes); + ogs_free(sscModeList); + } + _5gQoSProfile = dnnConfiguration->_5g_qos_profile; + if (_5gQoSProfile) { + if (_5gQoSProfile->arp) + ogs_free(_5gQoSProfile->arp); + ogs_free(_5gQoSProfile); + } + + sessionAmbr = dnnConfiguration->session_ambr; + if (sessionAmbr) { + if (sessionAmbr->uplink) + ogs_free(sessionAmbr->uplink); + if (sessionAmbr->downlink) + ogs_free(sessionAmbr->downlink); + ogs_free(sessionAmbr); + } + + staticIpAddress = dnnConfiguration->static_ip_address; + if (staticIpAddress) { + OpenAPI_list_for_each(staticIpAddress, node2) { + if (node2->data) { + ipAddress = node2->data; + if (ipAddress) { + if (ipAddress->ipv4_addr) + ogs_free(ipAddress->ipv4_addr); + if (ipAddress->ipv6_addr) + ogs_free(ipAddress->ipv6_addr); + ogs_free(ipAddress); + } + } + } + OpenAPI_list_free(staticIpAddress); + } + + ogs_free(dnnConfiguration); + } + ogs_free(dnnConfigurationMap); + } + } + + OpenAPI_list_free(dnnConfigurationList); + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + recvmsg->h.resource.component[3]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + recvmsg, "Unknown resource name", + recvmsg->h.resource.component[3]); + return false; + END + + return true; +} diff --git a/src/udr/nudr-handler.h b/src/udr/nudr-handler.h index 1213ada89..29de8f608 100644 --- a/src/udr/nudr-handler.h +++ b/src/udr/nudr-handler.h @@ -28,6 +28,10 @@ extern "C" { bool udr_nudr_dr_handle_subscription_authentication( ogs_sbi_session_t *session, ogs_sbi_message_t *message); +bool udr_nudr_dr_handle_subscription_context( + ogs_sbi_session_t *session, ogs_sbi_message_t *message); +bool udr_nudr_dr_handle_subscription_provisioned( + ogs_sbi_session_t *session, ogs_sbi_message_t *message); #ifdef __cplusplus } diff --git a/src/udr/sbi-path.c b/src/udr/sbi-path.c index 34bac852f..06b8a6ac7 100644 --- a/src/udr/sbi-path.c +++ b/src/udr/sbi-path.c @@ -81,8 +81,8 @@ int udr_sbi_open(void) service = ogs_sbi_nf_service_build_default(nf_instance, (char*)OGS_SBI_SERVICE_NAME_NUDR_DR); ogs_assert(service); - ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_VERSION, - (char*)OGS_SBI_API_FULL_VERSION, NULL); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1, + (char*)OGS_SBI_API_V1_0_0, NULL); udr_nf_fsm_init(nf_instance); udr_sbi_setup_client_callback(nf_instance); diff --git a/src/udr/udr-sm.c b/src/udr/udr-sm.c index 845fe9d44..e2cdb47c9 100644 --- a/src/udr/udr-sm.c +++ b/src/udr/udr-sm.c @@ -81,7 +81,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e) break; } - if (strcmp(message.h.api.version, OGS_SBI_API_VERSION) != 0) { + if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) { ogs_error("Not supported version [%s]", message.h.api.version); ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Not supported version", NULL); @@ -103,7 +103,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e) ogs_error("Invalid HTTP method [%s]", message.h.method); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &message, "Invalid HTTP method", message.h.method); END break; @@ -112,7 +112,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e) ogs_error("Invalid resource name [%s]", message.h.resource.component[0]); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Unknown resource name", message.h.resource.component[0]); END @@ -127,20 +127,42 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e) session, &message); break; + CASE(OGS_SBI_RESOURCE_NAME_CONTEXT_DATA) + udr_nudr_dr_handle_subscription_context(session, &message); + break; + DEFAULT - ogs_error("Invalid resource name [%s]", - message.h.resource.component[2]); - ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, - &message, "Unknown resource name", - message.h.resource.component[2]); + SWITCH(message.h.resource.component[3]) + CASE(OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA) + SWITCH(message.h.method) + CASE(OGS_SBI_HTTP_METHOD_GET) + udr_nudr_dr_handle_subscription_provisioned( + session, &message); + break; + DEFAULT + ogs_error("Invalid HTTP method [%s]", + message.h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_FORBIDDEN, + &message, "Invalid HTTP method", + message.h.method); + END + break; + DEFAULT + ogs_error("Invalid resource name [%s]", + message.h.resource.component[2]); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + &message, "Unknown resource name", + message.h.resource.component[2]); + END END break; DEFAULT ogs_error("Invalid resource name [%s]", message.h.resource.component[0]); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Unknown resource name", message.h.resource.component[0]); END @@ -149,7 +171,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e) DEFAULT ogs_error("Invalid API name [%s]", message.h.service.name); ogs_sbi_server_send_error(session, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, "Invalid API name", message.h.resource.component[0]); END @@ -170,7 +192,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e) break; } - if (strcmp(message.h.api.version, OGS_SBI_API_VERSION) != 0) { + if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) { ogs_error("Not supported version [%s]", message.h.api.version); ogs_sbi_message_free(&message); ogs_sbi_response_free(response); diff --git a/src/upf/context.c b/src/upf/context.c index e771adc35..930d173a4 100644 --- a/src/upf/context.c +++ b/src/upf/context.c @@ -461,8 +461,8 @@ upf_sess_t *upf_sess_add(ogs_pfcp_f_seid_t *cp_f_seid, "APN[%s] PDN-Type[%d] IPv4[%s] IPv6[%s], Default PDR ID[%d]", (long)sess->upf_n4_seid, (long)sess->smf_n4_seid, apn, pdn_type, - sess->ipv4 ? INET_NTOP(&sess->ipv4->addr, buf1) : "", - sess->ipv6 ? INET6_NTOP(&sess->ipv6->addr, buf2) : "", + sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", + sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : "", sess->pfcp.default_pdr->id); ogs_list_add(&self.sess_list, sess); diff --git a/src/upf/gtp-path.c b/src/upf/gtp-path.c index 0a555e7ed..d0023459a 100644 --- a/src/upf/gtp-path.c +++ b/src/upf/gtp-path.c @@ -375,7 +375,11 @@ static void upf_gtp_send_to_pdr(ogs_pfcp_pdr_t *pdr, ogs_pkbuf_t *sendbuf) far = pdr->far; ogs_assert(far); - upf_gtp_send_to_far(far, sendbuf); + if (far->gnode) { + upf_gtp_send_to_far(far, sendbuf); + } else { + ogs_fatal("TODO Buffering"); + } } static int upf_gtp_send_router_advertisement( diff --git a/src/upf/n4-handler.c b/src/upf/n4-handler.c index 543b5ede0..063820714 100644 --- a/src/upf/n4-handler.c +++ b/src/upf/n4-handler.c @@ -257,10 +257,7 @@ static ogs_pfcp_far_t *handle_create_far(ogs_pfcp_sess_t *sess, } if (message->forwarding_parameters. destination_interface.presence == 0) { - ogs_warn("No Destination Interface"); - *cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_MISSING; - *offending_ie_value = OGS_PFCP_DESTINATION_INTERFACE_TYPE; - return NULL; + return far; } far->apply_action = message->apply_action.u8; @@ -271,39 +268,117 @@ static ogs_pfcp_far_t *handle_create_far(ogs_pfcp_sess_t *sess, ogs_ip_t ip; ogs_gtp_node_t *gnode = NULL; - if (message->forwarding_parameters. - outer_header_creation.presence == 0) { - ogs_warn("No Outer Header Creation in PDI"); - *cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_MISSING; - *offending_ie_value = OGS_PFCP_OUTER_HEADER_CREATION_TYPE; - return NULL; - } + if (message->forwarding_parameters.outer_header_creation.presence) { + memcpy(&far->outer_header_creation, + message->forwarding_parameters.outer_header_creation.data, + message->forwarding_parameters.outer_header_creation.len); + far->outer_header_creation.teid = + be32toh(far->outer_header_creation.teid); - memcpy(&far->outer_header_creation, - message->forwarding_parameters.outer_header_creation.data, - message->forwarding_parameters.outer_header_creation.len); - far->outer_header_creation.teid = - be32toh(far->outer_header_creation.teid); - - /* Setup GTP Node */ - rv = ogs_pfcp_outer_header_creation_to_ip( - &far->outer_header_creation, &ip); - ogs_assert(rv == OGS_OK); - - gnode = ogs_gtp_node_find_by_ip(&upf_self()->gnb_n3_list, &ip); - if (!gnode) { - gnode = ogs_gtp_node_add_by_ip( - &upf_self()->gnb_n3_list, &ip, upf_self()->gtpu_port, - ogs_config()->parameter.no_ipv4, - ogs_config()->parameter.no_ipv6, - ogs_config()->parameter.prefer_ipv4); - ogs_assert(gnode); - - rv = ogs_gtp_connect( - upf_self()->gtpu_sock, upf_self()->gtpu_sock6, gnode); + /* Setup GTP Node */ + rv = ogs_pfcp_outer_header_creation_to_ip( + &far->outer_header_creation, &ip); ogs_assert(rv == OGS_OK); + + gnode = ogs_gtp_node_find_by_ip(&upf_self()->gnb_n3_list, &ip); + if (!gnode) { + gnode = ogs_gtp_node_add_by_ip( + &upf_self()->gnb_n3_list, &ip, upf_self()->gtpu_port, + ogs_config()->parameter.no_ipv4, + ogs_config()->parameter.no_ipv6, + ogs_config()->parameter.prefer_ipv4); + ogs_assert(gnode); + + rv = ogs_gtp_connect( + upf_self()->gtpu_sock, upf_self()->gtpu_sock6, gnode); + ogs_assert(rv == OGS_OK); + } + OGS_SETUP_GTP_NODE(far, gnode); + } + } else if (far->dst_if == OGS_PFCP_INTERFACE_CORE) { /* Uplink */ + + /* Nothing */ + + } else { + ogs_error("Invalid Destination Interface[%d] in FAR", far->dst_if); + *cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT; + *offending_ie_value = OGS_PFCP_DESTINATION_INTERFACE_TYPE; + return NULL; + } + + return far; +} + +static ogs_pfcp_far_t *handle_update_far(ogs_pfcp_sess_t *sess, + ogs_pfcp_tlv_update_far_t *message, + uint8_t *cause_value, uint8_t *offending_ie_value) +{ + ogs_pfcp_far_t *far = NULL; + + ogs_assert(message); + ogs_assert(sess); + + if (message->presence == 0) + return NULL; + + if (message->far_id.presence == 0) { + ogs_warn("No FAR-ID"); + *cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_MISSING; + *offending_ie_value = OGS_PFCP_FAR_ID_TYPE; + return NULL; + } + + far = ogs_pfcp_far_find(sess, message->far_id.u32); + if (!far) { + ogs_error("Cannot find FAR-ID[%d] in PDR", message->far_id.u32); + *cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT; + *offending_ie_value = OGS_PFCP_FAR_ID_TYPE; + return NULL; + } + + if (message->apply_action.presence) + far->apply_action = message->apply_action.u8; + + if (message->update_forwarding_parameters. + destination_interface.presence == 0) + far->dst_if = message->update_forwarding_parameters. + destination_interface.u8; + + if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) { /* Downlink */ + int rv; + ogs_ip_t ip; + ogs_gtp_node_t *gnode = NULL; + + if (message->update_forwarding_parameters. + outer_header_creation.presence) { + memcpy(&far->outer_header_creation, + message->update_forwarding_parameters. + outer_header_creation.data, + message->update_forwarding_parameters. + outer_header_creation.len); + far->outer_header_creation.teid = + be32toh(far->outer_header_creation.teid); + + /* Setup GTP Node */ + rv = ogs_pfcp_outer_header_creation_to_ip( + &far->outer_header_creation, &ip); + ogs_assert(rv == OGS_OK); + + gnode = ogs_gtp_node_find_by_ip(&upf_self()->gnb_n3_list, &ip); + if (!gnode) { + gnode = ogs_gtp_node_add_by_ip( + &upf_self()->gnb_n3_list, &ip, upf_self()->gtpu_port, + ogs_config()->parameter.no_ipv4, + ogs_config()->parameter.no_ipv6, + ogs_config()->parameter.prefer_ipv4); + ogs_assert(gnode); + + rv = ogs_gtp_connect( + upf_self()->gtpu_sock, upf_self()->gtpu_sock6, gnode); + ogs_assert(rv == OGS_OK); + } + OGS_SETUP_GTP_NODE(far, gnode); } - OGS_SETUP_GTP_NODE(far, gnode); } else if (far->dst_if == OGS_PFCP_INTERFACE_CORE) { /* Uplink */ /* Nothing */ @@ -572,7 +647,15 @@ void upf_n4_handle_session_modification_request( if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) goto cleanup; - for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) { + for (i = 0; i < OGS_MAX_NUM_OF_FAR; i++) { + if (handle_update_far(&sess->pfcp, &req->update_far[i], + &cause_value, &offending_ie_value) == NULL) + break; + } + if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) + goto cleanup; + + for (i = 0; i < OGS_MAX_NUM_OF_FAR; i++) { if (handle_remove_far(&sess->pfcp, &req->remove_far[i], &cause_value, &offending_ie_value) == false) break; @@ -596,7 +679,7 @@ void upf_n4_handle_session_modification_request( if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) goto cleanup; - for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) { + for (i = 0; i < OGS_MAX_NUM_OF_QER; i++) { if (handle_remove_qer(&sess->pfcp, &req->remove_qer[i], &cause_value, &offending_ie_value) == false) break; diff --git a/src/upf/rule-match.c b/src/upf/rule-match.c index 7ba1f2570..44d8e4ad6 100644 --- a/src/upf/rule-match.c +++ b/src/upf/rule-match.c @@ -160,10 +160,10 @@ ogs_pfcp_pdr_t *upf_pdr_find_by_packet(ogs_pkbuf_t *pkt) if (ip_h && sess->ipv4) ogs_debug("[UPF] PAA IPv4:%s", - INET_NTOP(&sess->ipv4->addr, buf)); + OGS_INET_NTOP(&sess->ipv4->addr, buf)); if (ip6_h && sess->ipv6) ogs_debug("[UPF] PAA IPv6:%s", - INET6_NTOP(&sess->ipv6->addr, buf)); + OGS_INET6_NTOP(&sess->ipv6->addr, buf)); /* Save the default PDR */ default_pdr = ogs_pfcp_sess_default_pdr(&sess->pfcp); diff --git a/tests/app/5gc-init.c b/tests/app/5gc-init.c index abe1323d5..1594c1e44 100644 --- a/tests/app/5gc-init.c +++ b/tests/app/5gc-init.c @@ -49,30 +49,30 @@ int app_initialize(const char *const argv[]) if (ogs_config()->parameter.no_nrf == 0) nrf_thread = test_child_create("nrf", argv_out); + if (ogs_config()->parameter.no_amf == 0) + amf_thread = test_child_create("amf", argv_out); if (ogs_config()->parameter.no_ausf == 0) ausf_thread = test_child_create("ausf", argv_out); if (ogs_config()->parameter.no_udm == 0) udm_thread = test_child_create("udm", argv_out); - if (ogs_config()->parameter.no_udr == 0) - udr_thread = test_child_create("udr", argv_out); - if (ogs_config()->parameter.no_upf == 0) - upf_thread = test_child_create("upf", argv_out); if (ogs_config()->parameter.no_smf == 0) smf_thread = test_child_create("smf", argv_out); - if (ogs_config()->parameter.no_amf == 0) - amf_thread = test_child_create("amf", argv_out); + if (ogs_config()->parameter.no_upf == 0) + upf_thread = test_child_create("upf", argv_out); + if (ogs_config()->parameter.no_udr == 0) + udr_thread = test_child_create("udr", argv_out); return OGS_OK;; } void app_terminate(void) { - if (amf_thread) ogs_thread_destroy(amf_thread); if (smf_thread) ogs_thread_destroy(smf_thread); - if (upf_thread) ogs_thread_destroy(upf_thread); if (udm_thread) ogs_thread_destroy(udm_thread); - if (udr_thread) ogs_thread_destroy(udr_thread); if (ausf_thread) ogs_thread_destroy(ausf_thread); + if (amf_thread) ogs_thread_destroy(amf_thread); + if (upf_thread) ogs_thread_destroy(upf_thread); + if (udr_thread) ogs_thread_destroy(udr_thread); if (nrf_thread) ogs_thread_destroy(nrf_thread); } diff --git a/tests/common/context.c b/tests/common/context.c index 92cf082a3..6e8008288 100644 --- a/tests/common/context.c +++ b/tests/common/context.c @@ -415,14 +415,13 @@ int test_context_parse_config(void) if (sst) { s_nssai->sst = atoi(sst); - if (sd) { + if (sd) s_nssai->sd = ogs_uint24_from_string( (char*)sd); - } else { + else s_nssai->sd.v = OGS_S_NSSAI_NO_SD_VALUE; - } self.plmn_support[ self.num_of_plmn_support]. @@ -472,13 +471,13 @@ void test_ue_set_mobile_identity(test_ue_t *test_ue, if (test_ue->suci) ogs_free(test_ue->suci); - test_ue->suci = ogs_nas_5gs_ueid_from_mobile_identity(mobile_identity); + test_ue->suci = ogs_nas_5gs_suci_from_mobile_identity(mobile_identity); if (test_ue->supi) ogs_free(test_ue->supi); test_ue->supi = ogs_supi_from_suci(test_ue->suci); if (test_ue->imsi) ogs_free(test_ue->imsi); - test_ue->imsi = ogs_ueid_from_supi(test_ue->supi); + test_ue->imsi = ogs_supi_get_id(test_ue->supi); } void test_ue_remove(test_ue_t *test_ue) diff --git a/tests/common/context.h b/tests/common/context.h index 3082ab9de..2ae83f66f 100644 --- a/tests/common/context.h +++ b/tests/common/context.h @@ -57,6 +57,8 @@ typedef struct test_context_s { ogs_nr_cgi_t cgi; } test_context_t; +typedef struct test_sess_s test_sess_t; + typedef struct test_ue_s { uint32_t ran_ue_ngap_id; /* eNB-UE-NGAP-ID received from eNB */ uint64_t amf_ue_ngap_id; /* AMF-UE-NGAP-ID received from AMF */ @@ -75,11 +77,20 @@ typedef struct test_ue_s { uint8_t kamf[OGS_SHA256_DIGEST_SIZE]; struct { -#define OGS_NAS_SECURITY_BEARER_3GPP 1 -#define OGS_NAS_SECURITY_BEARER_NON_3GPP 2 - uint8_t connection_identifier; - uint8_t ksi; - } nas; + uint8_t message_type; /* Type of last NAS message received */ + int access_type; /* 3GPP or Non-3GPP */ + + union { + struct { + ED3(uint8_t tsc:1;, + uint8_t ksi:3;, + uint8_t spare:4;) + }; + ogs_nas_5gs_registration_type_t registration; + uint8_t data; + }; + + } __attribute__ ((packed)) nas; uint8_t knas_int[OGS_SHA256_DIGEST_SIZE/2]; uint8_t knas_enc[OGS_SHA256_DIGEST_SIZE/2]; @@ -111,8 +122,28 @@ typedef struct test_ue_s { } while(0) int security_context_available; int mac_failed; + + ogs_nas_5gs_guti_t nas_guti; + + test_sess_t *sess; } test_ue_t; +typedef struct test_sess_s { + uint8_t psi; + + uint8_t pti; + uint8_t pdu_session_type; + char *dnn; + + ogs_ip_t ue_ip; + ogs_ip_t upf_n3_ip; + uint32_t upf_n3_teid; + ogs_ip_t gnb_n3_ip; + uint32_t gnb_n3_teid; + + test_ue_t *test_ue; +} test_sess_t; + void test_context_init(void); void test_context_final(void); test_context_t *test_self(void); diff --git a/tests/common/gmm-build.c b/tests/common/gmm-build.c index 4a1bd7265..fcca4d93d 100644 --- a/tests/common/gmm-build.c +++ b/tests/common/gmm-build.c @@ -41,9 +41,7 @@ ogs_pkbuf_t *testgmm_build_registration_request(test_ue_t *test_ue, OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; message.gmm.h.message_type = OGS_NAS_5GS_REGISTRATION_REQUEST; - registration_type->type = 1; - registration_type->follow_on_request = 1; - registration_type->value = 1; + registration_type->data = test_ue->nas.data; registration_request->mobile_identity.length = mobile_identity->length; registration_request->mobile_identity.buffer = mobile_identity->buffer; @@ -95,7 +93,8 @@ ogs_pkbuf_t *testgmm_build_authentication_response(test_ue_t *test_ue) milenage_f2345(test_ue->opc, test_ue->k, test_ue->rand, res, ck, ik, ak, NULL); - serving_network_name = ogs_plmn_id_string(&test_self()->tai.plmn_id); + serving_network_name = + ogs_serving_network_name_from_plmn_id(&test_self()->tai.plmn_id); ogs_kdf_xres_star( ck, ik, serving_network_name, test_ue->rand, res, 8, @@ -162,3 +161,122 @@ ogs_pkbuf_t *testgmm_build_security_mode_complete( return test_nas_5gs_security_encode(test_ue, &message); } + +ogs_pkbuf_t *testgmm_build_registration_complete(test_ue_t *test_ue) +{ + ogs_nas_5gs_message_t message; + ogs_pkbuf_t *pkbuf = NULL; + ogs_nas_5gs_registration_complete_t *registration_complete = + &message.gmm.registration_complete; + + ogs_assert(test_ue); + + memset(&message, 0, sizeof(message)); + message.h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; + message.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + + message.gmm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + message.gmm.h.message_type = OGS_NAS_5GS_REGISTRATION_COMPLETE; + + return test_nas_5gs_security_encode(test_ue, &message); +} + +ogs_pkbuf_t *testgmm_build_configuration_update_complete(test_ue_t *test_ue) +{ + ogs_nas_5gs_message_t message; + ogs_pkbuf_t *pkbuf = NULL; + ogs_nas_5gs_configuration_update_complete_t *configuration_update_complete = + &message.gmm.configuration_update_complete; + ogs_nas_control_plane_service_type_t *control_plane_service_type = NULL; + + ogs_assert(test_ue); + + control_plane_service_type = &configuration_update_complete->control_plane_service_type; + + memset(&message, 0, sizeof(message)); + message.h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; + message.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + + message.gmm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + message.gmm.h.message_type = OGS_NAS_5GS_CONFIGURATION_UPDATE_COMPLETE; + + control_plane_service_type->value = + OGS_NAS_5GS_CONTROL_PLANE_SERVICE_TYPE_MO; + + return test_nas_5gs_security_encode(test_ue, &message); +} + +ogs_pkbuf_t *testgmm_build_ul_nas_transport(test_sess_t *test_sess, + uint8_t payload_type, ogs_pkbuf_t *payload) +{ + test_ue_t *test_ue = NULL; + ogs_pkbuf_t *pkbuf = NULL; + + ogs_nas_5gs_message_t message; + ogs_nas_5gs_ul_nas_transport_t *ul_nas_transport = + &message.gmm.ul_nas_transport; + + ogs_nas_payload_container_type_t *payload_container_type = NULL; + ogs_nas_payload_container_t *payload_container = NULL; + ogs_nas_pdu_session_identity_2_t *pdu_session_id = NULL; + ogs_nas_request_type_t *request_type = NULL; + ogs_nas_s_nssai_t *s_nssai = NULL; + + ogs_assert(test_sess); + test_ue = test_sess->test_ue; + ogs_assert(test_ue); + ogs_assert(payload_type); + ogs_assert(payload); + + payload_container_type = &ul_nas_transport->payload_container_type; + payload_container = &ul_nas_transport->payload_container; + pdu_session_id = &ul_nas_transport->pdu_session_id; + request_type = &ul_nas_transport->request_type; + s_nssai = &ul_nas_transport->s_nssai; + + memset(&message, 0, sizeof(message)); + message.h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; + message.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + + message.gmm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM; + message.gmm.h.message_type = OGS_NAS_5GS_UL_NAS_TRANSPORT; + + payload_container_type->value = payload_type; + + payload_container->length = payload->len; + payload_container->buffer = payload->data; + + ul_nas_transport->presencemask |= + OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT; + *pdu_session_id = test_sess->psi; + + ul_nas_transport->presencemask |= + OGS_NAS_5GS_UL_NAS_TRANSPORT_REQUEST_TYPE_PRESENT; + request_type->value = OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + + ul_nas_transport->presencemask |= + OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_PRESENT; + s_nssai->length = 4; + s_nssai->sst = test_self()->plmn_support[0].s_nssai[0].sst; + s_nssai->sd = ogs_htobe24(test_self()->plmn_support[0].s_nssai[0].sd); + + ul_nas_transport->presencemask |= + OGS_NAS_5GS_UL_NAS_TRANSPORT_DNN_PRESENT; + ul_nas_transport->dnn.length = strlen(test_sess->dnn); + ogs_cpystrn(ul_nas_transport->dnn.value, test_sess->dnn, + ogs_min(ul_nas_transport->dnn.length, OGS_MAX_DNN_LEN) + 1); + + pkbuf = test_nas_5gs_security_encode(test_ue, &message); + ogs_pkbuf_free(payload); + + return pkbuf; +} diff --git a/tests/common/gmm-build.h b/tests/common/gmm-build.h index 95d1fad72..0a6126e31 100644 --- a/tests/common/gmm-build.h +++ b/tests/common/gmm-build.h @@ -29,6 +29,10 @@ ogs_pkbuf_t *testgmm_build_registration_request(test_ue_t *test_ue, ogs_pkbuf_t *testgmm_build_authentication_response(test_ue_t *test_ue); ogs_pkbuf_t *testgmm_build_security_mode_complete( test_ue_t *test_ue, ogs_pkbuf_t *nasbuf); +ogs_pkbuf_t *testgmm_build_registration_complete(test_ue_t *test_ue); +ogs_pkbuf_t *testgmm_build_configuration_update_complete(test_ue_t *test_ue); +ogs_pkbuf_t *testgmm_build_ul_nas_transport(test_sess_t *test_sess, + uint8_t payload_type, ogs_pkbuf_t *payload); #ifdef __cplusplus } diff --git a/tests/common/gmm-handler.c b/tests/common/gmm-handler.c index 70aeafcf5..0f9d66dc7 100644 --- a/tests/common/gmm-handler.c +++ b/tests/common/gmm-handler.c @@ -71,3 +71,38 @@ void testgmm_handle_security_mode_command(test_ue_t *test_ue, test_ue->security_context_available = 1; } + +void testgmm_handle_registration_accept(test_ue_t *test_ue, + ogs_nas_5gs_registration_accept_t *registration_accept) +{ + ogs_assert(test_ue); + ogs_assert(registration_accept); + + if (registration_accept->presencemask & + OGS_NAS_5GS_REGISTRATION_ACCEPT_5G_GUTI_PRESENT) { + ogs_nas_5gs_mobile_identity_t *mobile_identity = NULL; + ogs_nas_5gs_mobile_identity_guti_t *mobile_identity_guti = NULL; + + mobile_identity = ®istration_accept->guti; + mobile_identity_guti = mobile_identity->buffer; + + memcpy(&test_ue->nas_guti.nas_plmn_id, + &mobile_identity_guti->nas_plmn_id, OGS_PLMN_ID_LEN); + memcpy(&test_ue->nas_guti.amf_id, + &mobile_identity_guti->amf_id, sizeof(ogs_amf_id_t)); + test_ue->nas_guti.m_tmsi = be32toh(mobile_identity_guti->m_tmsi); + } +} + +void testgmm_handle_dl_nas_transport(test_ue_t *test_ue, + ogs_nas_5gs_dl_nas_transport_t *dl_nas_transport) +{ + test_sess_t *sess = NULL; + ogs_assert(test_ue); + ogs_assert(dl_nas_transport); + + sess = test_ue->sess; + ogs_assert(sess); + + testgmm_send_to_gsm(sess, &dl_nas_transport->payload_container); +} diff --git a/tests/common/gmm-handler.h b/tests/common/gmm-handler.h index 68a941459..e03f3acb8 100644 --- a/tests/common/gmm-handler.h +++ b/tests/common/gmm-handler.h @@ -28,6 +28,10 @@ void testgmm_handle_authentication_request(test_ue_t *test_ue, ogs_nas_5gs_authentication_request_t *authentication_request); void testgmm_handle_security_mode_command(test_ue_t *test_ue, ogs_nas_5gs_security_mode_command_t *security_mode_command); +void testgmm_handle_registration_accept(test_ue_t *test_ue, + ogs_nas_5gs_registration_accept_t *registration_accept); +void testgmm_handle_dl_nas_transport(test_ue_t *test_ue, + ogs_nas_5gs_dl_nas_transport_t *dl_nas_transport); #ifdef __cplusplus } diff --git a/tests/common/gsm-build.c b/tests/common/gsm-build.c new file mode 100644 index 000000000..45b6ff939 --- /dev/null +++ b/tests/common/gsm-build.c @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "test-common.h" + +ogs_pkbuf_t *testgsm_build_pdu_session_establishment_request( + test_sess_t *test_sess) +{ + ogs_nas_5gs_message_t message; + ogs_nas_5gs_pdu_session_establishment_request_t + *pdu_session_establishment_request = + &message.gsm.pdu_session_establishment_request; + ogs_nas_integrity_protection_maximum_data_rate_t + *integrity_protection_maximum_data_rate = NULL; + ogs_nas_pdu_session_type_t *pdu_session_type = NULL; + + ogs_s_nssai_t *s_nssai = NULL; + + test_ue_t *test_ue = NULL; + ogs_pkbuf_t *pkbuf = NULL; + + ogs_assert(test_sess); + test_ue = test_sess; + ogs_assert(test_ue); + + integrity_protection_maximum_data_rate = + &pdu_session_establishment_request-> + integrity_protection_maximum_data_rate; + + pdu_session_type = &pdu_session_establishment_request->pdu_session_type; + + memset(&message, 0, sizeof(message)); + + message.gsm.h.extended_protocol_discriminator = + OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM; + message.gsm.h.pdu_session_identity = test_sess->psi; + message.gsm.h.procedure_transaction_identity = test_sess->pti; + message.gsm.h.message_type = OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST; + + integrity_protection_maximum_data_rate->ul = 0xff; + integrity_protection_maximum_data_rate->dl = 0xff; + + pdu_session_establishment_request->presencemask |= + OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_PRESENT; + pdu_session_type->value = test_sess->pdu_session_type; + + s_nssai = &test_self()->plmn_support[0].s_nssai[0]; + ogs_assert(s_nssai); + + return ogs_nas_5gs_plain_encode(&message); +} diff --git a/tests/common/gsm-build.h b/tests/common/gsm-build.h new file mode 100644 index 000000000..f3cd4d9a4 --- /dev/null +++ b/tests/common/gsm-build.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef TEST_GSM_BUILD_H +#define TEST_GSM_BUILD_H + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_pkbuf_t *testgsm_build_pdu_session_establishment_request( + test_sess_t *test_sess); + +#ifdef __cplusplus +} +#endif + +#endif /* TEST_GSM_BUILD_H */ diff --git a/tests/common/gsm-handler.c b/tests/common/gsm-handler.c new file mode 100644 index 000000000..58596d0c7 --- /dev/null +++ b/tests/common/gsm-handler.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "test-common.h" + +void testgsm_handle_pdu_session_establishment_accept(test_sess_t *sess, + ogs_nas_5gs_pdu_session_establishment_accept_t + *pdu_session_establishment_accept) +{ + ogs_nas_pdu_address_t *pdu_address = NULL; + + ogs_assert(sess); + ogs_assert(pdu_session_establishment_accept); + + pdu_address = &pdu_session_establishment_accept->pdu_address; + + if (pdu_session_establishment_accept->presencemask & + OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_PRESENT) { + switch (pdu_address->pdn_type) { + case OGS_PDU_SESSION_TYPE_IPV4: + sess->ue_ip.ipv4 = 1; + sess->ue_ip.addr = pdu_address->addr; + break; + case OGS_PDU_SESSION_TYPE_IPV6: + break; + case OGS_PDU_SESSION_TYPE_IPV4V6: + sess->ue_ip.ipv4 = 1; + sess->ue_ip.both.addr = pdu_address->both.addr; + break; + default: + ogs_fatal("Invalid PDU Address Type [%d]", pdu_address->pdn_type); + ogs_assert_if_reached(); + } + + } +} diff --git a/tests/common/gsm-handler.h b/tests/common/gsm-handler.h new file mode 100644 index 000000000..02e8a789e --- /dev/null +++ b/tests/common/gsm-handler.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef TEST_GSM_HANDLE_H +#define TEST_GSM_HANDLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +void testgsm_handle_pdu_session_establishment_accept(test_sess_t *sess, + ogs_nas_5gs_pdu_session_establishment_accept_t + *pdu_session_establishment_accept); + +#ifdef __cplusplus +} +#endif + +#endif /* TEST_GSM_HANDLE_H */ diff --git a/tests/common/gtpu.c b/tests/common/gtpu.c index 6e62f1068..45e63805f 100644 --- a/tests/common/gtpu.c +++ b/tests/common/gtpu.c @@ -63,7 +63,171 @@ ogs_pkbuf_t *test_gtpu_read(ogs_socknode_t *node) return recvbuf; } +int testgnb_gtpu_send(ogs_socknode_t *node, ogs_pkbuf_t *sendbuf) +{ + int rv; + + ogs_sockaddr_t upf; + ssize_t sent; + + ogs_assert(node); + ogs_assert(node->sock); + + memset(&upf, 0, sizeof(ogs_sockaddr_t)); + upf.ogs_sin_port = htons(OGS_GTPV1_U_UDP_PORT); + upf.ogs_sa_family = AF_INET; + upf.sin.sin_addr.s_addr = inet_addr("127.0.0.4"); + + sent = ogs_sendto(node->sock->fd, sendbuf->data, sendbuf->len, 0, &upf); + ogs_pkbuf_free(sendbuf); + if (sent < 0 || sent != sendbuf->len) + return OGS_ERROR; + + return OGS_OK; +} + void test_gtpu_close(ogs_socknode_t *node) { ogs_socknode_free(node); } + +#include "upf/upf-config.h" + +#if HAVE_NETINET_IP_H +#include +#endif + +#if HAVE_NETINET_IP6_H +#include +#endif + +#if HAVE_NETINET_IP_ICMP_H +#include +#endif + +#if HAVE_NETINET_ICMP6_H +#include +#endif + +static uint16_t in_cksum(uint16_t *addr, int len) +{ + int nleft = len; + uint32_t sum = 0; + uint16_t *w = addr; + uint16_t answer = 0; + + // Adding 16 bits sequentially in sum + while (nleft > 1) { + sum += *w; + nleft -= 2; + w++; + } + + // If an odd byte is left + if (nleft == 1) { + *(uint8_t *) (&answer) = *(uint8_t *) w; + sum += answer; + } + + sum = (sum >> 16) + (sum & 0xffff); + sum += (sum >> 16); + answer = ~sum; + + return answer; +} + +int test_gtpu_build_ping(ogs_pkbuf_t **sendbuf, + test_sess_t *sess, const char *dst_ip) +{ + int rv; + ogs_pkbuf_t *pkbuf = NULL; + ogs_gtp_header_t *gtp_h = NULL; + ogs_ipsubnet_t dst_ipsub; + + ogs_assert(sess); + ogs_assert(dst_ip); + rv = ogs_ipsubnet(&dst_ipsub, dst_ip, NULL); + ogs_assert(rv == OGS_OK); + + pkbuf = ogs_pkbuf_alloc(NULL, + 200 /* enough for ICMP; use smaller buffer */); + ogs_pkbuf_put(pkbuf, 200); + memset(pkbuf->data, 0, pkbuf->len); + + gtp_h = (ogs_gtp_header_t *)pkbuf->data; + gtp_h->flags = 0x30; + gtp_h->type = OGS_GTPU_MSGTYPE_GPDU; + gtp_h->teid = htonl(sess->upf_n3_teid); + + if (dst_ipsub.family == AF_INET) { + struct ip *ip_h = NULL; + struct icmp *icmp_h = NULL; + + gtp_h->length = htons(sizeof *ip_h + ICMP_MINLEN); + + ip_h = (struct ip *)(pkbuf->data + OGS_GTPV1U_HEADER_LEN); + icmp_h = (struct icmp *)((uint8_t *)ip_h + sizeof *ip_h); + + ip_h->ip_v = 4; + ip_h->ip_hl = 5; + ip_h->ip_tos = 0; + ip_h->ip_id = rand(); + ip_h->ip_off = 0; + ip_h->ip_ttl = 255; + ip_h->ip_p = IPPROTO_ICMP; + ip_h->ip_len = gtp_h->length; + if (sess->ue_ip.ipv4 && sess->ue_ip.ipv6) + ip_h->ip_src.s_addr = sess->ue_ip.both.addr; + else + ip_h->ip_src.s_addr = sess->ue_ip.addr; + ip_h->ip_dst.s_addr = dst_ipsub.sub[0]; + ip_h->ip_sum = in_cksum((uint16_t *)ip_h, sizeof *ip_h); + + icmp_h->icmp_type = 8; + icmp_h->icmp_seq = rand(); + icmp_h->icmp_id = rand(); + icmp_h->icmp_cksum = in_cksum((uint16_t *)icmp_h, ICMP_MINLEN); + } else if (dst_ipsub.family == AF_INET6) { +#if 0 + struct ip6_hdr *ip6_h = NULL; + struct icmp6_hdr *icmp6_h = NULL; + uint16_t plen = 0; + uint8_t nxt = 0; + uint8_t *p = NULL; + + gtp_h->length = htons(sizeof *ip6_h + sizeof *icmp6_h); + plen = htons(sizeof *icmp6_h); + nxt = IPPROTO_ICMPV6; + + p = (uint8_t *)pkbuf->data + OGS_GTPV1U_HEADER_LEN; + ip6_h = (struct ip6_hdr *)p; + icmp6_h = (struct icmp6_hdr *)((uint8_t *)ip6_h + sizeof *ip6_h); + + memcpy(p, src_ipsub.sub, sizeof src_ipsub.sub); + p += sizeof src_ipsub.sub; + memcpy(p, dst_ipsub.sub, sizeof dst_ipsub.sub); + p += sizeof dst_ipsub.sub; + p += 2; memcpy(p, &plen, 2); p += 2; + p += 3; *p = nxt; p += 1; + + icmp6_h->icmp6_type = ICMP6_ECHO_REQUEST; + icmp6_h->icmp6_seq = rand(); + icmp6_h->icmp6_id = rand(); + + icmp6_h->icmp6_cksum = in_cksum( + (uint16_t *)ip6_h, sizeof *ip6_h + sizeof *icmp6_h); + + ip6_h->ip6_flow = htonl(0x60000001); + ip6_h->ip6_plen = plen; + ip6_h->ip6_nxt = nxt;; + ip6_h->ip6_hlim = 0xff; + memcpy(ip6_h->ip6_src.s6_addr, src_ipsub.sub, sizeof src_ipsub.sub); + memcpy(ip6_h->ip6_dst.s6_addr, dst_ipsub.sub, sizeof dst_ipsub.sub); +#endif + } else + ogs_assert_if_reached(); + + *sendbuf = pkbuf; + + return OGS_OK; +} diff --git a/tests/common/gtpu.h b/tests/common/gtpu.h index 385496833..1dff983ee 100644 --- a/tests/common/gtpu.h +++ b/tests/common/gtpu.h @@ -24,10 +24,18 @@ extern "C" { #endif +#define testgnb_gtpu_server(x) test_gtpu_server(x, OGS_GTPV1_U_UDP_PORT) +#define testgnb_gtpu_read(x) test_gtpu_read(x) +#define testgnb_gtpu_close(x) test_gtpu_close(x) + ogs_socknode_t *test_gtpu_server(const char *ipstr, int port); ogs_pkbuf_t *test_gtpu_read(ogs_socknode_t *node); +int testgnb_gtpu_send(ogs_socknode_t *node, ogs_pkbuf_t *sendbuf); void test_gtpu_close(ogs_socknode_t *node); +int test_gtpu_build_ping(ogs_pkbuf_t **sendbuf, + test_sess_t *sess, const char *dst_ip); + #ifdef __cplusplus } #endif diff --git a/tests/common/meson.build b/tests/common/meson.build index c1f9c7a07..bb2b947d5 100644 --- a/tests/common/meson.build +++ b/tests/common/meson.build @@ -32,6 +32,8 @@ libtestcommon_sources = files(''' gmm-build.c gmm-handler.c + gsm-build.c + gsm-handler.c nas-path.c nas-security.c '''.split()) @@ -41,11 +43,12 @@ libtestcommon_inc = include_directories('.') libtestcommon = static_library('testcomon', sources : libtestcommon_sources, c_args : testcore_cc_flags, - include_directories : [libtestcommon_inc, testinc], + include_directories : [libtestcommon_inc, testinc, srcinc], dependencies : [libcore_dep, libapp_dep, libdbi_dep, libsctp_dep, + libgtp_dep, libngap_dep, libnas_eps_dep, libnas_5gs_dep, @@ -54,11 +57,12 @@ libtestcommon = static_library('testcomon', libtestcommon_dep = declare_dependency( link_with : libtestcommon, - include_directories : [libtestcommon_inc, testinc], + include_directories : [libtestcommon_inc, testinc, srcinc], dependencies : [libcore_dep, libapp_dep, libdbi_dep, libsctp_dep, + libgtp_dep, libngap_dep, libnas_eps_dep, libnas_5gs_dep, diff --git a/tests/common/nas-path.c b/tests/common/nas-path.c index 87e4120c6..9c7d54eac 100644 --- a/tests/common/nas-path.c +++ b/tests/common/nas-path.c @@ -37,6 +37,15 @@ void testgmm_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf) break; case OGS_NAS_5GS_SECURITY_MODE_COMMAND: break; + case OGS_NAS_5GS_REGISTRATION_ACCEPT: + testgmm_handle_registration_accept(test_ue, + &message.gmm.authentication_request); + break; + case OGS_NAS_5GS_CONFIGURATION_UPDATE_COMMAND: + break; + case OGS_NAS_5GS_DL_NAS_TRANSPORT: + testgmm_handle_dl_nas_transport(test_ue, &message.gmm.dl_nas_transport); + break; default: ogs_error("Unknown message[%d]", message.gmm.h.message_type); break; @@ -45,10 +54,43 @@ void testgmm_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf) ogs_pkbuf_free(pkbuf); } -void testgsm_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf) +void testgsm_recv(test_sess_t *sess, ogs_pkbuf_t *pkbuf) { - ogs_assert(test_ue); + int rv; + ogs_nas_5gs_message_t message; + + ogs_assert(sess); ogs_assert(pkbuf); + rv = ogs_nas_5gsm_decode(&message, pkbuf); + ogs_assert(rv == OGS_OK); + + switch (message.gsm.h.message_type) { + case OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT: + testgsm_handle_pdu_session_establishment_accept(sess, + &message.gsm.pdu_session_establishment_accept); + break; + default: + ogs_error("Unknown message[%d]", message.gsm.h.message_type); + break; + } + ogs_pkbuf_free(pkbuf); } + +void testgmm_send_to_gsm(test_sess_t *sess, + ogs_nas_payload_container_t *payload_container) +{ + ogs_pkbuf_t *gsmbuf = NULL; + + ogs_assert(sess); + ogs_assert(payload_container); + ogs_assert(payload_container->buffer); + ogs_assert(payload_container->length); + + gsmbuf = ogs_pkbuf_alloc(NULL, payload_container->length); + ogs_pkbuf_put_data(gsmbuf, + payload_container->buffer, payload_container->length); + + testgsm_recv(sess, gsmbuf); +} diff --git a/tests/common/nas-path.h b/tests/common/nas-path.h index 99a5e7503..165e67482 100644 --- a/tests/common/nas-path.h +++ b/tests/common/nas-path.h @@ -25,7 +25,10 @@ extern "C" { #endif void testgmm_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf); -void testgsm_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf); +void testgsm_recv(test_sess_t *sess, ogs_pkbuf_t *pkbuf); + +void testgmm_send_to_gsm(test_sess_t *sess, + ogs_nas_payload_container_t *payload_container); #ifdef __cplusplus } diff --git a/tests/common/nas-security.c b/tests/common/nas-security.c index f08e4469a..c825fb78b 100644 --- a/tests/common/nas-security.c +++ b/tests/common/nas-security.c @@ -66,8 +66,19 @@ ogs_pkbuf_t *test_nas_5gs_security_encode( test_ue->dl_count.i32 = 0; } - if (test_ue->selected_enc_algorithm == 0) + if (test_ue->selected_enc_algorithm == 0) { ciphered = 0; +#if 0 /* Wireshark does not support it */ + if (message->h.security_header_type == + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED) + message->h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED; + else if (message->h.security_header_type == + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHTERD_WITH_NEW_INTEGRITY_CONTEXT) + message->h.security_header_type = + OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_NEW_SECURITY_CONTEXT; +#endif + } if (test_ue->selected_int_algorithm == 0) integrity_protected = 0; @@ -87,7 +98,7 @@ ogs_pkbuf_t *test_nas_5gs_security_encode( /* encrypt NAS message */ ogs_nas_encrypt(test_ue->selected_enc_algorithm, test_ue->knas_enc, test_ue->ul_count, - test_ue->nas.connection_identifier, + test_ue->nas.access_type, NAS_SECURITY_UPLINK_DIRECTION, new); } @@ -101,7 +112,7 @@ ogs_pkbuf_t *test_nas_5gs_security_encode( /* calculate NAS MAC(message authentication code) */ ogs_nas_mac_calculate(test_ue->selected_int_algorithm, test_ue->knas_int, test_ue->ul_count, - test_ue->nas.connection_identifier, + test_ue->nas.access_type, NAS_SECURITY_UPLINK_DIRECTION, new, mac); memcpy(&h.message_authentication_code, mac, sizeof(mac)); } @@ -162,7 +173,7 @@ int test_nas_5gs_security_decode(test_ue_t *test_ue, /* calculate NAS MAC(message authentication code) */ ogs_nas_mac_calculate(test_ue->selected_int_algorithm, test_ue->knas_int, test_ue->dl_count.i32, - test_ue->nas.connection_identifier, + test_ue->nas.access_type, NAS_SECURITY_DOWNLINK_DIRECTION, pkbuf, mac); h->message_authentication_code = original_mac; @@ -181,7 +192,7 @@ int test_nas_5gs_security_decode(test_ue_t *test_ue, /* decrypt NAS message */ ogs_nas_encrypt(test_ue->selected_enc_algorithm, test_ue->knas_enc, test_ue->dl_count.i32, - test_ue->nas.connection_identifier, + test_ue->nas.access_type, NAS_SECURITY_DOWNLINK_DIRECTION, pkbuf); } } diff --git a/tests/common/ngap-build.c b/tests/common/ngap-build.c index 731248297..0a427a83a 100644 --- a/tests/common/ngap-build.c +++ b/tests/common/ngap-build.c @@ -133,7 +133,7 @@ ogs_pkbuf_t *testngap_build_ng_setup_request(uint32_t gnb_id) *PagingDRX = NGAP_PagingDRX_v64; - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *testngap_build_initial_ue_message(ogs_pkbuf_t *gmmbuf) @@ -242,7 +242,7 @@ ogs_pkbuf_t *testngap_build_initial_ue_message(ogs_pkbuf_t *gmmbuf) *UEContextRequest = NGAP_UEContextRequest_requested; - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); } ogs_pkbuf_t *testngap_build_uplink_nas_transport( @@ -338,5 +338,323 @@ ogs_pkbuf_t *testngap_build_uplink_nas_transport( UserLocationInformation->choice.userLocationInformationNR = userLocationInformationNR; - return ogs_ngap_encode(&pdu); + return nga_ngap_encode(&pdu); +} + +ogs_pkbuf_t *testngap_build_initial_context_setup_response(test_ue_t *test_ue) +{ + int rv; + + NGAP_NGAP_PDU_t pdu; + NGAP_SuccessfulOutcome_t *successfulOutcome = NULL; + NGAP_InitialContextSetupResponse_t *InitialContextSetupResponse = NULL; + + NGAP_InitialContextSetupResponseIEs_t *ie = NULL; + NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL; + NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; + + memset(&pdu, 0, sizeof (NGAP_NGAP_PDU_t)); + pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = CALLOC(1, sizeof(NGAP_SuccessfulOutcome_t)); + + successfulOutcome = pdu.choice.successfulOutcome; + successfulOutcome->procedureCode = + NGAP_ProcedureCode_id_InitialContextSetup; + successfulOutcome->criticality = NGAP_Criticality_reject; + successfulOutcome->value.present = + NGAP_SuccessfulOutcome__value_PR_InitialContextSetupResponse; + + InitialContextSetupResponse = + &successfulOutcome->value.choice.InitialContextSetupResponse; + + ie = CALLOC(1, sizeof(NGAP_InitialContextSetupResponseIEs_t)); + ASN_SEQUENCE_ADD(&InitialContextSetupResponse->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = + NGAP_InitialContextSetupResponseIEs__value_PR_AMF_UE_NGAP_ID; + + AMF_UE_NGAP_ID = &ie->value.choice.AMF_UE_NGAP_ID; + + ie = CALLOC(1, sizeof(NGAP_InitialContextSetupResponseIEs_t)); + ASN_SEQUENCE_ADD(&InitialContextSetupResponse->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = + NGAP_InitialContextSetupResponseIEs__value_PR_RAN_UE_NGAP_ID; + + RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; + + asn_uint642INTEGER(AMF_UE_NGAP_ID, test_ue->amf_ue_ngap_id); + *RAN_UE_NGAP_ID = test_ue->ran_ue_ngap_id; + + return nga_ngap_encode(&pdu); +} + +ogs_pkbuf_t *testngap_build_initial_context_setup_failure(test_ue_t *test_ue, + NGAP_Cause_PR group, long cause) +{ + int rv; + + NGAP_NGAP_PDU_t pdu; + NGAP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL; + NGAP_InitialContextSetupFailure_t *InitialContextSetupFailure = NULL; + + NGAP_InitialContextSetupFailureIEs_t *ie = NULL; + NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL; + NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; + NGAP_Cause_t *Cause = NULL; + + memset(&pdu, 0, sizeof (NGAP_NGAP_PDU_t)); + pdu.present = NGAP_NGAP_PDU_PR_unsuccessfulOutcome; + pdu.choice.unsuccessfulOutcome = + CALLOC(1, sizeof(NGAP_UnsuccessfulOutcome_t)); + + unsuccessfulOutcome = pdu.choice.unsuccessfulOutcome; + unsuccessfulOutcome->procedureCode = + NGAP_ProcedureCode_id_InitialContextSetup; + unsuccessfulOutcome->criticality = NGAP_Criticality_reject; + unsuccessfulOutcome->value.present = + NGAP_UnsuccessfulOutcome__value_PR_InitialContextSetupFailure; + + InitialContextSetupFailure = + &unsuccessfulOutcome->value.choice.InitialContextSetupFailure; + + ie = CALLOC(1, sizeof(NGAP_InitialContextSetupFailureIEs_t)); + ASN_SEQUENCE_ADD(&InitialContextSetupFailure->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = + NGAP_InitialContextSetupFailureIEs__value_PR_AMF_UE_NGAP_ID; + + AMF_UE_NGAP_ID = &ie->value.choice.AMF_UE_NGAP_ID; + + ie = CALLOC(1, sizeof(NGAP_InitialContextSetupFailureIEs_t)); + ASN_SEQUENCE_ADD(&InitialContextSetupFailure->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = + NGAP_InitialContextSetupFailureIEs__value_PR_RAN_UE_NGAP_ID; + + RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; + + ie = CALLOC(1, sizeof(NGAP_InitialContextSetupFailureIEs_t)); + ASN_SEQUENCE_ADD(&InitialContextSetupFailure->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_Cause; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = + NGAP_InitialContextSetupFailureIEs__value_PR_Cause; + + Cause = &ie->value.choice.Cause; + + asn_uint642INTEGER(AMF_UE_NGAP_ID, test_ue->amf_ue_ngap_id); + *RAN_UE_NGAP_ID = test_ue->ran_ue_ngap_id; + + Cause->present = group; + Cause->choice.radioNetwork = cause; + + return nga_ngap_encode(&pdu); +} + +ogs_pkbuf_t *testngap_build_ue_radio_capability_info_indication( + test_ue_t *test_ue) +{ + NGAP_NGAP_PDU_t pdu; + NGAP_InitiatingMessage_t *initiatingMessage = NULL; + NGAP_UERadioCapabilityInfoIndication_t *UERadioCapabilityInfoIndication = NULL; + + NGAP_UERadioCapabilityInfoIndicationIEs_t *ie = NULL; + NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL; + NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; + NGAP_UERadioCapability_t *UERadioCapability = NULL; + + char capability[] = "abcd"; + + ogs_assert(test_ue); + + memset(&pdu, 0, sizeof (NGAP_NGAP_PDU_t)); + pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = + CALLOC(1, sizeof(NGAP_InitiatingMessage_t)); + + initiatingMessage = pdu.choice.initiatingMessage; + initiatingMessage->procedureCode = + NGAP_ProcedureCode_id_UERadioCapabilityInfoIndication; + initiatingMessage->criticality = NGAP_Criticality_ignore; + initiatingMessage->value.present = + NGAP_InitiatingMessage__value_PR_UERadioCapabilityInfoIndication; + + UERadioCapabilityInfoIndication = + &initiatingMessage->value.choice.UERadioCapabilityInfoIndication; + + ie = CALLOC(1, sizeof(NGAP_UERadioCapabilityInfoIndicationIEs_t)); + ASN_SEQUENCE_ADD(&UERadioCapabilityInfoIndication->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = + NGAP_UERadioCapabilityInfoIndicationIEs__value_PR_AMF_UE_NGAP_ID; + + AMF_UE_NGAP_ID = &ie->value.choice.AMF_UE_NGAP_ID; + + ie = CALLOC(1, sizeof(NGAP_UERadioCapabilityInfoIndicationIEs_t)); + ASN_SEQUENCE_ADD(&UERadioCapabilityInfoIndication->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = + NGAP_UERadioCapabilityInfoIndicationIEs__value_PR_RAN_UE_NGAP_ID; + + RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; + + ie = CALLOC(1, sizeof(NGAP_UERadioCapabilityInfoIndicationIEs_t)); + ASN_SEQUENCE_ADD(&UERadioCapabilityInfoIndication->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_UERadioCapability; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = NGAP_UERadioCapabilityInfoIndicationIEs__value_PR_UERadioCapability; + + UERadioCapability = &ie->value.choice.UERadioCapability; + + asn_uint642INTEGER(AMF_UE_NGAP_ID, test_ue->amf_ue_ngap_id); + *RAN_UE_NGAP_ID = test_ue->ran_ue_ngap_id; + + UERadioCapability->size = strlen(capability); + UERadioCapability->buf = CALLOC(UERadioCapability->size, sizeof(uint8_t)); + memcpy(UERadioCapability->buf, capability, UERadioCapability->size); + + return nga_ngap_encode(&pdu); +} + +static ogs_pkbuf_t *testngap_build_pdu_session_resource_response_trasfer( + test_sess_t *sess) +{ + ogs_ip_t gnb_n3_ip; + + NGAP_PDUSessionResourceSetupResponseTransfer_t message; + + NGAP_QosFlowPerTNLInformation_t *dLQosFlowPerTNLInformation = NULL; + + NGAP_UPTransportLayerInformation_t *uPTransportLayerInformation = NULL; + NGAP_GTPTunnel_t *gTPTunnel = NULL; + + NGAP_AssociatedQosFlowList_t *associatedQosFlowList = NULL; + NGAP_AssociatedQosFlowItem_t *associatedQosFlowItem = NULL; + + memset(&message, 0, sizeof(message)); + + dLQosFlowPerTNLInformation = &message.dLQosFlowPerTNLInformation; + uPTransportLayerInformation = + &dLQosFlowPerTNLInformation->uPTransportLayerInformation; + + gTPTunnel = CALLOC(1, sizeof(struct NGAP_GTPTunnel)); + uPTransportLayerInformation->present = + NGAP_UPTransportLayerInformation_PR_gTPTunnel; + uPTransportLayerInformation->choice.gTPTunnel = gTPTunnel; + + ogs_asn_ip_to_BIT_STRING(&sess->gnb_n3_ip, + &gTPTunnel->transportLayerAddress); + ogs_asn_uint32_to_OCTET_STRING(sess->gnb_n3_teid, &gTPTunnel->gTP_TEID); + + associatedQosFlowList = &dLQosFlowPerTNLInformation->associatedQosFlowList; + associatedQosFlowItem = + CALLOC(1, sizeof(struct NGAP_AssociatedQosFlowItem)); + ASN_SEQUENCE_ADD(&associatedQosFlowList->list, associatedQosFlowItem); + + associatedQosFlowItem->qosFlowIdentifier = 1; + + return ogs_asn_encode( + &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, &message); +} + +ogs_pkbuf_t *testngap_build_pdu_session_resource_setup_response( + test_sess_t *sess) +{ + int rv; + test_ue_t *test_ue; + ogs_pkbuf_t *n2smbuf = NULL; + ogs_pkbuf_t *ngapbuf = NULL; + + NGAP_NGAP_PDU_t pdu; + NGAP_SuccessfulOutcome_t *successfulOutcome = NULL; + NGAP_PDUSessionResourceSetupResponse_t *PDUSessionResourceSetupResponse; + + NGAP_PDUSessionResourceSetupResponseIEs_t *ie = NULL; + NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL; + NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; + NGAP_PDUSessionResourceSetupListSURes_t *PDUSessionList = NULL; + NGAP_PDUSessionResourceSetupItemSURes_t *PDUSessionItem = NULL; + OCTET_STRING_t *transfer = NULL; + + ogs_assert(sess); + test_ue = sess->test_ue; + ogs_assert(test_ue); + + memset(&pdu, 0, sizeof (NGAP_NGAP_PDU_t)); + pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome = CALLOC(1, sizeof(NGAP_SuccessfulOutcome_t)); + + successfulOutcome = pdu.choice.successfulOutcome; + successfulOutcome->procedureCode = + NGAP_ProcedureCode_id_PDUSessionResourceSetup; + successfulOutcome->criticality = NGAP_Criticality_reject; + successfulOutcome->value.present = + NGAP_SuccessfulOutcome__value_PR_PDUSessionResourceSetupResponse; + + PDUSessionResourceSetupResponse = + &successfulOutcome->value.choice.PDUSessionResourceSetupResponse; + + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupResponseIEs_t)); + ASN_SEQUENCE_ADD(&PDUSessionResourceSetupResponse->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = + NGAP_PDUSessionResourceSetupResponseIEs__value_PR_AMF_UE_NGAP_ID; + + AMF_UE_NGAP_ID = &ie->value.choice.AMF_UE_NGAP_ID; + + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupResponseIEs_t)); + ASN_SEQUENCE_ADD(&PDUSessionResourceSetupResponse->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = + NGAP_PDUSessionResourceSetupResponseIEs__value_PR_RAN_UE_NGAP_ID; + + RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; + + ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupResponseIEs_t)); + ASN_SEQUENCE_ADD(&PDUSessionResourceSetupResponse->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSURes; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_PDUSessionResourceSetupListSURes; + + PDUSessionList = &ie->value.choice.PDUSessionResourceSetupListSURes; + + asn_uint642INTEGER(AMF_UE_NGAP_ID, test_ue->amf_ue_ngap_id); + *RAN_UE_NGAP_ID = test_ue->ran_ue_ngap_id; + + PDUSessionItem = + CALLOC(1, sizeof(struct NGAP_PDUSessionResourceSetupItemSURes)); + ASN_SEQUENCE_ADD(&PDUSessionList->list, PDUSessionItem); + + PDUSessionItem->pDUSessionID = sess->psi; + + n2smbuf = testngap_build_pdu_session_resource_response_trasfer(sess); + ogs_assert(n2smbuf); + transfer = &PDUSessionItem->pDUSessionResourceSetupResponseTransfer; + + transfer->size = n2smbuf->len; + transfer->buf = CALLOC(transfer->size, sizeof(uint8_t)); + memcpy(transfer->buf, n2smbuf->data, transfer->size); + ogs_pkbuf_free(n2smbuf); + + return nga_ngap_encode(&pdu); } diff --git a/tests/common/ngap-build.h b/tests/common/ngap-build.h index 36c990d3a..aac955266 100644 --- a/tests/common/ngap-build.h +++ b/tests/common/ngap-build.h @@ -29,6 +29,16 @@ ogs_pkbuf_t *testngap_build_initial_ue_message(ogs_pkbuf_t *gmmbuf); ogs_pkbuf_t *testngap_build_uplink_nas_transport( test_ue_t *test_ue, ogs_pkbuf_t *gmmbuf); +ogs_pkbuf_t *testngap_build_initial_context_setup_response(test_ue_t *test_ue); +ogs_pkbuf_t *testngap_build_initial_context_setup_failure(test_ue_t *test_ue, + NGAP_Cause_PR group, long cause); + +ogs_pkbuf_t *testngap_build_ue_radio_capability_info_indication( + test_ue_t *test_ue); + +ogs_pkbuf_t *testngap_build_pdu_session_resource_setup_response( + test_sess_t *sess); + #ifdef __cplusplus } #endif diff --git a/tests/common/ngap-handler.c b/tests/common/ngap-handler.c index 488484704..7b9d15b82 100644 --- a/tests/common/ngap-handler.c +++ b/tests/common/ngap-handler.c @@ -19,6 +19,51 @@ #include "test-ngap.h" +void testngap_handle_ng_setup_response( + test_ue_t *test_ue, ogs_ngap_message_t *message) +{ + char buf[OGS_ADDRSTRLEN]; + int i, j; + + NGAP_SuccessfulOutcome_t *successfulOutcome = NULL; + NGAP_NGSetupResponse_t *NGSetupResponse = NULL; + NGAP_PLMNSupportList_t *PLMNSupportList = NULL; + + NGAP_NGSetupResponseIEs_t *ie = NULL; + + ogs_assert(test_ue); + ogs_assert(message); + + successfulOutcome = message->choice.successfulOutcome; + ogs_assert(successfulOutcome); + NGSetupResponse = &successfulOutcome->value.choice.NGSetupResponse; + ogs_assert(NGSetupResponse); + + ogs_debug("NG setup response"); + + for (i = 0; i < NGSetupResponse->protocolIEs.list.count; i++) { + ie = NGSetupResponse->protocolIEs.list.array[i]; + switch (ie->id) { + case NGAP_ProtocolIE_ID_id_PLMNSupportList: + PLMNSupportList = &ie->value.choice.PLMNSupportList; + break; + default: + break; + } + } + + for (i = 0; i < PLMNSupportList->list.count; i++) { + NGAP_PLMNSupportItem_t *NGAP_PLMNSupportItem = NULL; + NGAP_PLMNIdentity_t *pLMNIdentity = NULL; + NGAP_SliceSupportList_t *sliceSupportList = NULL; + + sliceSupportList = (NGAP_SliceSupportList_t *) + PLMNSupportList->list.array[i]; + for (j = 0; j < sliceSupportList->list.count; j++) { + } + } +} + void testngap_handle_downlink_nas_transport( test_ue_t *test_ue, ogs_ngap_message_t *message) { @@ -27,9 +72,9 @@ void testngap_handle_downlink_nas_transport( NGAP_NGAP_PDU_t pdu; NGAP_InitiatingMessage_t *initiatingMessage = NULL; - NGAP_DownlinkNASTransport_t *DownlinkNASTransport = NULL; + NGAP_InitialContextSetupRequest_t *InitialContextSetupRequest = NULL; - NGAP_DownlinkNASTransport_IEs_t *ie = NULL; + NGAP_InitialContextSetupRequestIEs_t *ie = NULL; NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL; NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL; NGAP_NAS_PDU_t *NAS_PDU = NULL; @@ -37,15 +82,14 @@ void testngap_handle_downlink_nas_transport( ogs_assert(test_ue); ogs_assert(message); - ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; ogs_assert(initiatingMessage); - DownlinkNASTransport = - &initiatingMessage->value.choice.DownlinkNASTransport; - ogs_assert(DownlinkNASTransport); + InitialContextSetupRequest = + &initiatingMessage->value.choice.InitialContextSetupRequest; + ogs_assert(InitialContextSetupRequest); - for (i = 0; i < DownlinkNASTransport->protocolIEs.list.count; i++) { - ie = DownlinkNASTransport->protocolIEs.list.array[i]; + for (i = 0; i < InitialContextSetupRequest->protocolIEs.list.count; i++) { + ie = InitialContextSetupRequest->protocolIEs.list.array[i]; switch (ie->id) { case NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID: RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID; @@ -67,3 +111,135 @@ void testngap_handle_downlink_nas_transport( if (NAS_PDU) testngap_send_to_nas(test_ue, NAS_PDU); } + +void testngap_handle_initial_context_setup_request( + test_ue_t *test_ue, ogs_ngap_message_t *message) +{ + int i; + char buf[OGS_ADDRSTRLEN]; + + NGAP_NGAP_PDU_t pdu; + NGAP_InitiatingMessage_t *initiatingMessage = NULL; + NGAP_InitialContextSetupRequest_t *InitialContextSetupRequest = NULL; + + NGAP_InitialContextSetupRequestIEs_t *ie = NULL; + NGAP_NAS_PDU_t *NAS_PDU = NULL; + + ogs_assert(test_ue); + ogs_assert(message); + + initiatingMessage = message->choice.initiatingMessage; + ogs_assert(initiatingMessage); + InitialContextSetupRequest = + &initiatingMessage->value.choice.InitialContextSetupRequest; + ogs_assert(InitialContextSetupRequest); + + for (i = 0; i < InitialContextSetupRequest->protocolIEs.list.count; i++) { + ie = InitialContextSetupRequest->protocolIEs.list.array[i]; + switch (ie->id) { + case NGAP_ProtocolIE_ID_id_NAS_PDU: + NAS_PDU = &ie->value.choice.NAS_PDU; + break; + default: + break; + } + } + + if (NAS_PDU) + testngap_send_to_nas(test_ue, NAS_PDU); +} + +void testngap_handle_pdu_session_resource_setup_request( + test_ue_t *test_ue, ogs_ngap_message_t *message) +{ + test_sess_t *sess = NULL; + int rv, i, j, k; + char buf[OGS_ADDRSTRLEN]; + + NGAP_NGAP_PDU_t pdu; + NGAP_InitiatingMessage_t *initiatingMessage = NULL; + NGAP_PDUSessionResourceSetupRequest_t *PDUSessionResourceSetupRequest; + + NGAP_PDUSessionResourceSetupListSUReq_t *PDUSessionList = NULL; + NGAP_PDUSessionResourceSetupItemSUReq_t *PDUSessionItem = NULL; + + NGAP_PDUSessionResourceSetupRequestIEs_t *ie = NULL; + NGAP_NAS_PDU_t *NAS_PDU = NULL; + + NGAP_PDUSessionResourceSetupRequestTransfer_t n2sm_message; + NGAP_PDUSessionResourceSetupRequestTransferIEs_t *ie2 = NULL; + NGAP_UPTransportLayerInformation_t *UPTransportLayerInformation = NULL; + NGAP_GTPTunnel_t *gTPTunnel = NULL; + NGAP_PDUSessionType_t *PDUSessionType = NULL; + OCTET_STRING_t *transfer = NULL; + ogs_pkbuf_t *n2smbuf = NULL; + + ogs_assert(test_ue); + sess = test_ue->sess; + ogs_assert(sess); + ogs_assert(message); + + initiatingMessage = message->choice.initiatingMessage; + ogs_assert(initiatingMessage); + PDUSessionResourceSetupRequest = + &initiatingMessage->value.choice.PDUSessionResourceSetupRequest; + ogs_assert(PDUSessionResourceSetupRequest); + + for (i = 0; i < PDUSessionResourceSetupRequest->protocolIEs.list.count; + i++) { + ie = PDUSessionResourceSetupRequest->protocolIEs.list.array[i]; + switch (ie->id) { + case NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSUReq: + PDUSessionList = &ie->value.choice.PDUSessionResourceSetupListSUReq; + ogs_assert(PDUSessionList); + for (j = 0; j < PDUSessionList->list.count; j++) { + PDUSessionItem = (NGAP_PDUSessionResourceSetupItemSUReq_t *) + PDUSessionList->list.array[j]; + ogs_assert(PDUSessionItem); + if (PDUSessionItem->pDUSessionNAS_PDU) + testngap_send_to_nas( + test_ue, PDUSessionItem->pDUSessionNAS_PDU); + transfer = &PDUSessionItem-> + pDUSessionResourceSetupRequestTransfer; + ogs_assert(transfer); + + n2smbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN); + ogs_pkbuf_put_data(n2smbuf, transfer->buf, transfer->size); + + rv = ogs_asn_decode( + &asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer, + &n2sm_message, sizeof(n2sm_message), n2smbuf); + ogs_assert(rv == OGS_OK); + + for (k = 0; k < n2sm_message.protocolIEs.list.count; k++) { + ie2 = n2sm_message.protocolIEs.list.array[k]; + switch (ie2->id) { + case NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLInformation: + UPTransportLayerInformation = + &ie2->value.choice.UPTransportLayerInformation; + gTPTunnel = + UPTransportLayerInformation->choice.gTPTunnel; + ogs_assert(gTPTunnel); + + ogs_asn_BIT_STRING_to_ip( + &gTPTunnel->transportLayerAddress, + &sess->upf_n3_ip); + ogs_asn_OCTET_STRING_to_uint32( + &gTPTunnel->gTP_TEID, &sess->upf_n3_teid); + default: + break; + } + } + + ogs_asn_free( + &asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer, + &n2sm_message); + + ogs_pkbuf_free(n2smbuf); + } + break; + default: + break; + } + } +} diff --git a/tests/common/ngap-handler.h b/tests/common/ngap-handler.h index 6bc71e6ba..f239ef132 100644 --- a/tests/common/ngap-handler.h +++ b/tests/common/ngap-handler.h @@ -24,8 +24,15 @@ extern "C" { #endif +void testngap_handle_ng_setup_response( + test_ue_t *test_ue, ogs_ngap_message_t *message); + void testngap_handle_downlink_nas_transport( test_ue_t *test_ue, ogs_ngap_message_t *message); +void testngap_handle_initial_context_setup_request( + test_ue_t *test_ue, ogs_ngap_message_t *message); +void testngap_handle_pdu_session_resource_setup_request( + test_ue_t *test_ue, ogs_ngap_message_t *message); #ifdef __cplusplus } diff --git a/tests/common/ngap-path.c b/tests/common/ngap-path.c index c24351903..a8c1d09ca 100644 --- a/tests/common/ngap-path.c +++ b/tests/common/ngap-path.c @@ -32,7 +32,7 @@ void testngap_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf) ogs_assert(test_ue); ogs_assert(pkbuf); - rv = ogs_ngap_decode(&message, pkbuf); + rv = nga_ngap_decode(&message, pkbuf); ogs_assert(rv == OGS_OK); pdu = &message; @@ -47,6 +47,12 @@ void testngap_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf) case NGAP_ProcedureCode_id_DownlinkNASTransport: testngap_handle_downlink_nas_transport(test_ue, pdu); break; + case NGAP_ProcedureCode_id_InitialContextSetup: + testngap_handle_initial_context_setup_request(test_ue, pdu); + break; + case NGAP_ProcedureCode_id_PDUSessionResourceSetup: + testngap_handle_pdu_session_resource_setup_request(test_ue, pdu); + break; default: ogs_error("Not implemented(choice:%d, proc:%d)", pdu->present, (int)initiatingMessage->procedureCode); @@ -58,6 +64,9 @@ void testngap_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf) ogs_assert(successfulOutcome); switch (successfulOutcome->procedureCode) { + case NGAP_ProcedureCode_id_NGSetup: + testngap_handle_ng_setup_response(test_ue, pdu); + break; default: ogs_error("Not implemented(choice:%d, proc:%d)", pdu->present, (int)successfulOutcome->procedureCode); @@ -80,7 +89,7 @@ void testngap_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf) break; } - ogs_ngap_free(&message); + nga_ngap_free(&message); ogs_pkbuf_free(pkbuf); } @@ -157,9 +166,6 @@ void testngap_send_to_nas(test_ue_t *test_ue, NGAP_NAS_PDU_t *nasPdu) if (h->extended_protocol_discriminator == OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM) { testgmm_recv(test_ue, nasbuf); - } else if (h->extended_protocol_discriminator == - OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM) { - testgsm_recv(test_ue, nasbuf); } else { ogs_error("Unknown NAS Protocol discriminator 0x%02x", h->extended_protocol_discriminator); diff --git a/tests/common/test-common.h b/tests/common/test-common.h index 43051a4cf..53119ea82 100644 --- a/tests/common/test-common.h +++ b/tests/common/test-common.h @@ -27,6 +27,7 @@ extern "C" { #include "ogs-app.h" #include "ogs-dbi.h" #include "ogs-sctp.h" +#include "ogs-gtp.h" #include "ogs-diameter-common.h" #include "ogs-nas-eps.h" #include "ogs-nas-5gs.h" @@ -41,6 +42,8 @@ extern "C" { #include "common/application.h" #include "common/gmm-build.h" #include "common/gmm-handler.h" +#include "common/gsm-build.h" +#include "common/gsm-handler.h" #include "common/nas-path.h" #include "common/nas-security.h" diff --git a/tests/crypt/abts-main.c b/tests/crypt/abts-main.c index fd54230b4..2af191bcb 100644 --- a/tests/crypt/abts-main.c +++ b/tests/crypt/abts-main.c @@ -23,12 +23,14 @@ abts_suite *test_aes(abts_suite *suite); abts_suite *test_sha(abts_suite *suite); +abts_suite *test_base64(abts_suite *suite); const struct testlist { abts_suite *(*func)(abts_suite *suite); } alltests[] = { {test_aes}, {test_sha}, + {test_base64}, {NULL}, }; diff --git a/tests/crypt/base64-test.c b/tests/crypt/base64-test.c new file mode 100644 index 000000000..6ee5ee9ca --- /dev/null +++ b/tests/crypt/base64-test.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ogs-crypt.h" +#include "core/abts.h" + +static struct { + const char *orig; + const char *enc; +} base64_tbl[] = +{ + {"", ""}, + {"H", "SA=="}, + {"He", "SGU="}, + {"Hel", "SGVs"}, + {"Hell", "SGVsbA=="}, + {"Hello", "SGVsbG8="}, + {"Hello World", "SGVsbG8gV29ybGQ="}, + {"\xff\xff\xff\xff", "/////w=="}, +}; +static int num_base64 = sizeof(base64_tbl) / sizeof(base64_tbl[0]); + +static void base64_test1(abts_case *tc, void *data) +{ + int i; + + for (i = 0; i < num_base64; i++) { + char *enc; + int orig_len, enc_len, b64_len, b64_enc_len; + + orig_len = strlen(base64_tbl[i].orig); + enc_len = strlen(base64_tbl[i].enc); + + /* includes + 1 for term null */ + b64_enc_len = ogs_base64_encode_len(orig_len); + ABTS_ASSERT(tc, "base 64 exp. length", (enc_len == (b64_enc_len - 1))); + + enc = ogs_malloc(b64_enc_len); + + b64_len = ogs_base64_encode(enc, base64_tbl[i].orig, orig_len); + + ABTS_ASSERT(tc, "base 64 encoded length", (b64_enc_len == b64_len)); + ABTS_ASSERT(tc, "base 64 encoded matches expected output", + (memcmp(enc, base64_tbl[i].enc, b64_enc_len) == 0)); + + ogs_free(enc); + } +} + +abts_suite *test_base64(abts_suite *suite) +{ + suite = ADD_SUITE(suite) + + abts_run_test(suite, base64_test1, NULL); + + return suite; +} diff --git a/tests/crypt/meson.build b/tests/crypt/meson.build index 70fca9f9f..8b16f8eb5 100644 --- a/tests/crypt/meson.build +++ b/tests/crypt/meson.build @@ -18,6 +18,7 @@ testcrypt_sources = files(''' aes-test.c sha-test.c + base64-test.c abts-main.c '''.split()) diff --git a/tests/minimal/minimal-test.c b/tests/minimal/minimal-test.c index 5941907e6..67fe5738b 100644 --- a/tests/minimal/minimal-test.c +++ b/tests/minimal/minimal-test.c @@ -25,6 +25,7 @@ static void test1_func(abts_case *tc, void *data) ogs_socknode_t *ngap; ogs_socknode_t *gtpu; ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; ogs_pkbuf_t *nasbuf; ogs_pkbuf_t *sendbuf; ogs_pkbuf_t *recvbuf; @@ -35,35 +36,9 @@ static void test1_func(abts_case *tc, void *data) ogs_nas_5gs_mobile_identity_t mobile_identity; ogs_nas_5gs_mobile_identity_imsi_t mobile_identity_imsi; test_ue_t test_ue; + test_sess_t test_sess; uint8_t tmp[OGS_MAX_SDU_LEN]; - const char *_ng_setup_request = - "0015002d00000300 1b00080002f83910 0001020066001500 000000010002f839" - "0001100801020310 0811223300154001 20"; - const char *_ng_setup_response = - "2015003a00000400 01000e05806f7065 6e3567732d616d66 3000600008000002" - "f839cafe00005640 01ff005000100002 f839000110080102 031008112233"; - const char *_authentication_request = - "000b403b00000300 000005c00100009d 000800020001001a 0025240752002008" - "0c3818183b522614 162c07601d0d10f1 1b89a2a8de8000ad 0ccf7f55e8b20d"; - const char *_security_mode_command = - "000b4028" - "00000300000005c0 0100009d00080002 0001001a00121137 f497722900075d01" - "0005e060c04070c1"; - const char *_esm_information_request = - "000b402000000300 000005c00100009d 000800020001001a 000a092779012320" - "010221d9"; - const char *_initial_context_setup_request = - "00090080d8000006 00000005c0010000 9d00080002000100 42000a183e800000" - "603e800000001800 8086000034008080 450009200f807f00 0002000000017127" - "4db5d98302074202 49064000f1105ba0 00485221c1010909 08696e7465726e65" - "7405010a2d00025e 06fefeeeee030327 2980c22304030000 0480211002000010" - "8106080808088306 08080404000d0408 080808000d040808 0404500bf600f110" - "0002010000000153 12172c5949640125 006b000518000c00 00004900203311c6" - "03c6a6d67f695e5a c02bb75b381b693c 3893a6d932fd9182 3544e3e79b"; - const char *_emm_information = - "000b403b00000300 000005c00100009d 000800020001001a 002524271f9b491e" - "030761430f10004f 00700065006e0035 0047005347812072 11240563490100"; const char *_k_string = "5122250214c33e723a5dd523fc145fc0"; uint8_t k[OGS_KEY_LEN]; @@ -115,35 +90,15 @@ static void test1_func(abts_case *tc, void *data) "\"__v\" : 0 " "}"; - /* gNB connects to AMF */ - ngap = testgnb_ngap_client("127.0.0.1"); - ABTS_PTR_NOTNULL(tc, ngap); - -#if 0 - /* eNB connects to SGW */ - gtpu = testgnb_gtpu_server("127.0.0.5"); - ABTS_PTR_NOTNULL(tc, gtpu); -#endif - - /* Send NG-Setup Reqeust */ - sendbuf = testngap_build_ng_setup_request(0x000102); - ABTS_PTR_NOTNULL(tc, sendbuf); - ABTS_TRUE(tc, memcmp(sendbuf->data, - OGS_HEX(_ng_setup_request, strlen(_ng_setup_request), tmp), - sendbuf->len) == 0); - rv = testgnb_ngap_send(ngap, sendbuf); - ABTS_INT_EQUAL(tc, OGS_OK, rv); - - /* Receive NG-Setup Response */ - recvbuf = testgnb_ngap_read(ngap); - ABTS_PTR_NOTNULL(tc, recvbuf); - ABTS_TRUE(tc, memcmp(recvbuf->data, - OGS_HEX(_ng_setup_response, strlen(_ng_setup_response), tmp), - recvbuf->len) == 0); - ogs_pkbuf_free(recvbuf); - - /* Setup Test UE Context */ + /* Setup Test UE & Session Context */ memset(&test_ue, 0, sizeof(test_ue)); + memset(&test_sess, 0, sizeof(test_sess)); + test_sess.test_ue = &test_ue; + test_ue.sess = &test_sess; + + test_ue.nas.registration.type = 1; /* TSC[0], KSI[1] */ + test_ue.nas.registration.follow_on_request = 1; + test_ue.nas.registration.value = 1; /* Initial Registration */ memset(&mobile_identity_imsi, 0, sizeof(mobile_identity_imsi)); mobile_identity.length = 12; @@ -166,12 +121,40 @@ static void test1_func(abts_case *tc, void *data) test_ue_set_mobile_identity(&test_ue, &mobile_identity); + test_ue.nas.access_type = OGS_ACCESS_TYPE_3GPP; test_ue.abba_len = 2; - test_ue.nas.connection_identifier = OGS_NAS_SECURITY_BEARER_3GPP; OGS_HEX(_k_string, strlen(_k_string), test_ue.k); OGS_HEX(_opc_string, strlen(_opc_string), test_ue.opc); + test_sess.psi = 10; + test_sess.pti = 0; + test_sess.pdu_session_type = OGS_PDU_SESSION_TYPE_IPV4; + test_sess.dnn = (char *)"internet"; + + test_sess.gnb_n3_ip.ipv4 = true; + test_sess.gnb_n3_ip.addr = inet_addr("127.0.0.5"); + test_sess.gnb_n3_teid = 3; + + /* gNB connects to AMF */ + ngap = testgnb_ngap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, ngap); + + /* gNB connects to UPF */ + gtpu = testgnb_gtpu_server("127.0.0.5"); + ABTS_PTR_NOTNULL(tc, gtpu); + + /* Send NG-Setup Reqeust */ + sendbuf = testngap_build_ng_setup_request(0x000102); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive NG-Setup Response */ + recvbuf = testgnb_ngap_read(ngap); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(&test_ue, recvbuf); + /********** Insert Subscriber in Database */ collection = mongoc_client_get_collection( ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); @@ -203,11 +186,6 @@ static void test1_func(abts_case *tc, void *data) recvbuf = testgnb_ngap_read(ngap); ABTS_PTR_NOTNULL(tc, recvbuf); testngap_recv(&test_ue, recvbuf); -#if 0 - ABTS_TRUE(tc, memcmp(recvbuf->data, - OGS_HEX(_authentication_request, strlen(_authentication_request), tmp), - recvbuf->len) == 0); -#endif /* Send Authentication response */ gmmbuf = testgmm_build_authentication_response(&test_ue); @@ -221,11 +199,6 @@ static void test1_func(abts_case *tc, void *data) recvbuf = testgnb_ngap_read(ngap); ABTS_PTR_NOTNULL(tc, recvbuf); testngap_recv(&test_ue, recvbuf); -#if 0 - ABTS_TRUE(tc, memcmp(recvbuf->data, - OGS_HEX(_security_mode_command, strlen(_security_mode_command), tmp), - recvbuf->len) == 0); -#endif /* Send Security mode complete */ nasbuf = testgmm_build_registration_request(&test_ue, &mobile_identity); @@ -238,74 +211,64 @@ static void test1_func(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, OGS_OK, rv); ogs_pkbuf_free(nasbuf); - ogs_msleep(300); -#if 0 - - /* Send Security mode Complete */ - rv = testngap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, OGS_OK, rv); - rv = testgnb_ngap_send(ngap, sendbuf); - ABTS_INT_EQUAL(tc, OGS_OK, rv); - - /* Receive ESM Information Request */ + /* Receive Initial context setup request */ recvbuf = testgnb_ngap_read(ngap); ABTS_PTR_NOTNULL(tc, recvbuf); - ABTS_TRUE(tc, memcmp(recvbuf->data, - OGS_HEX(_esm_information_request, strlen(_security_mode_command), tmp), - recvbuf->len) == 0); - ogs_pkbuf_free(recvbuf); + testngap_recv(&test_ue, recvbuf); - /* Send ESM Information Response */ - rv = testngap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, OGS_OK, rv); - rv = testgnb_ngap_send(ngap, sendbuf); - ABTS_INT_EQUAL(tc, OGS_OK, rv); - - /* Receive Initial Context Setup Request + - * Attach Accept + - * Activate Default Bearer Context Request */ - recvbuf = testgnb_ngap_read(ngap); - ABTS_PTR_NOTNULL(tc, recvbuf); - OGS_HEX(_initial_context_setup_request, - strlen(_initial_context_setup_request), tmp); - ABTS_TRUE(tc, memcmp(recvbuf->data, tmp, 62) == 0); - ABTS_TRUE(tc, memcmp(recvbuf->data+66, tmp+66, 78) == 0); - ABTS_TRUE(tc, memcmp(recvbuf->data+148, tmp+148, 50) == 0); - ogs_pkbuf_free(recvbuf); - - /* Send UE Capability Info Indication */ - rv = testngap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, OGS_OK, rv); + /* Send UE radio capability info indication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(&test_ue); + ABTS_PTR_NOTNULL(tc, sendbuf); rv = testgnb_ngap_send(ngap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); ogs_msleep(50); - /* Send Initial Context Setup Response */ - rv = testngap_build_initial_context_setup_response(&sendbuf, - 27263233, 24, 5, 1, "127.0.0.5"); - ABTS_INT_EQUAL(tc, OGS_OK, rv); + /* Send Initial context setup response */ + sendbuf = testngap_build_initial_context_setup_response(&test_ue); + ABTS_PTR_NOTNULL(tc, sendbuf); rv = testgnb_ngap_send(ngap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); - /* Send Attach Complete + Activate default EPS bearer cotext accept */ - rv = testngap_build_attach_complete(&sendbuf, msgindex); + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(&test_ue); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf = testgnb_ngap_read(ngap); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(&test_ue, recvbuf); + + /* Send PDU session establishment request */ + gsmbuf = testgsm_build_pdu_session_establishment_request(&test_sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(&test_sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDU session establishment accept */ + recvbuf = testgnb_ngap_read(ngap); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(&test_ue, recvbuf); + + /* Send PDU session resource setup response */ + sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess); + ABTS_PTR_NOTNULL(tc, sendbuf); rv = testgnb_ngap_send(ngap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); ogs_msleep(50); - /* Receive EMM information */ - recvbuf = testgnb_ngap_read(ngap); - ABTS_PTR_NOTNULL(tc, recvbuf); - OGS_HEX(_emm_information, strlen(_emm_information), tmp); - ABTS_TRUE(tc, memcmp(recvbuf->data, tmp, 28) == 0); - ABTS_TRUE(tc, memcmp(recvbuf->data+32, tmp+32, 20) == 0); - ogs_pkbuf_free(recvbuf); - /* Send GTP-U ICMP Packet */ - rv = testgtpu_build_ping(&sendbuf, 1, "10.45.0.2", "10.45.0.1"); + rv = test_gtpu_build_ping(&sendbuf, &test_sess, "10.45.0.1"); ABTS_INT_EQUAL(tc, OGS_OK, rv); rv = testgnb_gtpu_send(gtpu, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); @@ -314,7 +277,6 @@ static void test1_func(abts_case *tc, void *data) recvbuf = testgnb_gtpu_read(gtpu); ABTS_PTR_NOTNULL(tc, recvbuf); ogs_pkbuf_free(recvbuf); -#endif /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi)); @@ -328,10 +290,8 @@ static void test1_func(abts_case *tc, void *data) /* Clear Test UE Context */ test_ue_remove(&test_ue); -#if 0 - /* eNB disonncect from SGW */ + /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); -#endif /* gNB disonncect from AMF */ testgnb_ngap_close(ngap);