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
bf127c6a
Commit
bf127c6a
authored
Sep 05, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First refactoring version of PduSessionResourceModifyRequest
parent
9d560c5f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
24 deletions
+78
-24
src/common/conversions.cpp
src/common/conversions.cpp
+14
-0
src/common/conversions.hpp
src/common/conversions.hpp
+3
-0
src/ngap/ngapIEs/NAS-PDU.cpp
src/ngap/ngapIEs/NAS-PDU.cpp
+47
-16
src/ngap/ngapIEs/NAS-PDU.hpp
src/ngap/ngapIEs/NAS-PDU.hpp
+8
-2
src/ngap/ngapIEs/UEPagingIdentity.cpp
src/ngap/ngapIEs/UEPagingIdentity.cpp
+4
-4
src/ngap/ngapIEs/UEPagingIdentity.hpp
src/ngap/ngapIEs/UEPagingIdentity.hpp
+2
-2
No files found.
src/common/conversions.cpp
View file @
bf127c6a
...
@@ -379,3 +379,17 @@ bool conv::octet_string_2_int8(const OCTET_STRING_t& o_str, uint8_t& value) {
...
@@ -379,3 +379,17 @@ bool conv::octet_string_2_int8(const OCTET_STRING_t& o_str, uint8_t& value) {
value
=
o_str
.
buf
[
0
];
value
=
o_str
.
buf
[
0
];
return
true
;
return
true
;
}
}
//------------------------------------------------------------------------------
bool
conv
::
octet_string_2_octet_string
(
OCTET_STRING_t
&
destination
,
const
OCTET_STRING_t
&
source
)
{
if
(
!
source
.
buf
)
return
false
;
destination
.
buf
=
(
uint8_t
*
)
calloc
(
source
.
size
+
1
,
sizeof
(
uint8_t
));
if
(
!
destination
.
buf
)
return
false
;
memcpy
(
destination
.
buf
,
source
.
buf
,
source
.
size
);
((
uint8_t
*
)
destination
.
buf
)[
source
.
size
]
=
'\0'
;
destination
.
size
=
source
.
size
;
return
true
;
}
src/common/conversions.hpp
View file @
bf127c6a
...
@@ -81,5 +81,8 @@ class conv {
...
@@ -81,5 +81,8 @@ class conv {
static
bool
int8_2_octet_string
(
const
uint8_t
&
value
,
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
);
static
bool
octet_string_2_int8
(
const
OCTET_STRING_t
&
o_str
,
uint8_t
&
value
);
// TODO: bitstring_2_int32
// TODO: bitstring_2_int32
static
bool
octet_string_2_octet_string
(
OCTET_STRING_t
&
destination
,
const
OCTET_STRING_t
&
source
);
};
};
#endif
/* FILE_CONVERSIONS_HPP_SEEN */
#endif
/* FILE_CONVERSIONS_HPP_SEEN */
src/ngap/ngapIEs/NAS-PDU.cpp
View file @
bf127c6a
...
@@ -20,13 +20,16 @@
...
@@ -20,13 +20,16 @@
*/
*/
#include "NAS-PDU.hpp"
#include "NAS-PDU.hpp"
#include "conversions.hpp"
namespace
ngap
{
namespace
ngap
{
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
NAS_PDU
::
NAS_PDU
()
{
NAS_PDU
::
NAS_PDU
()
{
buffer_
=
nullptr
;
// buffer_ = nullptr;
size_
=
-
1
;
// size_ = -1;
pdu_
.
buf
=
nullptr
;
pdu_
.
size
=
-
1
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -34,32 +37,60 @@ NAS_PDU::~NAS_PDU() {}
...
@@ -34,32 +37,60 @@ NAS_PDU::~NAS_PDU() {}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
NAS_PDU
::
encode
(
Ngap_NAS_PDU_t
&
nas_pdu
)
{
bool
NAS_PDU
::
encode
(
Ngap_NAS_PDU_t
&
nas_pdu
)
{
int
ret
;
if
(
!
pdu_
.
buf
)
return
false
;
ret
=
OCTET_STRING_fromBuf
(
&
nas_pdu
,
buffer_
,
size_
);
return
conv
::
octet_string_2_octet_string
(
nas_pdu
,
pdu_
);
if
(
ret
!=
0
)
return
false
;
// int ret = OCTET_STRING_fromBuf(&nas_pdu, buffer_, size_);
return
true
;
// if (ret != 0) return false;
// return true;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
NAS_PDU
::
decode
(
Ngap_NAS_PDU_t
&
nas_pdu
)
{
bool
NAS_PDU
::
decode
(
Ngap_NAS_PDU_t
&
nas_pdu
)
{
buffer_
=
(
char
*
)
nas_pdu
.
buf
;
if
(
!
nas_pdu
.
buf
)
return
false
;
size_
=
nas_pdu
.
size
;
return
conv
::
octet_string_2_octet_string
(
pdu_
,
nas_pdu
);
return
true
;
// buffer_ = (char*) calloc(nas_pdu.size, sizeof(char));
// memcpy(buffer_, nas_pdu.buf, nas_pdu.size);
// size_ = nas_pdu.size;
// return true;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
NAS_PDU
::
get
(
uint8_t
*&
buffer
,
size_t
&
size
)
const
{
bool
NAS_PDU
::
get
(
uint8_t
*&
buffer
,
size_t
&
size
)
const
{
buffer
=
(
uint8_t
*
)
buffer_
;
if
(
!
pdu_
.
buf
)
return
false
;
size
=
size_
;
if
(
pdu_
.
size
<
0
)
return
false
;
if
(
!
buffer_
)
return
false
;
memcpy
(
buffer
,
pdu_
.
buf
,
pdu_
.
size
);
if
(
size_
<
0
)
return
false
;
size
=
pdu_
.
size
;
return
true
;
return
true
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
NAS_PDU
::
set
(
uint8_t
*
buffer
,
size_t
size
)
{
void
NAS_PDU
::
set
(
uint8_t
*
buffer
,
size_t
size
)
{
buffer_
=
(
char
*
)
buffer
;
if
(
!
buffer
)
return
;
size_
=
size
;
pdu_
.
buf
=
(
uint8_t
*
)
calloc
(
size
,
sizeof
(
uint8_t
));
memcpy
(
pdu_
.
buf
,
buffer
,
size
);
pdu_
.
size
=
size
;
return
;
}
//------------------------------------------------------------------------------
bool
NAS_PDU
::
get
(
OCTET_STRING_t
&
pdu
)
const
{
return
conv
::
octet_string_2_octet_string
(
pdu
,
pdu_
);
}
//------------------------------------------------------------------------------
bool
NAS_PDU
::
set
(
const
OCTET_STRING_t
&
pdu
)
{
return
conv
::
octet_string_2_octet_string
(
pdu_
,
pdu
);
}
//------------------------------------------------------------------------------
bool
NAS_PDU
::
get
(
NAS_PDU
&
nas_pdu
)
const
{
return
nas_pdu
.
set
(
pdu_
);
}
//------------------------------------------------------------------------------
bool
NAS_PDU
::
set
(
const
NAS_PDU
&
nas_pdu
)
{
OCTET_STRING_t
pdu
=
{};
nas_pdu
.
get
(
pdu
);
return
conv
::
octet_string_2_octet_string
(
pdu_
,
pdu
);
}
}
}
// namespace ngap
}
// namespace ngap
src/ngap/ngapIEs/NAS-PDU.hpp
View file @
bf127c6a
...
@@ -38,9 +38,15 @@ class NAS_PDU {
...
@@ -38,9 +38,15 @@ class NAS_PDU {
bool
get
(
uint8_t
*&
buffer
,
size_t
&
size
)
const
;
bool
get
(
uint8_t
*&
buffer
,
size_t
&
size
)
const
;
void
set
(
uint8_t
*
buffer
,
size_t
size
);
void
set
(
uint8_t
*
buffer
,
size_t
size
);
bool
get
(
OCTET_STRING_t
&
pdu
)
const
;
bool
get
(
NAS_PDU
&
nas_pdu
)
const
;
bool
set
(
const
OCTET_STRING_t
&
pdu
);
bool
set
(
const
NAS_PDU
&
nas_pdu
);
private:
private:
char
*
buffer_
;
// char* buffer_;
size_t
size_
;
// size_t size_;
OCTET_STRING_t
pdu_
;
};
};
}
// namespace ngap
}
// namespace ngap
...
...
src/ngap/ngapIEs/UEPagingIdentity.cpp
View file @
bf127c6a
...
@@ -31,9 +31,9 @@ UEPagingIdentity::~UEPagingIdentity() {}
...
@@ -31,9 +31,9 @@ UEPagingIdentity::~UEPagingIdentity() {}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
UEPagingIdentity
::
setUEPagingIdentity
(
void
UEPagingIdentity
::
setUEPagingIdentity
(
const
std
::
string
&
setid
,
const
std
::
string
&
pointer
,
const
std
::
string
&
set
_
id
,
const
std
::
string
&
pointer
,
const
std
::
string
&
tmsi
)
{
const
std
::
string
&
tmsi
)
{
fiveGSTmsi
.
set
(
setid
,
pointer
,
tmsi
);
fiveGSTmsi
.
set
(
set
_
id
,
pointer
,
tmsi
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -43,8 +43,8 @@ void UEPagingIdentity::getUEPagingIdentity(std::string& _5g_s_tmsi) {
...
@@ -43,8 +43,8 @@ void UEPagingIdentity::getUEPagingIdentity(std::string& _5g_s_tmsi) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
UEPagingIdentity
::
getUEPagingIdentity
(
void
UEPagingIdentity
::
getUEPagingIdentity
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
)
{
std
::
string
&
set
_
id
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
)
{
fiveGSTmsi
.
get
(
setid
,
pointer
,
tmsi
);
fiveGSTmsi
.
get
(
set
_
id
,
pointer
,
tmsi
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
src/ngap/ngapIEs/UEPagingIdentity.hpp
View file @
bf127c6a
...
@@ -36,11 +36,11 @@ class UEPagingIdentity {
...
@@ -36,11 +36,11 @@ class UEPagingIdentity {
virtual
~
UEPagingIdentity
();
virtual
~
UEPagingIdentity
();
void
setUEPagingIdentity
(
void
setUEPagingIdentity
(
const
std
::
string
&
setid
,
const
std
::
string
&
pointer
,
const
std
::
string
&
set
_
id
,
const
std
::
string
&
pointer
,
const
std
::
string
&
tmsi
);
const
std
::
string
&
tmsi
);
void
getUEPagingIdentity
(
std
::
string
&
_5g_s_tmsi
);
void
getUEPagingIdentity
(
std
::
string
&
_5g_s_tmsi
);
void
getUEPagingIdentity
(
void
getUEPagingIdentity
(
std
::
string
&
setid
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
);
std
::
string
&
set
_
id
,
std
::
string
&
pointer
,
std
::
string
&
tmsi
);
bool
encode2pdu
(
Ngap_UEPagingIdentity_t
*
pdu
);
bool
encode2pdu
(
Ngap_UEPagingIdentity_t
*
pdu
);
bool
decodeFromPdu
(
Ngap_UEPagingIdentity_t
pdu
);
bool
decodeFromPdu
(
Ngap_UEPagingIdentity_t
pdu
);
...
...
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