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
7571e854
Commit
7571e854
authored
Aug 05, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version from Bupt
parent
9b4a6072
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
863 additions
and
16 deletions
+863
-16
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+184
-0
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+6
-0
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+57
-1
src/amf-app/amf_n2.hpp
src/amf-app/amf_n2.hpp
+1
-0
src/contexts/ue_ngap_context.hpp
src/contexts/ue_ngap_context.hpp
+6
-0
src/itti/itti_msg.hpp
src/itti/itti_msg.hpp
+1
-0
src/itti/msgs/itti_msg_n2.hpp
src/itti/msgs/itti_msg_n2.hpp
+11
-0
src/ngap/libngap/NativeEnumerated.c
src/ngap/libngap/NativeEnumerated.c
+0
-1
src/ngap/libngap/NativeInteger.c
src/ngap/libngap/NativeInteger.c
+0
-1
src/ngap/libngap/constr_CHOICE.c
src/ngap/libngap/constr_CHOICE.c
+0
-5
src/ngap/libngap/constr_SEQUENCE.c
src/ngap/libngap/constr_SEQUENCE.c
+0
-5
src/ngap/libngap/per_opentype.c
src/ngap/libngap/per_opentype.c
+0
-3
src/ngap/ngapIEs/FiveGSTmsi.cpp
src/ngap/ngapIEs/FiveGSTmsi.cpp
+31
-0
src/ngap/ngapIEs/FiveGSTmsi.hpp
src/ngap/ngapIEs/FiveGSTmsi.hpp
+4
-0
src/ngap/ngapIEs/TAIListforPaging.cpp
src/ngap/ngapIEs/TAIListforPaging.cpp
+80
-0
src/ngap/ngapIEs/TAIListforPaging.hpp
src/ngap/ngapIEs/TAIListforPaging.hpp
+50
-0
src/ngap/ngapIEs/UEPagingIdentity.cpp
src/ngap/ngapIEs/UEPagingIdentity.cpp
+67
-0
src/ngap/ngapIEs/UEPagingIdentity.hpp
src/ngap/ngapIEs/UEPagingIdentity.hpp
+52
-0
src/ngap/ngapMsgs/InitialUEMessage.cpp
src/ngap/ngapMsgs/InitialUEMessage.cpp
+10
-0
src/ngap/ngapMsgs/InitialUEMessage.hpp
src/ngap/ngapMsgs/InitialUEMessage.hpp
+2
-0
src/ngap/ngapMsgs/Paging.cpp
src/ngap/ngapMsgs/Paging.cpp
+234
-0
src/ngap/ngapMsgs/Paging.hpp
src/ngap/ngapMsgs/Paging.hpp
+67
-0
No files found.
src/amf-app/amf_n1.cpp
View file @
7571e854
...
...
@@ -1071,6 +1071,13 @@ void amf_n1::registration_request_handle(
case
PERIODIC_REGISTRATION_UPDATING
:
{
Logger
::
amf_n1
().
error
(
"Network does not support periodic registration, reject ..."
);
/* Logger::amf_n1().debug("Network handling periodic registration
..."); if(is_messagecontainer)
run_periodic_registration_update_procedure(nc, nas_msg);
else
run_periodic_registration_update_procedure(nc,
pdu_session_status);
*/
}
break
;
case
EMERGENCY_REGISTRATION
:
{
...
...
@@ -2777,6 +2784,183 @@ void amf_n1::run_mobility_registration_update_procedure(
}
}
//------------------------------------------------------------------------------
void
amf_n1
::
run_periodic_registration_update_procedure
(
std
::
shared_ptr
<
nas_context
>
nc
,
uint16_t
pdu_session_status
)
{
// encoding REGISTRATION ACCEPT
RegistrationAccept
*
regAccept
=
new
RegistrationAccept
();
regAccept
->
setHeader
(
PLAIN_5GS_MSG
);
regAccept
->
set_5GS_Registration_Result
(
false
,
false
,
false
,
0x01
);
regAccept
->
set5G_GUTI
(
amf_cfg
.
guami
.
mcc
,
amf_cfg
.
guami
.
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
0x264a34c0
);
regAccept
->
setT3512_Value
(
0x5
,
0x1e
);
std
::
vector
<
p_tai_t
>
tai_list
;
p_tai_t
item0
;
item0
.
type
=
0x00
;
nas_plmn_t
plmn
;
plmn
.
mcc
=
amf_cfg
.
plmn_list
[
0
].
mcc
;
plmn
.
mnc
=
amf_cfg
.
plmn_list
[
0
].
mnc
;
item0
.
plmn_list
.
push_back
(
plmn
);
item0
.
tac_list
.
push_back
(
amf_cfg
.
plmn_list
[
0
].
tac
);
tai_list
.
push_back
(
item0
);
regAccept
->
setTaiList
(
tai_list
);
//
// std::vector<struct SNSSAI_s> nssai;
// SNSSAI_t snssai;
// snssai.sst = 0;
// snssai.sd = -1;
// snssai.mHplmnSst = -1;
// snssai.mHplmnSd = -1;
// nssai.push_back(snssai);
// regAccept->setALLOWED_NSSAI(nssai);
if
(
pdu_session_status
==
0x0000
)
{
regAccept
->
setPDU_session_status
(
0x0000
);
}
else
{
regAccept
->
setPDU_session_status
(
pdu_session_status
);
Logger
::
amf_n1
().
debug
(
"setting pdu session status 0x%02x"
,
htonl
(
pdu_session_status
));
// serApt->setPDU_session_status(0x2000);
}
regAccept
->
set_5GS_Network_Feature_Support
(
0x01
,
0x00
);
uint8_t
buffer
[
1024
]
=
{
0
};
int
encoded_size
=
regAccept
->
encode2buffer
(
buffer
,
1024
);
print_buffer
(
"amf_n1"
,
"Registration-Accept Message Buffer"
,
buffer
,
encoded_size
);
if
(
!
encoded_size
)
{
Logger
::
nas_mm
().
error
(
"Encode Registration-Accept message error"
);
return
;
}
else
{
delete
regAccept
;
}
nas_secu_ctx
*
secu
=
nc
.
get
()
->
security_ctx
;
// protect nas message
bstring
protectedNas
;
encode_nas_message_protected
(
secu
,
false
,
INTEGRITY_PROTECTED_AND_CIPHERED
,
NAS_MESSAGE_DOWNLINK
,
buffer
,
encoded_size
,
protectedNas
);
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
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_n1().error("Cannot get pdu_session_context with SUPI (%s)",
supi.c_str());
}
*/
itti_dl_nas_transport
*
itti_msg
=
new
itti_dl_nas_transport
(
TASK_AMF_N1
,
TASK_AMF_N2
);
itti_msg
->
ran_ue_ngap_id
=
nc
.
get
()
->
ran_ue_ngap_id
;
itti_msg
->
amf_ue_ngap_id
=
nc
.
get
()
->
amf_ue_ngap_id
;
itti_msg
->
nas
=
protectedNas
;
std
::
shared_ptr
<
itti_dl_nas_transport
>
i
=
std
::
shared_ptr
<
itti_dl_nas_transport
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
Logger
::
amf_n1
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N2"
,
i
->
get_msg_name
());
}
}
//------------------------------------------------------------------------------
void
amf_n1
::
run_periodic_registration_update_procedure
(
std
::
shared_ptr
<
nas_context
>
nc
,
bstring
&
nas_msg
)
{
// decoding REGISTRATION request
RegistrationRequest
*
regReq
=
new
RegistrationRequest
();
regReq
->
decodefrombuffer
(
nullptr
,
(
uint8_t
*
)
bdata
(
nas_msg
),
blength
(
nas_msg
));
bdestroy
(
nas_msg
);
// free buffer
// encoding REGISTRATION ACCEPT
RegistrationAccept
*
regAccept
=
new
RegistrationAccept
();
regAccept
->
setHeader
(
PLAIN_5GS_MSG
);
regAccept
->
set_5GS_Registration_Result
(
false
,
false
,
false
,
0x01
);
regAccept
->
set5G_GUTI
(
amf_cfg
.
guami
.
mcc
,
amf_cfg
.
guami
.
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
0x264a34c0
);
regAccept
->
setT3512_Value
(
0x5
,
0x1e
);
std
::
vector
<
p_tai_t
>
tai_list
;
p_tai_t
item0
;
item0
.
type
=
0x00
;
nas_plmn_t
plmn
;
plmn
.
mcc
=
amf_cfg
.
plmn_list
[
0
].
mcc
;
plmn
.
mnc
=
amf_cfg
.
plmn_list
[
0
].
mnc
;
item0
.
plmn_list
.
push_back
(
plmn
);
item0
.
tac_list
.
push_back
(
amf_cfg
.
plmn_list
[
0
].
tac
);
tai_list
.
push_back
(
item0
);
regAccept
->
setTaiList
(
tai_list
);
//
// std::vector<struct SNSSAI_s> nssai;
// SNSSAI_t snssai;
// snssai.sst = 0;
// snssai.sd = -1;
// snssai.mHplmnSst = -1;
// snssai.mHplmnSd = -1;
// nssai.push_back(snssai);
// regAccept->setALLOWED_NSSAI(nssai);
uint16_t
pdu_session_status
=
0xffff
;
pdu_session_status
=
regReq
->
getPduSessionStatus
();
if
(
pdu_session_status
==
0x0000
)
{
regAccept
->
setPDU_session_status
(
0x0000
);
}
else
{
regAccept
->
setPDU_session_status
(
pdu_session_status
);
Logger
::
amf_n1
().
debug
(
"setting pdu session status 0x%02x"
,
htonl
(
pdu_session_status
));
// serApt->setPDU_session_status(0x2000);
}
delete
regReq
;
regAccept
->
set_5GS_Network_Feature_Support
(
0x01
,
0x00
);
uint8_t
buffer
[
1024
]
=
{
0
};
int
encoded_size
=
regAccept
->
encode2buffer
(
buffer
,
1024
);
print_buffer
(
"amf_n1"
,
"Registration-Accept Message Buffer"
,
buffer
,
encoded_size
);
if
(
!
encoded_size
)
{
Logger
::
nas_mm
().
error
(
"Encode Registration-Accept message error"
);
return
;
}
else
{
delete
regAccept
;
}
nas_secu_ctx
*
secu
=
nc
.
get
()
->
security_ctx
;
// protect nas message
bstring
protectedNas
;
encode_nas_message_protected
(
secu
,
false
,
INTEGRITY_PROTECTED_AND_CIPHERED
,
NAS_MESSAGE_DOWNLINK
,
buffer
,
encoded_size
,
protectedNas
);
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
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_n1().error("Cannot get pdu_session_context with SUPI (%s)",
supi.c_str());
}
*/
itti_dl_nas_transport
*
itti_msg
=
new
itti_dl_nas_transport
(
TASK_AMF_N1
,
TASK_AMF_N2
);
itti_msg
->
ran_ue_ngap_id
=
nc
.
get
()
->
ran_ue_ngap_id
;
itti_msg
->
amf_ue_ngap_id
=
nc
.
get
()
->
amf_ue_ngap_id
;
itti_msg
->
nas
=
protectedNas
;
std
::
shared_ptr
<
itti_dl_nas_transport
>
i
=
std
::
shared_ptr
<
itti_dl_nas_transport
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
Logger
::
amf_n1
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N2"
,
i
->
get_msg_name
());
}
}
//------------------------------------------------------------------------------
void
amf_n1
::
set_5gmm_state
(
std
::
shared_ptr
<
nas_context
>
nc
,
_5gmm_state_t
state
)
{
...
...
src/amf-app/amf_n1.hpp
View file @
7571e854
...
...
@@ -105,6 +105,12 @@ class amf_n1 {
void
run_mobility_registration_update_procedure
(
std
::
shared_ptr
<
nas_context
>
nc
,
uint16_t
uplink_data_status
,
uint16_t
pdu_session_status
);
void
run_periodic_registration_update_procedure
(
std
::
shared_ptr
<
nas_context
>
nc
,
uint16_t
);
void
run_periodic_registration_update_procedure
(
std
::
shared_ptr
<
nas_context
>
nc
,
bstring
&
nas_msg
);
// authentication
bool
auth_vectors_generator
(
std
::
shared_ptr
<
nas_context
>&
nc
);
...
...
src/amf-app/amf_n2.cpp
View file @
7571e854
...
...
@@ -42,6 +42,7 @@
#include "PduSessionResourceSetupRequest.hpp"
#include "UEContextReleaseCommand.hpp"
#include "HandoverPreparationFailure.hpp"
#include "Paging.hpp"
#include "amf_app.hpp"
#include "amf_config.hpp"
#include "amf_n1.hpp"
...
...
@@ -198,6 +199,11 @@ void amf_n2_task(void* args_p) {
dynamic_cast
<
itti_uplink_ran_status_transfer
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
PAGING
:
{
Logger
::
amf_n2
().
info
(
"Received Paging message,handling"
);
itti_paging
*
m
=
dynamic_cast
<
itti_paging
*>
(
msg
);
amf_n2_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
default:
Logger
::
amf_n2
().
info
(
"No handler for msg type %d"
,
msg
->
msg_type
);
}
...
...
@@ -217,7 +223,57 @@ amf_n2::amf_n2(const std::string& address, const uint16_t port_num)
//------------------------------------------------------------------------------
amf_n2
::~
amf_n2
()
{}
// NGAP Messages Handlers
//------------------------------------------------------------------------------
void
amf_n2
::
handle_itti_message
(
itti_paging
&
itti_msg
)
{
Logger
::
amf_n2
().
debug
(
"Handling Paging message..."
);
std
::
shared_ptr
<
ue_ngap_context
>
unc
=
{};
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
itti_msg
.
ran_ue_ngap_id
))
{
Logger
::
amf_n2
().
error
(
"No UE NGAP context with ran_ue_ngap_id (%d)"
,
itti_msg
.
ran_ue_ngap_id
);
return
;
}
unc
=
ran_ue_id_2_ue_ngap_context
(
itti_msg
.
ran_ue_ngap_id
);
if
(
unc
.
get
()
->
amf_ue_ngap_id
!=
itti_msg
.
amf_ue_ngap_id
)
{
Logger
::
amf_n2
().
error
(
"The requested UE (amf_ue_ngap_id: 0x%x) is not valid, existed UE "
"which's amf_ue_ngap_id (0x%x)"
,
itti_msg
.
amf_ue_ngap_id
,
unc
.
get
()
->
amf_ue_ngap_id
);
}
if
(
unc
.
get
()
->
ng_ue_state
!=
NGAP_UE_CONNECTED
)
{
Logger
::
amf_n2
().
error
(
"Received NGAP UPLINK_NAS_TRANSPORT while UE in state != "
"NGAP_UE_CONNECTED"
);
// return;
}
PagingMsg
paging_msg
=
{};
paging_msg
.
setMessageType
();
Logger
::
amf_n2
().
warn
(
" unc.get()->s_setid (%d)"
,
unc
.
get
()
->
s_setid
);
Logger
::
amf_n2
().
warn
(
" unc.get()->s_pointer (%d)"
,
unc
.
get
()
->
s_pointer
);
Logger
::
amf_n2
().
warn
(
" unc.get()->s_tmsi (%d)"
,
unc
.
get
()
->
s_tmsi
);
paging_msg
.
setUEPagingIdentity
(
unc
.
get
()
->
s_setid
,
unc
.
get
()
->
s_pointer
,
unc
.
get
()
->
s_tmsi
);
Logger
::
amf_n2
().
warn
(
"=========================================="
);
std
::
vector
<
struct
Tai_s
>
list
;
Tai_t
tai_test
;
tai_test
.
mcc
=
unc
.
get
()
->
tai
.
mcc
;
tai_test
.
mnc
=
unc
.
get
()
->
tai
.
mnc
;
tai_test
.
tac
=
unc
.
get
()
->
tai
.
tac
;
list
.
push_back
(
tai_test
);
paging_msg
.
setTAIListForPaging
(
list
);
uint8_t
buffer
[
BUFFER_SIZE_512
];
int
encoded_size
=
paging_msg
.
encode2buffer
(
buffer
,
BUFFER_SIZE_512
);
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
amf_n2_inst
->
sctp_s_38412
.
sctp_send_msg
(
unc
.
get
()
->
gnb_assoc_id
,
unc
.
get
()
->
sctp_stream_send
,
&
b
);
}
//------------------------------------------------------------------------------
void
amf_n2
::
handle_itti_message
(
itti_new_sctp_association
&
new_assoc
)
{
}
// handled in class ngap_app
...
...
src/amf-app/amf_n2.hpp
View file @
7571e854
...
...
@@ -65,6 +65,7 @@ class amf_n2 : public ngap::ngap_app {
void
send_handover_preparation_failure
(
const
unsigned
long
amf_ue_ngap_id
,
const
uint32_t
ran_ue_ngap_id
,
const
sctp_assoc_id_t
&
gnb_assoc_id
);
void
handle_itti_message
(
itti_paging
&
itti_msg
);
bool
verifyPlmn
(
std
::
vector
<
SupportedItem_t
>
list
);
std
::
vector
<
SupportedItem_t
>
get_common_plmn
(
...
...
src/contexts/ue_ngap_context.hpp
View file @
7571e854
...
...
@@ -59,6 +59,12 @@ class ue_ngap_context {
bool
ueContextRequest
;
uint32_t
s_tmsi_5g
;
std
::
string
s_setid
;
std
::
string
s_pointer
;
std
::
string
s_tmsi
;
Tai_t
tai
;
// state management, ue status over the air
ng_ue_state_t
ng_ue_state
;
uint8_t
ncc
;
// Next Hop Chaining Counter
...
...
src/itti/itti_msg.hpp
View file @
7571e854
...
...
@@ -91,6 +91,7 @@ typedef enum {
HANDOVER_NOTIFY
,
UPLINK_RAN_STATUS_TRANSFER
,
PDU_SESSION_RESOURCE_SETUP_RESPONSE
,
PAGING
,
TIME_OUT
,
HEALTH_PING
,
TERMINATE
,
...
...
src/itti/msgs/itti_msg_n2.hpp
View file @
7571e854
...
...
@@ -221,6 +221,17 @@ class itti_handover_required : public itti_msg_n2 {
HandoverRequiredMsg
*
handoverReq
;
};
class
itti_paging
:
public
itti_msg_n2
{
public:
itti_paging
(
const
task_id_t
origin
,
const
task_id_t
destination
)
:
itti_msg_n2
(
PAGING
,
origin
,
destination
)
{}
itti_paging
(
const
itti_paging
&
i
)
:
itti_msg_n2
(
i
)
{}
public:
uint32_t
ran_ue_ngap_id
;
long
amf_ue_ngap_id
;
};
class
itti_handover_request_Ack
:
public
itti_msg_n2
{
public:
itti_handover_request_Ack
(
const
task_id_t
origin
,
const
task_id_t
destination
)
...
...
src/ngap/libngap/NativeEnumerated.c
View file @
7571e854
...
...
@@ -243,7 +243,6 @@ asn_dec_rval_t NativeEnumerated_decode_aper(
}
ASN_DEBUG
(
"Decoding %s as NativeEnumerated"
,
td
->
name
);
// printf("test0515 Decoding %s as NativeEnumerated\n", td->name);
if
(
ct
->
flags
&
APC_EXTENSIBLE
)
{
int
inext
=
per_get_few_bits
(
pd
,
1
);
...
...
src/ngap/libngap/NativeInteger.c
View file @
7571e854
...
...
@@ -321,7 +321,6 @@ asn_dec_rval_t NativeInteger_decode_aper(
(
void
)
opt_codec_ctx
;
ASN_DEBUG
(
"Decoding NativeInteger %s (APER)"
,
td
->
name
);
// printf("test0515 Decoding NativeInteger %s (APER)\n", td->name);
if
(
!
native
)
{
native
=
(
long
*
)
(
*
sptr
=
CALLOC
(
1
,
sizeof
(
*
native
)));
...
...
src/ngap/libngap/constr_CHOICE.c
View file @
7571e854
...
...
@@ -1033,8 +1033,6 @@ 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
);
// printf("test0515 CHOICE %s got index %d in range %d\n", td->name, value,
// ct->range_bits);
if
(
value
>
ct
->
upper_bound
)
ASN__DECODE_FAILED
;
}
else
{
if
(
specs
->
ext_start
==
-
1
)
ASN__DECODE_FAILED
;
...
...
@@ -1059,7 +1057,6 @@ asn_dec_rval_t CHOICE_decode_aper(
memb_ptr2
=
&
memb_ptr
;
}
ASN_DEBUG
(
"Discovered CHOICE %s encodes %s"
,
td
->
name
,
elm
->
name
);
// printf("test0515 Discovered CHOICE %s encodes %s\n", td->name, elm->name);
if
(
ct
&&
ct
->
range_bits
>=
0
)
{
rv
=
elm
->
type
->
op
->
aper_decoder
(
...
...
@@ -1074,8 +1071,6 @@ 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
);
// printf("test0515 Failed to decode %s in %s (CHOICE) %d\n", elm->name,
// td->name, rv.code);
}
return
rv
;
}
...
...
src/ngap/libngap/constr_SEQUENCE.c
View file @
7571e854
...
...
@@ -1493,7 +1493,6 @@ asn_dec_rval_t SEQUENCE_decode_aper(
}
ASN_DEBUG
(
"Decoding %s as SEQUENCE (APER)"
,
td
->
name
);
// printf("test0515 Decoding %s as SEQUENCE (APER)\n", td->name);
/* Handle extensions */
if
(
specs
->
first_extension
<
0
)
{
...
...
@@ -1566,9 +1565,6 @@ 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
);
// printf("test0515 Member %s->%s is optional, p=%d (%d->%d)\n",
// td->name, elm->name, present,
// (int)opmd.nboff, (int)opmd.nbits);
if
(
present
==
0
)
{
/* This element is not present */
if
(
elm
->
default_value_set
)
{
...
...
@@ -1587,7 +1583,6 @@ asn_dec_rval_t SEQUENCE_decode_aper(
/* Fetch the member from the stream */
ASN_DEBUG
(
"Decoding member
\"
%s
\"
in %s"
,
elm
->
name
,
td
->
name
);
// printf("test0515 Decoding member \"%s\" in %s\n", elm->name, td->name);
if
(
elm
->
flags
&
ATF_OPEN_TYPE
)
{
rv
=
OPEN_TYPE_aper_get
(
opt_codec_ctx
,
td
,
st
,
elm
,
pd
);
...
...
src/ngap/libngap/per_opentype.c
View file @
7571e854
...
...
@@ -406,7 +406,6 @@ static asn_dec_rval_t aper_open_type_get_simple(
ASN__STACK_OVERFLOW_CHECK
(
ctx
);
ASN_DEBUG
(
"Getting open type %s..."
,
td
->
name
);
// printf("test0515 Getting open type %s...\n", td->name);
do
{
chunk_bytes
=
aper_get_length
(
pd
,
-
1
,
-
1
,
&
repeat
);
...
...
@@ -433,8 +432,6 @@ static asn_dec_rval_t aper_open_type_get_simple(
ASN_DEBUG
(
"Getting open type %s encoded in %ld bytes"
,
td
->
name
,
(
long
)
bufLen
);
// printf("test0515 Getting open type %s encoded in %ld bytes\n", td->name,
//(long)bufLen);
memset
(
&
spd
,
0
,
sizeof
(
spd
));
spd
.
buffer
=
buf
;
...
...
src/ngap/ngapIEs/FiveGSTmsi.cpp
View file @
7571e854
...
...
@@ -46,6 +46,7 @@ bool FiveGSTmsi::decodefrompdu(Ngap_FiveG_S_TMSI_t pdu) {
amfSetid
.
getAMFSetID
(
setId
);
amfPointer
.
getAMFPointer
(
pointer
);
_5g_s_tmsi
=
setId
+
pointer
+
std
::
to_string
(
tmsi
);
tmsi_value
=
std
::
to_string
(
tmsi
);
return
true
;
}
...
...
@@ -53,3 +54,33 @@ bool FiveGSTmsi::decodefrompdu(Ngap_FiveG_S_TMSI_t pdu) {
void
FiveGSTmsi
::
getValue
(
std
::
string
&
tmsi
)
{
tmsi
=
_5g_s_tmsi
;
}
//------------------------------------------------------------------------------
void
FiveGSTmsi
::
getValue
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
)
{
amfSetid
.
getAMFSetID
(
setid
);
amfPointer
.
getAMFPointer
(
pointer
);
tmsi
=
tmsi_value
;
}
//------------------------------------------------------------------------------
void
FiveGSTmsi
::
setValue
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
)
{
amfSetid
.
setAMFSetID
(
setid
);
amfPointer
.
setAMFPointer
(
pointer
);
_5g_s_tmsi
=
tmsi
;
}
//------------------------------------------------------------------------------
bool
FiveGSTmsi
::
encode2pdu
(
Ngap_FiveG_S_TMSI_t
*
pdu
)
{
amfSetid
.
encode2bitstring
(
pdu
->
aMFSetID
);
amfPointer
.
encode2bitstring
(
pdu
->
aMFPointer
);
uint32_t
tmsi
=
(
uint32_t
)
std
::
stol
(
_5g_s_tmsi
);
uint8_t
*
buf
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint32_t
));
*
(
uint32_t
*
)
buf
=
htonl
(
tmsi
);
pdu
->
fiveG_TMSI
.
buf
=
buf
;
pdu
->
fiveG_TMSI
.
size
=
sizeof
(
uint32_t
);
return
true
;
}
src/ngap/ngapIEs/FiveGSTmsi.hpp
View file @
7571e854
...
...
@@ -47,9 +47,13 @@ class FiveGSTmsi {
public:
bool
decodefrompdu
(
Ngap_FiveG_S_TMSI_t
pdu
);
void
getValue
(
std
::
string
&
value
);
void
getValue
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
);
void
setValue
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
);
bool
encode2pdu
(
Ngap_FiveG_S_TMSI_t
*
pdu
);
private:
std
::
string
_5g_s_tmsi
;
std
::
string
tmsi_value
;
AMFSetID
amfSetid
;
AMFPointer
amfPointer
;
...
...
src/ngap/ngapIEs/TAIListforPaging.cpp
0 → 100644
View file @
7571e854
/*
* 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
*/
#include "TAIListforPaging.hpp"
extern
"C"
{
#include "Ngap_TAIListForPagingItem.h"
}
#include <iostream>
using
namespace
std
;
namespace
ngap
{
//------------------------------------------------------------------------------
TAIListForPaging
::
TAIListForPaging
()
{
tai
=
nullptr
;
numOftai
=
0
;
}
//------------------------------------------------------------------------------
TAIListForPaging
::~
TAIListForPaging
()
{
if
(
!
tai
)
delete
[]
tai
;
}
//------------------------------------------------------------------------------
bool
TAIListForPaging
::
encode2TAIListForPaging
(
Ngap_TAIListForPaging_t
*
pdu
)
{
for
(
int
i
=
0
;
i
<
numOftai
;
i
++
)
{
Ngap_TAIListForPagingItem_t
*
ta
=
(
Ngap_TAIListForPagingItem_t
*
)
calloc
(
1
,
sizeof
(
Ngap_TAIListForPagingItem_t
));
if
(
!
tai
[
i
].
encode2TAI
(
&
ta
->
tAI
))
return
false
;
if
(
ASN_SEQUENCE_ADD
(
&
pdu
->
list
,
ta
)
!=
0
)
return
false
;
}
return
true
;
}
//------------------------------------------------------------------------------
bool
TAIListForPaging
::
decodefromTAIListForPaging
(
Ngap_TAIListForPaging_t
*
pdu
)
{
numOftai
=
pdu
->
list
.
count
;
if
(
numOftai
<
0
)
return
false
;
tai
=
new
TAI
[
numOftai
];
for
(
int
i
=
0
;
i
<
numOftai
;
i
++
)
{
if
(
!
tai
[
i
].
decodefromTAI
(
&
pdu
->
list
.
array
[
i
]
->
tAI
))
return
false
;
}
return
true
;
}
//------------------------------------------------------------------------------
void
TAIListForPaging
::
setTAIListForPaging
(
TAI
*
m_tai
,
int
numOfItem
)
{
tai
=
m_tai
;
numOftai
=
numOfItem
;
}
//------------------------------------------------------------------------------
void
TAIListForPaging
::
getTAIListForPaging
(
TAI
*&
m_tai
,
int
&
numOfItem
)
{
m_tai
=
tai
;
numOfItem
=
numOftai
;
}
}
// namespace ngap
src/ngap/ngapIEs/TAIListforPaging.hpp
0 → 100644
View file @
7571e854
/*
* 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
*/
#ifndef _TAILISTFORPAGING_H_
#define _TAILISTFORPAGING_H_
#include "TAI.hpp"
extern
"C"
{
#include "Ngap_TAIListForPaging.h"
}
namespace
ngap
{
class
TAIListForPaging
{
public:
TAIListForPaging
();
virtual
~
TAIListForPaging
();
void
setTAIListForPaging
(
TAI
*
m_tai
,
int
numOfItem
);
void
getTAIListForPaging
(
TAI
*&
m_tai
,
int
&
numOfItem
);
bool
encode2TAIListForPaging
(
Ngap_TAIListForPaging_t
*
pdu
);
bool
decodefromTAIListForPaging
(
Ngap_TAIListForPaging_t
*
pdu
);
private:
TAI
*
tai
;
int
numOftai
;
};
}
// namespace ngap
#endif
src/ngap/ngapIEs/UEPagingIdentity.cpp
0 → 100644
View file @
7571e854
/*
* 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
*/
#include "UEPagingIdentity.hpp"
namespace
ngap
{
//------------------------------------------------------------------------------
UEPagingIdentity
::
UEPagingIdentity
()
{}
//------------------------------------------------------------------------------
UEPagingIdentity
::~
UEPagingIdentity
()
{}
//------------------------------------------------------------------------------
void
UEPagingIdentity
::
setUEPagingIdentity
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
)
{
fiveGSTmsi
.
setValue
(
setid
,
pointer
,
tmsi
);
}
//------------------------------------------------------------------------------
void
UEPagingIdentity
::
getUEPagingIdentity
(
std
::
string
&
_5g_s_tmsi
)
{
fiveGSTmsi
.
getValue
(
_5g_s_tmsi
);
}
//------------------------------------------------------------------------------
void
UEPagingIdentity
::
getUEPagingIdentity
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
)
{
fiveGSTmsi
.
getValue
(
setid
,
pointer
,
tmsi
);
}
//------------------------------------------------------------------------------
bool
UEPagingIdentity
::
encode2pdu
(
Ngap_UEPagingIdentity_t
*
pdu
)
{
pdu
->
present
=
Ngap_UEPagingIdentity_PR_fiveG_S_TMSI
;
Ngap_FiveG_S_TMSI_t
*
ie
=
(
Ngap_FiveG_S_TMSI_t
*
)
calloc
(
1
,
sizeof
(
Ngap_FiveG_S_TMSI_t
));
pdu
->
choice
.
fiveG_S_TMSI
=
ie
;
if
(
!
fiveGSTmsi
.
encode2pdu
(
pdu
->
choice
.
fiveG_S_TMSI
))
return
false
;
return
true
;
}
//------------------------------------------------------------------------------
bool
UEPagingIdentity
::
decodefrompdu
(
Ngap_UEPagingIdentity_t
pdu
)
{
if
(
pdu
.
present
!=
Ngap_UEPagingIdentity_PR_fiveG_S_TMSI
)
return
false
;
if
(
!
fiveGSTmsi
.
decodefrompdu
(
*
pdu
.
choice
.
fiveG_S_TMSI
))
return
false
;
return
true
;
}
}
// namespace ngap
src/ngap/ngapIEs/UEPagingIdentity.hpp
0 → 100644
View file @
7571e854
/*
* 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
*/
#ifndef _UEPAGINGIDENTITY_H_
#define _UEPAGINGIDENTITY_H_
#include "FiveGSTmsi.hpp"
extern
"C"
{
#include "Ngap_UEPagingIdentity.h"
}
namespace
ngap
{
class
UEPagingIdentity
{
public:
UEPagingIdentity
();
virtual
~
UEPagingIdentity
();
void
setUEPagingIdentity
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
);
void
getUEPagingIdentity
(
std
::
string
&
_5g_s_tmsi
);
void
getUEPagingIdentity
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
);
bool
encode2pdu
(
Ngap_UEPagingIdentity_t
*
pdu
);
bool
decodefrompdu
(
Ngap_UEPagingIdentity_t
pdu
);
private:
FiveGSTmsi
fiveGSTmsi
;
};
}
// namespace ngap
#endif
src/ngap/ngapMsgs/InitialUEMessage.cpp
View file @
7571e854
...
...
@@ -454,4 +454,14 @@ bool InitialUEMessageMsg::get5GS_TMSI(string& _5g_s_tmsi) {
return
false
;
}
//------------------------------------------------------------------------------
bool
InitialUEMessageMsg
::
get5GS_TMSI
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
)
{
if
(
fivegSTmsi
)
{
fivegSTmsi
->
getValue
(
setid
,
pointer
,
tmsi
);
return
true
;
}
else
return
false
;
}
}
// namespace ngap
src/ngap/ngapMsgs/InitialUEMessage.hpp
View file @
7571e854
...
...
@@ -67,6 +67,8 @@ class InitialUEMessageMsg {
int
getRRCEstablishmentCause
();
int
getUeContextRequest
();
bool
get5GS_TMSI
(
std
::
string
&
_5g_s_tmsi
);
bool
get5GS_TMSI
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
);
private:
Ngap_NGAP_PDU_t
*
initialUEMessagePdu
;
...
...
src/ngap/ngapMsgs/Paging.cpp
0 → 100644
View file @
7571e854
/*
* 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
*/
#include "Paging.hpp"
#include <iostream>
using
namespace
std
;
namespace
ngap
{
//------------------------------------------------------------------------------
PagingMsg
::
PagingMsg
()
{
pagingPdu
=
nullptr
;
pagingIEs
=
nullptr
;
uePagingIdentity
=
nullptr
;
taIListForPaging
=
nullptr
;
}
//------------------------------------------------------------------------------
PagingMsg
::~
PagingMsg
()
{
if
(
!
uePagingIdentity
)
delete
uePagingIdentity
;
if
(
!
taIListForPaging
)
delete
taIListForPaging
;
}
//------------------------------------------------------------------------------
void
PagingMsg
::
setMessageType
()
{
if
(
!
pagingPdu
)
pagingPdu
=
(
Ngap_NGAP_PDU_t
*
)
calloc
(
1
,
sizeof
(
Ngap_NGAP_PDU_t
));
MessageType
PagingTypeIE
;
PagingTypeIE
.
setProcedureCode
(
Ngap_ProcedureCode_id_Paging
);
PagingTypeIE
.
setTypeOfMessage
(
Ngap_NGAP_PDU_PR_initiatingMessage
);
PagingTypeIE
.
setCriticality
(
Ngap_Criticality_ignore
);
PagingTypeIE
.
setValuePresent
(
Ngap_InitiatingMessage__value_PR_Paging
);
if
(
PagingTypeIE
.
getProcedureCode
()
==
Ngap_ProcedureCode_id_Paging
&&
PagingTypeIE
.
getTypeOfMessage
()
==
Ngap_NGAP_PDU_PR_initiatingMessage
&&
PagingTypeIE
.
getCriticality
()
==
Ngap_Criticality_ignore
)
{
PagingTypeIE
.
encode2pdu
(
pagingPdu
);
pagingIEs
=
&
(
pagingPdu
->
choice
.
initiatingMessage
->
value
.
choice
.
Paging
);
}
else
{
cout
<<
"[warning] This information doesn't refer to Paging "
"Message!!!"
<<
endl
;
}
}
//------------------------------------------------------------------------------
int
PagingMsg
::
encode2buffer
(
uint8_t
*
buf
,
int
buf_size
)
{
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
pagingPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pagingPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
return
er
.
encoded
;
}
//------------------------------------------------------------------------------
bool
PagingMsg
::
decodefrompdu
(
Ngap_NGAP_PDU_t
*
ngap_msg_pdu
)
{
pagingPdu
=
ngap_msg_pdu
;
if
(
pagingPdu
->
present
==
Ngap_NGAP_PDU_PR_initiatingMessage
)
{
if
(
pagingPdu
->
choice
.
initiatingMessage
&&
pagingPdu
->
choice
.
initiatingMessage
->
procedureCode
==
Ngap_ProcedureCode_id_Paging
&&
pagingPdu
->
choice
.
initiatingMessage
->
criticality
==
Ngap_Criticality_ignore
&&
pagingPdu
->
choice
.
initiatingMessage
->
value
.
present
==
Ngap_InitiatingMessage__value_PR_Paging
)
{
pagingIEs
=
&
pagingPdu
->
choice
.
initiatingMessage
->
value
.
choice
.
Paging
;
}
else
{
cout
<<
"Check Paging message error!!!"
<<
endl
;
return
false
;
}
}
else
{
cout
<<
"MessageType error!!!"
<<
endl
;
return
false
;
}
for
(
int
i
=
0
;
i
<
pagingIEs
->
protocolIEs
.
list
.
count
;
i
++
)
{
switch
(
pagingIEs
->
protocolIEs
.
list
.
array
[
i
]
->
id
)
{
case
Ngap_ProtocolIE_ID_id_UEPagingIdentity
:
{
if
(
pagingIEs
->
protocolIEs
.
list
.
array
[
i
]
->
criticality
==
Ngap_Criticality_ignore
&&
pagingIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
present
==
Ngap_PagingIEs__value_PR_UEPagingIdentity
)
{
uePagingIdentity
=
new
UEPagingIdentity
();
if
(
!
uePagingIdentity
->
decodefrompdu
(
pagingIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
choice
.
UEPagingIdentity
))
{
cout
<<
"Decoded NGAP UEPagingIdentity IE error"
<<
endl
;
return
false
;
}
cout
<<
"[Paging] Received UEPagingIdentity "
<<
endl
;
}
else
{
cout
<<
"Decoded NGAP UEPagingIdentity IE error"
<<
endl
;
return
false
;
}
}
break
;
case
Ngap_ProtocolIE_ID_id_TAIListForPaging
:
{
if
(
pagingIEs
->
protocolIEs
.
list
.
array
[
i
]
->
criticality
==
Ngap_Criticality_ignore
&&
pagingIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
present
==
Ngap_PagingIEs__value_PR_TAIListForPaging
)
{
taIListForPaging
=
new
TAIListForPaging
();
if
(
!
taIListForPaging
->
decodefromTAIListForPaging
(
&
pagingIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
choice
.
TAIListForPaging
))
{
cout
<<
"Decoded NGAP TAIListForPaging IE error"
<<
endl
;
return
false
;
}
cout
<<
"[Paging] Received TAIListForPaging "
<<
endl
;
}
else
{
cout
<<
"Decoded NGAP TAIListForPaging IE error"
<<
endl
;
return
false
;
}
}
break
;
default:
{
cout
<<
"not decoded IE:"
<<
pagingIEs
->
protocolIEs
.
list
.
array
[
i
]
->
id
<<
endl
;
return
true
;
}
}
}
return
true
;
}
//------------------------------------------------------------------------------
void
PagingMsg
::
setUEPagingIdentity
(
std
::
string
SetId
,
std
::
string
Pointer
,
std
::
string
tmsi
)
{
if
(
!
uePagingIdentity
)
uePagingIdentity
=
new
UEPagingIdentity
();
uePagingIdentity
->
setUEPagingIdentity
(
SetId
,
Pointer
,
tmsi
);
Ngap_PagingIEs_t
*
ie
=
(
Ngap_PagingIEs_t
*
)
calloc
(
1
,
sizeof
(
Ngap_PagingIEs_t
));
ie
->
id
=
Ngap_ProtocolIE_ID_id_UEPagingIdentity
;
ie
->
criticality
=
Ngap_Criticality_ignore
;
ie
->
value
.
present
=
Ngap_PagingIEs__value_PR_UEPagingIdentity
;
int
ret
=
uePagingIdentity
->
encode2pdu
(
&
ie
->
value
.
choice
.
UEPagingIdentity
);
if
(
!
ret
)
{
cout
<<
"encode UEPagingIdentity IE error"
<<
endl
;
return
;
}
ret
=
ASN_SEQUENCE_ADD
(
&
pagingIEs
->
protocolIEs
.
list
,
ie
);
if
(
ret
!=
0
)
cout
<<
"encode UEPagingIdentity IE error"
<<
endl
;
}
//------------------------------------------------------------------------------
void
PagingMsg
::
getUEPagingIdentity
(
std
::
string
&
_5g_s_tmsi
)
{
if
(
uePagingIdentity
)
uePagingIdentity
->
getUEPagingIdentity
(
_5g_s_tmsi
);
}
//------------------------------------------------------------------------------
void
PagingMsg
::
getUEPagingIdentity
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
)
{
if
(
uePagingIdentity
)
uePagingIdentity
->
getUEPagingIdentity
(
setid
,
pointer
,
tmsi
);
}
//------------------------------------------------------------------------------
void
PagingMsg
::
setTAIListForPaging
(
const
std
::
vector
<
struct
Tai_s
>
list
)
{
if
(
list
.
size
()
==
0
)
{
cout
<<
"[Warning] Setup failed, vector is empty!!!"
<<
endl
;
return
;
}
if
(
!
taIListForPaging
)
taIListForPaging
=
new
TAIListForPaging
();
TAI
tai
[
list
.
size
()];
PlmnId
plmnid
[
list
.
size
()];
TAC
tac
[
list
.
size
()];
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
plmnid
[
i
].
setMccMnc
(
list
[
i
].
mcc
,
list
[
i
].
mnc
);
tac
[
i
].
setTac
(
list
[
i
].
tac
);
tai
[
i
].
setTAI
(
&
plmnid
[
i
],
&
tac
[
i
]);
}
taIListForPaging
->
setTAIListForPaging
(
tai
,
list
.
size
());
Ngap_PagingIEs_t
*
ie
=
(
Ngap_PagingIEs_t
*
)
calloc
(
1
,
sizeof
(
Ngap_PagingIEs_t
));
ie
->
id
=
Ngap_ProtocolIE_ID_id_TAIListForPaging
;
ie
->
criticality
=
Ngap_Criticality_ignore
;
ie
->
value
.
present
=
Ngap_PagingIEs__value_PR_TAIListForPaging
;
int
ret
=
taIListForPaging
->
encode2TAIListForPaging
(
&
ie
->
value
.
choice
.
TAIListForPaging
);
if
(
!
ret
)
{
cout
<<
"encode TAIListForPaging IE error"
<<
endl
;
return
;
}
ret
=
ASN_SEQUENCE_ADD
(
&
pagingIEs
->
protocolIEs
.
list
,
ie
);
if
(
ret
!=
0
)
cout
<<
"encode TAIListForPaging IE error"
<<
endl
;
}
//------------------------------------------------------------------------------
void
PagingMsg
::
getTAIListForPaging
(
std
::
vector
<
struct
Tai_s
>&
list
)
{
if
(
!
taIListForPaging
)
return
;
TAI
*
tailist
;
int
sizeoftailist
;
taIListForPaging
->
getTAIListForPaging
(
tailist
,
sizeoftailist
);
for
(
int
i
=
0
;
i
<
sizeoftailist
;
i
++
)
{
Tai_t
tai
;
PlmnId
*
plmnid
;
TAC
*
tac
;
tailist
[
i
].
getTAI
(
plmnid
,
tac
);
plmnid
->
getMcc
(
tai
.
mcc
);
plmnid
->
getMnc
(
tai
.
mnc
);
tai
.
tac
=
tac
->
getTac
();
list
.
push_back
(
tai
);
}
}
}
// namespace ngap
src/ngap/ngapMsgs/Paging.hpp
0 → 100644
View file @
7571e854
/*
* 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
*/
#ifndef _PAGING_H_
#define _PAGING_H_
#include "NgapIEsStruct.hpp"
#include "MessageType.hpp"
#include "UEPagingIdentity.hpp"
#include "TAIListforPaging.hpp"
extern
"C"
{
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
#include "Ngap_Paging.h"
}
namespace
ngap
{
class
PagingMsg
{
public:
PagingMsg
();
virtual
~
PagingMsg
();
void
setMessageType
();
int
encode2buffer
(
uint8_t
*
buf
,
int
buf_size
);
bool
decodefrompdu
(
Ngap_NGAP_PDU_t
*
ngap_msg_pdu
);
void
setUEPagingIdentity
(
std
::
string
SetId
,
std
::
string
Pointer
,
std
::
string
tmsi
);
void
getUEPagingIdentity
(
std
::
string
&
_5g_s_tmsi
);
void
getUEPagingIdentity
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
);
void
setTAIListForPaging
(
const
std
::
vector
<
struct
Tai_s
>
list
);
void
getTAIListForPaging
(
std
::
vector
<
struct
Tai_s
>&
list
);
private:
Ngap_NGAP_PDU_t
*
pagingPdu
;
Ngap_Paging_t
*
pagingIEs
;
UEPagingIdentity
*
uePagingIdentity
;
TAIListForPaging
*
taIListForPaging
;
};
}
// namespace ngap
#endif
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