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
4581a722
Commit
4581a722
authored
Aug 26, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor TAI/TAC
parent
0344ddc8
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
146 additions
and
186 deletions
+146
-186
src/common/conversions.hpp
src/common/conversions.hpp
+1
-0
src/ngap/ngapIEs/CoreNetworkAssistanceInformation.cpp
src/ngap/ngapIEs/CoreNetworkAssistanceInformation.cpp
+2
-2
src/ngap/ngapIEs/EUTRA-CGI.cpp
src/ngap/ngapIEs/EUTRA-CGI.cpp
+14
-26
src/ngap/ngapIEs/EUTRA-CGI.hpp
src/ngap/ngapIEs/EUTRA-CGI.hpp
+7
-6
src/ngap/ngapIEs/EUTRACellIdentity.cpp
src/ngap/ngapIEs/EUTRACellIdentity.cpp
+25
-25
src/ngap/ngapIEs/EUTRACellIdentity.hpp
src/ngap/ngapIEs/EUTRACellIdentity.hpp
+8
-5
src/ngap/ngapIEs/SupportedTaItem.cpp
src/ngap/ngapIEs/SupportedTaItem.cpp
+2
-2
src/ngap/ngapIEs/TAI.cpp
src/ngap/ngapIEs/TAI.cpp
+24
-24
src/ngap/ngapIEs/TAI.hpp
src/ngap/ngapIEs/TAI.hpp
+6
-5
src/ngap/ngapIEs/TAIListforPaging.cpp
src/ngap/ngapIEs/TAIListforPaging.cpp
+2
-2
src/ngap/ngapIEs/Tac.cpp
src/ngap/ngapIEs/Tac.cpp
+21
-21
src/ngap/ngapIEs/Tac.hpp
src/ngap/ngapIEs/Tac.hpp
+5
-5
src/ngap/ngapIEs/UserLocationInformationEUTRA.cpp
src/ngap/ngapIEs/UserLocationInformationEUTRA.cpp
+13
-45
src/ngap/ngapIEs/UserLocationInformationEUTRA.hpp
src/ngap/ngapIEs/UserLocationInformationEUTRA.hpp
+9
-11
src/ngap/ngapIEs/UserLocationInformationNR.cpp
src/ngap/ngapIEs/UserLocationInformationNR.cpp
+2
-2
src/ngap/ngapMsgs/HandoverRequiredMsg.cpp
src/ngap/ngapMsgs/HandoverRequiredMsg.cpp
+1
-1
src/ngap/ngapMsgs/NGSetupRequest.cpp
src/ngap/ngapMsgs/NGSetupRequest.cpp
+2
-2
src/ngap/ngapMsgs/Paging.cpp
src/ngap/ngapMsgs/Paging.cpp
+1
-1
src/ngap/ngapMsgs/UEContextReleaseComplete.cpp
src/ngap/ngapMsgs/UEContextReleaseComplete.cpp
+1
-1
No files found.
src/common/conversions.hpp
View file @
4581a722
...
...
@@ -80,5 +80,6 @@ class conv {
const
std
::
string
&
str
,
OCTET_STRING_t
&
o_str
);
static
bool
int8_2_octet_string
(
const
uint8_t
&
value
,
OCTET_STRING_t
&
o_str
);
static
bool
octet_string_2_int8
(
const
OCTET_STRING_t
&
o_str
,
uint8_t
&
value
);
// TODO: bitstring_2_int32
};
#endif
/* FILE_CONVERSIONS_HPP_SEEN */
src/ngap/ngapIEs/CoreNetworkAssistanceInformation.cpp
View file @
4581a722
...
...
@@ -86,7 +86,7 @@ bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo(
(
Ngap_TAIListForInactiveItem_t
*
)
calloc
(
1
,
sizeof
(
Ngap_TAIListForInactiveItem_t
));
if
(
!
taiListForInactiveItem
)
return
false
;
if
(
!
it
->
encode
2TAI
(
&
taiListForInactiveItem
->
tAI
))
return
false
;
if
(
!
it
->
encode
(
&
taiListForInactiveItem
->
tAI
))
return
false
;
if
(
ASN_SEQUENCE_ADD
(
&
coreNetworkAssistanceInformation
->
tAIListForInactive
.
list
,
taiListForInactiveItem
)
!=
0
)
...
...
@@ -129,7 +129,7 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
i
<
coreNetworkAssistanceInformation
->
tAIListForInactive
.
list
.
count
;
i
++
)
{
TAI
tai_item
=
{};
if
(
!
tai_item
.
decode
fromTAI
(
if
(
!
tai_item
.
decode
(
&
coreNetworkAssistanceInformation
->
tAIListForInactive
.
list
.
array
[
i
]
->
tAI
))
return
false
;
...
...
src/ngap/ngapIEs/EUTRA-CGI.cpp
View file @
4581a722
...
...
@@ -21,51 +21,39 @@
#include "EUTRA-CGI.hpp"
#include <iostream>
using
namespace
std
;
namespace
ngap
{
//------------------------------------------------------------------------------
EUTRA_CGI
::
EUTRA_CGI
()
{
plmnId
=
NULL
;
eUTRACellIdentity
=
NULL
;
}
EUTRA_CGI
::
EUTRA_CGI
()
{}
//------------------------------------------------------------------------------
EUTRA_CGI
::~
EUTRA_CGI
()
{}
//------------------------------------------------------------------------------
void
EUTRA_CGI
::
set
EUTRA_CGI
(
PlmnId
*
m_plmnId
,
EUTRACellIdentity
*
m_eUTRACellI
dentity
)
{
plmn
Id
=
m_plmnI
d
;
eUTRA
CellIdentity
=
m_eUTRACellI
dentity
;
void
EUTRA_CGI
::
set
(
const
PlmnId
&
plmn_id
,
const
EUTRACellIdentity
&
eUTRA_cell_i
dentity
)
{
plmn
_id_
=
plmn_i
d
;
eUTRA
_cell_identity_
=
eUTRA_cell_i
dentity
;
}
//------------------------------------------------------------------------------
bool
EUTRA_CGI
::
encode2EUTRA_CGI
(
Ngap_EUTRA_CGI_t
*
eutra_cgi
)
{
if
(
!
plmnId
->
encode
(
eutra_cgi
->
pLMNIdentity
))
return
false
;
if
(
!
eUTRACellIdentity
->
encode2bitstring
(
eutra_cgi
->
eUTRACellIdentity
))
return
false
;
bool
EUTRA_CGI
::
encode
(
Ngap_EUTRA_CGI_t
&
eutra_cgi
)
{
if
(
!
plmn_id_
.
encode
(
eutra_cgi
.
pLMNIdentity
))
return
false
;
if
(
!
eUTRA_cell_identity_
.
encode
(
eutra_cgi
.
eUTRACellIdentity
))
return
false
;
return
true
;
}
//------------------------------------------------------------------------------
bool
EUTRA_CGI
::
decodefromEUTRA_CGI
(
Ngap_EUTRA_CGI_t
*
eutra_cgi
)
{
if
(
plmnId
==
nullptr
)
plmnId
=
new
PlmnId
();
if
(
eUTRACellIdentity
==
nullptr
)
eUTRACellIdentity
=
new
EUTRACellIdentity
();
if
(
!
plmnId
->
decode
(
eutra_cgi
->
pLMNIdentity
))
return
false
;
if
(
!
eUTRACellIdentity
->
decodefrombitstring
(
eutra_cgi
->
eUTRACellIdentity
))
return
false
;
bool
EUTRA_CGI
::
decode
(
Ngap_EUTRA_CGI_t
&
eutra_cgi
)
{
if
(
!
plmn_id_
.
decode
(
eutra_cgi
.
pLMNIdentity
))
return
false
;
if
(
!
eUTRA_cell_identity_
.
decode
(
eutra_cgi
.
eUTRACellIdentity
))
return
false
;
return
true
;
}
//------------------------------------------------------------------------------
void
EUTRA_CGI
::
getEUTRA_CGI
(
PlmnId
*&
m_plmnId
,
EUTRACellIdentity
*&
m_eUTRACellIdentity
)
{
m_plmnId
=
plmnId
;
m_eUTRACellIdentity
=
eUTRACellIdentity
;
void
EUTRA_CGI
::
get
(
PlmnId
&
plmn_id
,
EUTRACellIdentity
&
eUTRA_cell_identity
)
{
plmn_id
=
plmn_id_
;
eUTRA_cell_identity
=
eUTRA_cell_identity_
;
}
}
// namespace ngap
src/ngap/ngapIEs/EUTRA-CGI.hpp
View file @
4581a722
...
...
@@ -36,14 +36,15 @@ class EUTRA_CGI {
EUTRA_CGI
();
virtual
~
EUTRA_CGI
();
void
setEUTRA_CGI
(
PlmnId
*
,
EUTRACellIdentity
*
);
bool
encode2EUTRA_CGI
(
Ngap_EUTRA_CGI_t
*
);
bool
decodefromEUTRA_CGI
(
Ngap_EUTRA_CGI_t
*
);
void
getEUTRA_CGI
(
PlmnId
*&
,
EUTRACellIdentity
*&
);
void
set
(
const
PlmnId
&
,
const
EUTRACellIdentity
&
);
void
get
(
PlmnId
&
,
EUTRACellIdentity
&
);
bool
encode
(
Ngap_EUTRA_CGI_t
&
);
bool
decode
(
Ngap_EUTRA_CGI_t
&
);
private:
PlmnId
*
plmnId
;
EUTRACellIdentity
*
eUTRACellIdentity
;
PlmnId
plmn_id_
;
// Mandatory
EUTRACellIdentity
eUTRA_cell_identity_
;
// Mandatory
};
}
// namespace ngap
...
...
src/ngap/ngapIEs/EUTRACellIdentity.cpp
View file @
4581a722
...
...
@@ -28,47 +28,47 @@ namespace ngap {
//------------------------------------------------------------------------------
EUTRACellIdentity
::
EUTRACellIdentity
()
{
eutracellidentity
=
0
;
id_
=
0
;
}
//------------------------------------------------------------------------------
EUTRACellIdentity
::~
EUTRACellIdentity
()
{}
//------------------------------------------------------------------------------
void
EUTRACellIdentity
::
setEUTRACellIdentity
(
uint32_t
m_eutracellidentity
)
{
eutracellidentity
=
m_eutracellidentity
;
bool
EUTRACellIdentity
::
set
(
const
uint32_t
&
id
)
{
if
(
id
>
kEUTRACellIdentityMaxValue
)
return
false
;
id_
=
id
;
return
true
;
}
//------------------------------------------------------------------------------
bool
EUTRACellIdentity
::
encode2bitstring
(
Ngap_EUTRACellIdentity_t
&
eUTRACellIdentity
)
{
eUTRACellIdentity
.
bits_unused
=
4
;
eUTRACellIdentity
.
size
=
4
;
eUTRACellIdentity
.
buf
=
(
uint8_t
*
)
calloc
(
1
,
sizeof
(
uint32_t
));
if
(
!
eUTRACellIdentity
.
buf
)
return
false
;
eUTRACellIdentity
.
buf
[
3
]
=
eutracellidentity
&
0x000000ff
;
eUTRACellIdentity
.
buf
[
2
]
=
(
eutracellidentity
&
0x0000ff00
)
>>
8
;
eUTRACellIdentity
.
buf
[
1
]
=
(
eutracellidentity
&
0x00ff0000
)
>>
16
;
eUTRACellIdentity
.
buf
[
0
]
=
(
eutracellidentity
&
0xff000000
)
>>
24
;
return
true
;
uint32_t
EUTRACellIdentity
::
get
()
{
return
id_
;
}
//------------------------------------------------------------------------------
bool
EUTRACellIdentity
::
decodefrombitstring
(
Ngap_EUTRACellIdentity_t
&
eUTRACellIdentity
)
{
if
(
!
eUTRACellIdentity
.
buf
)
return
false
;
eutracellidentity
=
eUTRACellIdentity
.
buf
[
0
]
<<
24
;
eutracellidentity
|=
eUTRACellIdentity
.
buf
[
1
]
<<
16
;
eutracellidentity
|=
eUTRACellIdentity
.
buf
[
2
]
<<
8
;
eutracellidentity
|=
eUTRACellIdentity
.
buf
[
3
];
bool
EUTRACellIdentity
::
encode
(
Ngap_EUTRACellIdentity_t
&
eUTRA_cell_identity
)
{
eUTRA_cell_identity
.
bits_unused
=
4
;
// 28 = 4*8 - 4 bits
eUTRA_cell_identity
.
size
=
4
;
eUTRA_cell_identity
.
buf
=
(
uint8_t
*
)
calloc
(
1
,
sizeof
(
uint32_t
));
if
(
!
eUTRA_cell_identity
.
buf
)
return
false
;
eUTRA_cell_identity
.
buf
[
3
]
=
id_
&
0x000000ff
;
eUTRA_cell_identity
.
buf
[
2
]
=
(
id_
&
0x0000ff00
)
>>
8
;
eUTRA_cell_identity
.
buf
[
1
]
=
(
id_
&
0x00ff0000
)
>>
16
;
eUTRA_cell_identity
.
buf
[
0
]
=
(
id_
&
0xff000000
)
>>
24
;
return
true
;
}
//------------------------------------------------------------------------------
uint32_t
EUTRACellIdentity
::
getEUTRACellIdentity
()
{
return
eutracellidentity
;
bool
EUTRACellIdentity
::
decode
(
Ngap_EUTRACellIdentity_t
&
eUTRA_cell_identity
)
{
if
(
!
eUTRA_cell_identity
.
buf
)
return
false
;
id_
=
eUTRA_cell_identity
.
buf
[
0
]
<<
24
;
id_
|=
eUTRA_cell_identity
.
buf
[
1
]
<<
16
;
id_
|=
eUTRA_cell_identity
.
buf
[
2
]
<<
8
;
id_
|=
eUTRA_cell_identity
.
buf
[
3
];
return
true
;
}
}
// namespace ngap
src/ngap/ngapIEs/EUTRACellIdentity.hpp
View file @
4581a722
...
...
@@ -21,6 +21,9 @@
#ifndef _EUTRACellIdentity_H_
#define _EUTRACellIdentity_H_
#include <cstdint>
constexpr
uint32_t
kEUTRACellIdentityMaxValue
=
268435455
;
// 2^28-1
extern
"C"
{
#include "Ngap_EUTRACellIdentity.h"
...
...
@@ -33,13 +36,13 @@ class EUTRACellIdentity {
EUTRACellIdentity
();
virtual
~
EUTRACellIdentity
();
bool
encode
2bitstring
(
Ngap_EUTRACellIdentity_t
&
eUTRACellIdentity
);
bool
decode
frombitstring
(
Ngap_EUTRACellIdentity_t
&
eUTRACellIdentity
);
uint32_t
get
EUTRACellIdentity
();
void
setEUTRACellIdentity
(
uint32_t
m_eutracellidentity
);
bool
encode
(
Ngap_EUTRACellIdentity_t
&
eUTRACellIdentity
);
bool
decode
(
Ngap_EUTRACellIdentity_t
&
eUTRACellIdentity
);
uint32_t
get
();
bool
set
(
const
uint32_t
&
m_eutracellidentity
);
private:
uint32_t
eutracellidentity
;
uint32_t
id_
;
};
}
// namespace ngap
...
...
src/ngap/ngapIEs/SupportedTaItem.cpp
View file @
4581a722
...
...
@@ -64,7 +64,7 @@ void SupportedTaItem::getBroadcastPlmnList(
//------------------------------------------------------------------------------
bool
SupportedTaItem
::
encode2SupportedTaItem
(
Ngap_SupportedTAItem_t
*
ta
)
{
if
(
!
tac
.
encode
2octetstring
(
ta
->
tAC
))
return
false
;
if
(
!
tac
.
encode
(
ta
->
tAC
))
return
false
;
for
(
std
::
vector
<
BroadcastPLMNItem
>::
iterator
it
=
std
::
begin
(
broadcastPLMNList
);
...
...
@@ -80,7 +80,7 @@ bool SupportedTaItem::encode2SupportedTaItem(Ngap_SupportedTAItem_t* ta) {
//------------------------------------------------------------------------------
bool
SupportedTaItem
::
decodefromSupportedTaItem
(
Ngap_SupportedTAItem_t
*
pdu
)
{
if
(
!
tac
.
decode
fromoctetstring
(
pdu
->
tAC
))
return
false
;
if
(
!
tac
.
decode
(
pdu
->
tAC
))
return
false
;
for
(
int
i
=
0
;
i
<
pdu
->
broadcastPLMNList
.
list
.
count
;
i
++
)
{
BroadcastPLMNItem
item
=
{};
if
(
!
item
.
decodefromBroadcastPLMNItem
(
pdu
->
broadcastPLMNList
.
list
.
array
[
i
]))
...
...
src/ngap/ngapIEs/TAI.cpp
View file @
4581a722
...
...
@@ -30,56 +30,56 @@ TAI::TAI() {}
TAI
::~
TAI
()
{}
//------------------------------------------------------------------------------
void
TAI
::
setTAI
(
const
PlmnId
&
m_plmnId
,
const
TAC
&
m_
tac
)
{
plmn
Id
=
m_plmnI
d
;
tac
=
m_
tac
;
void
TAI
::
setTAI
(
const
PlmnId
&
plmn_id
,
const
TAC
&
tac
)
{
plmn
_id_
=
plmn_i
d
;
tac
_
=
tac
;
}
//------------------------------------------------------------------------------
void
TAI
::
setTAI
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
uint32_t
&
m_
tac
)
{
plmn
Id
.
set
(
mcc
,
mnc
);
tac
.
setTac
(
m_
tac
);
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
uint32_t
&
tac
)
{
plmn
_id_
.
set
(
mcc
,
mnc
);
tac
_
.
set
(
tac
);
}
//------------------------------------------------------------------------------
void
TAI
::
getTAI
(
std
::
string
&
mcc
,
std
::
string
&
mnc
,
uint32_t
&
m_
tac
)
{
plmn
Id
.
getMcc
(
mcc
);
plmn
Id
.
getMnc
(
mnc
);
m_tac
=
tac
.
getTac
();
void
TAI
::
getTAI
(
std
::
string
&
mcc
,
std
::
string
&
mnc
,
uint32_t
&
tac
)
{
plmn
_id_
.
getMcc
(
mcc
);
plmn
_id_
.
getMnc
(
mnc
);
tac
=
tac_
.
get
();
}
//------------------------------------------------------------------------------
void
TAI
::
setTAI
(
const
Tai_t
&
tai
)
{
plmn
Id
.
set
(
tai
.
mcc
,
tai
.
mnc
);
tac
.
setTac
(
tai
.
tac
);
plmn
_id_
.
set
(
tai
.
mcc
,
tai
.
mnc
);
tac
_
.
set
(
tai
.
tac
);
}
//------------------------------------------------------------------------------
bool
TAI
::
encode
2TAI
(
Ngap_TAI_t
*
tai
)
{
if
(
!
plmn
Id
.
encode
(
tai
->
pLMNIdentity
))
return
false
;
if
(
!
tac
.
encode2octetstring
(
tai
->
tAC
))
return
false
;
bool
TAI
::
encode
(
Ngap_TAI_t
*
tai
)
{
if
(
!
plmn
_id_
.
encode
(
tai
->
pLMNIdentity
))
return
false
;
if
(
!
tac
_
.
encode
(
tai
->
tAC
))
return
false
;
return
true
;
}
//------------------------------------------------------------------------------
bool
TAI
::
decode
fromTAI
(
Ngap_TAI_t
*
tai
)
{
if
(
!
plmn
Id
.
decode
(
tai
->
pLMNIdentity
))
return
false
;
if
(
!
tac
.
decodefromoctetstring
(
tai
->
tAC
))
return
false
;
bool
TAI
::
decode
(
Ngap_TAI_t
*
tai
)
{
if
(
!
plmn
_id_
.
decode
(
tai
->
pLMNIdentity
))
return
false
;
if
(
!
tac
_
.
decode
(
tai
->
tAC
))
return
false
;
return
true
;
}
//------------------------------------------------------------------------------
void
TAI
::
getTAI
(
PlmnId
&
m_plmnId
,
TAC
&
m_
tac
)
{
m_plmnId
=
plmnId
;
m_tac
=
tac
;
void
TAI
::
getTAI
(
PlmnId
&
plmn_id
,
TAC
&
tac
)
{
plmn_id
=
plmn_id_
;
tac
=
tac_
;
}
//------------------------------------------------------------------------------
void
TAI
::
getTAI
(
Tai_t
&
tai
)
{
plmn
Id
.
getMcc
(
tai
.
mcc
);
plmn
Id
.
getMnc
(
tai
.
mnc
);
tai
.
tac
=
tac
.
getTac
();
plmn
_id_
.
getMcc
(
tai
.
mcc
);
plmn
_id_
.
getMnc
(
tai
.
mnc
);
tai
.
tac
=
tac
_
.
get
();
}
}
// namespace ngap
src/ngap/ngapIEs/TAI.hpp
View file @
4581a722
...
...
@@ -38,6 +38,8 @@ class TAI {
virtual
~
TAI
();
void
setTAI
(
const
PlmnId
&
,
const
TAC
&
);
void
getTAI
(
PlmnId
&
,
TAC
&
);
void
setTAI
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
uint32_t
&
tac
);
void
getTAI
(
std
::
string
&
mcc
,
std
::
string
&
mnc
,
uint32_t
&
tac
);
...
...
@@ -45,13 +47,12 @@ class TAI {
void
setTAI
(
const
Tai_t
&
tai
);
void
getTAI
(
Tai_t
&
tai
);
bool
encode2TAI
(
Ngap_TAI_t
*
);
bool
decodefromTAI
(
Ngap_TAI_t
*
);
void
getTAI
(
PlmnId
&
,
TAC
&
);
bool
encode
(
Ngap_TAI_t
*
);
bool
decode
(
Ngap_TAI_t
*
);
private:
PlmnId
plmn
Id
;
// Mandatory
TAC
tac
;
// Mandatory
PlmnId
plmn
_id_
;
// Mandatory
TAC
tac
_
;
// Mandatory
};
}
// namespace ngap
...
...
src/ngap/ngapIEs/TAIListforPaging.cpp
View file @
4581a722
...
...
@@ -47,7 +47,7 @@ bool TAIListForPaging::encode2TAIListForPaging(Ngap_TAIListForPaging_t* pdu) {
for
(
auto
&
tai
:
taiList
)
{
Ngap_TAIListForPagingItem_t
*
ta
=
(
Ngap_TAIListForPagingItem_t
*
)
calloc
(
1
,
sizeof
(
Ngap_TAIListForPagingItem_t
));
if
(
!
tai
.
encode
2TAI
(
&
ta
->
tAI
))
return
false
;
if
(
!
tai
.
encode
(
&
ta
->
tAI
))
return
false
;
if
(
ASN_SEQUENCE_ADD
(
&
pdu
->
list
,
ta
)
!=
0
)
return
false
;
}
return
true
;
...
...
@@ -59,7 +59,7 @@ bool TAIListForPaging::decodefromTAIListForPaging(
if
(
pdu
->
list
.
count
<
0
)
return
false
;
for
(
int
i
=
0
;
i
<
pdu
->
list
.
count
;
i
++
)
{
TAI
tai
=
{};
if
(
!
tai
.
decode
fromTAI
(
&
pdu
->
list
.
array
[
i
]
->
tAI
))
return
false
;
if
(
!
tai
.
decode
(
&
pdu
->
list
.
array
[
i
]
->
tAI
))
return
false
;
taiList
.
push_back
(
tai
);
}
...
...
src/ngap/ngapIEs/Tac.cpp
View file @
4581a722
...
...
@@ -20,48 +20,48 @@
*/
#include "Tac.hpp"
#include "logger.hpp"
#include <iostream>
namespace
ngap
{
//------------------------------------------------------------------------------
TAC
::
TAC
()
{
tac
=
0
;
tac
_
=
0
;
}
//------------------------------------------------------------------------------
TAC
::~
TAC
()
{}
//------------------------------------------------------------------------------
void
TAC
::
set
Tac
(
uint32_t
m_
tac
)
{
tac
=
m_
tac
;
void
TAC
::
set
(
const
uint32_t
&
tac
)
{
tac
_
=
tac
;
}
//------------------------------------------------------------------------------
bool
TAC
::
encode2octetstring
(
Ngap_TAC_t
&
m_tac
)
{
m_tac
.
size
=
3
;
// OCTET_STRING(SIZE(3))
m_tac
.
buf
=
(
uint8_t
*
)
calloc
(
1
,
sizeof
(
uint8_t
)
+
sizeof
(
uint16_t
));
m_tac
.
buf
[
2
]
=
tac
&
0x0000ff
;
m_tac
.
buf
[
1
]
=
(
tac
&
0x00ff00
)
>>
8
;
m_tac
.
buf
[
0
]
=
(
tac
&
0xff0000
)
>>
16
;
return
true
;
uint32_t
TAC
::
get
()
const
{
return
tac_
;
}
//------------------------------------------------------------------------------
bool
TAC
::
decodefromoctetstring
(
Ngap_TAC_t
&
m_
tac
)
{
if
(
!
m_tac
.
buf
)
return
false
;
tac
=
0
;
for
(
int
i
=
0
;
i
<
m_tac
.
size
;
i
++
)
{
tac
|=
m_tac
.
buf
[
i
]
<<
((
m_tac
.
size
-
1
-
i
)
*
8
)
;
}
std
::
cout
<<
"Received TAC: "
<<
tac
<<
std
::
endl
;
bool
TAC
::
encode
(
Ngap_TAC_t
&
tac
)
{
tac
.
size
=
3
;
// OCTET_STRING(SIZE(3))
tac
.
buf
=
(
uint8_t
*
)
calloc
(
3
,
sizeof
(
uint8_t
))
;
tac
.
buf
[
2
]
=
tac_
&
0x0000ff
;
tac
.
buf
[
1
]
=
(
tac_
&
0x00ff00
)
>>
8
;
tac
.
buf
[
0
]
=
(
tac_
&
0xff0000
)
>>
16
;
return
true
;
}
//------------------------------------------------------------------------------
uint32_t
TAC
::
getTac
()
{
return
tac
;
bool
TAC
::
decode
(
Ngap_TAC_t
&
tac
)
{
if
(
!
tac
.
buf
)
return
false
;
tac_
=
0
;
for
(
int
i
=
0
;
i
<
tac
.
size
;
i
++
)
{
tac_
|=
tac
.
buf
[
i
]
<<
((
tac
.
size
-
1
-
i
)
*
8
);
}
Logger
::
ngap
().
debug
(
"Received TAC 0x%x"
,
tac_
);
return
true
;
}
}
// namespace ngap
src/ngap/ngapIEs/Tac.hpp
View file @
4581a722
...
...
@@ -33,14 +33,14 @@ class TAC {
TAC
();
virtual
~
TAC
();
uint32_t
get
Tac
()
;
void
set
Tac
(
uint32_t
m_
tac
);
uint32_t
get
()
const
;
void
set
(
const
uint32_t
&
tac
);
bool
encode
2octetstring
(
Ngap_TAC_t
&
);
bool
decode
fromoctetstring
(
Ngap_TAC_t
&
m_tac
);
bool
encode
(
Ngap_TAC_t
&
);
bool
decode
(
Ngap_TAC_t
&
m_tac
);
private:
uint32_t
tac
:
24
;
uint32_t
tac
_
:
24
;
};
}
// namespace ngap
...
...
src/ngap/ngapIEs/UserLocationInformationEUTRA.cpp
View file @
4581a722
...
...
@@ -20,49 +20,32 @@
*/
#include "UserLocationInformationEUTRA.hpp"
#include <iostream>
using
namespace
std
;
#include "logger.hpp"
namespace
ngap
{
//------------------------------------------------------------------------------
UserLocationInformationEUTRA
::
UserLocationInformationEUTRA
()
{
eUTRA_CGI
=
NULL
;
tAI
=
NULL
;
/*istimeStampSet = false;
timeStamp = NULL;*/
}
UserLocationInformationEUTRA
::
UserLocationInformationEUTRA
()
{}
//------------------------------------------------------------------------------
UserLocationInformationEUTRA
::~
UserLocationInformationEUTRA
()
{}
//------------------------------------------------------------------------------
void
UserLocationInformationEUTRA
::
setInformationEUTRA
(
EUTRA_CGI
*
m_eUTRA_CGI
,
TAI
*
m_tAI
)
{
const
EUTRA_CGI
&
m_eUTRA_CGI
,
const
TAI
&
m_tAI
)
{
eUTRA_CGI
=
m_eUTRA_CGI
;
tAI
=
m_tAI
;
}
//------------------------------------------------------------------------------
/*void UserLocationInformationEUTRA::setInformationEUTRA(EUTRA_CGI*
m_eUTRA_CGI,TAI* m_tAI,TimeStamp* m_timeStamp)
{
eUTRA_CGI = m_eUTRA_CGI;
tAI = m_tAI;
istimeStampSet = true;
timeStamp = m_timeStamp;
}*/
//------------------------------------------------------------------------------
bool
UserLocationInformationEUTRA
::
encode2UserLocationInformationEUTRA
(
Ngap_UserLocationInformationEUTRA_t
*
userLocationInformationEUTRA
)
{
if
(
!
eUTRA_CGI
->
encode2EUTRA_CGI
(
&
userLocationInformationEUTRA
->
eUTRA_CGI
))
{
cout
<<
"[Warning] eUTRA_CGI->encode2EUTRA_CGI() error!"
<<
endl
;
if
(
!
eUTRA_CGI
.
encode
(
userLocationInformationEUTRA
->
eUTRA_CGI
))
{
Logger
::
ngap
().
warn
(
"Encode eUTRA_CGI IE error"
)
;
return
false
;
}
if
(
!
tAI
->
encode2TAI
(
&
userLocationInformationEUTRA
->
tAI
))
{
cout
<<
"[Warning] tAI->encode2TAI() error!"
<<
endl
;
if
(
!
tAI
.
encode
(
&
userLocationInformationEUTRA
->
tAI
))
{
Logger
::
ngap
().
warn
(
"Encode TAI IE error"
)
;
return
false
;
}
#if 0
...
...
@@ -84,15 +67,13 @@ bool UserLocationInformationEUTRA::encode2UserLocationInformationEUTRA(
//------------------------------------------------------------------------------
bool
UserLocationInformationEUTRA
::
decodefromUserLocationInformationEUTRA
(
Ngap_UserLocationInformationEUTRA_t
*
userLocationInformationEUTRA
)
{
if
(
eUTRA_CGI
==
nullptr
)
eUTRA_CGI
=
new
EUTRA_CGI
();
if
(
!
eUTRA_CGI
->
decodefromEUTRA_CGI
(
&
userLocationInformationEUTRA
->
eUTRA_CGI
))
{
cout
<<
"[Warning] eUTRA_CGI->decodefromEUTRA_CGI() error!"
<<
endl
;
if
(
!
eUTRA_CGI
.
decode
(
userLocationInformationEUTRA
->
eUTRA_CGI
))
{
Logger
::
ngap
().
warn
(
"Decode eUTRA_CGI IE error"
);
return
false
;
}
tAI
=
new
TAI
();
if
(
!
tAI
->
decodefromTAI
(
&
userLocationInformationEUTRA
->
tAI
))
{
cout
<<
"[Warning] tAI->decodefromTAI() error!"
<<
endl
;
if
(
!
tAI
.
decode
(
&
userLocationInformationEUTRA
->
tAI
))
{
Logger
::
ngap
().
warn
(
"Decode TAI IE error"
)
;
return
false
;
}
#if 0
...
...
@@ -110,22 +91,9 @@ bool UserLocationInformationEUTRA::decodefromUserLocationInformationEUTRA(
return
true
;
}
//------------------------------------------------------------------------------
/*bool UserLocationInformationEUTRA::getTimeStampPresence()
{
return istimeStampSet;
}*/
/*void UserLocationInformationEUTRA::getInformationEUTRA(EUTRA_CGI*
&m_eUTRA_CGI,TAI* &m_tAI,TimeStamp* &m_timeStamp)
{
m_eUTRA_CGI = eUTRA_CGI;
m_tAI = tAI;
m_timeStamp = timeStamp;
}*/
//------------------------------------------------------------------------------
void
UserLocationInformationEUTRA
::
getInformationEUTRA
(
EUTRA_CGI
*&
m_eUTRA_CGI
,
TAI
*
&
m_tAI
)
{
EUTRA_CGI
&
m_eUTRA_CGI
,
TAI
&
m_tAI
)
{
m_eUTRA_CGI
=
eUTRA_CGI
;
m_tAI
=
tAI
;
}
...
...
src/ngap/ngapIEs/UserLocationInformationEUTRA.hpp
View file @
4581a722
...
...
@@ -36,23 +36,21 @@ class UserLocationInformationEUTRA {
UserLocationInformationEUTRA
();
virtual
~
UserLocationInformationEUTRA
();
void
setInformationEUTRA
(
EUTRA_CGI
*
m_eUTRA_CGI
,
TAI
*
m_tAI
);
// void setInformationEUTRA(EUTRA_CGI* m_eUTRA_CGI,TAI* m_tAI,TimeStamp*
// m_timeStamp);
void
setInformationEUTRA
(
const
EUTRA_CGI
&
m_eUTRA_CGI
,
const
TAI
&
m_tAI
);
void
getInformationEUTRA
(
EUTRA_CGI
&
m_eUTRA_CGI
,
TAI
&
m_tAI
);
// bool getTimeStampPresence();
bool
encode2UserLocationInformationEUTRA
(
Ngap_UserLocationInformationEUTRA_t
*
userLocationInformation
);
bool
decodefromUserLocationInformationEUTRA
(
Ngap_UserLocationInformationEUTRA_t
*
userLocationInformation
);
// void getInformationEUTRA(EUTRA_CGI* &m_eUTRA_CGI,TAI* &m_tAI,TimeStamp*
// &m_timeStamp);
void
getInformationEUTRA
(
EUTRA_CGI
*&
m_eUTRA_CGI
,
TAI
*&
m_tAI
);
// bool getTimeStampPresence();
private:
EUTRA_CGI
*
eUTRA_CGI
;
TAI
*
tAI
;
//
bool istimeStampSet;
// T
imeStamp *timeStamp;
EUTRA_CGI
eUTRA_CGI
;
// Mandatory
TAI
tAI
;
// Mandatory
//
TODO: TimeStamp *timeStamp; //Age of Location (Optional)
// T
ODO: NG-RAN CGI (PSCell Information) (Optional)
};
}
// namespace ngap
...
...
src/ngap/ngapIEs/UserLocationInformationNR.cpp
View file @
4581a722
...
...
@@ -42,7 +42,7 @@ bool UserLocationInformationNR::encode2UserLocationInformationNR(
if
(
!
nR_CGI
.
encode2NR_CGI
(
&
userLocationInformationNR
->
nR_CGI
))
{
return
false
;
}
if
(
!
tAI
.
encode
2TAI
(
&
userLocationInformationNR
->
tAI
))
{
if
(
!
tAI
.
encode
(
&
userLocationInformationNR
->
tAI
))
{
return
false
;
}
#if 0
...
...
@@ -67,7 +67,7 @@ bool UserLocationInformationNR::decodefromUserLocationInformationNR(
return
false
;
}
if
(
!
tAI
.
decode
fromTAI
(
&
userLocationInformationNR
->
tAI
))
{
if
(
!
tAI
.
decode
(
&
userLocationInformationNR
->
tAI
))
{
return
false
;
}
#if 0
...
...
src/ngap/ngapMsgs/HandoverRequiredMsg.cpp
View file @
4581a722
...
...
@@ -109,7 +109,7 @@ bool HandoverRequiredMsg::getTargetID(GlobalgNBId& gnbId, TAI& tai) {
Ngap_GlobalRANNodeID_PR_globalGNB_ID
)
{
gnbId
.
decode
(
targetID
.
choice
.
targetRANNodeID
->
globalRANNodeID
.
choice
.
globalGNB_ID
);
tai
.
decode
fromTAI
(
&
targetID
.
choice
.
targetRANNodeID
->
selectedTAI
);
tai
.
decode
(
&
targetID
.
choice
.
targetRANNodeID
->
selectedTAI
);
return
true
;
}
}
...
...
src/ngap/ngapMsgs/NGSetupRequest.cpp
View file @
4581a722
...
...
@@ -118,7 +118,7 @@ void NGSetupRequestMsg::setSupportedTAList(
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
SupportedTaItem
item
=
{};
TAC
tac
=
{};
tac
.
set
Tac
(
list
[
i
].
tac
);
tac
.
set
(
list
[
i
].
tac
);
item
.
setTac
(
tac
);
std
::
vector
<
BroadcastPLMNItem
>
broadcastPlmnItems
;
...
...
@@ -329,7 +329,7 @@ bool NGSetupRequestMsg::getSupportedTAList(
it
->
getTac
(
tac
);
SupportedItem_t
supporteditem_data
=
{};
supporteditem_data
.
tac
=
tac
.
get
Tac
();
supporteditem_data
.
tac
=
tac
.
get
();
std
::
vector
<
BroadcastPLMNItem
>
broadcastPLMNItems
;
it
->
getBroadcastPlmnList
(
broadcastPLMNItems
);
...
...
src/ngap/ngapMsgs/Paging.cpp
View file @
4581a722
...
...
@@ -157,7 +157,7 @@ void PagingMsg::setTAIListForPaging(const std::vector<Tai_t>& list) {
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
TAI
tai
=
{};
plmnid
[
i
].
set
(
list
[
i
].
mcc
,
list
[
i
].
mnc
);
tac
[
i
].
set
Tac
(
list
[
i
].
tac
);
tac
[
i
].
set
(
list
[
i
].
tac
);
tai
.
setTAI
(
plmnid
[
i
],
tac
[
i
]);
tailist
.
push_back
(
tai
);
}
...
...
src/ngap/ngapMsgs/UEContextReleaseComplete.cpp
View file @
4581a722
...
...
@@ -146,7 +146,7 @@ void UEContextReleaseCompleteMsg::getUserLocationInfoNR(
plmnId
.
getMcc
(
tai
.
mcc
);
plmnId
.
getMnc
(
tai
.
mnc
);
tai
.
tac
=
tac
.
get
Tac
()
&
0x00ffffff
;
tai
.
tac
=
tac
.
get
()
&
0x00ffffff
;
}
}
...
...
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