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
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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
OpenXG
OpenXG-AMF
Commits
b841938a
Commit
b841938a
authored
Jun 13, 2022
by
yangjian
Browse files
Options
Browse Files
Download
Plain Diff
merge amf-arm
parents
7146804d
bf6d3952
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
416 additions
and
72 deletions
+416
-72
.gitattributes
.gitattributes
+1
-0
build/scripts/build_helper
build/scripts/build_helper
+2
-1
build/scripts/build_helper.amf
build/scripts/build_helper.amf
+8
-1
etc/amf-arm-83.conf
etc/amf-arm-83.conf
+116
-0
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+2
-0
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+145
-28
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+10
-0
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+29
-27
src/contexts/nas_context.cpp
src/contexts/nas_context.cpp
+1
-0
src/itti/itti.cpp
src/itti/itti.cpp
+2
-0
src/nas/common/3gpp_ts24501.hpp
src/nas/common/3gpp_ts24501.hpp
+1
-0
src/nas/ies/5GSMobilityIdentity.cpp
src/nas/ies/5GSMobilityIdentity.cpp
+12
-9
src/ngap/libngap/NativeEnumerated.c
src/ngap/libngap/NativeEnumerated.c
+2
-0
src/ngap/libngap/NativeInteger.c
src/ngap/libngap/NativeInteger.c
+2
-0
src/ngap/libngap/constr_CHOICE.c
src/ngap/libngap/constr_CHOICE.c
+20
-0
src/ngap/libngap/constr_SEQUENCE.c
src/ngap/libngap/constr_SEQUENCE.c
+12
-0
src/ngap/libngap/constr_SET_OF.c
src/ngap/libngap/constr_SET_OF.c
+2
-0
src/ngap/libngap/constr_TYPE.c
src/ngap/libngap/constr_TYPE.c
+2
-1
src/ngap/libngap/per_opentype.c
src/ngap/libngap/per_opentype.c
+10
-0
src/ngap/ngapIEs/PlmnId.cpp
src/ngap/ngapIEs/PlmnId.cpp
+0
-2
src/oai-amf/CMakeLists.txt
src/oai-amf/CMakeLists.txt
+7
-2
src/sctp/sctp_server.cpp
src/sctp/sctp_server.cpp
+5
-0
src/utils/thread_sched.cpp
src/utils/thread_sched.cpp
+22
-1
src/utils/thread_sched.hpp
src/utils/thread_sched.hpp
+3
-0
No files found.
.gitattributes
0 → 100644
View file @
b841938a
etc/amf.conf merge=ours
build/scripts/build_helper
View file @
b841938a
...
...
@@ -25,7 +25,7 @@
#
#######################################
#SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 7, RHEL 7"
SUPPORTED_DISTRO="Ubuntu 18.04"
SUPPORTED_DISTRO="Ubuntu 18.04
, Ubuntu 20.04
"
if [ ! -f /etc/os-release ]; then
echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro."
fi
...
...
@@ -128,6 +128,7 @@ check_supported_distribution() {
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;;
#"rhel7") return 0 ;;
#"centos7") return 0 ;;
esac
...
...
build/scripts/build_helper.amf
View file @
b841938a
...
...
@@ -271,6 +271,13 @@ check_install_amf_deps(){
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
fi
;;
"ubuntu20.04")
if [ $IS_CONTAINER -eq 0 ]; then
specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server"
else
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
fi
;;
esac
# removed libspdlog-dev
PACKAGE_LIST="\
...
...
@@ -282,7 +289,7 @@ check_install_amf_deps(){
guile-2.0-dev \
libcurl4-gnutls-dev \
libevent-dev \
libgcrypt
11
-dev \
libgcrypt
20
-dev \
libgmp-dev \
libhogweed? \
libidn2-0-dev \
...
...
etc/amf-arm-83.conf
0 → 100644
View file @
b841938a
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# 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
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
AMF
=
{
INSTANCE_ID
=
10
;
# 0 is the default
PID_DIRECTORY
=
"/var/run"
;
# /var/run is the default
AMF_NAME
=
"OAI-AMF"
;
RELATIVE_CAPACITY
=
50
;
# Display statistics about whole system (in seconds)
STATISTICS_TIMER_INTERVAL
=
20
;
# YOUR CONFIG HERE
CORE_CONFIGURATION
:
{
EMERGENCY_SUPPORT
=
"false"
;
};
GUAMI
:
{
MCC
=
"460"
;
MNC
=
"11"
;
RegionID
=
"128"
;
AMFSetID
=
"4"
;
AMFPointer
=
"1"
# YOUR GUAMI CONFIG HERE
}
SERVED_GUAMI_LIST
= (
{
MCC
=
"460"
;
MNC
=
"11"
;
RegionID
=
"128"
;
AMFSetID
=
"4"
;
AMFPointer
=
"1"
}
#48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer>
);
PLMN_SUPPORT_LIST
= (
{
MCC
=
"460"
;
MNC
=
"11"
;
TAC
=
100
;
# YOUR PLMN CONFIG HERE
SLICE_SUPPORT_LIST
= (
{
SST
=
"1"
;
SD
=
"none"
}
# YOUR NSSAI CONFIG HERE
)
}
);
INTERFACES
:
{
# AMF binded interface for N1/N2 interface (NGAP)
NGAP_AMF
:
{
INTERFACE_NAME
=
"eth0"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"read"
;
PORT
=
38412
;
# YOUR NETWORK CONFIG HERE
PPID
=
60
;
# YOUR NETWORK CONFIG HERE
};
# AMF binded interface for Nausf interface
NAUSF
:
{
INTERFACE_NAME
=
"eth0"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"192.168.199.181/24"
;
PORT
=
8383
;
# YOUR NETWORK CONFIG HERE
};
# AMF binded interface for N11
N11
:
{
INTERFACE_NAME
=
"lo"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"127.0.0.1/24"
;
PORT
=
8282
;
# YOUR NETWORK CONFIG HERE
SMF_INSTANCES_POOL
= (
{
SMF_INSTANCE_ID
=
1
;
IPV4_ADDRESS
=
"127.0.0.2"
;
PORT
=
"8889"
;
VERSION
=
"v1"
;
SELECTED
=
"true"
},
# YOUR SMF CONFIG HERE
{
SMF_INSTANCE_ID
=
2
;
IPV4_ADDRESS
=
"10.103.238.21"
;
PORT
=
"8181"
;
VERSION
=
"v1"
;
SELECTED
=
"false"
}
# YOUR SMF CONFIG HERE
);
};
};
AUTHENTICATION
:
{
## MySQL mandatory options
MYSQL_server
=
"127.0.0.1"
;
# MySQL Server address
MYSQL_user
=
"openxg"
;
# Database server login
MYSQL_pass
=
"123456"
;
# Database server password
MYSQL_db
=
"OPENXG_DB"
;
# Your database name
## OP
OPERATOR_key
=
"1006020f0a478bf6b699f15c062e42b3"
;
# OP key matching your database
RANDOM
=
"true"
;
};
NAS
:
{
ORDERED_SUPPORTED_INTEGRITY_ALGORITHM_LIST
= [
"NIA1"
,
"NIA0"
,
"NIA2"
];
ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST
= [
"NEA0"
,
"NEA1"
,
"NEA2"
];
};
};
MODULES
=
{
NGAP_MESSAGE
= (
{
MSG_NAME
=
"NGSetupRequest"
;
ProcedureCode
=
21
;
TypeOfMessage
=
"initialMessage"
}
);
};
src/amf-app/amf_app.cpp
View file @
b841938a
...
...
@@ -69,6 +69,7 @@ amf_app::amf_app(const amf_config& amf_cfg) {
try
{
amf_n1_inst
=
new
amf_n1
();
printf
(
"----------Got N2 Address is %s
\n
"
,
std
::
string
(
inet_ntoa
(
amf_cfg
.
n2
.
addr4
)).
c_str
());
amf_n2_inst
=
new
amf_n2
(
std
::
string
(
inet_ntoa
(
amf_cfg
.
n2
.
addr4
)),
amf_cfg
.
n2
.
port
);
amf_n11_inst
=
new
amf_n11
();
...
...
@@ -92,6 +93,7 @@ void amf_app::allRegistredModulesInit(const amf_modules& modules) {
void
amf_app_task
(
void
*
)
{
const
task_id_t
task_id
=
TASK_AMF_APP
;
itti_inst
->
notify_task_ready
(
task_id
);
// set_cpu(1);
do
{
std
::
shared_ptr
<
itti_msg
>
shared_msg
=
itti_inst
->
receive_msg
(
task_id
);
auto
*
msg
=
shared_msg
.
get
();
...
...
src/amf-app/amf_n1.cpp
View file @
b841938a
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n11.cpp
View file @
b841938a
...
...
@@ -101,6 +101,7 @@ void amf_n11_task(void*);
void
amf_n11_task
(
void
*
)
{
const
task_id_t
task_id
=
TASK_AMF_N11
;
itti_inst
->
notify_task_ready
(
task_id
);
// set_cpu(4);
do
{
std
::
shared_ptr
<
itti_msg
>
shared_msg
=
itti_inst
->
receive_msg
(
task_id
);
auto
*
msg
=
shared_msg
.
get
();
...
...
@@ -554,7 +555,16 @@ void amf_n11::curl_http_client(
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
body
.
length
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDS
,
body_data
);
// struct timeval tv1;
// struct timezone tz1;
// gettimeofday(&tv1,&tz1);
// long time_start = tv1.tv_sec*1000000 +tv1.tv_usec;
// std::cout << "*************** time["<< time_start <<"] amf_n11 http curl_easy_perform start ***********"<<std::endl;
res
=
curl_easy_perform
(
curl
);
// gettimeofday(&tv1,&tz1);
// long time_end = tv1.tv_sec*1000000 +tv1.tv_usec;
// std::cout << "*************** time["<< time_end <<"] amf_n11 http curl_easy_perform end ***********"<<std::endl;
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
// get cause from the response
...
...
src/amf-app/amf_n2.cpp
View file @
b841938a
...
...
@@ -83,6 +83,7 @@ void amf_n2_task(void*);
void
amf_n2_task
(
void
*
args_p
)
{
const
task_id_t
task_id
=
TASK_AMF_N2
;
itti_inst
->
notify_task_ready
(
task_id
);
// set_cpu(3);
do
{
std
::
shared_ptr
<
itti_msg
>
shared_msg
=
itti_inst
->
receive_msg
(
task_id
);
auto
*
msg
=
shared_msg
.
get
();
...
...
@@ -492,7 +493,8 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
itti_msg
->
is_5g_s_tmsi_present
=
false
;
Logger
::
amf_n2
().
debug
(
"5g_s_tmsi not present"
);
}
else
{
itti_msg
->
is_5g_s_tmsi_present
=
true
;
// itti_msg->is_5g_s_tmsi_present = true;
itti_msg
->
is_5g_s_tmsi_present
=
false
;
itti_msg
->
_5g_s_tmsi
=
_5g_s_tmsi
;
Logger
::
amf_n2
().
debug
(
"5g_s_tmsi present"
);
...
...
@@ -682,29 +684,29 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
Logger
::
amf_n2
().
debug
(
"Encoding parameters for Service Request"
);
if
(
itti_msg
.
is_pdu_exist
)
{
std
::
vector
<
PDUSessionResourceSetupRequestItem_t
>
list
;
PDUSessionResourceSetupRequestItem_t
item
;
item
.
pduSessionId
=
itti_msg
.
pdu_session_id
;
// item.s_nssai.sst = "01";
// item.s_nssai.sd = "None";
item
.
s_nssai
.
sst
=
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sST
;
item
.
s_nssai
.
sd
=
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sD
;
item
.
pduSessionNAS_PDU
=
NULL
;
if
(
itti_msg
.
isn2sm_avaliable
)
{
//bstring n2sm = itti_msg.n2sm;
if
(
blength
(
itti_msg
.
n2sm
)
!=
0
)
{
Logger
::
amf_n2
().
debug
(
"*** test into itti_msg.n2sm ***"
);
item
.
pduSessionResourceSetupRequestTransfer
.
buf
=
(
uint8_t
*
)
bdata
(
itti_msg
.
n2sm
);
Logger
::
amf_n2
().
debug
(
"*** test into item.pduSessionResourceSetupRequestTransfer.buf ***"
);
item
.
pduSessionResourceSetupRequestTransfer
.
size
=
blength
(
itti_msg
.
n2sm
);
}
else
{
Logger
::
amf_n2
().
error
(
"n2sm empty!"
);
}
}
list
.
push_back
(
item
);
msg
->
setPduSessionResourceSetupRequestList
(
list
);
//
std::vector<PDUSessionResourceSetupRequestItem_t> list;
//
PDUSessionResourceSetupRequestItem_t item;
//
item.pduSessionId = itti_msg.pdu_session_id;
//
// item.s_nssai.sst = "01";
//
// item.s_nssai.sd = "None";
//
item.s_nssai.sst = amf_cfg.plmn_list[0].slice_list[0].sST;
//
item.s_nssai.sd = amf_cfg.plmn_list[0].slice_list[0].sD;
//
item.pduSessionNAS_PDU = NULL;
//
if (itti_msg.isn2sm_avaliable) {
//
//bstring n2sm = itti_msg.n2sm;
//
if (blength(itti_msg.n2sm) != 0) {
//
Logger::amf_n2().debug("*** test into itti_msg.n2sm ***");
//
item.pduSessionResourceSetupRequestTransfer.buf =
//
(uint8_t*) bdata(itti_msg.n2sm);
//
Logger::amf_n2().debug("*** test into item.pduSessionResourceSetupRequestTransfer.buf ***");
//
item.pduSessionResourceSetupRequestTransfer.size =
//
blength(itti_msg.n2sm);
//
} else {
//
Logger::amf_n2().error("n2sm empty!");
//
}
//
}
//
list.push_back(item);
//
msg->setPduSessionResourceSetupRequestList(list);
msg
->
setUEAggregateMaxBitRate
(
0x08a7d8c0
,
0x20989680
);
// TODO: remove hardcoded value
}
...
...
@@ -900,12 +902,12 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) {
if
(
itti_msg
.
cause
.
getChoiceOfCause
()
==
Ngap_Cause_PR_nas
)
{
ueCtxRelCmd
->
setCauseNas
((
e_Ngap_CauseNas
)
itti_msg
.
cause
.
getValue
());
}
if
(
itti_msg
.
cause
.
getChoiceOfCause
()
==
Ngap_Cause_PR_radioNetwork
)
{
else
if
(
itti_msg
.
cause
.
getChoiceOfCause
()
==
Ngap_Cause_PR_radioNetwork
)
{
ueCtxRelCmd
->
setCauseRadioNetwork
(
(
e_Ngap_CauseRadioNetwork
)
itti_msg
.
cause
.
getValue
());
}
uint8_t
buffer
[
200
];
int
encoded_size
=
ueCtxRelCmd
->
encode2buffer
(
buffer
,
200
);
uint8_t
buffer
[
BUFFER_SIZE_512
];
int
encoded_size
=
ueCtxRelCmd
->
encode2buffer
(
buffer
,
BUFFER_SIZE_512
);
delete
ueCtxRelCmd
;
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
sctp_s_38412
.
sctp_send_msg
(
...
...
src/contexts/nas_context.cpp
View file @
b841938a
...
...
@@ -45,6 +45,7 @@ nas_context::nas_context() {
ueSecurityCaplen
=
2
;
ueSecurityCapEEnc
=
0
;
ueSecurityCapEInt
=
0
;
ngKsi
=
0
;
}
//------------------------------------------------------------------------------
...
...
src/itti/itti.cpp
View file @
b841938a
...
...
@@ -276,6 +276,8 @@ std::shared_ptr<itti_msg> itti_mw::receive_msg(task_id_t task_id) {
std
::
shared_ptr
<
itti_msg
>
msg
=
itti_task_ctxts
[
task_id
]
->
msg_queue
.
front
();
itti_task_ctxts
[
task_id
]
->
msg_queue
.
pop
();
// std::cout << "*************** task_id ("<< task_id << ") queue_num = " << itti_task_ctxts[task_id]->msg_queue.size()<<"***********"<<std::endl;
return
msg
;
}
}
...
...
src/nas/common/3gpp_ts24501.hpp
View file @
b841938a
...
...
@@ -135,6 +135,7 @@
#define _5GMM_CAUSE_SYNCH_FAILURE 0b00010101
#define _5GMM_CAUSE_IMPLICITLY_DE_REGISTERED 10
#define _5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED 9
#define _5GMM_CAUSE_NGKSI_ALREADY_IN_USE 71
// A.5 Causes related to invalid messages
//------------------------------------------------------------------------------
#define _5GMM_CAUSE_SEMANTICALLY_INCORRECT 95
...
...
src/nas/ies/5GSMobilityIdentity.cpp
View file @
b841938a
...
...
@@ -659,24 +659,27 @@ int _5GSMobilityIdentity::_5g_guti_decodefrombuffer(uint8_t* buf, int len) {
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Octet 0x%x"
,
octet
);
digit
[
0
]
=
octet
;
tmsi
|=
octet
;
digit
[
3
]
=
octet
;
//
tmsi |= octet;
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Octet 0x%x"
,
octet
);
digit
[
1
]
=
octet
;
tmsi
|=
octet
<<
8
;
digit
[
2
]
=
octet
;
//
tmsi |= octet << 8;
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Octet 0x%x"
,
octet
);
digit
[
2
]
=
octet
;
tmsi
|=
octet
<<
16
;
digit
[
1
]
=
octet
;
//
tmsi |= octet << 16;
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Octet 0x%x"
,
octet
);
digit
[
3
]
=
octet
;
tmsi
|=
octet
<<
24
;
_5g_guti
->
_5g_tmsi
=
tmsi
;
digit
[
0
]
=
octet
;
// tmsi |= octet << 24;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
tmsi
|=
(
digit
[
i
]
<<
(
i
*
8
));
_5g_guti
->
_5g_tmsi
=
tmsi
;
Logger
::
nas_mm
().
debug
(
"decoding 5GSMobilityIdentity 5G-GUTI"
);
return
decoded_size
;
}
...
...
src/ngap/libngap/NativeEnumerated.c
View file @
b841938a
...
...
@@ -243,7 +243,9 @@ asn_dec_rval_t NativeEnumerated_decode_aper(
}
ASN_DEBUG
(
"Decoding %s as NativeEnumerated"
,
td
->
name
);
#if TEST0515_IS_ON
printf
(
"test0515 Decoding %s as NativeEnumerated
\n
"
,
td
->
name
);
#endif
if
(
ct
->
flags
&
APC_EXTENSIBLE
)
{
int
inext
=
per_get_few_bits
(
pd
,
1
);
...
...
src/ngap/libngap/NativeInteger.c
View file @
b841938a
...
...
@@ -321,7 +321,9 @@ asn_dec_rval_t NativeInteger_decode_aper(
(
void
)
opt_codec_ctx
;
ASN_DEBUG
(
"Decoding NativeInteger %s (APER)"
,
td
->
name
);
#if TEST0515_IS_ON
printf
(
"test0515 Decoding NativeInteger %s (APER)
\n
"
,
td
->
name
);
#endif
if
(
!
native
)
{
native
=
(
long
*
)
(
*
sptr
=
CALLOC
(
1
,
sizeof
(
*
native
)));
...
...
src/ngap/libngap/constr_CHOICE.c
View file @
b841938a
...
...
@@ -1033,9 +1033,11 @@ asn_dec_rval_t CHOICE_decode_aper(
if
(
value
<
0
)
ASN__DECODE_STARVED
;
ASN_DEBUG
(
"CHOICE %s got index %d in range %d"
,
td
->
name
,
value
,
ct
->
range_bits
);
#if TEST0515_IS_ON
printf
(
"test0515 CHOICE %s got index %d in range %d
\n
"
,
td
->
name
,
value
,
ct
->
range_bits
);
#endif
if
(
value
>
ct
->
upper_bound
)
ASN__DECODE_FAILED
;
}
else
{
if
(
specs
->
ext_start
==
-
1
)
ASN__DECODE_FAILED
;
...
...
@@ -1050,7 +1052,9 @@ asn_dec_rval_t CHOICE_decode_aper(
/* Set presence to be able to free it later */
_set_present_idx
(
st
,
specs
->
pres_offset
,
specs
->
pres_size
,
value
+
1
);
#if TEST1130_IS_ON
printf
(
"test1130 decoding td->name %s set present %d
\n
"
,
td
->
name
,
value
+
1
);
#endif
elm
=
&
td
->
elements
[
value
];
if
(
elm
->
flags
&
ATF_POINTER
)
{
/* Member is a pointer to another structure */
...
...
@@ -1060,9 +1064,11 @@ asn_dec_rval_t CHOICE_decode_aper(
memb_ptr2
=
&
memb_ptr
;
}
ASN_DEBUG
(
"Discovered CHOICE %s encodes %s"
,
td
->
name
,
elm
->
name
);
#if TEST1130_IS_ON
printf
(
"test1130 decoding element(%s) in td->name(%s), pointer(%p)
\n
"
,
elm
->
name
,
td
->
name
,
memb_ptr2
);
#endif
if
(
ct
&&
ct
->
range_bits
>=
0
)
{
rv
=
elm
->
type
->
op
->
aper_decoder
(
...
...
@@ -1077,9 +1083,11 @@ asn_dec_rval_t CHOICE_decode_aper(
if
(
rv
.
code
!=
RC_OK
)
{
ASN_DEBUG
(
"Failed to decode %s in %s (CHOICE) %d"
,
elm
->
name
,
td
->
name
,
rv
.
code
);
#if TEST0515_IS_ON
printf
(
"test0515 Failed to decode %s in %s (CHOICE) %d
\n
"
,
elm
->
name
,
td
->
name
,
rv
.
code
);
#endif
}
return
rv
;
}
...
...
@@ -1169,32 +1177,42 @@ int CHOICE_print(
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
unsigned
present
;
#if TEST1130_IS_ON
if
(
!
sptr
)
printf
(
"test1130 sptr null
\n
"
);
else
printf
(
"test1130 OK
\n
"
);
#endif
if
(
!
sptr
)
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
/*
* Figure out which CHOICE element is encoded.
*/
present
=
_fetch_present_idx
(
sptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
#if TEST1130_IS_ON
printf
(
"test1130 present %d, td->elements %d
\n
"
,
present
,
td
->
elements_count
);
#endif
/*
* Print that element.
*/
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
#if TEST1130_IS_ON
printf
(
"test1130 td_name %s, element_name %s
\n
"
,
td
->
name
,
elm
->
name
);
#endif
const
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
const
void
*
const
*
)
((
const
char
*
)
sptr
+
elm
->
memb_offset
);
#if TEST1130_IS_ON
printf
(
"test1130 memb_ptr1 (%p)
\n
"
,
memb_ptr
);
#endif
if
(
!
memb_ptr
)
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
}
else
{
memb_ptr
=
(
const
void
*
)
((
const
char
*
)
sptr
+
elm
->
memb_offset
);
#if TEST1130_IS_ON
printf
(
"test1130 memb_ptr2 (%p)
\n
"
,
memb_ptr
);
#endif
}
/* Print member's name and stuff */
...
...
@@ -1207,7 +1225,9 @@ int CHOICE_print(
return
elm
->
type
->
op
->
print_struct
(
elm
->
type
,
memb_ptr
,
ilevel
,
cb
,
app_key
);
}
else
{
#if TEST1130_IS_ON
printf
(
"test1130 casued by present = %d
\n
"
,
present
);
#endif
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
}
}
...
...
src/ngap/libngap/constr_SEQUENCE.c
View file @
b841938a
...
...
@@ -932,10 +932,12 @@ int SEQUENCE_print(
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
size_t
edx
;
int
ret
;
#if TEST1130_IS_ON
if
(
!
sptr
)
printf
(
"test1130 memory not present %s
\n
"
,
td
->
name
);
else
printf
(
"test1130 memory present %s
\n
"
,
td
->
name
);
#endif
if
(
!
sptr
)
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
/* Dump preamble */
...
...
@@ -957,7 +959,9 @@ int SEQUENCE_print(
}
}
else
{
memb_ptr
=
(
const
void
*
)
((
const
char
*
)
sptr
+
elm
->
memb_offset
);
#if TEST1130_IS_ON
printf
(
"test1130 element name(%s): mem_ptr(%p)
\n
"
,
elm
->
name
,
memb_ptr
);
#endif
}
/* Indentation */
...
...
@@ -1498,7 +1502,9 @@ asn_dec_rval_t SEQUENCE_decode_aper(
}
ASN_DEBUG
(
"Decoding %s as SEQUENCE (APER)"
,
td
->
name
);
#if TEST0515_IS_ON
printf
(
"test0515 Decoding %s as SEQUENCE (APER)
\n
"
,
td
->
name
);
#endif
/* Handle extensions */
if
(
specs
->
first_extension
<
0
)
{
...
...
@@ -1532,7 +1538,9 @@ asn_dec_rval_t SEQUENCE_decode_aper(
*/
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
#if TEST1130_IS_ON
printf
(
"test1130 decoding element (%s)
\n
"
,
elm
->
name
);
#endif
void
*
memb_ptr
;
/* Pointer to the member */
void
**
memb_ptr2
;
/* Pointer to that pointer */
#if 0
...
...
@@ -1572,9 +1580,11 @@ asn_dec_rval_t SEQUENCE_decode_aper(
ASN_DEBUG
(
"Member %s->%s is optional, p=%d (%d->%d)"
,
td
->
name
,
elm
->
name
,
present
,
(
int
)
opmd
.
nboff
,
(
int
)
opmd
.
nbits
);
#if TEST0515_IS_ON
printf
(
"test0515 Member %s->%s is optional, p=%d (%d->%d)
\n
"
,
td
->
name
,
elm
->
name
,
present
,
(
int
)
opmd
.
nboff
,
(
int
)
opmd
.
nbits
);
#endif
if
(
present
==
0
)
{
/* This element is not present */
if
(
elm
->
default_value_set
)
{
...
...
@@ -1593,7 +1603,9 @@ asn_dec_rval_t SEQUENCE_decode_aper(
/* Fetch the member from the stream */
ASN_DEBUG
(
"Decoding member
\"
%s
\"
in %s"
,
elm
->
name
,
td
->
name
);
#if TEST0515_IS_ON
printf
(
"test0515 Decoding member
\"
%s
\"
in %s
\n
"
,
elm
->
name
,
td
->
name
);
#endif
if
(
elm
->
flags
&
ATF_OPEN_TYPE
)
{
rv
=
OPEN_TYPE_aper_get
(
opt_codec_ctx
,
td
,
st
,
elm
,
pd
);
...
...
src/ngap/libngap/constr_SET_OF.c
View file @
b841938a
...
...
@@ -789,10 +789,12 @@ int SET_OF_print(
const
asn_anonymous_set_
*
list
=
_A_CSET_FROM_VOID
(
sptr
);
int
ret
;
int
i
;
#if TEST1130_IS_ON
if
(
!
sptr
)
printf
(
"test1130 set_of_printf sptr null
\n
"
);
else
printf
(
"test1130 set_of_printf OK
\n
"
);
#endif
if
(
!
sptr
)
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
/* Dump preamble */
...
...
src/ngap/libngap/constr_TYPE.c
View file @
b841938a
...
...
@@ -33,6 +33,7 @@ ber_tlv_tag_t asn_TYPE_outmost_tag(
*/
int
asn_fprint
(
FILE
*
stream
,
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
struct_ptr
)
{
#if ASN_FPRINT_IS_ON
if
(
!
stream
)
stream
=
stdout
;
if
(
!
td
||
!
struct_ptr
)
{
errno
=
EINVAL
;
...
...
@@ -48,7 +49,7 @@ int asn_fprint(
if
(
_print2fp
(
"
\n
"
,
1
,
stream
))
{
return
-
1
;
}
#endif
return
fflush
(
stream
);
}
...
...
src/ngap/libngap/per_opentype.c
View file @
b841938a
...
...
@@ -79,7 +79,9 @@ static asn_dec_rval_t uper_open_type_get_simple(
ASN__STACK_OVERFLOW_CHECK
(
ctx
);
ASN_DEBUG
(
"Getting open type %s..."
,
td
->
name
);
#if TEST1130_IS_ON
printf
(
"test1130 decoding open type %s
\n
"
,
td
->
name
);
#endif
do
{
chunk_bytes
=
uper_get_length
(
pd
,
-
1
,
0
,
&
repeat
);
...
...
@@ -407,10 +409,14 @@ static asn_dec_rval_t aper_open_type_get_simple(
ASN__STACK_OVERFLOW_CHECK
(
ctx
);
ASN_DEBUG
(
"Getting open type %s..."
,
td
->
name
);
#if TEST0515_IS_ON
printf
(
"test0515 Getting open type %s...
\n
"
,
td
->
name
);
#endif
do
{
#if TEST1130_IS_ON
printf
(
"test1130 while repeat1(%d)
\n
"
,
repeat
);
#endif
chunk_bytes
=
aper_get_length
(
pd
,
-
1
,
-
1
,
&
repeat
);
if
(
chunk_bytes
<
0
)
{
FREEMEM
(
buf
);
...
...
@@ -431,14 +437,18 @@ static asn_dec_rval_t aper_open_type_get_simple(
ASN__DECODE_STARVED
;
}
bufLen
+=
chunk_bytes
;
#if TEST1130_IS_ON
printf
(
"test1130 while repeat2(%d)
\n
"
,
repeat
);
#endif
}
while
(
repeat
);
// ASN_DEBUG("Getting open type %s encoded in %ld bytes", td->name,
// (long)bufLen);
#if TEST1130_IS_ON
printf
(
"test1130 Getting open type %s encoded in %ld bytes
\n
"
,
td
->
name
,
(
long
)
bufLen
);
#endif
memset
(
&
spd
,
0
,
sizeof
(
spd
));
spd
.
buffer
=
buf
;
...
...
src/ngap/ngapIEs/PlmnId.cpp
View file @
b841938a
...
...
@@ -81,8 +81,6 @@ void PlmnId::getMnc(std::string& mnc) {
mnc
=
to_string
(
mnc_digit2
);
mnc
+=
to_string
(
mnc_digit3
);
}
//mnc = to_string(m_mnc);
cout
<<
"################ MNC "
<<
mnc
<<
endl
;
}
//------------------------------------------------------------------------------
...
...
src/oai-amf/CMakeLists.txt
View file @
b841938a
...
...
@@ -136,6 +136,9 @@ endif()
Message
(
"Architecture is
${
CMAKE_SYSTEM_PROCESSOR
}
"
)
if
(
CMAKE_SYSTEM_PROCESSOR STREQUAL
"armv7l"
)
set
(
C_FLAGS_PROCESSOR
"-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt"
)
elseif
(
CMAKE_SYSTEM_PROCESSOR STREQUAL
"aarch64"
)
#set(C_FLAGS_PROCESSOR "-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt")
set
(
C_FLAGS_PROCESSOR
"-gdwarf-2 -lgcc -lrt"
)
else
(
CMAKE_SYSTEM_PROCESSOR STREQUAL
"armv7l"
)
set
(
C_FLAGS_PROCESSOR
"-msse4.2"
)
endif
()
...
...
@@ -155,7 +158,8 @@ add_definitions(-DBSTRLIB_CAN_USE_STL=1 -DBSTRLIB_CAN_USE_IOSTREAM=1 -DBSTRLIB_T
if
(
STATIC_LINKING
)
set
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS
}
-g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer"
)
else
(
STATIC_LINKING
)
set
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS
}
-g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer"
)
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
set
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS
}
-g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer"
)
endif
(
STATIC_LINKING
)
set
(
CMAKE_C_FLAGS_RELEASE
"
${
CMAKE_C_FLAGS
}
-O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1 "
)
set
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"
${
CMAKE_C_FLAGS
}
-g -O2 -DINFO_IS_ON=1 "
)
...
...
@@ -164,7 +168,8 @@ set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -Os -s -DTRACE_IS_ON=1 -DDEBUG_IS
if
(
STATIC_LINKING
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS
}
-std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer"
)
else
(
STATIC_LINKING
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS
}
-std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer"
)
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS
}
-std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer"
)
endif
(
STATIC_LINKING
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS
}
-std=c++17 -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1"
)
set
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"
${
CMAKE_CXX_FLAGS
}
-std=c++17 -g -O2 -DINFO_IS_ON=1"
)
...
...
src/sctp/sctp_server.cpp
View file @
b841938a
...
...
@@ -48,6 +48,8 @@ extern "C" {
#include <iostream>
#include "thread_sched.hpp"
namespace
sctp
{
//------------------------------------------------------------------------------
...
...
@@ -91,10 +93,13 @@ void sctp_server::start_receive(sctp_application* app) {
pthread_create
(
&
thread_
,
NULL
,
sctp_receiver_thread
,
(
void
*
)
this
);
}
//------------------------------------------------------------------------------
void
*
sctp_server
::
sctp_receiver_thread
(
void
*
arg
)
{
sctp_server
*
ptr
=
(
sctp_server
*
)
arg
;
Logger
::
sctp
().
info
(
"Create pthread to receive sctp message"
);
set_cpu
(
5
);
int
fdmax
;
int
clientsock
;
fd_set
master
;
...
...
src/utils/thread_sched.cpp
View file @
b841938a
...
...
@@ -24,7 +24,7 @@
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#include <iostream>
#include "thread_sched.hpp"
//------------------------------------------------------------------------------
...
...
@@ -48,3 +48,24 @@ void util::thread_sched_params::apply(
"Could not set schedparam to ITTI task %d, err=%d"
,
task_id
,
rc
);
}
}
//------------------------------------------------------------------------------
int
set_cpu
(
int
cpu_num
)
{
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
CPU_SET
(
cpu_num
,
&
cpuset
);
// int rc =pthread_setaffinity_np(threads[i].native_handle(),sizeof(cpu_set_t), &cpuset);
int
rc
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
if
(
rc
!=
0
)
{
std
::
cerr
<<
"Error calling pthread_setaffinity_np: "
<<
rc
<<
"
\n
"
;
}
return
rc
;
}
\ No newline at end of file
src/utils/thread_sched.hpp
View file @
b841938a
...
...
@@ -44,4 +44,7 @@ class thread_sched_params {
};
}
// namespace util
int
set_cpu
(
int
cpu_num
);
#endif
/* FILE_THREAD_SCHED_HPP_SEEN */
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