Commit ca9dadc7 authored by Keliang's avatar Keliang

The version is same as eurecom

parents 460e39a2 aef65b41
...@@ -115,4 +115,3 @@ SortUsingDeclarations: true ...@@ -115,4 +115,3 @@ SortUsingDeclarations: true
# PenaltyBreakTemplateDeclaration (unsigned) # PenaltyBreakTemplateDeclaration (unsigned)
# PenaltyExcessCharacter (unsigned) # PenaltyExcessCharacter (unsigned)
# PenaltyReturnTypeOnItsOwnLine (unsigned) # PenaltyReturnTypeOnItsOwnLine (unsigned)
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -28,18 +28,18 @@ ...@@ -28,18 +28,18 @@
#include "amf_app.hpp" #include "amf_app.hpp"
#include <stdexcept>
#include <iostream>
#include <cstdlib> #include <cstdlib>
#include <iostream>
#include <stdexcept>
#include "itti.hpp" #include "itti.hpp"
#include "ngap_app.hpp" #include "DLNASTransport.hpp"
#include "amf_config.hpp" #include "amf_config.hpp"
#include "amf_n2.hpp"
#include "amf_n1.hpp" #include "amf_n1.hpp"
#include "amf_n11.hpp" #include "amf_n11.hpp"
#include "amf_n2.hpp"
#include "amf_statistics.hpp" #include "amf_statistics.hpp"
#include "DLNASTransport.hpp" #include "ngap_app.hpp"
using namespace ngap; using namespace ngap;
using namespace nas; using namespace nas;
...@@ -56,7 +56,7 @@ amf_n11* amf_n11_inst = nullptr; ...@@ -56,7 +56,7 @@ amf_n11* amf_n11_inst = nullptr;
extern amf_config amf_cfg; extern amf_config amf_cfg;
extern statistics stacs; extern statistics stacs;
void amf_app_task(void*); void amf_app_task(void *);
uint32_t golbal_tmsi = 1; uint32_t golbal_tmsi = 1;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -77,9 +77,9 @@ amf_app::amf_app(const amf_config& amf_cfg) { ...@@ -77,9 +77,9 @@ amf_app::amf_app(const amf_config& amf_cfg) {
throw; throw;
} }
timer_id_t tid = itti_inst->timer_setup( timer_id_t tid =
amf_cfg.statistics_interval, 0, TASK_AMF_APP, itti_inst->timer_setup(amf_cfg.statistics_interval, 0, TASK_AMF_APP,
TASK_AMF_APP_PERIODIC_STATISTICS, 0); TASK_AMF_APP_PERIODIC_STATISTICS, 0);
Logger::amf_app().startup("Started timer(%d)", tid); Logger::amf_app().startup("Started timer(%d)", tid);
} }
...@@ -89,7 +89,7 @@ void amf_app::allRegistredModulesInit(const amf_modules& modules) { ...@@ -89,7 +89,7 @@ void amf_app::allRegistredModulesInit(const amf_modules& modules) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_app_task(void*) { void amf_app_task(void *) {
const task_id_t task_id = TASK_AMF_APP; const task_id_t task_id = TASK_AMF_APP;
itti_inst->notify_task_ready(task_id); itti_inst->notify_task_ready(task_id);
do { do {
...@@ -99,25 +99,25 @@ void amf_app_task(void*) { ...@@ -99,25 +99,25 @@ void amf_app_task(void*) {
switch (msg->msg_type) { switch (msg->msg_type) {
case NAS_SIG_ESTAB_REQ: { case NAS_SIG_ESTAB_REQ: {
Logger::amf_app().debug("Received NAS_SIG_ESTAB_REQ"); Logger::amf_app().debug("Received NAS_SIG_ESTAB_REQ");
itti_nas_signalling_establishment_request* m = itti_nas_signalling_establishment_request *m =
dynamic_cast<itti_nas_signalling_establishment_request*>(msg); dynamic_cast<itti_nas_signalling_establishment_request *>(msg);
amf_app_inst->handle_itti_message(ref(*m)); amf_app_inst->handle_itti_message(ref(*m));
} break; } break;
case N1N2_MESSAGE_TRANSFER_REQ: { case N1N2_MESSAGE_TRANSFER_REQ: {
Logger::amf_app().debug("Received N1N2_MESSAGE_TRANSFER_REQ"); Logger::amf_app().debug("Received N1N2_MESSAGE_TRANSFER_REQ");
itti_n1n2_message_transfer_request* m = itti_n1n2_message_transfer_request *m =
dynamic_cast<itti_n1n2_message_transfer_request*>(msg); dynamic_cast<itti_n1n2_message_transfer_request *>(msg);
amf_app_inst->handle_itti_message(ref(*m)); amf_app_inst->handle_itti_message(ref(*m));
} break; } break;
case TIME_OUT: case TIME_OUT:
if (itti_msg_timeout* to = dynamic_cast<itti_msg_timeout*>(msg)) { if (itti_msg_timeout *to = dynamic_cast<itti_msg_timeout *>(msg)) {
switch (to->arg1_user) { switch (to->arg1_user) {
case TASK_AMF_APP_PERIODIC_STATISTICS: case TASK_AMF_APP_PERIODIC_STATISTICS:
tid = itti_inst->timer_setup( tid = itti_inst->timer_setup(amf_cfg.statistics_interval, 0,
amf_cfg.statistics_interval, 0, TASK_AMF_APP, TASK_AMF_APP,
TASK_AMF_APP_PERIODIC_STATISTICS, 0); TASK_AMF_APP_PERIODIC_STATISTICS, 0);
stacs.display(); stacs.display();
break; break;
default: default:
...@@ -183,20 +183,20 @@ void amf_app::set_ran_amf_id_2_ue_context( ...@@ -183,20 +183,20 @@ void amf_app::set_ran_amf_id_2_ue_context(
// ITTI handlers // ITTI handlers
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_app::handle_itti_message( void amf_app::handle_itti_message(
itti_n1n2_message_transfer_request& itti_msg) { itti_n1n2_message_transfer_request &itti_msg) {
// 1. encode DL NAS TRANSPORT message(NAS message) // 1. encode DL NAS TRANSPORT message(NAS message)
DLNASTransport* dl = new DLNASTransport(); DLNASTransport *dl = new DLNASTransport();
dl->setHeader(PLAIN_5GS_MSG); dl->setHeader(PLAIN_5GS_MSG);
dl->setPayload_Container_Type(N1_SM_INFORMATION); dl->setPayload_Container_Type(N1_SM_INFORMATION);
dl->setPayload_Container( dl->setPayload_Container((uint8_t *)bdata(itti_msg.n1sm),
(uint8_t*) bdata(itti_msg.n1sm), blength(itti_msg.n1sm)); blength(itti_msg.n1sm));
dl->setPDUSessionId(itti_msg.pdu_session_id); dl->setPDUSessionId(itti_msg.pdu_session_id);
uint8_t nas[1024]; uint8_t nas[1024];
int encoded_size = dl->encode2buffer(nas, 1024); int encoded_size = dl->encode2buffer(nas, 1024);
print_buffer("amf_app", "n1n2 transfer", nas, encoded_size); print_buffer("amf_app", "n1n2 transfer", nas, encoded_size);
bstring dl_nas = blk2bstr(nas, encoded_size); bstring dl_nas = blk2bstr(nas, encoded_size);
itti_downlink_nas_transfer* dl_msg = itti_downlink_nas_transfer *dl_msg =
new itti_downlink_nas_transfer(TASK_AMF_APP, TASK_AMF_N1); new itti_downlink_nas_transfer(TASK_AMF_APP, TASK_AMF_N1);
dl_msg->dl_nas = dl_nas; dl_msg->dl_nas = dl_nas;
if (!itti_msg.is_n2sm_set) { if (!itti_msg.is_n2sm_set) {
...@@ -221,7 +221,7 @@ void amf_app::handle_itti_message( ...@@ -221,7 +221,7 @@ void amf_app::handle_itti_message(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_app::handle_itti_message( void amf_app::handle_itti_message(
itti_nas_signalling_establishment_request& itti_msg) { itti_nas_signalling_establishment_request &itti_msg) {
// 1. generate amf_ue_ngap_id // 1. generate amf_ue_ngap_id
// 2. establish ue_context associated with amf_ue_ngap_id // 2. establish ue_context associated with amf_ue_ngap_id
// 3. store ue-reated core information // 3. store ue-reated core information
...@@ -253,7 +253,7 @@ void amf_app::handle_itti_message( ...@@ -253,7 +253,7 @@ void amf_app::handle_itti_message(
uc.get()->tai = itti_msg.tai; uc.get()->tai = itti_msg.tai;
if (itti_msg.rrc_cause != -1) if (itti_msg.rrc_cause != -1)
uc.get()->rrc_estb_cause = uc.get()->rrc_estb_cause =
(e_Ngap_RRCEstablishmentCause) itti_msg.rrc_cause; (e_Ngap_RRCEstablishmentCause)itti_msg.rrc_cause;
if (itti_msg.ueCtxReq == -1) if (itti_msg.ueCtxReq == -1)
uc.get()->isUeContextRequest = false; uc.get()->isUeContextRequest = false;
else else
...@@ -270,10 +270,10 @@ void amf_app::handle_itti_message( ...@@ -270,10 +270,10 @@ void amf_app::handle_itti_message(
Logger::amf_app().debug("Receiving GUTI %s", guti.c_str()); Logger::amf_app().debug("Receiving GUTI %s", guti.c_str());
} }
itti_uplink_nas_data_ind* itti_n1_msg = itti_uplink_nas_data_ind *itti_n1_msg =
new itti_uplink_nas_data_ind(TASK_AMF_APP, TASK_AMF_N1); new itti_uplink_nas_data_ind(TASK_AMF_APP, TASK_AMF_N1);
itti_n1_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_n1_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_n1_msg->ran_ue_ngap_id = itti_msg.ran_ue_ngap_id; itti_n1_msg->ran_ue_ngap_id = itti_msg.ran_ue_ngap_id;
itti_n1_msg->is_nas_signalling_estab_req = true; itti_n1_msg->is_nas_signalling_estab_req = true;
itti_n1_msg->nas_msg = itti_msg.nas_buf; itti_n1_msg->nas_msg = itti_msg.nas_buf;
itti_n1_msg->mcc = itti_msg.tai.mcc; itti_n1_msg->mcc = itti_msg.tai.mcc;
...@@ -299,8 +299,8 @@ void amf_app::handle_post_sm_context_response_error_400() { ...@@ -299,8 +299,8 @@ void amf_app::handle_post_sm_context_response_error_400() {
Logger::amf_app().error("Post SM context response error 400"); Logger::amf_app().error("Post SM context response error 400");
} }
bool amf_app::generate_5g_guti( bool amf_app::generate_5g_guti(uint32_t ranid, long amfid, string &mcc,
uint32_t ranid, long amfid, string& mcc, string& mnc, uint32_t& tmsi) { string &mnc, uint32_t &tmsi) {
string ue_context_key = string ue_context_key =
"app_ue_ranid_" + to_string(ranid) + ":amfid_" + to_string(amfid); "app_ue_ranid_" + to_string(ranid) + ":amfid_" + to_string(amfid);
if (!is_ran_amf_id_2_ue_context(ue_context_key)) { if (!is_ran_amf_id_2_ue_context(ue_context_key)) {
...@@ -309,9 +309,9 @@ bool amf_app::generate_5g_guti( ...@@ -309,9 +309,9 @@ bool amf_app::generate_5g_guti(
return false; return false;
} }
std::shared_ptr<ue_context> uc; std::shared_ptr<ue_context> uc;
uc = ran_amf_id_2_ue_context(ue_context_key); uc = ran_amf_id_2_ue_context(ue_context_key);
mcc = uc.get()->tai.mcc; mcc = uc.get()->tai.mcc;
mnc = uc.get()->tai.mnc; mnc = uc.get()->tai.mnc;
tmsi = golbal_tmsi; tmsi = golbal_tmsi;
golbal_tmsi++; golbal_tmsi++;
return true; return true;
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -47,14 +47,14 @@ namespace amf_application { ...@@ -47,14 +47,14 @@ namespace amf_application {
class amf_app { class amf_app {
public: public:
explicit amf_app(const amf_config& amf_cfg); explicit amf_app(const amf_config &amf_cfg);
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);
long generate_amf_ue_ngap_id(); long generate_amf_ue_ngap_id();
// itti handlers // itti handlers
void handle_itti_message(itti_nas_signalling_establishment_request& itti_msg); void handle_itti_message(itti_nas_signalling_establishment_request &itti_msg);
void handle_itti_message(itti_n1n2_message_transfer_request& itti_msg); void handle_itti_message(itti_n1n2_message_transfer_request &itti_msg);
// context management // context management
std::map<long, std::shared_ptr<ue_context>> amf_ue_ngap_id2ue_ctx; std::map<long, std::shared_ptr<ue_context>> amf_ue_ngap_id2ue_ctx;
mutable std::shared_mutex m_amf_ue_ngap_id2ue_ctx; mutable std::shared_mutex m_amf_ue_ngap_id2ue_ctx;
...@@ -75,9 +75,8 @@ class amf_app { ...@@ -75,9 +75,8 @@ class amf_app {
// SMF Client response handlers // SMF Client response handlers
void handle_post_sm_context_response_error_400(); void handle_post_sm_context_response_error_400();
// others // others
bool generate_5g_guti( bool generate_5g_guti(uint32_t ranid, long amfid, std::string &mcc,
uint32_t ranid, long amfid, std::string& mcc, std::string& mnc, std::string &mnc, uint32_t &tmsi);
uint32_t& tmsi);
}; };
} // namespace amf_application } // namespace amf_application
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include "logger.hpp" #include "3gpp_ts24501.hpp"
#include "amf_app.hpp" #include "amf_app.hpp"
#include "if.hpp" #include "if.hpp"
#include "3gpp_ts24501.hpp" #include "logger.hpp"
extern "C" { extern "C" {
#include <arpa/inet.h> #include <arpa/inet.h>
...@@ -128,7 +128,7 @@ int amf_config::load(const std::string& config_file) { ...@@ -128,7 +128,7 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath()); "%s : %s, using defaults", nfex.what(), nfex.getPath());
} }
try { try {
const Setting& guami_list_cfg = const Setting &guami_list_cfg =
amf_cfg[AMF_CONFIG_STRING_SERVED_GUAMI_LIST]; amf_cfg[AMF_CONFIG_STRING_SERVED_GUAMI_LIST];
int count = guami_list_cfg.getLength(); int count = guami_list_cfg.getLength();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
...@@ -178,8 +178,8 @@ int amf_config::load(const std::string& config_file) { ...@@ -178,8 +178,8 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath()); "%s : %s, using defaults", nfex.what(), nfex.getPath());
} }
try { try {
const Setting& new_if_cfg = amf_cfg[AMF_CONFIG_STRING_INTERFACES]; const Setting &new_if_cfg = amf_cfg[AMF_CONFIG_STRING_INTERFACES];
const Setting& n2_amf_cfg = const Setting &n2_amf_cfg =
new_if_cfg[AMF_CONFIG_STRING_INTERFACE_NGAP_AMF]; new_if_cfg[AMF_CONFIG_STRING_INTERFACE_NGAP_AMF];
load_interface(n2_amf_cfg, n2); load_interface(n2_amf_cfg, n2);
if (is_Nausf) { if (is_Nausf) {
...@@ -189,7 +189,7 @@ int amf_config::load(const std::string& config_file) { ...@@ -189,7 +189,7 @@ int amf_config::load(const std::string& config_file) {
} }
const Setting& n11_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_N11]; const Setting& n11_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_N11];
load_interface(n11_cfg, n11); load_interface(n11_cfg, n11);
const Setting& smf_addr_pool = const Setting &smf_addr_pool =
n11_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL]; n11_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL];
int count = smf_addr_pool.getLength(); int count = smf_addr_pool.getLength();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
...@@ -402,12 +402,12 @@ int amf_config::load_interface( ...@@ -402,12 +402,12 @@ int amf_config::load_interface(
} }
} else { } else {
std::vector<std::string> words; std::vector<std::string> words;
boost::split( boost::split(words, address, boost::is_any_of("/"),
words, address, boost::is_any_of("/"), boost::token_compress_on); boost::token_compress_on);
if (words.size() != 2) { if (words.size() != 2) {
Logger::amf_app().error( Logger::amf_app().error("Bad value " AMF_CONFIG_STRING_IPV4_ADDRESS
"Bad value " AMF_CONFIG_STRING_IPV4_ADDRESS " = %s in config file", " = %s in config file",
address.c_str()); address.c_str());
return RETURNerror; return RETURNerror;
} }
unsigned char buf_in_addr[sizeof(struct in6_addr)]; // you never know... unsigned char buf_in_addr[sizeof(struct in6_addr)]; // you never know...
...@@ -421,9 +421,9 @@ int amf_config::load_interface( ...@@ -421,9 +421,9 @@ int amf_config::load_interface(
util::trim(words.at(0)).c_str()); util::trim(words.at(0)).c_str());
return RETURNerror; return RETURNerror;
} }
cfg.network4.s_addr = htons( cfg.network4.s_addr =
ntohs(cfg.addr4.s_addr) & htons(ntohs(cfg.addr4.s_addr) &
0xFFFFFFFF << (32 - std::stoi(util::trim(words.at(1))))); 0xFFFFFFFF << (32 - std::stoi(util::trim(words.at(1)))));
} }
if_cfg.lookupValue(AMF_CONFIG_STRING_PORT, cfg.port); if_cfg.lookupValue(AMF_CONFIG_STRING_PORT, cfg.port);
...@@ -439,8 +439,8 @@ int amf_config::load_interface( ...@@ -439,8 +439,8 @@ int amf_config::load_interface(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int amf_config::load_thread_sched_params( int amf_config::load_thread_sched_params(const Setting &thread_sched_params_cfg,
const Setting& thread_sched_params_cfg, util::thread_sched_params& cfg) { util::thread_sched_params &cfg) {
try { try {
thread_sched_params_cfg.lookupValue( thread_sched_params_cfg.lookupValue(
AMF_CONFIG_STRING_THREAD_RD_CPU_ID, cfg.cpu_id); AMF_CONFIG_STRING_THREAD_RD_CPU_ID, cfg.cpu_id);
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -29,18 +29,18 @@ ...@@ -29,18 +29,18 @@
#ifndef _AMF_MODULE_FROM_CONFIG_H_ #ifndef _AMF_MODULE_FROM_CONFIG_H_
#define _AMF_MODULE_FROM_CONFIG_H_ #define _AMF_MODULE_FROM_CONFIG_H_
#include <libconfig.h++>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include <libconfig.h++>
#include "Ngap_ProcedureCode.h"
#include "Ngap_NGAP-PDU.h" #include "Ngap_NGAP-PDU.h"
#include "Ngap_ProcedureCode.h"
#define MODULES_CONFIG_STRING_AMF_MODULES "MODULES" #define MODULES_CONFIG_STRING_AMF_MODULES "MODULES"
#define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE "NGAP_MESSAGE" #define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE "NGAP_MESSAGE"
#define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_NAME "MSG_NAME" #define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_NAME "MSG_NAME"
#define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_PROCEDURECODE \ #define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_PROCEDURECODE \
"ProcedureCode" "ProcedureCode"
#define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_TYPEOFMSG "TypeOfMessage" #define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_TYPEOFMSG "TypeOfMessage"
......
This diff is collapsed.
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -29,20 +29,20 @@ ...@@ -29,20 +29,20 @@
#ifndef _AMF_N1_H_ #ifndef _AMF_N1_H_
#define _AMF_N1_H_ #define _AMF_N1_H_
#include <map> #include <mysql/mysql.h>
#include <shared_mutex>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <mysql/mysql.h> #include <map>
#include <shared_mutex>
#include "nas_context.hpp"
#include "pdu_session_context.hpp"
#include "itti_msg_n1.hpp"
#include "bstrlib.h"
#include "3gpp_ts24501.hpp" #include "3gpp_ts24501.hpp"
#include "amf_statistics.hpp"
#include "amf.hpp" #include "amf.hpp"
#include "amf_statistics.hpp"
#include "bstrlib.h"
#include "itti_msg_n1.hpp"
#include "mysql_db.hpp" #include "mysql_db.hpp"
#include "nas_context.hpp"
#include "pdu_session_context.hpp"
namespace amf_application { namespace amf_application {
...@@ -61,8 +61,8 @@ class amf_n1 { ...@@ -61,8 +61,8 @@ class amf_n1 {
public: public:
amf_n1(); amf_n1();
~amf_n1(); ~amf_n1();
void handle_itti_message(itti_uplink_nas_data_ind&); void handle_itti_message(itti_uplink_nas_data_ind &);
void handle_itti_message(itti_downlink_nas_transfer& itti_msg); void handle_itti_message(itti_downlink_nas_transfer &itti_msg);
// nas message decode // nas message decode
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,
...@@ -100,7 +100,7 @@ class amf_n1 { ...@@ -100,7 +100,7 @@ class amf_n1 {
database_t* db_desc; database_t* db_desc;
// procedures // procedures
void run_registration_procedure(std::shared_ptr<nas_context>& nc); void run_registration_procedure(std::shared_ptr<nas_context> &nc);
void run_initial_registration_procedure(); void run_initial_registration_procedure();
void run_mobility_registration_update_procedure( void run_mobility_registration_update_procedure(
std::shared_ptr<nas_context> nc); std::shared_ptr<nas_context> nc);
...@@ -117,10 +117,10 @@ class amf_n1 { ...@@ -117,10 +117,10 @@ class amf_n1 {
bool authentication_vectors_generator_in_ausf( bool authentication_vectors_generator_in_ausf(
std::shared_ptr<nas_context>& nc); std::shared_ptr<nas_context>& nc);
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 // mysql handlers in mysql_db.cpp
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);
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);
void mysql_increment_sqn(std::string imsi); void mysql_increment_sqn(std::string imsi);
bool connect_to_mysql(); bool connect_to_mysql();
void generate_random(uint8_t* random_p, ssize_t length); void generate_random(uint8_t* random_p, ssize_t length);
...@@ -157,40 +157,42 @@ class amf_n1 { ...@@ -157,40 +157,42 @@ class amf_n1 {
uint8_t pdu_session_id, bstring dnn, bstring sm_msg); uint8_t pdu_session_id, bstring dnn, bstring sm_msg);
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);
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);
private: // nas message handlers private: // nas message handlers
void ue_initiate_de_registration_handle( void ue_initiate_de_registration_handle(uint32_t ran_ue_ngap_id,
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas); long amf_ue_ngap_id, bstring nas);
void registration_request_handle( void registration_request_handle(bool isNasSig,
bool isNasSig, std::shared_ptr<nas_context> nc, uint32_t ran_ue_ngap_id, std::shared_ptr<nas_context> nc,
long amf_ue_ngap_id, std::string snn, bstring reg); uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
void authentication_response_handle( std::string snn, bstring reg);
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg); void authentication_response_handle(uint32_t ran_ue_ngap_id,
void authentication_failure_handle( long amf_ue_ngap_id, bstring plain_msg);
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg); void authentication_failure_handle(uint32_t ran_ue_ngap_id,
void security_mode_complete_handle( long amf_ue_ngap_id, bstring plain_msg);
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas_msg); void security_mode_complete_handle(uint32_t ran_ue_ngap_id,
void security_mode_reject_handle( long amf_ue_ngap_id, bstring nas_msg);
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas_msg); void security_mode_reject_handle(uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
void ul_nas_transport_handle( bstring nas_msg);
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas); void ul_nas_transport_handle(uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
void ul_nas_transport_handle( bstring nas);
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas, plmn_t plmn); void ul_nas_transport_handle(uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
void sha256(unsigned char* message, int msg_len, unsigned char* output); bstring nas, plmn_t plmn);
void service_request_handle( void sha256(unsigned char *message, int msg_len, unsigned char *output);
bool isNasSig, std::shared_ptr<nas_context> nc, uint32_t ran_ue_ngap_id, void service_request_handle(bool isNasSig, std::shared_ptr<nas_context> nc,
long amf_ue_ngap_id, bstring nas); uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
void identity_response_handle( bstring nas);
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg); void identity_response_handle(uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
bstring plain_msg);
// authentication vector // authentication vector
bool generate_authentication_vector(); bool generate_authentication_vector();
void itti_send_dl_nas_buffer_to_task_n2( void itti_send_dl_nas_buffer_to_task_n2(bstring &b, uint32_t ran_ue_ngap_id,
bstring& b, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id); long amf_ue_ngap_id);
// response message // response message
void response_registration_reject_msg( void response_registration_reject_msg(uint8_t cause_value,
uint8_t cause_value, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id); uint32_t ran_ue_ngap_id,
long amf_ue_ngap_id);
}; };
} // namespace amf_application } // namespace amf_application
......
This diff is collapsed.
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -43,7 +43,7 @@ class amf_n11 { ...@@ -43,7 +43,7 @@ class amf_n11 {
amf_n11(); amf_n11();
~amf_n11(); ~amf_n11();
void handle_itti_message(itti_smf_services_consumer&); void handle_itti_message(itti_smf_services_consumer &);
void handle_pdu_session_initial_request( void handle_pdu_session_initial_request(
std::string supi, std::shared_ptr<pdu_session_context> psc, std::string supi, std::shared_ptr<pdu_session_context> psc,
std::string smf_addr, bstring sm_msg, std::string dnn); std::string smf_addr, bstring sm_msg, std::string dnn);
......
This diff is collapsed.
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
#ifndef _AMF_N2_H_ #ifndef _AMF_N2_H_
#define _AMF_N2_H_ #define _AMF_N2_H_
#include "ngap_app.hpp" #include "DownlinkRANStatusTransfer.hpp"
#include "HandoverCommandMsg.hpp"
#include "HandoverRequest.hpp"
#include "PduSessionResourceReleaseCommand.hpp"
#include "itti_msg_n2.hpp" #include "itti_msg_n2.hpp"
#include "ngap_app.hpp"
#include "ue_ngap_context.hpp" #include "ue_ngap_context.hpp"
#include "PduSessionResourceReleaseCommand.hpp"
#include "HandoverRequest.hpp"
#include "HandoverCommandMsg.hpp"
#include "DownlinkRANStatusTransfer.hpp"
#include "amf.hpp" #include "amf.hpp"
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -79,7 +79,7 @@ void statistics::display() { ...@@ -79,7 +79,7 @@ void statistics::display() {
"UE NGAP ID | AMF UE ID | PLMN |Cell ID|"); "UE NGAP ID | AMF UE ID | PLMN |Cell ID|");
int i = 0; int i = 0;
for (auto const& ue : ue_infos) { for (auto const &ue : ue_infos) {
Logger::amf_app().info( Logger::amf_app().info(
"|%7d|%22s|%18s|%15s|%16d|%11d|%9s|%7d|", i + 1, "|%7d|%22s|%18s|%15s|%16d|%11d|%9s|%7d|", i + 1,
ue.second.registerStatus.c_str(), ue.second.imsi.c_str(), ue.second.registerStatus.c_str(), ue.second.imsi.c_str(),
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#ifndef _STATISTICS_H_ #ifndef _STATISTICS_H_
#define _STATISTICS_H_ #define _STATISTICS_H_
#include <vector>
#include <string> #include <string>
#include <vector>
#include "amf.hpp" #include "amf.hpp"
#include "ngap_app.hpp" #include "ngap_app.hpp"
...@@ -63,8 +63,8 @@ class statistics { ...@@ -63,8 +63,8 @@ class statistics {
void display(); void display();
statistics(); statistics();
~statistics(); ~statistics();
void update_ue_info(const ue_info_t& ue_info); void update_ue_info(const ue_info_t &ue_info);
void update_5gmm_state(const std::string& imsi, const std::string& state); void update_5gmm_state(const std::string &imsi, const std::string &state);
public: public:
uint32_t gNB_connected; uint32_t gNB_connected;
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
\email: contact@openairinterface.org \email: contact@openairinterface.org
*/ */
#include "amf_config.hpp"
#include "amf_n1.hpp" #include "amf_n1.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "amf_config.hpp"
using namespace amf_application; using namespace amf_application;
using namespace config; using namespace config;
...@@ -38,9 +38,9 @@ extern amf_config amf_cfg; ...@@ -38,9 +38,9 @@ extern amf_config amf_cfg;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool amf_n1::get_mysql_auth_info( bool amf_n1::get_mysql_auth_info(
std::string imsi, std::string imsi,
mysql_auth_info_t& mysql_auth_info_t
resp) { // openair-cn/tree/v0.5.0/src/oai_hss/db/db_connector.c &resp) { // openair-cn/tree/v0.5.0/src/oai_hss/db/db_connector.c
MYSQL_RES* res; MYSQL_RES *res;
MYSQL_ROW row; MYSQL_ROW row;
std::string query; std::string query;
...@@ -88,7 +88,7 @@ bool amf_n1::get_mysql_auth_info( ...@@ -88,7 +88,7 @@ bool amf_n1::get_mysql_auth_info(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool amf_n1::connect_to_mysql() { bool amf_n1::connect_to_mysql() {
const int mysql_reconnect_val = 1; const int mysql_reconnect_val = 1;
db_desc = (database_t*) calloc(1, sizeof(database_t)); db_desc = (database_t *)calloc(1, sizeof(database_t));
if (!db_desc) { if (!db_desc) {
Logger::amf_n1().error( Logger::amf_n1().error(
"An error occurs when allocating memory for DB_DESC"); "An error occurs when allocating memory for DB_DESC");
...@@ -130,8 +130,8 @@ void amf_n1::mysql_push_rand_sqn( ...@@ -130,8 +130,8 @@ void amf_n1::mysql_push_rand_sqn(
Logger::amf_n1().error("Need sqn and rand"); Logger::amf_n1().error("Need sqn and rand");
return; return;
} }
sqn_decimal = ((uint64_t) sqn[0] << 40) | ((uint64_t) sqn[1] << 32) | sqn_decimal = ((uint64_t)sqn[0] << 40) | ((uint64_t)sqn[1] << 32) |
((uint64_t) sqn[2] << 24) | (sqn[3] << 16) | (sqn[4] << 8) | ((uint64_t)sqn[2] << 24) | (sqn[3] << 16) | (sqn[4] << 8) |
sqn[5]; sqn[5];
query_length = sprintf(query, "UPDATE `users` SET `rand`=UNHEX('"); query_length = sprintf(query, "UPDATE `users` SET `rand`=UNHEX('");
for (int i = 0; i < RAND_LENGTH; i++) { for (int i = 0; i < RAND_LENGTH; i++) {
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this * the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the * file except in compliance with the License. You may obtain a copy of the
*License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#ifndef _MYSQL_DB_HANDLERS_H_ #ifndef _MYSQL_DB_HANDLERS_H_
#define _MYSQL_DB_HANDLERS_H_ #define _MYSQL_DB_HANDLERS_H_
#include <pthread.h>
#include <mysql/mysql.h> #include <mysql/mysql.h>
#include <pthread.h>
#include <string> #include <string>
#define KEY_LENGTH (16) #define KEY_LENGTH (16)
...@@ -45,7 +45,7 @@ typedef struct { ...@@ -45,7 +45,7 @@ typedef struct {
typedef struct { typedef struct {
// mysql reference connector object // mysql reference connector object
MYSQL* db_conn; MYSQL *db_conn;
std::string server; std::string server;
std::string user; std::string user;
std::string password; std::string password;
......
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