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
624cdca0
Commit
624cdca0
authored
Aug 18, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish log
parent
0905be13
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
226 additions
and
243 deletions
+226
-243
src/amf-app/amf_config.cpp
src/amf-app/amf_config.cpp
+2
-2
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+6
-6
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+5
-5
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+12
-12
src/amf-app/amf_statistics.cpp
src/amf-app/amf_statistics.cpp
+7
-4
src/common/logger.cpp
src/common/logger.cpp
+0
-3
src/common/logger.hpp
src/common/logger.hpp
+0
-12
src/nas/ies/5GSMobilityIdentity.cpp
src/nas/ies/5GSMobilityIdentity.cpp
+1
-1
src/nas/ies/ABBA.cpp
src/nas/ies/ABBA.cpp
+6
-6
src/nas/ies/Authentication_Parameter_AUTN.cpp
src/nas/ies/Authentication_Parameter_AUTN.cpp
+5
-5
src/nas/ies/Authentication_Parameter_RAND.cpp
src/nas/ies/Authentication_Parameter_RAND.cpp
+5
-5
src/nas/ies/S_NSSAI.cpp
src/nas/ies/S_NSSAI.cpp
+18
-18
src/nas/msgs/AuthenticationFailure.cpp
src/nas/msgs/AuthenticationFailure.cpp
+10
-11
src/nas/msgs/AuthenticationReject.cpp
src/nas/msgs/AuthenticationReject.cpp
+9
-10
src/nas/msgs/AuthenticationResponse.cpp
src/nas/msgs/AuthenticationResponse.cpp
+12
-13
src/nas/msgs/AuthenticationResult.cpp
src/nas/msgs/AuthenticationResult.cpp
+11
-12
src/nas/msgs/DLNASTransport.cpp
src/nas/msgs/DLNASTransport.cpp
+20
-21
src/nas/msgs/RegistrationComplete.cpp
src/nas/msgs/RegistrationComplete.cpp
+9
-9
src/nas/msgs/RegistrationReject.cpp
src/nas/msgs/RegistrationReject.cpp
+18
-18
src/nas/msgs/SecurityModeCommand.cpp
src/nas/msgs/SecurityModeCommand.cpp
+27
-27
src/nas/msgs/SecurityModeComplete.cpp
src/nas/msgs/SecurityModeComplete.cpp
+14
-14
src/nas/msgs/ServiceRequest.cpp
src/nas/msgs/ServiceRequest.cpp
+20
-20
src/sbi/amf_server/api/N1N2MessageCollectionDocumentApi.cpp
src/sbi/amf_server/api/N1N2MessageCollectionDocumentApi.cpp
+1
-1
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
.../amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
+8
-8
No files found.
src/amf-app/amf_config.cpp
View file @
624cdca0
...
...
@@ -240,7 +240,7 @@ int amf_config::load(const std::string &config_file) {
//------------------------------------------------------------------------------
void
amf_config
::
display
()
{
Logger
::
config
().
info
(
"=======
AMF
======="
);
Logger
::
config
().
info
(
"=======
=============== AMF ==============
======="
);
Logger
::
config
().
info
(
"Configuration AMF:"
);
Logger
::
config
().
info
(
"- Instance ...........................................: %d"
,
instance
);
Logger
::
config
().
info
(
"- PID dir ............................................: %s"
,
pid_dir
.
c_str
());
...
...
@@ -268,7 +268,7 @@ void amf_config::display() {
Logger
::
config
().
info
(
"- MYSQL db ...........................................: %s"
,
auth_para
.
mysql_db
.
c_str
());
Logger
::
config
().
info
(
"- operator key .......................................: %s"
,
auth_para
.
operator_key
.
c_str
());
Logger
::
config
().
info
(
"- random .............................................: %s"
,
auth_para
.
random
.
c_str
());
Logger
::
config
().
info
(
"- Remote SMF Pool..................: "
);
Logger
::
config
().
info
(
"- Remote SMF Pool..................
...................
: "
);
for
(
int
i
=
0
;
i
<
smf_pool
.
size
();
i
++
)
{
std
::
string
selected
;
if
(
smf_pool
[
i
].
selected
)
...
...
src/amf-app/amf_n1.cpp
View file @
624cdca0
...
...
@@ -74,19 +74,19 @@ void amf_n1_task(void*) {
auto
*
msg
=
shared_msg
.
get
();
switch
(
msg
->
msg_type
)
{
case
UL_NAS_DATA_IND
:
{
//receive nas message buffer from amf_n2
Logger
::
task_
amf_n1
().
info
(
"Received UL_NAS_DATA_IND"
);
Logger
::
amf_n1
().
info
(
"Received UL_NAS_DATA_IND"
);
itti_uplink_nas_data_ind
*
m
=
dynamic_cast
<
itti_uplink_nas_data_ind
*>
(
msg
);
amf_n1_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
DOWNLINK_NAS_TRANSFER
:
{
Logger
::
task_
amf_n1
().
info
(
"Received DOWNLINK_NAS_TRANSFER"
);
Logger
::
amf_n1
().
info
(
"Received DOWNLINK_NAS_TRANSFER"
);
itti_downlink_nas_transfer
*
m
=
dynamic_cast
<
itti_downlink_nas_transfer
*>
(
msg
);
amf_n1_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
default:
Logger
::
task_
amf_n1
().
error
(
"no handler for msg type %d"
,
msg
->
msg_type
);
Logger
::
amf_n1
().
error
(
"no handler for msg type %d"
,
msg
->
msg_type
);
}
}
while
(
true
);
}
...
...
@@ -97,8 +97,8 @@ amf_n1::amf_n1() {
Logger
::
amf_n1
().
error
(
"Cannot create task TASK_AMF_N1"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_AMF_N1"
);
}
Logger
::
task_
amf_n1
().
startup
(
"Started"
);
Logger
::
task_
amf_n1
().
debug
(
"construct amf_n1 successfully"
);
Logger
::
amf_n1
().
startup
(
"Started"
);
Logger
::
amf_n1
().
debug
(
"construct amf_n1 successfully"
);
}
amf_n1
::~
amf_n1
()
{
}
...
...
@@ -963,7 +963,7 @@ void amf_n1::annex_a_4_33501(uint8_t ck[16], uint8_t ik[16], uint8_t *input, uin
oldS
[
24
+
i
]
=
input
[
i
];
oldS
[
32
]
=
0x00
;
oldS
[
33
]
=
0x08
;
print_buffer
(
"amf_n1"
,
"
i
nput string: "
,
S
,
31
+
netName
.
size
);
print_buffer
(
"amf_n1"
,
"
I
nput string: "
,
S
,
31
+
netName
.
size
);
uint8_t
key
[
32
];
memcpy
(
&
key
[
0
],
ck
,
16
);
memcpy
(
&
key
[
16
],
ik
,
16
);
//KEY
...
...
src/amf-app/amf_n11.cpp
View file @
624cdca0
...
...
@@ -99,19 +99,19 @@ void amf_n11_task(void*) {
auto
*
msg
=
shared_msg
.
get
();
switch
(
msg
->
msg_type
)
{
case
SMF_SERVICES_CONSUMER
:
{
Logger
::
task_amf_n1
1
().
info
(
"Running SMF_SERVICES_CONSUMER"
);
Logger
::
amf_n
1
().
info
(
"Running SMF_SERVICES_CONSUMER"
);
itti_smf_services_consumer
*
m
=
dynamic_cast
<
itti_smf_services_consumer
*>
(
msg
);
amf_n11_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
NSMF_PDU_SESS_UPDATE_SMCTX
:
{
Logger
::
task_amf_n1
1
().
info
(
"Receive NSMF_PDU_SESS_UPDATE_SMCTX, handling ..."
);
Logger
::
amf_n
1
().
info
(
"Receive NSMF_PDU_SESS_UPDATE_SMCTX, handling ..."
);
itti_nsmf_pdusession_update_sm_context
*
m
=
dynamic_cast
<
itti_nsmf_pdusession_update_sm_context
*>
(
msg
);
amf_n11_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
PDU_SESS_RES_SET_RESP
:
{
Logger
::
task_amf_n1
1
().
info
(
"Receive PDU_SESS_RES_SET_RESP, handling ..."
);
Logger
::
amf_n
1
().
info
(
"Receive PDU_SESS_RES_SET_RESP, handling ..."
);
itti_pdu_session_resource_setup_response
*
m
=
dynamic_cast
<
itti_pdu_session_resource_setup_response
*>
(
msg
);
amf_n11_inst
->
handle_itti_message
(
ref
(
*
m
));
}
...
...
@@ -126,8 +126,8 @@ amf_n11::amf_n11() {
Logger
::
amf_n11
().
error
(
"Cannot create task TASK_AMF_N1"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_AMF_N1"
);
}
Logger
::
task_amf_n1
1
().
startup
(
"Started"
);
Logger
::
task_amf_n1
1
().
debug
(
"Construct amf_n1 successfully"
);
Logger
::
amf_n
1
().
startup
(
"Started"
);
Logger
::
amf_n
1
().
debug
(
"Construct amf_n1 successfully"
);
}
//------------------------------------------------------------------------------
...
...
src/amf-app/amf_n2.cpp
View file @
624cdca0
...
...
@@ -66,61 +66,61 @@ void amf_n2_task(void *args_p) {
auto
*
msg
=
shared_msg
.
get
();
switch
(
msg
->
msg_type
)
{
case
NEW_SCTP_ASSOCIATION
:
{
Logger
::
task_
amf_n2
().
info
(
"Received NEW_SCTP_ASSOCIATION"
);
Logger
::
amf_n2
().
info
(
"Received NEW_SCTP_ASSOCIATION"
);
itti_new_sctp_association
*
m
=
dynamic_cast
<
itti_new_sctp_association
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
NG_SETUP_REQ
:
{
Logger
::
task_
amf_n2
().
info
(
"Received NGSetupRequest message, handling"
);
Logger
::
amf_n2
().
info
(
"Received NGSetupRequest message, handling"
);
itti_ng_setup_request
*
m
=
dynamic_cast
<
itti_ng_setup_request
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
INITIAL_UE_MSG
:
{
Logger
::
task_
amf_n2
().
info
(
"Received INITIAL_UE_MESSAGE message, handling"
);
Logger
::
amf_n2
().
info
(
"Received INITIAL_UE_MESSAGE message, handling"
);
itti_initial_ue_message
*
m
=
dynamic_cast
<
itti_initial_ue_message
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
ITTI_UL_NAS_TRANSPORT
:
{
Logger
::
task_
amf_n2
().
info
(
"Received UPLINK_NAS_TRANSPORT message, handling"
);
Logger
::
amf_n2
().
info
(
"Received UPLINK_NAS_TRANSPORT message, handling"
);
itti_ul_nas_transport
*
m
=
dynamic_cast
<
itti_ul_nas_transport
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
ITTI_DL_NAS_TRANSPORT
:
{
Logger
::
task_
amf_n2
().
info
(
"Encoding DOWNLINK NAS TRANSPORT message, sending "
);
Logger
::
amf_n2
().
info
(
"Encoding DOWNLINK NAS TRANSPORT message, sending "
);
itti_dl_nas_transport
*
m
=
dynamic_cast
<
itti_dl_nas_transport
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
PDU_SESSION_RESOURCE_SETUP_REQUEST
:
{
Logger
::
task_
amf_n2
().
info
(
"Encoding PDU SESSION RESOURCE SETUP REQUEST message, sending "
);
Logger
::
amf_n2
().
info
(
"Encoding PDU SESSION RESOURCE SETUP REQUEST message, sending "
);
itti_pdu_session_resource_setup_request
*
m
=
dynamic_cast
<
itti_pdu_session_resource_setup_request
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
INITIAL_CONTEXT_SETUP_REQUEST
:
{
Logger
::
task_
amf_n2
().
info
(
"Encoding INITIAL CONTEXT SETUP REQUEST message, sending "
);
Logger
::
amf_n2
().
info
(
"Encoding INITIAL CONTEXT SETUP REQUEST message, sending "
);
itti_initial_context_setup_request
*
m
=
dynamic_cast
<
itti_initial_context_setup_request
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
UE_CONTEXT_RELEASE_REQUEST
:
{
Logger
::
task_
amf_n2
().
info
(
"Received UE_CONTEXT_RELEASE_REQUEST message, handling"
);
Logger
::
amf_n2
().
info
(
"Received UE_CONTEXT_RELEASE_REQUEST message, handling"
);
itti_ue_context_release_request
*
m
=
dynamic_cast
<
itti_ue_context_release_request
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
UE_RADIO_CAP_IND
:
{
Logger
::
task_
amf_n2
().
info
(
"Received UE_RADIO_CAP_IND message, handling"
);
Logger
::
amf_n2
().
info
(
"Received UE_RADIO_CAP_IND message, handling"
);
itti_ue_radio_capability_indication
*
m
=
dynamic_cast
<
itti_ue_radio_capability_indication
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
default:
Logger
::
task_
amf_n2
().
info
(
"No handler for msg type %d"
,
msg
->
msg_type
);
Logger
::
amf_n2
().
info
(
"No handler for msg type %d"
,
msg
->
msg_type
);
}
}
while
(
true
);
}
...
...
@@ -133,8 +133,8 @@ amf_n2::amf_n2(const std::string &address, const uint16_t port_num)
Logger
::
amf_n2
().
error
(
"Cannot create task TASK_AMF_N2"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_AMF_N2"
);
}
Logger
::
task_
amf_n2
().
startup
(
"Started"
);
Logger
::
task_
amf_n2
().
debug
(
"Construct amf_n2 successfully"
);
Logger
::
amf_n2
().
startup
(
"Started"
);
Logger
::
amf_n2
().
debug
(
"Construct amf_n2 successfully"
);
}
//------------------------------------------------------------------------------
...
...
src/amf-app/amf_statistics.cpp
View file @
624cdca0
...
...
@@ -41,13 +41,16 @@ void statistics::display() {
Logger
::
amf_app
().
info
(
"|-----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------gNBs' information--------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"| Index | Status | Global ID | gNB Name | Tracking Area (PLMN, TAC)| "
);
if
(
gnbs
.
size
()
==
0
)
{
Logger
::
amf_app
().
info
(
"| - | - | - | - | - | "
);
}
//TODO: Show the list of common PLMNs
for
(
int
i
=
0
;
i
<
gnbs
.
size
();
i
++
)
{
Logger
::
amf_app
().
info
(
"|
%d | Connected | 0x%x | %s | %s,
%d | "
,
i
+
1
,
gnbs
[
i
].
gnb_id
,
gnbs
[
i
].
gnb_name
.
c_str
(),
(
gnbs
[
i
].
mcc
+
gnbs
[
i
].
mnc
).
c_str
(),
gnbs
[
i
].
tac
);
Logger
::
amf_app
().
info
(
"|
%d | Connected | 0x%x | %s |%s,
%d | "
,
i
+
1
,
gnbs
[
i
].
gnb_id
,
gnbs
[
i
].
gnb_name
.
c_str
(),
(
gnbs
[
i
].
mcc
+
gnbs
[
i
].
mnc
).
c_str
(),
gnbs
[
i
].
tac
);
//Logger::amf_app().info("[index %d][connected][GlobalID: 0x%x][gnb name: %s][Tracking Area: plmn(%s), tac(%d)]", i + 1, gnbs[i].gnb_id, gnbs[i].gnb_name.c_str(), (gnbs[i].mcc + gnbs[i].mnc).c_str(), gnbs[i].tac);
}
Logger
::
amf_app
().
info
(
"
-----------------------------------------------------------------------------------------------------------------
"
);
Logger
::
amf_app
().
info
(
"
|-----------------------------------------------------------------------------------------------------------------|
"
);
Logger
::
amf_app
().
info
(
""
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
...
...
@@ -55,13 +58,13 @@ void statistics::display() {
Logger
::
amf_app
().
info
(
"| Index | Connection state | Registration state | IMSI | GUTI | RAN UE NGAP ID | AMF UE ID |"
);
for
(
int
i
=
0
;
i
<
ues
.
size
();
i
++
)
{
//Logger::amf_app().info("[index %d][%s][%s][imsi %s][guti %s]", i + 1, ues[i].connStatus.c_str(), ues[i].registerStatus.c_str(), ues[i].imsi.c_str(), ues[i].guti.c_str());
Logger
::
amf_app
().
info
(
"| %d
| %s | %s | %s | %s | %d | %d
| "
,
i
+
1
,
ues
[
i
].
connStatus
.
c_str
(),
ues
[
i
].
registerStatus
.
c_str
(),
ues
[
i
].
imsi
.
c_str
(),
ues
[
i
].
guti
.
c_str
(),
ues
[
i
].
ranid
,
ues
[
i
].
amfid
);
Logger
::
amf_app
().
info
(
"| %d
| %s | %s | %s | %s | %d | %d
| "
,
i
+
1
,
ues
[
i
].
connStatus
.
c_str
(),
ues
[
i
].
registerStatus
.
c_str
(),
ues
[
i
].
imsi
.
c_str
(),
ues
[
i
].
guti
.
c_str
(),
ues
[
i
].
ranid
,
ues
[
i
].
amfid
);
//Logger::amf_app().info("Current ran_ue_ngap_id[%d]; Current amf_ue_ngap_id[%d]", ues[i].ranid, ues[i].amfid);
Logger
::
amf_app
().
info
(
"Location[NrCgi][PLMN(%s), cellID(%d)]"
,
(
ues
[
i
].
mcc
+
ues
[
i
].
mnc
).
c_str
(),
ues
[
i
].
cellId
);
Logger
::
amf_app
().
info
(
""
);
}
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------
----
|"
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
""
);
}
...
...
src/common/logger.cpp
View file @
624cdca0
...
...
@@ -71,11 +71,8 @@ void Logger::_init(const char *app, const bool log_stdout, const bool log_rot_fi
m_ngap
=
new
_Logger
(
"ngap"
,
m_sinks
,
ss
.
str
().
c_str
());
m_itti
=
new
_Logger
(
"itti"
,
m_sinks
,
ss
.
str
().
c_str
());
m_amf_n2
=
new
_Logger
(
"amf_n2"
,
m_sinks
,
ss
.
str
().
c_str
());
m_task_amf_n2
=
new
_Logger
(
"TASK_AMF_N2"
,
m_sinks
,
ss
.
str
().
c_str
());
m_amf_n1
=
new
_Logger
(
"amf_n1"
,
m_sinks
,
ss
.
str
().
c_str
());
m_task_amf_n1
=
new
_Logger
(
"TASK_AMF_N1"
,
m_sinks
,
ss
.
str
().
c_str
());
m_amf_n11
=
new
_Logger
(
"amf_n11"
,
m_sinks
,
ss
.
str
().
c_str
());
m_task_amf_n11
=
new
_Logger
(
"TASK_AMF_N11"
,
m_sinks
,
ss
.
str
().
c_str
());
m_amf_server
=
new
_Logger
(
"amf_server"
,
m_sinks
,
ss
.
str
().
c_str
());
}
...
...
src/common/logger.hpp
View file @
624cdca0
...
...
@@ -118,21 +118,12 @@ class Logger {
static
_Logger
&
amf_n2
()
{
return
*
singleton
().
m_amf_n2
;
}
static
_Logger
&
task_amf_n2
()
{
return
*
singleton
().
m_task_amf_n2
;
}
static
_Logger
&
amf_n1
()
{
return
*
singleton
().
m_amf_n1
;
}
static
_Logger
&
task_amf_n1
()
{
return
*
singleton
().
m_task_amf_n1
;
}
static
_Logger
&
amf_n11
()
{
return
*
singleton
().
m_amf_n11
;
}
static
_Logger
&
task_amf_n11
()
{
return
*
singleton
().
m_task_amf_n11
;
}
static
_Logger
&
amf_server
()
{
return
*
singleton
().
m_amf_server
;
}
...
...
@@ -165,11 +156,8 @@ class Logger {
_Logger
*
m_ngap
;
_Logger
*
m_itti
;
_Logger
*
m_amf_n2
;
_Logger
*
m_task_amf_n2
;
_Logger
*
m_amf_n1
;
_Logger
*
m_task_amf_n1
;
_Logger
*
m_amf_n11
;
_Logger
*
m_task_amf_n11
;
_Logger
*
m_amf_server
;
};
...
...
src/nas/ies/5GSMobilityIdentity.cpp
View file @
624cdca0
...
...
@@ -282,7 +282,7 @@ int _5GSMobilityIdentity::_5g_guti_encode2buffer(uint8_t *buf, int len) {
Logger
::
nas_mm
().
debug
(
"Error: len is less than %d"
,
length
);
int
encoded_size
=
0
;
if
(
iei
)
{
Logger
::
nas_mm
().
debug
(
"
W
ncoding 5GSMobilityIdentity type 0x%x"
,
typeOfIdentity
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding 5GSMobilityIdentity type 0x%x"
,
typeOfIdentity
);
*
(
buf
)
=
iei
;
encoded_size
++
;
encoded_size
+=
2
;
...
...
src/nas/ies/ABBA.cpp
View file @
624cdca0
...
...
@@ -53,14 +53,14 @@ ABBA::~ABBA() {
//------------------------------------------------------------------------------
uint8_t
ABBA
::
getValue
()
{
for
(
int
j
=
0
;
j
<
_length
;
j
++
)
{
Logger
::
nas_mm
().
debug
(
"
decoded ABBA value
(0x%2x)"
,
_value
[
j
]);
Logger
::
nas_mm
().
debug
(
"
Decoded ABBA value
(0x%2x)"
,
_value
[
j
]);
}
return
1
;
}
//------------------------------------------------------------------------------
int
ABBA
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
encoding ABBA iei
(0x%x)"
,
_iei
);
Logger
::
nas_mm
().
debug
(
"
Encoding ABBA IEI
(0x%x)"
,
_iei
);
if
(
len
<
_length
)
{
Logger
::
nas_mm
().
error
(
"len is less than %d"
,
_length
);
return
0
;
...
...
@@ -90,13 +90,13 @@ int ABBA::encode2buffer(uint8_t *buf, int len) {
i
++
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded ABBA len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded ABBA len
(%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
ABBA
::
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"
decoding ABBA iei
(0x%x)"
,
*
buf
);
Logger
::
nas_mm
().
debug
(
"
Encoding ABBA IEI
(0x%x)"
,
*
buf
);
int
decoded_size
=
0
;
if
(
is_option
)
{
decoded_size
++
;
...
...
@@ -114,9 +114,9 @@ int ABBA::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
i
++
;
}
for
(
int
j
=
0
;
j
<
_length
;
j
++
)
{
Logger
::
nas_mm
().
debug
(
"
decoded ABBA value(0x%4x),length
(0x%4x)"
,
_value
[
j
],
_length
);
Logger
::
nas_mm
().
debug
(
"
Decoded ABBA value (0x%4x), length
(0x%4x)"
,
_value
[
j
],
_length
);
}
Logger
::
nas_mm
().
debug
(
"
decoded ABBA len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded ABBA len
(%d)"
,
decoded_size
);
return
decoded_size
;
}
src/nas/ies/Authentication_Parameter_AUTN.cpp
View file @
624cdca0
...
...
@@ -61,7 +61,7 @@ uint8_t* Authentication_Parameter_AUTN::getValue() {
//------------------------------------------------------------------------------
int
Authentication_Parameter_AUTN
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
encoding Authentication_Parameter_AUTN iei
(0x%x)"
,
_iei
);
Logger
::
nas_mm
().
debug
(
"
Encoding Authentication_Parameter_AUTN IEI
(0x%x)"
,
_iei
);
if
(
len
<
18
)
{
Logger
::
nas_mm
().
error
(
"len is less than 18"
);
return
0
;
...
...
@@ -81,13 +81,13 @@ int Authentication_Parameter_AUTN::encode2buffer(uint8_t *buf, int len) {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger
::
nas_mm
().
debug
(
"
encoded Authentication_Parameter_AUTN len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded Authentication_Parameter_AUTN len
(%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
Authentication_Parameter_AUTN
::
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"
decoding Authentication_Parameter_AUTN iei
(0x%x)"
,
*
buf
);
Logger
::
nas_mm
().
debug
(
"
Decoding Authentication_Parameter_AUTN IEI
(0x%x)"
,
*
buf
);
int
decoded_size
=
0
;
if
(
is_option
)
{
decoded_size
++
;
...
...
@@ -98,9 +98,9 @@ int Authentication_Parameter_AUTN::decodefrombuffer(uint8_t *buf, int len, bool
decoded_size
++
;
}
for
(
int
j
=
0
;
j
<
16
;
j
++
)
{
Logger
::
nas_mm
().
debug
(
"
decoded Authentication_Parameter_AUTN value
(0x%2x)"
,
_value
[
j
]);
Logger
::
nas_mm
().
debug
(
"
Decoded Authentication_Parameter_AUTN value
(0x%2x)"
,
_value
[
j
]);
}
Logger
::
nas_mm
().
debug
(
"
decoded Authentication_Parameter_AUTN len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded Authentication_Parameter_AUTN len
(%d)"
,
decoded_size
);
return
decoded_size
;
}
src/nas/ies/Authentication_Parameter_RAND.cpp
View file @
624cdca0
...
...
@@ -58,7 +58,7 @@ uint8_t* Authentication_Parameter_RAND::getValue() {
//------------------------------------------------------------------------------
int
Authentication_Parameter_RAND
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
encoding Authentication_Parameter_RAND iei
(0x%x)"
,
_iei
);
Logger
::
nas_mm
().
debug
(
"
Encoding Authentication_Parameter_RAND IEI
(0x%x)"
,
_iei
);
if
(
len
<
17
)
{
Logger
::
nas_mm
().
error
(
"len is less than 17"
);
return
0
;
...
...
@@ -78,13 +78,13 @@ int Authentication_Parameter_RAND::encode2buffer(uint8_t *buf, int len) {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger
::
nas_mm
().
debug
(
"
encoded Authentication_Parameter_RAND len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded Authentication_Parameter_RAND len
(%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
Authentication_Parameter_RAND
::
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"
decoding Authentication_Parameter_RAND iei
(0x%x)"
,
*
buf
);
Logger
::
nas_mm
().
debug
(
"
Decoding Authentication_Parameter_RAND IEI
(0x%x)"
,
*
buf
);
int
decoded_size
=
0
;
if
(
is_option
)
{
decoded_size
++
;
...
...
@@ -94,9 +94,9 @@ int Authentication_Parameter_RAND::decodefrombuffer(uint8_t *buf, int len, bool
decoded_size
++
;
}
for
(
int
j
=
0
;
j
<
16
;
j
++
)
{
Logger
::
nas_mm
().
debug
(
"
decoded Authentication_Parameter_RAND value
(0x%2x)"
,
_value
[
j
]);
Logger
::
nas_mm
().
debug
(
"
Decoded Authentication_Parameter_RAND value
(0x%2x)"
,
_value
[
j
]);
}
Logger
::
nas_mm
().
debug
(
"
decoded Authentication_Parameter_RAND len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded Authentication_Parameter_RAND len
(%d)"
,
decoded_size
);
return
decoded_size
;
}
src/nas/ies/S_NSSAI.cpp
View file @
624cdca0
...
...
@@ -72,7 +72,7 @@ void S_NSSAI::getValue(SNSSAI_s &snssai) {
//------------------------------------------------------------------------------
int
S_NSSAI
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
encoding S_NSSAI iei
(0x%x)"
,
_iei
);
Logger
::
nas_mm
().
debug
(
"
Encoding S_NSSAI IEI
(0x%x)"
,
_iei
);
if
(
len
<
length
)
{
Logger
::
nas_mm
().
error
(
"len is less than %d"
,
length
);
return
0
;
...
...
@@ -109,13 +109,13 @@ int S_NSSAI::encode2buffer(uint8_t *buf, int len) {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger
::
nas_mm
().
debug
(
"encoded S_NSSAI len(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"encoded S_NSSAI len
(%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
S_NSSAI
::
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"decoding S_NSSAI
iei
(0x%x)"
,
*
buf
);
Logger
::
nas_mm
().
debug
(
"decoding S_NSSAI
IEI
(0x%x)"
,
*
buf
);
int
decoded_size
=
0
;
SNSSAI_s
a
=
{
0
,
0
,
0
,
0
};
if
(
is_option
)
{
...
...
@@ -126,7 +126,7 @@ int S_NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
switch
(
*
(
buf
+
decoded_size
-
1
))
{
case
1
:
{
a
.
sst
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//无 sd
decoded_size
++
;
a
.
sd
=
-
1
;
a
.
mHplmnSst
=
-
1
;
a
.
mHplmnSd
=
-
1
;
...
...
@@ -136,13 +136,13 @@ int S_NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
a
.
sst
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
sd
<<
8
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
sd
<<
8
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
mHplmnSst
=
-
1
;
a
.
mHplmnSd
=
-
1
;
}
...
...
@@ -151,13 +151,13 @@ int S_NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
a
.
sst
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
sd
<<
8
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
sd
<<
8
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
mHplmnSst
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
a
.
mHplmnSd
=
-
1
;
...
...
@@ -167,29 +167,29 @@ int S_NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
a
.
sst
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
sd
<<
8
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
sd
<<
8
;
a
.
sd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
mHplmnSst
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
a
.
mHplmnSd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
mHplmnSd
<<
16
;
a
.
mHplmnSd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
a
.
mHplmnSd
<<
8
;
a
.
mHplmnSd
|=
*
(
buf
+
decoded_size
);
decoded_size
++
;
//有 sd
decoded_size
++
;
}
break
;
}
SNSSAI
=
a
;
Logger
::
nas_mm
().
debug
(
"
decoded S_NSSAI SST(0x%x) SD(0x%x) hplmnSST(0x%x) hplmnSD
(0x%x)"
,
a
.
sst
,
a
.
sd
,
a
.
mHplmnSst
,
a
.
mHplmnSd
);
Logger
::
nas_mm
().
debug
(
"
decoded S_NSSAI len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded S_NSSAI SST (0x%x) SD (0x%x) hplmnSST (0x%x) hplmnSD
(0x%x)"
,
a
.
sst
,
a
.
sd
,
a
.
mHplmnSst
,
a
.
mHplmnSd
);
Logger
::
nas_mm
().
debug
(
"
Decoded S_NSSAI len
(%d)"
,
decoded_size
);
return
decoded_size
;
}
src/nas/msgs/AuthenticationFailure.cpp
View file @
624cdca0
...
...
@@ -34,7 +34,6 @@ using namespace nas;
//------------------------------------------------------------------------------
AuthenticationFailure
::
AuthenticationFailure
()
{
Logger
::
nas_mm
().
debug
(
"initiating class AuthenticationFailure"
);
plain_header
=
NULL
;
ie_5gmm_cause
=
NULL
;
ie_authentication_failure_parameter
=
NULL
;
...
...
@@ -79,7 +78,7 @@ bool AuthenticationFailure::getAutsInAuthFailPara(bstring &auts) {
//------------------------------------------------------------------------------
int
AuthenticationFailure
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding AuthenticationFailure message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding AuthenticationFailure message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -94,7 +93,7 @@ int AuthenticationFailure::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_5gmm_cause
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_5gmm_cause
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_5gmm_cause
error"
);
}
}
if
(
!
ie_authentication_failure_parameter
)
{
...
...
@@ -103,38 +102,38 @@ int AuthenticationFailure::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_authentication_failure_parameter
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_authentication_failure_parameter
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_authentication_failure_parameter
error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded AuthenticationFailure message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded AuthenticationFailure message len
(%d)"
,
encoded_size
);
return
1
;
}
//------------------------------------------------------------------------------
int
AuthenticationFailure
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding AuthenticationFailure message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding AuthenticationFailure message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
ie_5gmm_cause
=
new
_5GMM_Cause
();
decoded_size
+=
ie_5gmm_cause
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
Logger
::
nas_mm
().
debug
(
"
decoded_size
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded_size
(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
case
0x30
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x30)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x30)"
);
ie_authentication_failure_parameter
=
new
Authentication_Failure_Parameter
();
decoded_size
+=
ie_authentication_failure_parameter
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded AuthenticationFailure message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded AuthenticationFailure message len
(%d)"
,
decoded_size
);
}
src/nas/msgs/AuthenticationReject.cpp
View file @
624cdca0
...
...
@@ -34,7 +34,6 @@ using namespace nas;
//------------------------------------------------------------------------------
AuthenticationReject
::
AuthenticationReject
()
{
Logger
::
nas_mm
().
debug
(
"initiating class AuthenticationReject"
);
plain_header
=
NULL
;
ie_eap_message
=
NULL
;
}
...
...
@@ -56,7 +55,7 @@ void AuthenticationReject::setEAP_Message(bstring eap) {
//------------------------------------------------------------------------------
int
AuthenticationReject
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding AuthenticationReject message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding AuthenticationReject message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -71,35 +70,35 @@ int AuthenticationReject::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_eap_message
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_eap_message
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_eap_message
error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded AuthenticationReject message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded AuthenticationReject message len
(%d)"
,
encoded_size
);
return
1
;
}
//------------------------------------------------------------------------------
int
AuthenticationReject
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding AuthenticationReject message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding AuthenticationReject message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
Logger
::
nas_mm
().
debug
(
"
decoded_size
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded_size
(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
case
0x78
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x78)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x78)"
);
ie_eap_message
=
new
EAP_Message
();
decoded_size
+=
ie_eap_message
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded AuthenticationReject message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded AuthenticationReject message len
(%d)"
,
decoded_size
);
}
src/nas/msgs/AuthenticationResponse.cpp
View file @
624cdca0
...
...
@@ -34,7 +34,6 @@ using namespace nas;
//------------------------------------------------------------------------------
AuthenticationResponse
::
AuthenticationResponse
()
{
Logger
::
nas_mm
().
debug
(
"initiating class AuthenticationResponse"
);
plain_header
=
NULL
;
ie_authentication_response_parameter
=
NULL
;
ie_eap_message
=
NULL
;
...
...
@@ -82,7 +81,7 @@ bool AuthenticationResponse::getEapMessage(bstring &eap) {
//------------------------------------------------------------------------------
int
AuthenticationResponse
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding AuthenticationResponse message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding AuthenticationResponse message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -97,7 +96,7 @@ int AuthenticationResponse::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_authentication_response_parameter
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_authentication_response_parameter
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_authentication_response_parameter
error"
);
return
0
;
}
}
...
...
@@ -107,43 +106,43 @@ int AuthenticationResponse::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_eap_message
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_eap_message
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_eap_message
error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded AuthenticationResponse message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded AuthenticationResponse message len
(%d)"
,
encoded_size
);
return
1
;
}
//------------------------------------------------------------------------------
int
AuthenticationResponse
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding AuthenticationResponse message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding AuthenticationResponse message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
Logger
::
nas_mm
().
debug
(
"
decoded_size
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded_size
(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
case
0x2D
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x2D)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x2D)"
);
ie_authentication_response_parameter
=
new
Authentication_Response_Parameter
();
decoded_size
+=
ie_authentication_response_parameter
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x78
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x78)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x78)"
);
ie_eap_message
=
new
EAP_Message
();
decoded_size
+=
ie_eap_message
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded AuthenticationResponse message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded AuthenticationResponse message len
(%d)"
,
decoded_size
);
}
src/nas/msgs/AuthenticationResult.cpp
View file @
624cdca0
...
...
@@ -34,7 +34,6 @@ using namespace nas;
//------------------------------------------------------------------------------
AuthenticationResult
::
AuthenticationResult
()
{
Logger
::
nas_mm
().
debug
(
"initiating class AuthenticationResult"
);
plain_header
=
NULL
;
ie_ngKSI
=
NULL
;
ie_abba
=
NULL
;
...
...
@@ -68,7 +67,7 @@ void AuthenticationResult::setEAP_Message(bstring eap) {
//------------------------------------------------------------------------------
int
AuthenticationResult
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding AuthenticationResult message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding AuthenticationResult message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -83,7 +82,7 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_ngKSI
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_ngKSI
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_ngKSI
error"
);
return
0
;
}
}
...
...
@@ -93,7 +92,7 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_eap_message
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_eap_message
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_eap_message
error"
);
return
0
;
}
}
...
...
@@ -103,17 +102,17 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_abba
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"encoding ie_abba
error"
);
Logger
::
nas_mm
().
error
(
"encoding ie_abba error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded AuthenticationResult message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded AuthenticationResult message len
(%d)"
,
encoded_size
);
return
1
;
}
//------------------------------------------------------------------------------
int
AuthenticationResult
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding AuthenticationResult message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding AuthenticationResult message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
ie_ngKSI
=
new
NasKeySetIdentifier
();
...
...
@@ -121,22 +120,22 @@ int AuthenticationResult::decodefrombuffer(NasMmPlainHeader *header, uint8_t *bu
decoded_size
++
;
ie_eap_message
=
new
EAP_Message
();
decoded_size
+=
ie_eap_message
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
Logger
::
nas_mm
().
debug
(
"
decoded_size
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded_size
(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
case
0x38
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x38)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x38)"
);
ie_abba
=
new
ABBA
();
decoded_size
+=
ie_abba
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded AuthenticationResult message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded AuthenticationResult message len
(%d)"
,
decoded_size
);
}
src/nas/msgs/DLNASTransport.cpp
View file @
624cdca0
...
...
@@ -35,7 +35,6 @@ using namespace nas;
//------------------------------------------------------------------------------
DLNASTransport
::
DLNASTransport
()
{
Logger
::
nas_mm
().
debug
(
"initiating class DLNASTransport"
);
plain_header
=
NULL
;
ie_payload_container_type
=
NULL
;
ie_payload_container
=
NULL
;
...
...
@@ -93,7 +92,7 @@ void DLNASTransport::setBack_off_timer_value(uint8_t unit, uint8_t value) {
//------------------------------------------------------------------------------
int
DLNASTransport
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding DLNASTransport message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding DLNASTransport message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -108,7 +107,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_payload_container_type
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_payload_container_type
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_payload_container_type
error"
);
return
0
;
}
}
...
...
@@ -118,7 +117,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_payload_container
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_payload_container
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_payload_container
error"
);
return
0
;
}
}
...
...
@@ -128,7 +127,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_pdu_session_identity_2
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie ie_pdu_session_identity_2
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding IE ie_pdu_session_identity_2
error"
);
return
0
;
}
...
...
@@ -139,7 +138,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_additional_information
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie ie_additional_information
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding IE ie_additional_information
error"
);
return
0
;
}
...
...
@@ -150,7 +149,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_5gmm_cause
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_5gmm_cause
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_5gmm_cause
error"
);
}
}
if
(
!
ie_back_off_timer_value
)
{
...
...
@@ -159,63 +158,63 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_back_off_timer_value
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_back_off_timer_value
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_back_off_timer_value
error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded DLNASTransport message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded DLNASTransport message len
(%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
DLNASTransport
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding DLNASTransport message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding DLNASTransport message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
ie_payload_container_type
=
new
Payload_Container_Type
();
decoded_size
+=
ie_payload_container_type
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
ie_payload_container
=
new
Payload_Container
();
decoded_size
+=
ie_payload_container
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
Logger
::
nas_mm
().
debug
(
"
decoded_size
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded_size
(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
case
0x12
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x12)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x12)"
);
ie_pdu_session_identity_2
=
new
PDU_Session_Identity_2
();
decoded_size
+=
ie_pdu_session_identity_2
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x24
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x24)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x24)"
);
ie_additional_information
=
new
Additional_Information
();
decoded_size
+=
ie_additional_information
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x58
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x58)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x58)"
);
ie_5gmm_cause
=
new
_5GMM_Cause
();
decoded_size
+=
ie_5gmm_cause
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x37
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x37)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x37)"
);
ie_back_off_timer_value
=
new
GPRS_Timer_3
();
decoded_size
+=
ie_back_off_timer_value
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded DLNASTransport message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded DLNASTransport message len
(%d)"
,
decoded_size
);
}
src/nas/msgs/RegistrationComplete.cpp
View file @
624cdca0
...
...
@@ -56,7 +56,7 @@ void RegistrationComplete::setSOR_Transparent_Container(uint8_t header, uint8_t
//------------------------------------------------------------------------------
int
RegistrationComplete
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding RegistrationComplete message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding RegistrationComplete message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -71,35 +71,35 @@ int RegistrationComplete::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_sor_transparent_container
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_sor_transparent_container
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_sor_transparent_container
error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded RegistrationComplete message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded RegistrationComplete message len
(%d)"
,
encoded_size
);
return
1
;
}
//------------------------------------------------------------------------------
int
RegistrationComplete
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding RegistrationComplete message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding RegistrationComplete message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
Logger
::
nas_mm
().
debug
(
"
decoded_size
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded_size
(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
case
0x73
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x73)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x73)"
);
ie_sor_transparent_container
=
new
SOR_Transparent_Container
();
decoded_size
+=
ie_sor_transparent_container
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded RegistrationComplete message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded RegistrationComplete message len
(%d)"
,
decoded_size
);
}
src/nas/msgs/RegistrationReject.cpp
View file @
624cdca0
...
...
@@ -80,7 +80,7 @@ void RegistrationReject::setRejected_NSSAI(uint8_t cause, uint8_t value) {
//------------------------------------------------------------------------------
int
RegistrationReject
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding RegistrationReject message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding RegistrationReject message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -95,7 +95,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_5gmm_cause
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_5gmm_cause
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_5gmm_cause
error"
);
}
}
if
(
!
ie_T3346_value
)
{
...
...
@@ -104,7 +104,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_T3346_value
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_T3346_value
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_T3346_value
error"
);
return
0
;
}
}
...
...
@@ -114,7 +114,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_T3502_value
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_T3502_value
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_T3502_value
error"
);
return
0
;
}
}
...
...
@@ -124,7 +124,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_eap_message
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_eap_message
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_eap_message
error"
);
return
0
;
}
}
...
...
@@ -134,55 +134,55 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_rejected_nssai
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_rejected_nssai
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_rejected_nssai
error"
);
}
}
Logger
::
nas_mm
().
debug
(
"
encoded RegistrationReject message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded RegistrationReject message len
(%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
RegistrationReject
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding RegistrationReject message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding RegistrationReject message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
ie_5gmm_cause
=
new
_5GMM_Cause
();
decoded_size
+=
ie_5gmm_cause
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
Logger
::
nas_mm
().
debug
(
"
decoded_size
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded_size
(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
case
0x5F
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x5F)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x5F)"
);
ie_T3346_value
=
new
GPRS_Timer_2
();
decoded_size
+=
ie_T3346_value
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x16
:
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding iei(0x16)"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding iei(0x16)"
);
ie_T3502_value
=
new
GPRS_Timer_2
();
decoded_size
+=
ie_T3502_value
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x78
:
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding iei(0x78)"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding iei(0x78)"
);
ie_eap_message
=
new
EAP_Message
();
decoded_size
+=
ie_eap_message
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x69
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x69)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x69)"
);
ie_rejected_nssai
=
new
Rejected_NSSAI
();
decoded_size
+=
ie_rejected_nssai
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
...
...
src/nas/msgs/SecurityModeCommand.cpp
View file @
624cdca0
...
...
@@ -103,7 +103,7 @@ void SecurityModeCommand::setS1_UE_Security_Capability(uint8_t g_EEASel, uint8_t
//------------------------------------------------------------------------------
int
SecurityModeCommand
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding SecurityModeCommand message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding SecurityModeCommand message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -118,7 +118,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_selected_nas_security_algorithms
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_selected_nas_security_algorithms
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_selected_nas_security_algorithms
error"
);
return
0
;
}
}
...
...
@@ -128,7 +128,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_ngKSI
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_ngKSI
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_ngKSI
error"
);
return
0
;
}
}
...
...
@@ -138,7 +138,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_ue_security_capability
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_ue_security_capability
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_ue_security_capability
error"
);
return
0
;
}
}
...
...
@@ -148,7 +148,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_imeisv_request
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_imeisv_request
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_imeisv_request
error"
);
return
0
;
}
}
...
...
@@ -158,7 +158,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_eps_nas_security_algorithms
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_eps_nas_security_algorithms
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_eps_nas_security_algorithms
error"
);
return
0
;
}
}
...
...
@@ -168,7 +168,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_additional_5G_security_information
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_additional_5G_security_information
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_additional_5G_security_information
error"
);
return
0
;
}
}
...
...
@@ -178,7 +178,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_eap_message
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"encoding ie_eap_message
error"
);
Logger
::
nas_mm
().
error
(
"encoding ie_eap_message error"
);
return
0
;
}
}
...
...
@@ -188,7 +188,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_abba
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_abba
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_abba
error"
);
return
0
;
}
}
...
...
@@ -198,17 +198,17 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_s1_ue_security_capability
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"encoding ie_s1_ue_security_capability
error"
);
Logger
::
nas_mm
().
error
(
"encoding ie_s1_ue_security_capability error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded SecurityModeCommand message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded SecurityModeCommand message len
(%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
SecurityModeCommand
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding SecurityModeCommand message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding SecurityModeCommand message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
ie_selected_nas_security_algorithms
=
new
NAS_Security_Algorithms
();
...
...
@@ -217,64 +217,64 @@ int SecurityModeCommand::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
decoded_size
+=
ie_ngKSI
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
false
);
ie_ue_security_capability
=
new
UESecurityCapability
();
decoded_size
+=
ie_ue_security_capability
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
Logger
::
nas_mm
().
debug
(
"
decoded_size
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded_size
(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
((
octet
&
0xf0
)
>>
4
)
{
case
0xE
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0xE)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0xE)"
);
ie_imeisv_request
=
new
IMEISV_Request
();
decoded_size
+=
ie_imeisv_request
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
switch
(
octet
)
{
case
0x57
:
{
Logger
::
nas_mm
().
debug
(
"decoding
iei
(0x57)"
);
Logger
::
nas_mm
().
debug
(
"decoding
IEI
(0x57)"
);
ie_eps_nas_security_algorithms
=
new
EPS_NAS_Security_Algorithms
();
decoded_size
+=
ie_eps_nas_security_algorithms
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x36
:
{
Logger
::
nas_mm
().
debug
(
"decoding
iei
(0x36)"
);
Logger
::
nas_mm
().
debug
(
"decoding
IEI
(0x36)"
);
ie_additional_5G_security_information
=
new
Additional_5G_Security_Information
();
decoded_size
+=
ie_additional_5G_security_information
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x78
:
{
Logger
::
nas_mm
().
debug
(
"decoding
iei
(0x78)"
);
Logger
::
nas_mm
().
debug
(
"decoding
IEI
(0x78)"
);
ie_eap_message
=
new
EAP_Message
();
decoded_size
+=
ie_eap_message
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x38
:
{
Logger
::
nas_mm
().
debug
(
"decoding
iei
(0x38)"
);
Logger
::
nas_mm
().
debug
(
"decoding
IEI
(0x38)"
);
ie_abba
=
new
ABBA
();
decoded_size
+=
ie_abba
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x19
:
{
Logger
::
nas_mm
().
debug
(
"decoding
iei
(0x19)"
);
Logger
::
nas_mm
().
debug
(
"decoding
IEI
(0x19)"
);
ie_s1_ue_security_capability
=
new
S1_UE_Security_Capability
();
decoded_size
+=
ie_s1_ue_security_capability
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded SecurityModeCommand message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded SecurityModeCommand message len
(%d)"
,
decoded_size
);
}
src/nas/msgs/SecurityModeComplete.cpp
View file @
624cdca0
...
...
@@ -103,7 +103,7 @@ bool SecurityModeComplete::getNON_IMEISV(IMEISV_t &imeisv) {
//------------------------------------------------------------------------------
int
SecurityModeComplete
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding SecurityModeComplete message"
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding SecurityModeComplete message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -118,7 +118,7 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_imeisv
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie ie_imeisv
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding IE ie_imeisv
error"
);
return
0
;
}
...
...
@@ -129,7 +129,7 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_nas_message_container
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_nas_message_container
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_nas_message_container
error"
);
return
0
;
}
}
...
...
@@ -139,52 +139,52 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) {
if
(
int
size
=
ie_non_imeisvpei
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie ie_non_imeisvpei
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding IE ie_non_imeisvpei
error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
encoded SecurityModeComplete message len
(%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
Encoded SecurityModeComplete message len
(%d)"
,
encoded_size
);
return
1
;
}
//------------------------------------------------------------------------------
int
SecurityModeComplete
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding SecurityModeComplete message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding SecurityModeComplete message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
Logger
::
nas_mm
().
debug
(
"decoded_size(%d)"
,
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first option iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First option IEI
(0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
switch
(
octet
)
{
case
0x77
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x77)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x77)"
);
ie_imeisv
=
new
_5GSMobilityIdentity
();
decoded_size
+=
ie_imeisv
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x71
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x71)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x71)"
);
ie_nas_message_container
=
new
NAS_Message_Container
();
decoded_size
+=
ie_nas_message_container
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x78
:
{
Logger
::
nas_mm
().
debug
(
"
decoding iei
(0x78)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding IEI
(0x78)"
);
ie_non_imeisvpei
=
new
_5GSMobilityIdentity
();
decoded_size
+=
ie_non_imeisvpei
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded SecurityModeComplete message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded SecurityModeComplete message len
(%d)"
,
decoded_size
);
}
src/nas/msgs/ServiceRequest.cpp
View file @
624cdca0
...
...
@@ -83,7 +83,7 @@ void ServiceRequest::setNAS_Message_Container(bstring value) {
//------------------------------------------------------------------------------
int
ServiceRequest
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
e
ncoding ServiceRequest message..."
);
Logger
::
nas_mm
().
debug
(
"
E
ncoding ServiceRequest message..."
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
...
...
@@ -108,18 +108,18 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
if
(
ie_service_type
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
)
!=
-
1
)
{
encoded_size
++
;
}
else
{
Logger
::
nas_mm
().
error
(
"
e
ncoding ie_service_type error"
);
Logger
::
nas_mm
().
error
(
"
E
ncoding ie_service_type error"
);
return
0
;
}
}
else
{
Logger
::
nas_mm
().
error
(
"
e
ncoding ie_ngKSI error"
);
Logger
::
nas_mm
().
error
(
"
E
ncoding ie_ngKSI error"
);
return
0
;
}
int
size
=
ie_5g_s_tmsi
->
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
0
)
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie ie_5g_s_tmsi
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding IE ie_5g_s_tmsi
error"
);
return
0
;
}
if
(
!
ie_uplink_data_status
)
{
...
...
@@ -129,7 +129,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
if
(
size
!=
0
)
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_uplink_data_status
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_uplink_data_status
error"
);
return
0
;
}
}
...
...
@@ -140,7 +140,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
if
(
size
!=
0
)
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_PDU_session_status
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_PDU_session_status
error"
);
return
0
;
}
}
...
...
@@ -151,7 +151,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
if
(
size
!=
0
)
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_allowed_PDU_session_status
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_allowed_PDU_session_status
error"
);
return
0
;
}
}
...
...
@@ -162,17 +162,17 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
if
(
size
!=
0
)
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"
encoding ie_nas_message_container
error"
);
Logger
::
nas_mm
().
error
(
"
Encoding ie_nas_message_container
error"
);
return
0
;
}
}
Logger
::
nas_mm
().
debug
(
"
e
ncoded ServiceRequest message (%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"
E
ncoded ServiceRequest message (%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
ServiceRequest
::
decodefrombuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
d
ecoding ServiceRequest message"
);
Logger
::
nas_mm
().
debug
(
"
D
ecoding ServiceRequest message"
);
int
decoded_size
=
3
;
plain_header
=
header
;
ie_ngKSI
=
new
NasKeySetIdentifier
();
...
...
@@ -183,44 +183,44 @@ int ServiceRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf, int
ie_5g_s_tmsi
=
new
_5GSMobilityIdentity
();
decoded_size
+=
ie_5g_s_tmsi
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
first optional ie
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
First optional IE
(0x%x)"
,
octet
);
while
(
!
octet
)
{
switch
(
octet
)
{
case
0x40
:
{
Logger
::
nas_mm
().
debug
(
"
decoding ie_uplink_data_status(iei
: 0x40)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding ie_uplink_data_status (IEI
: 0x40)"
);
ie_uplink_data_status
=
new
UplinkDataStatus
();
decoded_size
+=
ie_uplink_data_status
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x50
:
{
Logger
::
nas_mm
().
debug
(
"
decoding ie_PDU_session_status(iei
: 0x50)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding ie_PDU_session_status (IEI
: 0x50)"
);
ie_PDU_session_status
=
new
PDU_Session_Status
();
decoded_size
+=
ie_PDU_session_status
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x25
:
{
Logger
::
nas_mm
().
debug
(
"
decoding ie_allowed_PDU_session_status(iei
: 0x25)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding ie_allowed_PDU_session_status (IEI
: 0x25)"
);
ie_allowed_PDU_session_status
=
new
Allowed_PDU_Session_Status
();
decoded_size
+=
ie_allowed_PDU_session_status
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
case
0x71
:
{
Logger
::
nas_mm
().
debug
(
"
decoding ie_nas_message_container(iei
: 0x71)"
);
Logger
::
nas_mm
().
debug
(
"
Decoding ie_nas_message_container(IEI
: 0x71)"
);
ie_nas_message_container
=
new
NAS_Message_Container
();
decoded_size
+=
ie_nas_message_container
->
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
next iei
(0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"
Next IEI
(0x%x)"
,
octet
);
}
break
;
}
}
Logger
::
nas_mm
().
debug
(
"
decoded ServiceRequest message len
(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"
Decoded ServiceRequest message len
(%d)"
,
decoded_size
);
}
//------------------------------------------------------------------------------
...
...
src/sbi/amf_server/api/N1N2MessageCollectionDocumentApi.cpp
View file @
624cdca0
...
...
@@ -42,7 +42,7 @@ void N1N2MessageCollectionDocumentApi::setupRoutes() {
void
N1N2MessageCollectionDocumentApi
::
n1_n2_message_transfer_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
// Getting the path params
auto
ueContextId
=
request
.
param
(
":ueContextId"
).
as
<
std
::
string
>
();
Logger
::
amf_server
().
debug
(
"Received a N1N2MessageTrasfer request with ue_ctx_id
(%s) "
,
ueContextId
.
c_str
());
Logger
::
amf_server
().
debug
(
"Received a N1N2MessageTrasfer request with ue_ctx_id
%s "
,
ueContextId
.
c_str
());
// Getting the body param
//simple parser
...
...
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
View file @
624cdca0
...
...
@@ -35,30 +35,30 @@ N1N2MessageCollectionDocumentApiImpl::N1N2MessageCollectionDocumentApiImpl(std::
{
}
void
N1N2MessageCollectionDocumentApiImpl
::
n1_n2_message_transfer
(
const
std
::
string
&
ueContextId
,
const
N1N2MessageTransferReqData
&
n1N2MessageTransferReqData
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
amf_server
().
debug
(
"
response OK"
);
Logger
::
amf_server
().
debug
(
"
Response OK"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer API has not been implemented yet!
\n
"
);
}
void
N1N2MessageCollectionDocumentApiImpl
::
n1_n2_message_transfer
(
const
std
::
string
&
ueContextId
,
const
N1N2MessageTransferReqData
&
n1N2MessageTransferReqData
,
std
::
string
&
n1sm_str
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
amf_server
().
debug
(
"
r
eceive N1N2MessageTransfer Request, handling..."
);
Logger
::
amf_server
().
debug
(
"
R
eceive N1N2MessageTransfer Request, handling..."
);
bstring
n1sm
;
msg_str_2_msg_hex
(
n1sm_str
,
n1sm
);
print_buffer
(
"amf_server"
,
"
r
eceived N1 SM"
,
(
uint8_t
*
)
bdata
(
n1sm
),
blength
(
n1sm
));
print_buffer
(
"amf_server"
,
"
R
eceived N1 SM"
,
(
uint8_t
*
)
bdata
(
n1sm
),
blength
(
n1sm
));
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer API has not been implemented yet!
\n
"
);
}
void
N1N2MessageCollectionDocumentApiImpl
::
n1_n2_message_transfer
(
const
std
::
string
&
ueContextId
,
const
N1N2MessageTransferReqData
&
n1N2MessageTransferReqData
,
std
::
string
&
n1sm_str
,
std
::
string
&
n2sm_str
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
amf_server
().
debug
(
"
r
eceive N1N2MessageTransfer Request, handling..."
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"
Do some magic
\n
"
);
Logger
::
amf_server
().
debug
(
"
R
eceive N1N2MessageTransfer Request, handling..."
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"
OK
"
);
std
::
string
supi
=
ueContextId
;
Logger
::
amf_server
().
debug
(
"Key for
pdu session context: supi
(%s)"
,
supi
.
c_str
());
Logger
::
amf_server
().
debug
(
"Key for
PDU Session context: supi
(%s)"
,
supi
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
;
if
(
amf_n11_inst
->
is_supi_to_pdu_ctx
(
supi
)){
psc
=
amf_n11_inst
->
supi_to_pdu_ctx
(
supi
);
}
else
{
Logger
::
amf_server
().
error
(
"Cannot get pdu_session_context with supi(%s)"
,
supi
.
c_str
());
Logger
::
amf_server
().
error
(
"Cannot get pdu_session_context with supi
(%s)"
,
supi
.
c_str
());
}
bstring
n1sm
;
...
...
@@ -68,7 +68,7 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(const std::str
msg_str_2_msg_hex
(
n2sm_str
,
n2sm
);
psc
.
get
()
->
n2sm
=
n2sm
;
Logger
::
amf_server
().
debug
(
"n2sm size in amf_server(%d)"
,
blength
(
psc
.
get
()
->
n2sm
));
Logger
::
amf_server
().
debug
(
"n2sm size in amf_server
(%d)"
,
blength
(
psc
.
get
()
->
n2sm
));
itti_n1n2_message_transfer_request
*
itti_msg
=
new
itti_n1n2_message_transfer_request
(
AMF_SERVER
,
TASK_AMF_APP
);
itti_msg
->
supi
=
ueContextId
;
...
...
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