Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF-Simple
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-AMF-Simple
Commits
ca9dadc7
Commit
ca9dadc7
authored
Feb 03, 2021
by
Keliang
Browse files
Options
Browse Files
Download
Plain Diff
The version is same as eurecom
parents
460e39a2
aef65b41
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
745 additions
and
767 deletions
+745
-767
src/.clang-format
src/.clang-format
+0
-1
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+35
-35
src/amf-app/amf_app.hpp
src/amf-app/amf_app.hpp
+10
-11
src/amf-app/amf_config.cpp
src/amf-app/amf_config.cpp
+18
-18
src/amf-app/amf_config.hpp
src/amf-app/amf_config.hpp
+2
-2
src/amf-app/amf_module_from_config.cpp
src/amf-app/amf_module_from_config.cpp
+2
-2
src/amf-app/amf_module_from_config.hpp
src/amf-app/amf_module_from_config.hpp
+5
-5
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+367
-382
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+46
-44
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+109
-113
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+3
-3
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+120
-123
src/amf-app/amf_n2.hpp
src/amf-app/amf_n2.hpp
+7
-7
src/amf-app/amf_statistics.cpp
src/amf-app/amf_statistics.cpp
+3
-3
src/amf-app/amf_statistics.hpp
src/amf-app/amf_statistics.hpp
+5
-5
src/amf-app/mysql_db.cpp
src/amf-app/mysql_db.cpp
+9
-9
src/amf-app/mysql_db.hpp
src/amf-app/mysql_db.hpp
+4
-4
No files found.
src/.clang-format
View file @
ca9dadc7
...
...
@@ -115,4 +115,3 @@ SortUsingDeclarations: true
# PenaltyBreakTemplateDeclaration (unsigned)
# PenaltyExcessCharacter (unsigned)
# PenaltyReturnTypeOnItsOwnLine (unsigned)
src/amf-app/amf_app.cpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -28,18 +28,18 @@
#include "amf_app.hpp"
#include <stdexcept>
#include <iostream>
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include "itti.hpp"
#include "
ngap_app
.hpp"
#include "
DLNASTransport
.hpp"
#include "amf_config.hpp"
#include "amf_n2.hpp"
#include "amf_n1.hpp"
#include "amf_n11.hpp"
#include "amf_n2.hpp"
#include "amf_statistics.hpp"
#include "
DLNASTransport
.hpp"
#include "
ngap_app
.hpp"
using
namespace
ngap
;
using
namespace
nas
;
...
...
@@ -56,7 +56,7 @@ amf_n11* amf_n11_inst = nullptr;
extern
amf_config
amf_cfg
;
extern
statistics
stacs
;
void
amf_app_task
(
void
*
);
void
amf_app_task
(
void
*
);
uint32_t
golbal_tmsi
=
1
;
//------------------------------------------------------------------------------
...
...
@@ -77,8 +77,8 @@ amf_app::amf_app(const amf_config& amf_cfg) {
throw
;
}
timer_id_t
tid
=
itti_inst
->
timer_setup
(
amf_cfg
.
statistics_interval
,
0
,
TASK_AMF_APP
,
timer_id_t
tid
=
itti_inst
->
timer_setup
(
amf_cfg
.
statistics_interval
,
0
,
TASK_AMF_APP
,
TASK_AMF_APP_PERIODIC_STATISTICS
,
0
);
Logger
::
amf_app
().
startup
(
"Started timer(%d)"
,
tid
);
}
...
...
@@ -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
;
itti_inst
->
notify_task_ready
(
task_id
);
do
{
...
...
@@ -99,24 +99,24 @@ void amf_app_task(void*) {
switch
(
msg
->
msg_type
)
{
case
NAS_SIG_ESTAB_REQ
:
{
Logger
::
amf_app
().
debug
(
"Received NAS_SIG_ESTAB_REQ"
);
itti_nas_signalling_establishment_request
*
m
=
dynamic_cast
<
itti_nas_signalling_establishment_request
*>
(
msg
);
itti_nas_signalling_establishment_request
*
m
=
dynamic_cast
<
itti_nas_signalling_establishment_request
*>
(
msg
);
amf_app_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
N1N2_MESSAGE_TRANSFER_REQ
:
{
Logger
::
amf_app
().
debug
(
"Received N1N2_MESSAGE_TRANSFER_REQ"
);
itti_n1n2_message_transfer_request
*
m
=
dynamic_cast
<
itti_n1n2_message_transfer_request
*>
(
msg
);
itti_n1n2_message_transfer_request
*
m
=
dynamic_cast
<
itti_n1n2_message_transfer_request
*>
(
msg
);
amf_app_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
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
)
{
case
TASK_AMF_APP_PERIODIC_STATISTICS
:
tid
=
itti_inst
->
timer_setup
(
amf_cfg
.
statistics_interval
,
0
,
TASK_AMF_APP
,
tid
=
itti_inst
->
timer_setup
(
amf_cfg
.
statistics_interval
,
0
,
TASK_AMF_APP
,
TASK_AMF_APP_PERIODIC_STATISTICS
,
0
);
stacs
.
display
();
break
;
...
...
@@ -183,20 +183,20 @@ void amf_app::set_ran_amf_id_2_ue_context(
// ITTI handlers
//------------------------------------------------------------------------------
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)
DLNASTransport
*
dl
=
new
DLNASTransport
();
DLNASTransport
*
dl
=
new
DLNASTransport
();
dl
->
setHeader
(
PLAIN_5GS_MSG
);
dl
->
setPayload_Container_Type
(
N1_SM_INFORMATION
);
dl
->
setPayload_Container
(
(
uint8_t
*
)
bdata
(
itti_msg
.
n1sm
),
blength
(
itti_msg
.
n1sm
));
dl
->
setPayload_Container
(
(
uint8_t
*
)
bdata
(
itti_msg
.
n1sm
),
blength
(
itti_msg
.
n1sm
));
dl
->
setPDUSessionId
(
itti_msg
.
pdu_session_id
);
uint8_t
nas
[
1024
];
int
encoded_size
=
dl
->
encode2buffer
(
nas
,
1024
);
print_buffer
(
"amf_app"
,
"n1n2 transfer"
,
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
);
dl_msg
->
dl_nas
=
dl_nas
;
if
(
!
itti_msg
.
is_n2sm_set
)
{
...
...
@@ -221,7 +221,7 @@ 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
// 2. establish ue_context associated with amf_ue_ngap_id
// 3. store ue-reated core information
...
...
@@ -253,7 +253,7 @@ void amf_app::handle_itti_message(
uc
.
get
()
->
tai
=
itti_msg
.
tai
;
if
(
itti_msg
.
rrc_cause
!=
-
1
)
uc
.
get
()
->
rrc_estb_cause
=
(
e_Ngap_RRCEstablishmentCause
)
itti_msg
.
rrc_cause
;
(
e_Ngap_RRCEstablishmentCause
)
itti_msg
.
rrc_cause
;
if
(
itti_msg
.
ueCtxReq
==
-
1
)
uc
.
get
()
->
isUeContextRequest
=
false
;
else
...
...
@@ -270,7 +270,7 @@ void amf_app::handle_itti_message(
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
);
itti_n1_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_n1_msg
->
ran_ue_ngap_id
=
itti_msg
.
ran_ue_ngap_id
;
...
...
@@ -299,8 +299,8 @@ void amf_app::handle_post_sm_context_response_error_400() {
Logger
::
amf_app
().
error
(
"Post SM context response error 400"
);
}
bool
amf_app
::
generate_5g_guti
(
uint32_t
ranid
,
long
amfid
,
string
&
mcc
,
string
&
mnc
,
uint32_t
&
tmsi
)
{
bool
amf_app
::
generate_5g_guti
(
uint32_t
ranid
,
long
amfid
,
string
&
mcc
,
string
&
mnc
,
uint32_t
&
tmsi
)
{
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
ranid
)
+
":amfid_"
+
to_string
(
amfid
);
if
(
!
is_ran_amf_id_2_ue_context
(
ue_context_key
))
{
...
...
src/amf-app/amf_app.hpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -47,14 +47,14 @@ namespace amf_application {
class
amf_app
{
public:
explicit
amf_app
(
const
amf_config
&
amf_cfg
);
amf_app
(
amf_app
const
&
)
=
delete
;
void
operator
=
(
amf_app
const
&
)
=
delete
;
void
allRegistredModulesInit
(
const
amf_modules
&
modules
);
explicit
amf_app
(
const
amf_config
&
amf_cfg
);
amf_app
(
amf_app
const
&
)
=
delete
;
void
operator
=
(
amf_app
const
&
)
=
delete
;
void
allRegistredModulesInit
(
const
amf_modules
&
modules
);
long
generate_amf_ue_ngap_id
();
// itti handlers
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_nas_signalling_establishment_request
&
itti_msg
);
void
handle_itti_message
(
itti_n1n2_message_transfer_request
&
itti_msg
);
// context management
std
::
map
<
long
,
std
::
shared_ptr
<
ue_context
>>
amf_ue_ngap_id2ue_ctx
;
mutable
std
::
shared_mutex
m_amf_ue_ngap_id2ue_ctx
;
...
...
@@ -75,9 +75,8 @@ class amf_app {
// SMF Client response handlers
void
handle_post_sm_context_response_error_400
();
// others
bool
generate_5g_guti
(
uint32_t
ranid
,
long
amfid
,
std
::
string
&
mcc
,
std
::
string
&
mnc
,
uint32_t
&
tmsi
);
bool
generate_5g_guti
(
uint32_t
ranid
,
long
amfid
,
std
::
string
&
mcc
,
std
::
string
&
mnc
,
uint32_t
&
tmsi
);
};
}
// namespace amf_application
...
...
src/amf-app/amf_config.cpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -37,10 +37,10 @@
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include "
logger
.hpp"
#include "
3gpp_ts24501
.hpp"
#include "amf_app.hpp"
#include "if.hpp"
#include "
3gpp_ts24501
.hpp"
#include "
logger
.hpp"
extern
"C"
{
#include <arpa/inet.h>
...
...
@@ -128,7 +128,7 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
const
Setting
&
guami_list_cfg
=
const
Setting
&
guami_list_cfg
=
amf_cfg
[
AMF_CONFIG_STRING_SERVED_GUAMI_LIST
];
int
count
=
guami_list_cfg
.
getLength
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -178,8 +178,8 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
const
Setting
&
new_if_cfg
=
amf_cfg
[
AMF_CONFIG_STRING_INTERFACES
];
const
Setting
&
n2_amf_cfg
=
const
Setting
&
new_if_cfg
=
amf_cfg
[
AMF_CONFIG_STRING_INTERFACES
];
const
Setting
&
n2_amf_cfg
=
new_if_cfg
[
AMF_CONFIG_STRING_INTERFACE_NGAP_AMF
];
load_interface
(
n2_amf_cfg
,
n2
);
if
(
is_Nausf
)
{
...
...
@@ -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
];
load_interface
(
n11_cfg
,
n11
);
const
Setting
&
smf_addr_pool
=
const
Setting
&
smf_addr_pool
=
n11_cfg
[
AMF_CONFIG_STRING_SMF_INSTANCES_POOL
];
int
count
=
smf_addr_pool
.
getLength
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -402,11 +402,11 @@ int amf_config::load_interface(
}
}
else
{
std
::
vector
<
std
::
string
>
words
;
boost
::
split
(
words
,
address
,
boost
::
is_any_of
(
"/"
),
boost
::
token_compress_on
);
boost
::
split
(
words
,
address
,
boost
::
is_any_of
(
"/"
),
boost
::
token_compress_on
);
if
(
words
.
size
()
!=
2
)
{
Logger
::
amf_app
().
error
(
"Bad value "
AMF_CONFIG_STRING_IPV4_ADDRESS
" = %s in config file"
,
Logger
::
amf_app
().
error
(
"Bad value "
AMF_CONFIG_STRING_IPV4_ADDRESS
" = %s in config file"
,
address
.
c_str
());
return
RETURNerror
;
}
...
...
@@ -421,8 +421,8 @@ int amf_config::load_interface(
util
::
trim
(
words
.
at
(
0
)).
c_str
());
return
RETURNerror
;
}
cfg
.
network4
.
s_addr
=
htons
(
ntohs
(
cfg
.
addr4
.
s_addr
)
&
cfg
.
network4
.
s_addr
=
htons
(
ntohs
(
cfg
.
addr4
.
s_addr
)
&
0xFFFFFFFF
<<
(
32
-
std
::
stoi
(
util
::
trim
(
words
.
at
(
1
)))));
}
if_cfg
.
lookupValue
(
AMF_CONFIG_STRING_PORT
,
cfg
.
port
);
...
...
@@ -439,8 +439,8 @@ int amf_config::load_interface(
}
//------------------------------------------------------------------------------
int
amf_config
::
load_thread_sched_params
(
const
Setting
&
thread_sched_params_cfg
,
util
::
thread_sched_params
&
cfg
)
{
int
amf_config
::
load_thread_sched_params
(
const
Setting
&
thread_sched_params_cfg
,
util
::
thread_sched_params
&
cfg
)
{
try
{
thread_sched_params_cfg
.
lookupValue
(
AMF_CONFIG_STRING_THREAD_RD_CPU_ID
,
cfg
.
cpu_id
);
...
...
src/amf-app/amf_config.hpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
src/amf-app/amf_module_from_config.cpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
src/amf-app/amf_module_from_config.hpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -29,13 +29,13 @@
#ifndef _AMF_MODULE_FROM_CONFIG_H_
#define _AMF_MODULE_FROM_CONFIG_H_
#include <libconfig.h++>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <libconfig.h++>
#include "Ngap_ProcedureCode.h"
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProcedureCode.h"
#define MODULES_CONFIG_STRING_AMF_MODULES "MODULES"
#define MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE "NGAP_MESSAGE"
...
...
src/amf-app/amf_n1.cpp
View file @
ca9dadc7
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n1.hpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -29,20 +29,20 @@
#ifndef _AMF_N1_H_
#define _AMF_N1_H_
#include <map>
#include <shared_mutex>
#include <mysql/mysql.h>
#include <stdlib.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 "amf_statistics.hpp"
#include "amf.hpp"
#include "amf_statistics.hpp"
#include "bstrlib.h"
#include "itti_msg_n1.hpp"
#include "mysql_db.hpp"
#include "nas_context.hpp"
#include "pdu_session_context.hpp"
namespace
amf_application
{
...
...
@@ -61,8 +61,8 @@ class amf_n1 {
public:
amf_n1
();
~
amf_n1
();
void
handle_itti_message
(
itti_uplink_nas_data_ind
&
);
void
handle_itti_message
(
itti_downlink_nas_transfer
&
itti_msg
);
void
handle_itti_message
(
itti_uplink_nas_data_ind
&
);
void
handle_itti_message
(
itti_downlink_nas_transfer
&
itti_msg
);
// nas message decode
void
nas_signalling_establishment_request_handle
(
SecurityHeaderType
type
,
std
::
shared_ptr
<
nas_context
>
nc
,
...
...
@@ -100,7 +100,7 @@ class amf_n1 {
database_t
*
db_desc
;
// 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_mobility_registration_update_procedure
(
std
::
shared_ptr
<
nas_context
>
nc
);
...
...
@@ -117,10 +117,10 @@ class amf_n1 {
bool
authentication_vectors_generator_in_ausf
(
std
::
shared_ptr
<
nas_context
>&
nc
);
bool
authentication_vectors_generator_in_udm
(
std
::
shared_ptr
<
nas_context
>
&
nc
);
std
::
shared_ptr
<
nas_context
>
&
nc
);
// mysql handlers in mysql_db.cpp
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
);
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_increment_sqn
(
std
::
string
imsi
);
bool
connect_to_mysql
();
void
generate_random
(
uint8_t
*
random_p
,
ssize_t
length
);
...
...
@@ -157,40 +157,42 @@ class amf_n1 {
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
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
void
ue_initiate_de_registration_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
void
registration_request_handle
(
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
std
::
string
snn
,
bstring
reg
);
void
authentication_response_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
);
void
authentication_failure_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
);
void
security_mode_complete_handle
(
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
,
bstring
nas_msg
);
void
ul_nas_transport_handle
(
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
,
bstring
nas
,
plmn_t
plmn
);
void
sha256
(
unsigned
char
*
message
,
int
msg_len
,
unsigned
char
*
output
);
void
service_request_handle
(
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
void
ue_initiate_de_registration_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
void
identity_response_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
);
void
registration_request_handle
(
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
std
::
string
snn
,
bstring
reg
);
void
authentication_response_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
);
void
authentication_failure_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
);
void
security_mode_complete_handle
(
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
,
bstring
nas_msg
);
void
ul_nas_transport_handle
(
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
,
bstring
nas
,
plmn_t
plmn
);
void
sha256
(
unsigned
char
*
message
,
int
msg_len
,
unsigned
char
*
output
);
void
service_request_handle
(
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
void
identity_response_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
);
// authentication vector
bool
generate_authentication_vector
();
void
itti_send_dl_nas_buffer_to_task_n2
(
bstring
&
b
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
);
void
itti_send_dl_nas_buffer_to_task_n2
(
bstring
&
b
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
);
// response message
void
response_registration_reject_msg
(
uint8_t
cause_value
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
);
void
response_registration_reject_msg
(
uint8_t
cause_value
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
);
};
}
// namespace amf_application
...
...
src/amf-app/amf_n11.cpp
View file @
ca9dadc7
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n11.hpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -43,7 +43,7 @@ class 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
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
);
...
...
src/amf-app/amf_n2.cpp
View file @
ca9dadc7
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n2.hpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -29,13 +29,13 @@
#ifndef _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 "ngap_app.hpp"
#include "ue_ngap_context.hpp"
#include "PduSessionResourceReleaseCommand.hpp"
#include "HandoverRequest.hpp"
#include "HandoverCommandMsg.hpp"
#include "DownlinkRANStatusTransfer.hpp"
#include "amf.hpp"
...
...
src/amf-app/amf_statistics.cpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -79,7 +79,7 @@ void statistics::display() {
"UE NGAP ID | AMF UE ID | PLMN |Cell ID|"
);
int
i
=
0
;
for
(
auto
const
&
ue
:
ue_infos
)
{
for
(
auto
const
&
ue
:
ue_infos
)
{
Logger
::
amf_app
().
info
(
"|%7d|%22s|%18s|%15s|%16d|%11d|%9s|%7d|"
,
i
+
1
,
ue
.
second
.
registerStatus
.
c_str
(),
ue
.
second
.
imsi
.
c_str
(),
...
...
src/amf-app/amf_statistics.hpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -29,8 +29,8 @@
#ifndef _STATISTICS_H_
#define _STATISTICS_H_
#include <vector>
#include <string>
#include <vector>
#include "amf.hpp"
#include "ngap_app.hpp"
...
...
@@ -63,8 +63,8 @@ class statistics {
void
display
();
statistics
();
~
statistics
();
void
update_ue_info
(
const
ue_info_t
&
ue_info
);
void
update_5gmm_state
(
const
std
::
string
&
imsi
,
const
std
::
string
&
state
);
void
update_ue_info
(
const
ue_info_t
&
ue_info
);
void
update_5gmm_state
(
const
std
::
string
&
imsi
,
const
std
::
string
&
state
);
public:
uint32_t
gNB_connected
;
...
...
src/amf-app/mysql_db.cpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -26,9 +26,9 @@
\email: contact@openairinterface.org
*/
#include "amf_config.hpp"
#include "amf_n1.hpp"
#include "logger.hpp"
#include "amf_config.hpp"
using
namespace
amf_application
;
using
namespace
config
;
...
...
@@ -38,9 +38,9 @@ extern amf_config amf_cfg;
//------------------------------------------------------------------------------
bool
amf_n1
::
get_mysql_auth_info
(
std
::
string
imsi
,
mysql_auth_info_t
&
resp
)
{
// openair-cn/tree/v0.5.0/src/oai_hss/db/db_connector.c
MYSQL_RES
*
res
;
mysql_auth_info_t
&
resp
)
{
// openair-cn/tree/v0.5.0/src/oai_hss/db/db_connector.c
MYSQL_RES
*
res
;
MYSQL_ROW
row
;
std
::
string
query
;
...
...
@@ -88,7 +88,7 @@ bool amf_n1::get_mysql_auth_info(
//------------------------------------------------------------------------------
bool
amf_n1
::
connect_to_mysql
()
{
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
)
{
Logger
::
amf_n1
().
error
(
"An error occurs when allocating memory for DB_DESC"
);
...
...
@@ -130,8 +130,8 @@ void amf_n1::mysql_push_rand_sqn(
Logger
::
amf_n1
().
error
(
"Need sqn and rand"
);
return
;
}
sqn_decimal
=
((
uint64_t
)
sqn
[
0
]
<<
40
)
|
((
uint64_t
)
sqn
[
1
]
<<
32
)
|
((
uint64_t
)
sqn
[
2
]
<<
24
)
|
(
sqn
[
3
]
<<
16
)
|
(
sqn
[
4
]
<<
8
)
|
sqn_decimal
=
((
uint64_t
)
sqn
[
0
]
<<
40
)
|
((
uint64_t
)
sqn
[
1
]
<<
32
)
|
((
uint64_t
)
sqn
[
2
]
<<
24
)
|
(
sqn
[
3
]
<<
16
)
|
(
sqn
[
4
]
<<
8
)
|
sqn
[
5
];
query_length
=
sprintf
(
query
,
"UPDATE `users` SET `rand`=UNHEX('"
);
for
(
int
i
=
0
;
i
<
RAND_LENGTH
;
i
++
)
{
...
...
src/amf-app/mysql_db.hpp
View file @
ca9dadc7
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* 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
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -29,8 +29,8 @@
#ifndef _MYSQL_DB_HANDLERS_H_
#define _MYSQL_DB_HANDLERS_H_
#include <pthread.h>
#include <mysql/mysql.h>
#include <pthread.h>
#include <string>
#define KEY_LENGTH (16)
...
...
@@ -45,7 +45,7 @@ typedef struct {
typedef
struct
{
// mysql reference connector object
MYSQL
*
db_conn
;
MYSQL
*
db_conn
;
std
::
string
server
;
std
::
string
user
;
std
::
string
password
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment