Commit 7d7e83fe authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix network slicing related issues (Interaction between AMF and UDM/NSSF/NRF)

parent 13b46221
...@@ -96,42 +96,69 @@ class amf_app { ...@@ -96,42 +96,69 @@ class amf_app {
amf_app(amf_app const&) = delete; amf_app(amf_app const&) = delete;
void operator=(amf_app const&) = delete; void operator=(amf_app const&) = delete;
void allRegistredModulesInit(const amf_modules& modules); void allRegistredModulesInit(const amf_modules& modules);
/*
* Generate AMF UE NGAP ID
* @return generated ID
*/
long generate_amf_ue_ngap_id(); long generate_amf_ue_ngap_id();
// itti handlers
/*
* Handle ITTI message (NAS Signalling Establishment Request: Registration
* Request, Service Request )
* @param [itti_nas_signalling_establishment_request&]: ITTI message
* @return void
*/
void handle_itti_message(itti_nas_signalling_establishment_request& itti_msg); void handle_itti_message(itti_nas_signalling_establishment_request& itti_msg);
/*
* Handle ITTI message (N1N2MessageTransferRequest)
* @param [itti_n1n2_message_transfer_request&]: ITTI message
* @return void
*/
void handle_itti_message(itti_n1n2_message_transfer_request& itti_msg); void handle_itti_message(itti_n1n2_message_transfer_request& itti_msg);
/*
* Handle ITTI message (SBI N1 Message Notification)
* @param [itti_sbi_n1_message_notification&]: ITTI message
* @return void
*/
void handle_itti_message(itti_sbi_n1_message_notification& itti_msg); void handle_itti_message(itti_sbi_n1_message_notification& itti_msg);
// TODO
bool is_amf_ue_id_2_ue_context(const long& amf_ue_ngap_id) const; bool is_amf_ue_id_2_ue_context(const long& amf_ue_ngap_id) const;
std::shared_ptr<ue_context> amf_ue_id_2_ue_context( std::shared_ptr<ue_context> amf_ue_id_2_ue_context(
const long& amf_ue_ngap_id) const; const long& amf_ue_ngap_id) const;
// TODO
void set_amf_ue_ngap_id_2_ue_context( void set_amf_ue_ngap_id_2_ue_context(
const long& amf_ue_ngap_id, std::shared_ptr<ue_context> uc); const long& amf_ue_ngap_id, std::shared_ptr<ue_context> uc);
// TODO
bool is_ran_amf_id_2_ue_context(const std::string& ue_context_key) const; bool is_ran_amf_id_2_ue_context(const std::string& ue_context_key) const;
std::shared_ptr<ue_context> ran_amf_id_2_ue_context( std::shared_ptr<ue_context> ran_amf_id_2_ue_context(
const std::string& ue_context_key) const; const std::string& ue_context_key) const;
// TODO
bool ran_amf_id_2_ue_context( bool ran_amf_id_2_ue_context(
const std::string& ue_context_key, std::shared_ptr<ue_context>& uc) const; const std::string& ue_context_key, std::shared_ptr<ue_context>& uc) const;
// TODO
void set_ran_amf_id_2_ue_context( void set_ran_amf_id_2_ue_context(
const std::string& ue_context_key, std::shared_ptr<ue_context> uc); const std::string& ue_context_key, std::shared_ptr<ue_context> uc);
// TODO
bool is_supi_2_ue_context(const string& supi) const; bool is_supi_2_ue_context(const string& supi) const;
std::shared_ptr<ue_context> supi_2_ue_context(const string& supi) const; std::shared_ptr<ue_context> supi_2_ue_context(const string& supi) const;
// TODO
void set_supi_2_ue_context( void set_supi_2_ue_context(
const string& ue_context_key, std::shared_ptr<ue_context>& uc); const string& ue_context_key, std::shared_ptr<ue_context>& uc);
// TODO
bool find_pdu_session_context( bool find_pdu_session_context(
const string& supi, const std::uint8_t pdu_session_id, const string& supi, const std::uint8_t pdu_session_id,
std::shared_ptr<pdu_session_context>& psc); std::shared_ptr<pdu_session_context>& psc);
// TODO
bool get_pdu_sessions_context( bool get_pdu_sessions_context(
const string& supi, const string& supi,
std::vector<std::shared_ptr<pdu_session_context>>& sessions_ctx); std::vector<std::shared_ptr<pdu_session_context>>& sessions_ctx);
// TODO
uint32_t generate_tmsi(); uint32_t generate_tmsi();
// TODO
bool generate_5g_guti( bool generate_5g_guti(
uint32_t ranid, long amfid, std::string& mcc, std::string& mnc, uint32_t ranid, long amfid, std::string& mcc, std::string& mnc,
uint32_t& tmsi); uint32_t& tmsi);
...@@ -267,6 +294,24 @@ class amf_app { ...@@ -267,6 +294,24 @@ class amf_app {
void add_promise( void add_promise(
uint32_t pid, boost::shared_ptr<boost::promise<uint32_t>>& p); uint32_t pid, boost::shared_ptr<boost::promise<uint32_t>>& p);
/*
* Store the promise
* @param [uint32_t] pid: promise id
* @param [boost::shared_ptr<boost::promise<std::string>>&] p: promise
* @return void
*/
void add_promise(
uint32_t pid, boost::shared_ptr<boost::promise<std::string>>& p);
/*
* Store the promise
* @param [uint32_t] pid: promise id
* @param [boost::shared_ptr<boost::promise<nlohmann::json>>&] p: promise
* @return void
*/
void add_promise(
uint32_t pid, boost::shared_ptr<boost::promise<nlohmann::json>>& p);
/* /*
* Remove the promise * Remove the promise
* @param [uint32_t] pid: promise id * @param [uint32_t] pid: promise id
...@@ -283,14 +328,34 @@ class amf_app { ...@@ -283,14 +328,34 @@ class amf_app {
return util::uint_uid_generator<uint64_t>::get_instance().get_uid(); return util::uint_uid_generator<uint64_t>::get_instance().get_uid();
} }
void add_promise( /*
uint32_t pid, boost::shared_ptr<boost::promise<std::string>>& p); * Trigger the response from API server
void add_promise( * @param [uint32_t] pid: promise id
uint32_t pid, boost::shared_ptr<boost::promise<nlohmann::json>>& p); * @param [uint32_t] http_code: result for the corresponding promise
* @return void
*/
void trigger_process_response(uint32_t pid, uint32_t http_code); void trigger_process_response(uint32_t pid, uint32_t http_code);
/*
* Trigger the response from API server
* @param [uint32_t] pid: promise id
* @param [std::string] n2_sm: result for the corresponding promise
* @return void
*/
void trigger_process_response(uint32_t pid, std::string n2_sm); void trigger_process_response(uint32_t pid, std::string n2_sm);
/*
* Trigger the response from API server
* @param [uint32_t] pid: promise id
* @param [nlohmann::json&] json_data: result for the corresponding promise
* @return void
*/
void trigger_process_response(uint32_t pid, nlohmann::json& json_data); void trigger_process_response(uint32_t pid, nlohmann::json& json_data);
/*
* Get the AMF's NF instance
* @return NF instance in string format
*/
std::string get_nf_instance() const; std::string get_nf_instance() const;
}; };
......
This diff is collapsed.
...@@ -70,10 +70,11 @@ class amf_n1 { ...@@ -70,10 +70,11 @@ class amf_n1 {
public: public:
std::map<long, std::shared_ptr<nas_context>> std::map<long, std::shared_ptr<nas_context>>
amfueid2nas_context; // amf ue ngap id amfueid2nas_context; // amf ue ngap id
mutable std::shared_mutex m_amfueid2nas_context;
std::map<std::string, std::shared_ptr<nas_context>> imsi2nas_context; std::map<std::string, std::shared_ptr<nas_context>> imsi2nas_context;
std::map<std::string, long> supi2amfId; std::map<std::string, long> supi2amfId;
std::map<std::string, uint32_t> supi2ranId; std::map<std::string, uint32_t> supi2ranId;
mutable std::shared_mutex m_nas_context; mutable std::shared_mutex m_nas_context;
std::map<std::string, std::shared_ptr<nas_context>> guti2nas_context; std::map<std::string, std::shared_ptr<nas_context>> guti2nas_context;
...@@ -86,174 +87,293 @@ class amf_n1 { ...@@ -86,174 +87,293 @@ class amf_n1 {
amf_n1(); amf_n1();
~amf_n1(); ~amf_n1();
/*
* Handle ITTI message
* @param [itti_uplink_nas_data_ind&]: ITTI message
* @return void
*/
void handle_itti_message(itti_uplink_nas_data_ind&); void handle_itti_message(itti_uplink_nas_data_ind&);
/*
* Handle ITTI message
* @param [itti_downlink_nas_transfer&]: ITTI message
* @return void
*/
void handle_itti_message(itti_downlink_nas_transfer& itti_msg); void handle_itti_message(itti_downlink_nas_transfer& itti_msg);
// nas message decode
/*
* Handle NAS Establishment Request (Registration Request, Service Request)
* @param [SecurityHeaderType] type: Security Header Type
* @param [std::shared_ptr<nas_context>] nc: Shared pointer to the NAS context
* @param [uint32_t] ran_ue_ngap_id: RAN UE NGAP Id
* @param [long] amf_ue_ngap_id: AMF UE NGAP Id
* @param [bstring] plain_msg: NAS message in plain text
* @param [std::string] snn: Serving Network
* @param [uint8_t] ulCount: UL Sequence number
* @return void
*/
void nas_signalling_establishment_request_handle( void nas_signalling_establishment_request_handle(
SecurityHeaderType type, std::shared_ptr<nas_context> nc, SecurityHeaderType type, std::shared_ptr<nas_context> nc,
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
std::string snn, uint8_t ulCount); std::string snn, uint8_t ulCount);
// TODO
void uplink_nas_msg_handle( void uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
plmn_t plmn); plmn_t plmn);
// TODO
bool check_security_header_type(SecurityHeaderType& type, uint8_t* buffer); bool check_security_header_type(SecurityHeaderType& type, uint8_t* buffer);
// TODO
bool is_guti_2_nas_context(const std::string& guti) const; bool is_guti_2_nas_context(const std::string& guti) const;
// TODO
std::shared_ptr<nas_context> guti_2_nas_context( std::shared_ptr<nas_context> guti_2_nas_context(
const std::string& guti) const; const std::string& guti) const;
// TODO
void set_guti_2_nas_context( void set_guti_2_nas_context(
const std::string& guti, std::shared_ptr<nas_context> nc); const std::string& guti, std::shared_ptr<nas_context> nc);
mutable std::shared_mutex m_amfueid2nas_context; // TODO
bool is_amf_ue_id_2_nas_context(const long& amf_ue_ngap_id) const; bool is_amf_ue_id_2_nas_context(const long& amf_ue_ngap_id) const;
// TODO
std::shared_ptr<nas_context> amf_ue_id_2_nas_context( std::shared_ptr<nas_context> amf_ue_id_2_nas_context(
const long& amf_ue_ngap_id) const; const long& amf_ue_ngap_id) const;
// TODO
void set_amf_ue_ngap_id_2_nas_context( void set_amf_ue_ngap_id_2_nas_context(
const long& amf_ue_ngap_id, std::shared_ptr<nas_context> nc); const long& amf_ue_ngap_id, std::shared_ptr<nas_context> nc);
// procedures // TODO
// specific procedures running logic
void run_registration_procedure(std::shared_ptr<nas_context>& nc); void run_registration_procedure(std::shared_ptr<nas_context>& nc);
// TODO
void run_mobility_registration_update_procedure( void run_mobility_registration_update_procedure(
std::shared_ptr<nas_context> nc, uint16_t uplink_data_status, std::shared_ptr<nas_context> nc, uint16_t uplink_data_status,
uint16_t pdu_session_status); uint16_t pdu_session_status);
// TODO
void run_periodic_registration_update_procedure( void run_periodic_registration_update_procedure(
std::shared_ptr<nas_context> nc, uint16_t); std::shared_ptr<nas_context> nc, uint16_t);
// TODO
void run_periodic_registration_update_procedure( void run_periodic_registration_update_procedure(
std::shared_ptr<nas_context> nc, bstring& nas_msg); std::shared_ptr<nas_context> nc, bstring& nas_msg);
// authentication // TODO
bool auth_vectors_generator(std::shared_ptr<nas_context>& nc); bool auth_vectors_generator(std::shared_ptr<nas_context>& nc);
// TODO
bool get_authentication_vectors_from_ausf(std::shared_ptr<nas_context>& nc); bool get_authentication_vectors_from_ausf(std::shared_ptr<nas_context>& nc);
// TODO
bool _5g_aka_confirmation_from_ausf( bool _5g_aka_confirmation_from_ausf(
std::shared_ptr<nas_context>& nc, bstring resStar); std::shared_ptr<nas_context>& nc, bstring resStar);
// TODO
bool authentication_vectors_generator_in_ausf( bool authentication_vectors_generator_in_ausf(
std::shared_ptr<nas_context>& nc); std::shared_ptr<nas_context>& nc);
// TODO
bool authentication_vectors_generator_in_udm( bool authentication_vectors_generator_in_udm(
std::shared_ptr<nas_context>& nc); std::shared_ptr<nas_context>& nc);
// mysql handlers in mysql_db.cpp
// TODO
bool get_mysql_auth_info(std::string imsi, mysql_auth_info_t& resp); bool get_mysql_auth_info(std::string imsi, mysql_auth_info_t& resp);
// TODO
void mysql_push_rand_sqn(std::string imsi, uint8_t* rand_p, uint8_t* sqn); void mysql_push_rand_sqn(std::string imsi, uint8_t* rand_p, uint8_t* sqn);
// TODO
void mysql_increment_sqn(std::string imsi); void mysql_increment_sqn(std::string imsi);
// TODO
bool connect_to_mysql(); bool connect_to_mysql();
// TODO
void generate_random(uint8_t* random_p, ssize_t length); void generate_random(uint8_t* random_p, ssize_t length);
// TODO
void generate_5g_he_av_in_udm( void generate_5g_he_av_in_udm(
const uint8_t opc[16], std::string imsi, uint8_t key[16], uint8_t sqn[6], const uint8_t opc[16], std::string imsi, uint8_t key[16], uint8_t sqn[6],
std::string serving_network, _5G_HE_AV_t& vector); std::string serving_network, _5G_HE_AV_t& vector);
// TODO
void test_generate_5g_he_av_in_udm( void test_generate_5g_he_av_in_udm(
const uint8_t opc[16], uint8_t key[16], uint8_t sqnak[6], const uint8_t opc[16], uint8_t key[16], uint8_t sqnak[6],
std::string serving_network, _5G_HE_AV_t& vector); std::string serving_network, _5G_HE_AV_t& vector);
// TODO
void handle_auth_vector_successful_result(std::shared_ptr<nas_context> nc); void handle_auth_vector_successful_result(std::shared_ptr<nas_context> nc);
// TODO
bool start_authentication_procedure( bool start_authentication_procedure(
std::shared_ptr<nas_context> nc, int vindex, uint8_t ngksi); std::shared_ptr<nas_context> nc, int vindex, uint8_t ngksi);
// TODO
bool check_nas_common_procedure_on_going(std::shared_ptr<nas_context> nc); bool check_nas_common_procedure_on_going(std::shared_ptr<nas_context> nc);
// TODO
int security_select_algorithms( int security_select_algorithms(
uint8_t nea, uint8_t nia, uint8_t& amf_nea, uint8_t& amf_nia); uint8_t nea, uint8_t nia, uint8_t& amf_nea, uint8_t& amf_nia);
// TODO
bool start_security_mode_control_procedure(std::shared_ptr<nas_context> nc); bool start_security_mode_control_procedure(std::shared_ptr<nas_context> nc);
// TODO
void encode_nas_message_protected( void encode_nas_message_protected(
nas_secu_ctx* nsc, bool is_secu_ctx_new, uint8_t security_header_type, nas_secu_ctx* nsc, bool is_secu_ctx_new, uint8_t security_header_type,
uint8_t direction, uint8_t* input_nas_buf, int input_nas_len, uint8_t direction, uint8_t* input_nas_buf, int input_nas_len,
bstring& encrypted_nas); bstring& encrypted_nas);
// TODO
bool nas_message_integrity_protected( bool nas_message_integrity_protected(
nas_secu_ctx* nsc, uint8_t direction, uint8_t* input_nas, nas_secu_ctx* nsc, uint8_t direction, uint8_t* input_nas,
int input_nas_len, uint32_t& mac); int input_nas_len, uint32_t& mac);
// TODO
bool nas_message_cipher_protected( bool nas_message_cipher_protected(
nas_secu_ctx* nsc, uint8_t direction, bstring input_nas, nas_secu_ctx* nsc, uint8_t direction, bstring input_nas,
bstring& output_nas); bstring& output_nas);
// TODO
void dump_nas_message(uint8_t* buf, int len); void dump_nas_message(uint8_t* buf, int len);
// TODO
void ue_authentication_simulator(uint8_t* rand, uint8_t* autn); void ue_authentication_simulator(uint8_t* rand, uint8_t* autn);
// TODO
void annex_a_4_33501( void annex_a_4_33501(
uint8_t ck[16], uint8_t ik[16], uint8_t* input, uint8_t rand[16], uint8_t ck[16], uint8_t ik[16], uint8_t* input, uint8_t rand[16],
std::string serving_network, uint8_t* output); std::string serving_network, uint8_t* output);
// TODO
void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state); void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state);
// TODO
void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state); void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state);
// TODO
void set_5gcm_state( void set_5gcm_state(
std::shared_ptr<nas_context>& nc, const cm_state_t& state); std::shared_ptr<nas_context>& nc, const cm_state_t& state);
// TODO
void get_5gcm_state( void get_5gcm_state(
const std::shared_ptr<nas_context>& nc, cm_state_t& state) const; const std::shared_ptr<nas_context>& nc, cm_state_t& state) const;
// TODO
void handle_ue_location_change( void handle_ue_location_change(
std::string supi, oai::amf::model::UserLocation, uint8_t http_version); std::string supi, oai::amf::model::UserLocation, uint8_t http_version);
// TODO
void handle_ue_reachability_status_change( void handle_ue_reachability_status_change(
std::string supi, uint8_t status, uint8_t http_version); std::string supi, uint8_t status, uint8_t http_version);
// TODO
void handle_ue_registration_state_change( void handle_ue_registration_state_change(
std::string supi, uint8_t status, uint8_t http_version); std::string supi, uint8_t status, uint8_t http_version);
// TODO
void handle_ue_connectivity_state_change( void handle_ue_connectivity_state_change(
std::string supi, uint8_t status, uint8_t http_version); std::string supi, uint8_t status, uint8_t http_version);
// TODO
void get_pdu_session_to_be_activated( void get_pdu_session_to_be_activated(
uint16_t pdu_session_status, uint16_t pdu_session_status,
std::vector<uint8_t>& pdu_session_to_be_activated); std::vector<uint8_t>& pdu_session_to_be_activated);
// TODO
void initialize_registration_accept( void initialize_registration_accept(
std::unique_ptr<nas::RegistrationAccept>& registration_accept); std::unique_ptr<nas::RegistrationAccept>& registration_accept);
// TODO
void initialize_registration_accept( void initialize_registration_accept(
std::unique_ptr<nas::RegistrationAccept>& registration_accept, std::unique_ptr<nas::RegistrationAccept>& registration_accept,
std::shared_ptr<nas_context>& nc); std::shared_ptr<nas_context>& nc);
// TODO
bool find_ue_context( bool find_ue_context(
const std::shared_ptr<nas_context>& nc, std::shared_ptr<ue_context>& uc); const std::shared_ptr<nas_context>& nc, std::shared_ptr<ue_context>& uc);
// TODO
bool find_ue_context( bool find_ue_context(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
std::shared_ptr<ue_context>& uc); std::shared_ptr<ue_context>& uc);
// TODO
void mobile_reachable_timer_timeout( void mobile_reachable_timer_timeout(
timer_id_t timer_id, uint64_t amf_ue_ngap_id); timer_id_t timer_id, uint64_t amf_ue_ngap_id);
// TODO
void set_mobile_reachable_timer_timeout( void set_mobile_reachable_timer_timeout(
std::shared_ptr<nas_context>& nc, const bool& b); std::shared_ptr<nas_context>& nc, const bool& b);
// TODO
void get_mobile_reachable_timer_timeout( void get_mobile_reachable_timer_timeout(
const std::shared_ptr<nas_context>& nc, bool& b) const; const std::shared_ptr<nas_context>& nc, bool& b) const;
// TODO
bool get_mobile_reachable_timer_timeout( bool get_mobile_reachable_timer_timeout(
const std::shared_ptr<nas_context>& nc) const; const std::shared_ptr<nas_context>& nc) const;
// TODO
void set_mobile_reachable_timer( void set_mobile_reachable_timer(
std::shared_ptr<nas_context>& nc, const timer_id_t& t); std::shared_ptr<nas_context>& nc, const timer_id_t& t);
// TODO
void set_implicit_deregistration_timer( void set_implicit_deregistration_timer(
std::shared_ptr<nas_context>& nc, const timer_id_t& t); std::shared_ptr<nas_context>& nc, const timer_id_t& t);
// TODO
void implicit_deregistration_timer_timeout( void implicit_deregistration_timer_timeout(
timer_id_t timer_id, uint64_t amf_ue_ngap_id); timer_id_t timer_id, uint64_t amf_ue_ngap_id);
// TODO
bool reroute_registration_request(std::shared_ptr<nas_context>& nc); bool reroute_registration_request(
std::shared_ptr<nas_context>& nc, bool& reroute_result);
// TODO
bool get_slice_selection_subscription_data( bool get_slice_selection_subscription_data(
const std::shared_ptr<nas_context>& nc, oai::amf::model::Nssai& nssai); const std::shared_ptr<nas_context>& nc, oai::amf::model::Nssai& nssai);
// TODO
bool get_slice_selection_subscription_data_from_conf_file( bool get_slice_selection_subscription_data_from_conf_file(
const std::shared_ptr<nas_context>& nc, oai::amf::model::Nssai& nssai); const std::shared_ptr<nas_context>& nc, oai::amf::model::Nssai& nssai);
// TODO
bool check_subscribed_nssai( bool check_subscribed_nssai(
const std::shared_ptr<nas_context>& nc, oai::amf::model::Nssai& nssai); const std::shared_ptr<nas_context>& nc, oai::amf::model::Nssai& nssai);
// TODO
bool check_requested_nssai(const std::shared_ptr<nas_context>& nc); bool check_requested_nssai(const std::shared_ptr<nas_context>& nc);
// TODO
bool get_network_slice_selection( bool get_network_slice_selection(
const std::shared_ptr<nas_context>& nc, const std::string& nf_instance_id, const std::shared_ptr<nas_context>& nc, const std::string& nf_instance_id,
const oai::amf::model::SliceInfoForRegistration& slice_info, const oai::amf::model::SliceInfoForRegistration& slice_info,
oai::amf::model::AuthorizedNetworkSliceInfo& oai::amf::model::AuthorizedNetworkSliceInfo&
authorized_network_slice_info); authorized_network_slice_info);
// TODO
bool get_network_slice_selection_from_conf_file( bool get_network_slice_selection_from_conf_file(
const std::string& nf_instance_id, const std::string& nf_instance_id,
const oai::amf::model::SliceInfoForRegistration& slice_info, const oai::amf::model::SliceInfoForRegistration& slice_info,
oai::amf::model::AuthorizedNetworkSliceInfo& oai::amf::model::AuthorizedNetworkSliceInfo&
authorized_network_slice_info) const; authorized_network_slice_info) const;
// TODO
bool get_target_amf( bool get_target_amf(
const std::shared_ptr<nas_context>& nc, std::string& target_amf, const std::shared_ptr<nas_context>& nc, std::string& target_amf,
const oai::amf::model::AuthorizedNetworkSliceInfo& const oai::amf::model::AuthorizedNetworkSliceInfo&
authorized_network_slice_info); authorized_network_slice_info);
// TODO
bool select_target_amf( bool select_target_amf(
const std::shared_ptr<nas_context>& nc, std::string& target_amf, const std::shared_ptr<nas_context>& nc, std::string& target_amf,
const nlohmann::json& amf_candidate_list); const nlohmann::json& amf_candidate_list);
// TODO
void send_n1_message_notity( void send_n1_message_notity(
const std::shared_ptr<nas_context>& nc, const std::shared_ptr<nas_context>& nc,
const std::string& target_amf) const; const std::string& target_amf) const;
// TODO
bool reroute_nas_via_an( bool reroute_nas_via_an(
const std::shared_ptr<nas_context>& nc, const std::shared_ptr<nas_context>& nc,
const std::string& target_amf_set) const; const std::string& target_amf_set);
// TODO
bool get_amf_set_id(const std::string& target_amf_set, uint16_t& amf_set_id);
private: private:
void ue_initiate_de_registration_handle( void ue_initiate_de_registration_handle(
......
...@@ -155,7 +155,14 @@ void amf_n11_task(void*) { ...@@ -155,7 +155,14 @@ void amf_n11_task(void*) {
dynamic_cast<itti_n11_n1_message_notify*>(msg); dynamic_cast<itti_n11_n1_message_notify*>(msg);
amf_n11_inst->handle_itti_message(ref(*m)); amf_n11_inst->handle_itti_message(ref(*m));
} break; } break;
case N11_NF_INSTANCE_DISCOVERY: {
Logger::amf_n11().info(
"Receive N1 NF Instance Discovery message, "
"handling ...");
itti_n11_nf_instance_discovery* m =
dynamic_cast<itti_n11_nf_instance_discovery*>(msg);
amf_n11_inst->handle_itti_message(ref(*m));
} break;
case TERMINATE: { case TERMINATE: {
if (itti_msg_terminate* terminate = if (itti_msg_terminate* terminate =
dynamic_cast<itti_msg_terminate*>(msg)) { dynamic_cast<itti_msg_terminate*>(msg)) {
...@@ -625,20 +632,21 @@ void amf_n11::handle_itti_message( ...@@ -625,20 +632,21 @@ void amf_n11::handle_itti_message(
std::string url = std::string url =
amf_cfg.get_udm_slice_selection_subscription_data_retrieval_uri( amf_cfg.get_udm_slice_selection_subscription_data_retrieval_uri(
itti_msg.supi); itti_msg.supi);
nlohmann::json json_data = {}; nlohmann::json plmn_id = {};
json_data["plmn-id"]["mcc"] = itti_msg.plmn.mcc; plmn_id["mcc"] = itti_msg.plmn.mcc;
json_data["plmn-id"]["mnc"] = itti_msg.plmn.mnc; plmn_id["mnc"] = itti_msg.plmn.mnc;
std::string body = json_data.dump();
std::string parameters = {};
parameters = "?plmn-id=" + plmn_id.dump();
url += parameters;
Logger::amf_n11().debug( Logger::amf_n11().debug(
"Send Slice Selection Subscription Data Retrieval to UDM, URL %s", "Send Slice Selection Subscription Data Retrieval to UDM, URL %s",
url.c_str()); url.c_str());
Logger::amf_n11().debug("MSG body: \n %s", body.c_str());
nlohmann::json response_data = {}; nlohmann::json response_data = {};
uint32_t response_code = 0; uint32_t response_code = 0;
curl_http_client(url, "GET", body, response_data, response_code); curl_http_client(url, "GET", "", response_data, response_code);
// Notify to the result // Notify to the result
if (itti_msg.promise_id > 0) { if (itti_msg.promise_id > 0) {
...@@ -662,16 +670,22 @@ void amf_n11::handle_itti_message( ...@@ -662,16 +670,22 @@ void amf_n11::handle_itti_message(
// Slice Info Request For Registration // Slice Info Request For Registration
nlohmann::json slice_info = {}; nlohmann::json slice_info = {};
to_json(slice_info, itti_msg.slice_info); to_json(slice_info, itti_msg.slice_info);
// home-plmn-id // TODO: home-plmn-id
nlohmann::json home_plmn_id = {}; // nlohmann::json home_plmn_id = {};
home_plmn_id["mcc"] = itti_msg.plmn.mcc; // home_plmn_id["mcc"] = itti_msg.tai.plmn.mcc;
home_plmn_id["mnc"] = itti_msg.plmn.mnc; // home_plmn_id["mnc"] = itti_msg.tai.plmn.mnc;
// TODO: tai
std::string parameters = {}; // TAI
parameters = "?nf-type=AMF?nf-id=" + amf_app_inst->get_nf_instance() + nlohmann::json tai = {};
"?slice-info-request-for-registration=" + slice_info.dump() + tai["plmnId"]["mcc"] = itti_msg.tai.plmn.mcc;
"?home-plmn-id=" + home_plmn_id.dump(); tai["plmnId"]["mnc"] = itti_msg.tai.plmn.mnc;
tai["tac"] = std::to_string(itti_msg.tai.tac);
std::string parameters = {};
parameters = "?nf-type=AMF&nf-id=" + amf_app_inst->get_nf_instance() +
"&slice-info-request-for-registration=" + slice_info.dump() +
"&tai=" + tai.dump();
//"?home-plmn-id=" + home_plmn_id.dump();
url += parameters; url += parameters;
Logger::amf_n11().debug( Logger::amf_n11().debug(
"Send Slice Selection Information Retrieval to NSSF, URL %s", "Send Slice Selection Information Retrieval to NSSF, URL %s",
...@@ -722,6 +736,34 @@ void amf_n11::handle_itti_message(itti_n11_n1_message_notify& itti_msg) { ...@@ -722,6 +736,34 @@ void amf_n11::handle_itti_message(itti_n11_n1_message_notify& itti_msg) {
return; return;
} }
//------------------------------------------------------------------------------
void amf_n11::handle_itti_message(itti_n11_nf_instance_discovery& itti_msg) {
Logger::amf_n11().debug(
"Send NF Instance Discovery to NRF (HTTP version %d)",
itti_msg.http_version);
Logger::amf_n11().debug("NRF URI: %s", itti_msg.nrf_amf_set.c_str());
uint8_t http_version = itti_msg.http_version;
if (amf_cfg.support_features.use_http2) http_version = 2;
nlohmann::json json_data = {};
std::string url = itti_msg.nrf_amf_set;
// TODO: remove hardcoded values
url += "?target-nf-type=AMF&requester-nf-type=AMF";
nlohmann::json response_data = {};
uint32_t response_code = 0;
curl_http_client(url, "GET", "", response_data, response_code);
// Notify to the result
if (itti_msg.promise_id > 0) {
amf_app_inst->trigger_process_response(itti_msg.promise_id, response_data);
return;
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool amf_n11::smf_selection_from_configuration( bool amf_n11::smf_selection_from_configuration(
std::string& smf_addr, std::string& smf_port, std::string& smf_addr, std::string& smf_port,
...@@ -963,8 +1005,11 @@ bool amf_n11::send_ue_authentication_request( ...@@ -963,8 +1005,11 @@ bool amf_n11::send_ue_authentication_request(
Logger::amf_n11().debug( Logger::amf_n11().debug(
"UE Authentication, response from AUSF\n, %s ", "UE Authentication, response from AUSF\n, %s ",
response_data.dump().c_str()); response_data.dump().c_str());
from_json(response_data, ue_auth_ctx); try {
from_json(response_data, ue_auth_ctx);
} catch (std::exception& e) {
return false;
}
} else { } else {
Logger::amf_n11().warn( Logger::amf_n11().warn(
"UE Authentication, could not get response from AUSF"); "UE Authentication, could not get response from AUSF");
...@@ -1551,6 +1596,7 @@ bool amf_n11::get_nrf_uri( ...@@ -1551,6 +1596,7 @@ bool amf_n11::get_nrf_uri(
} }
} else { // Get NRF info from NSSF } else { // Get NRF info from NSSF
// TODO: check if external NSSF feature is supported
Logger::amf_n11().debug( Logger::amf_n11().debug(
"Send NS Selection to NSSF to discover the appropriate NRF"); "Send NS Selection to NSSF to discover the appropriate NRF");
......
...@@ -65,6 +65,7 @@ class amf_n11 { ...@@ -65,6 +65,7 @@ class amf_n11 {
itti_n11_network_slice_selection_information& itti_msg); itti_n11_network_slice_selection_information& itti_msg);
void handle_itti_message(itti_n11_n1_message_notify& itti_msg); void handle_itti_message(itti_n11_n1_message_notify& itti_msg);
void handle_itti_message(itti_n11_nf_instance_discovery& itti_msg);
void send_pdu_session_update_sm_context_request( void send_pdu_session_update_sm_context_request(
std::string supi, std::shared_ptr<pdu_session_context> psc, std::string supi, std::shared_ptr<pdu_session_context> psc,
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "amf_n1.hpp" #include "amf_n1.hpp"
#include "amf_n11.hpp" #include "amf_n11.hpp"
#include "amf_statistics.hpp" #include "amf_statistics.hpp"
#include "comUt.hpp"
#include "itti.hpp" #include "itti.hpp"
#include "itti_msg_amf_app.hpp" #include "itti_msg_amf_app.hpp"
#include "logger.hpp" #include "logger.hpp"
...@@ -688,11 +689,16 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) { ...@@ -688,11 +689,16 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
} }
// Store InitialUEMessage for Rereoute NAS later // Store InitialUEMessage for Rereoute NAS later
unc.get()->initialUEMsg.buf =
(uint8_t*) calloc(BUFFER_SIZE_1024, sizeof(uint8_t));
if (unc.get()->initialUEMsg.buf) { if (unc.get()->initialUEMsg.buf) {
unc.get()->initialUEMsg.size = init_ue_msg.initUeMsg->encode2buffer( int encoded_size = 0;
unc.get()->initialUEMsg.buf, BUFFER_SIZE_1024); init_ue_msg.initUeMsg->encode2buffer(
unc.get()->initialUEMsg.buf, encoded_size);
if (encoded_size > 0) {
comUt::print_buffer(
"ngap", "InitialUEMessage", unc.get()->initialUEMsg.buf,
encoded_size);
unc.get()->initialUEMsg.size = encoded_size;
}
} }
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id; itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
...@@ -2093,12 +2099,14 @@ void amf_n2::handle_itti_message(itti_rereoute_nas& itti_msg) { ...@@ -2093,12 +2099,14 @@ void amf_n2::handle_itti_message(itti_rereoute_nas& itti_msg) {
rerouteNASRequest.setRanUeNgapId(itti_msg.ran_ue_ngap_id); rerouteNASRequest.setRanUeNgapId(itti_msg.ran_ue_ngap_id);
rerouteNASRequest.setAmfUeNgapId(itti_msg.amf_ue_ngap_id); rerouteNASRequest.setAmfUeNgapId(itti_msg.amf_ue_ngap_id);
rerouteNASRequest.setAMFSetID(itti_msg.amf_set_id); rerouteNASRequest.setAMFSetID(itti_msg.amf_set_id);
rerouteNASRequest.setNgapMessage( if (unc->initialUEMsg.size > 0)
unc->initialUEMsg); // Include InitialUEMessage rerouteNASRequest.setNgapMessage(
unc->initialUEMsg); // Include InitialUEMessage
// TODO: AllowedNSSAI (Optional) // TODO: AllowedNSSAI (Optional)
uint8_t buffer[BUFFER_SIZE_1024]; uint8_t buffer[BUFFER_SIZE_2048];
int encoded_size = rerouteNASRequest.encode2buffer(buffer, BUFFER_SIZE_1024); int encoded_size = rerouteNASRequest.encode2buffer(buffer, BUFFER_SIZE_2048);
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
amf_n2_inst->sctp_s_38412.sctp_send_msg( amf_n2_inst->sctp_s_38412.sctp_send_msg(
......
...@@ -43,45 +43,179 @@ class amf_n2 : public ngap::ngap_app { ...@@ -43,45 +43,179 @@ class amf_n2 : public ngap::ngap_app {
public: public:
amf_n2(const std::string& address, const uint16_t port_num); amf_n2(const std::string& address, const uint16_t port_num);
~amf_n2(); ~amf_n2();
/*
* Handle ITTI message (New SCTP Association)
* @param [itti_new_sctp_association&]: ITTI message
* @return void
*/
void handle_itti_message(itti_new_sctp_association& new_assoc); void handle_itti_message(itti_new_sctp_association& new_assoc);
/*
* Handle ITTI message (Downlink NAS Transfer)
* @param [itti_downlink_nas_transfer&]: ITTI message
* @return void
*/
void handle_itti_message(itti_ng_setup_request& ngsetupreq); void handle_itti_message(itti_ng_setup_request& ngsetupreq);
/*
* Handle ITTI message (Downlink NAS Transfer)
* @param [itti_downlink_nas_transfer&]: ITTI message
* @return void
*/
void handle_itti_message(itti_ng_reset&); void handle_itti_message(itti_ng_reset&);
/*
* Handle ITTI message (SCTP Shutdown)
* @param [itti_ng_shutdown&]: ITTI message
* @return void
*/
void handle_itti_message(itti_ng_shutdown&); void handle_itti_message(itti_ng_shutdown&);
/*
* Handle ITTI message (InitialUEMessage)
* @param [itti_initial_ue_message&]: ITTI message
* @return void
*/
void handle_itti_message(itti_initial_ue_message& init_ue_msg); void handle_itti_message(itti_initial_ue_message& init_ue_msg);
/*
* Handle ITTI message (ULNASTransport)
* @param [itti_ul_nas_transport&]: ITTI message
* @return void
*/
void handle_itti_message(itti_ul_nas_transport& ul_nas_transport); void handle_itti_message(itti_ul_nas_transport& ul_nas_transport);
/*
* Handle ITTI message (DLNASTransport)
* @param [itti_dl_nas_transport&]: ITTI message
* @return void
*/
void handle_itti_message(itti_dl_nas_transport& dl_nas_transport); void handle_itti_message(itti_dl_nas_transport& dl_nas_transport);
/*
* Handle ITTI message (InitialContextSetupRequest)
* @param [itti_initial_context_setup_request&]: ITTI message
* @return void
*/
void handle_itti_message(itti_initial_context_setup_request& itti_msg); void handle_itti_message(itti_initial_context_setup_request& itti_msg);
/*
* Handle ITTI message (PDUSessionResourceSetupRequest)
* @param [itti_pdu_session_resource_setup_request&]: ITTI message
* @return void
*/
void handle_itti_message(itti_pdu_session_resource_setup_request& itti_msg); void handle_itti_message(itti_pdu_session_resource_setup_request& itti_msg);
/*
* Handle ITTI message (PDUSessionResourceModifyRequest)
* @param [itti_pdu_session_resource_modify_request&]: ITTI message
* @return void
*/
void handle_itti_message(itti_pdu_session_resource_modify_request& itti_msg); void handle_itti_message(itti_pdu_session_resource_modify_request& itti_msg);
/*
* Handle ITTI message (PDUSessionResourceReleaseCommand)
* @param [itti_pdu_session_resource_release_command&]: ITTI message
* @return void
*/
void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg); void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg);
/*
* Handle ITTI message (PDUSessionResourceReleaseRequest)
* @param [itti_ue_context_release_request&]: ITTI message
* @return void
*/
void handle_itti_message(itti_ue_context_release_request& itti_msg); void handle_itti_message(itti_ue_context_release_request& itti_msg);
/*
* Handle ITTI message (PDUSessionResourceReleaseComplete)
* @param [itti_ue_context_release_complete&]: ITTI message
* @return void
*/
void handle_itti_message(itti_ue_context_release_complete& itti_msg); void handle_itti_message(itti_ue_context_release_complete& itti_msg);
void handle_itti_message(itti_ue_radio_capability_indication& itti_msg);
/*
* Handle ITTI message (UEContextReleaseCommand)
* @param [itti_ue_context_release_command&]: ITTI message
* @return void
*/
void handle_itti_message(itti_ue_context_release_command& itti_msg); void handle_itti_message(itti_ue_context_release_command& itti_msg);
/*
* Handle ITTI message (UECapabilityIndication)
* @param [itti_ue_radio_capability_indication&]: ITTI message
* @return void
*/
void handle_itti_message(itti_ue_radio_capability_indication& itti_msg);
/*
* Handle ITTI message (HandoverRequired)
* @param [itti_handover_required&]: ITTI message
* @return void
*/
bool handle_itti_message(itti_handover_required& itti_msg); bool handle_itti_message(itti_handover_required& itti_msg);
/*
* Handle ITTI message (HandoverRequestAck)
* @param [itti_handover_request_Ack&]: ITTI message
* @return void
*/
void handle_itti_message(itti_handover_request_Ack& itti_msg); void handle_itti_message(itti_handover_request_Ack& itti_msg);
/*
* Handle ITTI message (HandoverNotify)
* @param [itti_handover_notify&]: ITTI message
* @return void
*/
void handle_itti_message(itti_handover_notify& itti_msg); void handle_itti_message(itti_handover_notify& itti_msg);
/*
* Handle ITTI message (UplinkRANStatusTransfer)
* @param [itti_uplink_ran_status_transfer&]: ITTI message
* @return void
*/
void handle_itti_message(itti_uplink_ran_status_transfer& itti_msg); void handle_itti_message(itti_uplink_ran_status_transfer& itti_msg);
/*
* Handle ITTI message (RerouteNAS)
* @param [itti_rereoute_nas&]: ITTI message
* @return void
*/
void handle_itti_message(itti_rereoute_nas& itti_msg); void handle_itti_message(itti_rereoute_nas& itti_msg);
/*
* Handle ITTI message (Paging)
* @param [itti_paging&]: ITTI message
* @return void
*/
void handle_itti_message(itti_paging& itti_msg);
// TODO
void send_handover_preparation_failure( void send_handover_preparation_failure(
const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id, const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id,
const sctp_assoc_id_t& gnb_assoc_id); const sctp_assoc_id_t& gnb_assoc_id);
void handle_itti_message(itti_paging& itti_msg);
// TODO
bool verifyPlmn(std::vector<SupportedItem_t> list); bool verifyPlmn(std::vector<SupportedItem_t> list);
// TODO
bool get_common_plmn( bool get_common_plmn(
std::vector<SupportedItem_t> list, std::vector<SupportedItem_t>& result); std::vector<SupportedItem_t> list, std::vector<SupportedItem_t>& result);
// TODO
std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context( std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id) const; const uint32_t& ran_ue_ngap_id) const;
// TODO
bool is_ran_ue_id_2_ue_ngap_context(const uint32_t& ran_ue_ngap_id) const; bool is_ran_ue_id_2_ue_ngap_context(const uint32_t& ran_ue_ngap_id) const;
// TODO
void set_ran_ue_ngap_id_2_ue_ngap_context( void set_ran_ue_ngap_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc); const uint32_t& ran_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc);
// TODO
std::shared_ptr<ue_ngap_context> amf_ue_id_2_ue_ngap_context( std::shared_ptr<ue_ngap_context> amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id) const; const unsigned long& amf_ue_ngap_id) const;
// TODO
bool is_amf_ue_id_2_ue_ngap_context( bool is_amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id) const; const unsigned long& amf_ue_ngap_id) const;
// TODO
void set_amf_ue_ngap_id_2_ue_ngap_context( void set_amf_ue_ngap_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id, const unsigned long& amf_ue_ngap_id,
std::shared_ptr<ue_ngap_context> unc); std::shared_ptr<ue_ngap_context> unc);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <map> #include <map>
#include "gNB_context.hpp" #include "gNB_context.hpp"
#include "amf.hpp"
using namespace sctp; using namespace sctp;
typedef enum { typedef enum {
...@@ -46,6 +47,34 @@ typedef enum { ...@@ -46,6 +47,34 @@ typedef enum {
class ue_ngap_context { class ue_ngap_context {
public: public:
public:
ue_ngap_context() {
ran_ue_ngap_id = 0;
amf_ue_ngap_id = 0;
target_ran_ue_ngap_id = 0;
sctp_stream_recv = {};
sctp_stream_send = {};
gnb_assoc_id = {};
target_gnb_assoc_id = {};
ueContextRequest = false;
s_tmsi_5g = {};
s_setid = {};
s_pointer = {};
s_tmsi = {};
tai = {};
ng_ue_state = NGAP_UE_INVALID_STATE;
ncc = 0;
initialUEMsg.buf = new uint8_t[BUFFER_SIZE_1024];
initialUEMsg.size = 0;
}
virtual ~ue_ngap_context() {
delete[] initialUEMsg.buf;
initialUEMsg.buf = nullptr;
initialUEMsg.size = 0;
}
uint32_t ran_ue_ngap_id; // 32bits uint32_t ran_ue_ngap_id; // 32bits
long amf_ue_ngap_id : 40; // 40bits long amf_ue_ngap_id : 40; // 40bits
uint32_t target_ran_ue_ngap_id; // 32bits, for HO uint32_t target_ran_ue_ngap_id; // 32bits, for HO
......
...@@ -223,7 +223,8 @@ class itti_n11_network_slice_selection_information : public itti_msg_n11 { ...@@ -223,7 +223,8 @@ class itti_n11_network_slice_selection_information : public itti_msg_n11 {
uint8_t http_version; uint8_t http_version;
std::string nf_instance_id; std::string nf_instance_id;
oai::amf::model::SliceInfoForRegistration slice_info; oai::amf::model::SliceInfoForRegistration slice_info;
plmn_t plmn; // plmn_t plmn;
tai_t tai;
uint32_t promise_id; uint32_t promise_id;
}; };
...@@ -240,6 +241,7 @@ class itti_n11_nf_instance_discovery : public itti_msg_n11 { ...@@ -240,6 +241,7 @@ class itti_n11_nf_instance_discovery : public itti_msg_n11 {
std::string target_amf_set; std::string target_amf_set;
bool target_amf_set_is_set; bool target_amf_set_is_set;
std::string target_nf_type; std::string target_nf_type;
std::string nrf_amf_set;
uint32_t promise_id; uint32_t promise_id;
}; };
......
...@@ -305,7 +305,7 @@ class itti_rereoute_nas : public itti_msg_n2 { ...@@ -305,7 +305,7 @@ class itti_rereoute_nas : public itti_msg_n2 {
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id; long amf_ue_ngap_id;
std::string amf_set_id; uint16_t amf_set_id;
}; };
#endif #endif
...@@ -48,6 +48,10 @@ void AMFSetID::setAMFSetID(const std::string charid) { ...@@ -48,6 +48,10 @@ void AMFSetID::setAMFSetID(const std::string charid) {
setid = fromString<uint16_t>(charid); setid = fromString<uint16_t>(charid);
} }
//------------------------------------------------------------------------------
void AMFSetID::setAMFSetID(const uint16_t set_id) {
setid = set_id;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AMFSetID::getAMFSetID(std::string& charid) { void AMFSetID::getAMFSetID(std::string& charid) {
charid = to_string(setid); charid = to_string(setid);
......
...@@ -43,6 +43,7 @@ class AMFSetID { ...@@ -43,6 +43,7 @@ class AMFSetID {
virtual ~AMFSetID(); virtual ~AMFSetID();
void setAMFSetID(const std::string); void setAMFSetID(const std::string);
void setAMFSetID(const uint16_t set_id);
void getAMFSetID(std::string&); void getAMFSetID(std::string&);
bool encode2bitstring(Ngap_AMFSetID_t&); bool encode2bitstring(Ngap_AMFSetID_t&);
......
...@@ -237,12 +237,12 @@ void InitialUEMessageMsg::setUeContextRequest( ...@@ -237,12 +237,12 @@ void InitialUEMessageMsg::setUeContextRequest(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int InitialUEMessageMsg::encode2buffer(uint8_t* buf, int buf_size) { void InitialUEMessageMsg::encode2buffer(uint8_t*& buf, int& buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, initialUEMessagePdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, initialUEMessagePdu);
asn_enc_rval_t er = aper_encode_to_buffer( buf_size = aper_encode_to_new_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialUEMessagePdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, initialUEMessagePdu, (void**) &buf);
Logger::ngap().debug("er.encoded( %d )", er.encoded); Logger::ngap().debug("Encoded message size ( %d )", buf_size);
return er.encoded; return;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -58,7 +58,7 @@ class InitialUEMessageMsg { ...@@ -58,7 +58,7 @@ class InitialUEMessageMsg {
void setRRCEstablishmentCause(e_Ngap_RRCEstablishmentCause cause_value); void setRRCEstablishmentCause(e_Ngap_RRCEstablishmentCause cause_value);
// void set5GS_TMSI(string amfSetId, string amfPointer, string _5g_tmsi); // void set5GS_TMSI(string amfSetId, string amfPointer, string _5g_tmsi);
void setUeContextRequest(e_Ngap_UEContextRequest ueCtxReq); void setUeContextRequest(e_Ngap_UEContextRequest ueCtxReq);
int encode2buffer(uint8_t* buf, int buf_size); void encode2buffer(uint8_t*& buf, int& buf_size);
// Decapsulation // Decapsulation
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu); bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
bool getRanUENgapID(uint32_t& value); bool getRanUENgapID(uint32_t& value);
......
...@@ -328,8 +328,9 @@ bool RerouteNASRequest::getNgapMessage(OCTET_STRING_t& message) const { ...@@ -328,8 +328,9 @@ bool RerouteNASRequest::getNgapMessage(OCTET_STRING_t& message) const {
message = ngapMessage; message = ngapMessage;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RerouteNASRequest::setAMFSetID(const std::string& amf_set_id) { void RerouteNASRequest::setAMFSetID(const uint16_t& amf_set_id) {
amfSetID.setAMFSetID(amf_set_id); amfSetID.setAMFSetID(amf_set_id);
Ngap_RerouteNASRequest_IEs_t* ie = (Ngap_RerouteNASRequest_IEs_t*) calloc( Ngap_RerouteNASRequest_IEs_t* ie = (Ngap_RerouteNASRequest_IEs_t*) calloc(
......
...@@ -61,7 +61,8 @@ class RerouteNASRequest { ...@@ -61,7 +61,8 @@ class RerouteNASRequest {
void setNgapMessage(OCTET_STRING_t& message); void setNgapMessage(OCTET_STRING_t& message);
bool getNgapMessage(OCTET_STRING_t& message) const; bool getNgapMessage(OCTET_STRING_t& message) const;
void setAMFSetID(const std::string& amf_set_id); // void setAMFSetID(const std::string& amf_set_id);
void setAMFSetID(const uint16_t& amf_set_id);
void getAMFSetID(std::string& amf_set_id); void getAMFSetID(std::string& amf_set_id);
void setAllowedNssai(std::vector<S_Nssai> list); void setAllowedNssai(std::vector<S_Nssai> list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment