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
a78537c1
Commit
a78537c1
authored
Jan 11, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
caebfeeb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
23 deletions
+39
-23
src/nas/ies/ABBA.cpp
src/nas/ies/ABBA.cpp
+17
-0
src/nas/ies/ABBA.hpp
src/nas/ies/ABBA.hpp
+3
-1
src/nas/msgs/AuthenticationRequest.cpp
src/nas/msgs/AuthenticationRequest.cpp
+14
-17
src/nas/msgs/AuthenticationRequest.hpp
src/nas/msgs/AuthenticationRequest.hpp
+5
-5
No files found.
src/nas/ies/ABBA.cpp
View file @
a78537c1
...
@@ -59,6 +59,23 @@ ABBA::ABBA(uint8_t iei, uint8_t length, uint8_t* value) : Type4NasIe(iei) {
...
@@ -59,6 +59,23 @@ ABBA::ABBA(uint8_t iei, uint8_t length, uint8_t* value) : Type4NasIe(iei) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
ABBA
::~
ABBA
()
{}
ABBA
::~
ABBA
()
{}
//------------------------------------------------------------------------------
void
ABBA
::
Set
(
uint8_t
length
,
uint8_t
*
value
)
{
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
this
->
value_
[
i
]
=
value
[
i
];
}
SetLengthIndicator
(
length
);
}
//------------------------------------------------------------------------------
void
ABBA
::
Set
(
uint8_t
iei
,
uint8_t
length
,
uint8_t
*
value
)
{
SetIei
(
iei
);
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
this
->
value_
[
i
]
=
value
[
i
];
}
SetLengthIndicator
(
length
);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
ABBA
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
int
ABBA
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
...
...
src/nas/ies/ABBA.hpp
View file @
a78537c1
...
@@ -38,9 +38,11 @@ class ABBA : public Type4NasIe {
...
@@ -38,9 +38,11 @@ class ABBA : public Type4NasIe {
ABBA
(
uint8_t
iei
,
uint8_t
length
,
uint8_t
*
value
);
ABBA
(
uint8_t
iei
,
uint8_t
length
,
uint8_t
*
value
);
~
ABBA
();
~
ABBA
();
void
Set
(
uint8_t
length
,
uint8_t
*
value
);
void
Set
(
uint8_t
iei
,
uint8_t
length
,
uint8_t
*
value
);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
// uint8_t GetValue() const;
private:
private:
uint8_t
value_
[
256
];
// TODO:
uint8_t
value_
[
256
];
// TODO:
...
...
src/nas/msgs/AuthenticationRequest.cpp
View file @
a78537c1
...
@@ -29,7 +29,6 @@ using namespace nas;
...
@@ -29,7 +29,6 @@ using namespace nas;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
AuthenticationRequest
::
AuthenticationRequest
()
AuthenticationRequest
::
AuthenticationRequest
()
:
NasMmPlainHeader
(
EPD_5GS_MM_MSG
,
AUTHENTICATION_REQUEST
)
{
:
NasMmPlainHeader
(
EPD_5GS_MM_MSG
,
AUTHENTICATION_REQUEST
)
{
ie_abba
=
NULL
;
ie_authentication_parameter_rand
=
NULL
;
ie_authentication_parameter_rand
=
NULL
;
ie_authentication_parameter_autn
=
NULL
;
ie_authentication_parameter_autn
=
NULL
;
ie_eap_message
=
NULL
;
ie_eap_message
=
NULL
;
...
@@ -52,7 +51,7 @@ void AuthenticationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) {
...
@@ -52,7 +51,7 @@ void AuthenticationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
AuthenticationRequest
::
setABBA
(
uint8_t
length
,
uint8_t
*
value
)
{
void
AuthenticationRequest
::
setABBA
(
uint8_t
length
,
uint8_t
*
value
)
{
ie_abba
=
new
ABBA
(
length
,
value
);
ie_abba
.
Set
(
length
,
value
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -96,20 +95,16 @@ int AuthenticationRequest::Encode(uint8_t* buf, int len) {
...
@@ -96,20 +95,16 @@ int AuthenticationRequest::Encode(uint8_t* buf, int len) {
// Spare half octet
// Spare half octet
encoded_size
++
;
// 1/2 octet + 1/2 octet from ie_ngKSI
encoded_size
++
;
// 1/2 octet + 1/2 octet from ie_ngKSI
if
(
!
ie_abba
)
{
// ABBA
Logger
::
nas_mm
().
warn
(
"IE ie_abba is not available"
);
size
=
ie_abba
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
}
else
{
}
else
{
int
size
=
ie_abba
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
Logger
::
nas_mm
().
error
(
"Encoding ie_abba error"
);
if
(
size
!=
0
)
{
return
0
;
Logger
::
nas_mm
().
debug
(
"0x%x, 0x%x, 0x%x"
,
(
buf
+
encoded_size
)[
0
],
(
buf
+
encoded_size
)[
1
],
(
buf
+
encoded_size
)[
2
]);
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding ie_abba error"
);
return
0
;
}
}
}
// Authentication parameter RAND
if
(
!
ie_authentication_parameter_rand
)
{
if
(
!
ie_authentication_parameter_rand
)
{
Logger
::
nas_mm
().
warn
(
Logger
::
nas_mm
().
warn
(
"IE ie_authentication_parameter_rand is not available"
);
"IE ie_authentication_parameter_rand is not available"
);
...
@@ -123,6 +118,7 @@ int AuthenticationRequest::Encode(uint8_t* buf, int len) {
...
@@ -123,6 +118,7 @@ int AuthenticationRequest::Encode(uint8_t* buf, int len) {
return
0
;
return
0
;
}
}
}
}
// Authentication parameter AUTN
if
(
!
ie_authentication_parameter_autn
)
{
if
(
!
ie_authentication_parameter_autn
)
{
Logger
::
nas_mm
().
warn
(
Logger
::
nas_mm
().
warn
(
"IE ie_authentication_parameter_autn is not available"
);
"IE ie_authentication_parameter_autn is not available"
);
...
@@ -136,6 +132,7 @@ int AuthenticationRequest::Encode(uint8_t* buf, int len) {
...
@@ -136,6 +132,7 @@ int AuthenticationRequest::Encode(uint8_t* buf, int len) {
return
0
;
return
0
;
}
}
}
}
// EAP message
if
(
!
ie_eap_message
)
{
if
(
!
ie_eap_message
)
{
Logger
::
nas_mm
().
warn
(
"IE ie_eap_message is not available"
);
Logger
::
nas_mm
().
warn
(
"IE ie_eap_message is not available"
);
}
else
{
}
else
{
...
@@ -163,10 +160,10 @@ int AuthenticationRequest::Decode(uint8_t* buf, int len) {
...
@@ -163,10 +160,10 @@ int AuthenticationRequest::Decode(uint8_t* buf, int len) {
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
false
);
// length 1/2, low position
false
);
// length 1/2, low position
decoded_size
++
;
// 1/2 octet from ie_ngKSI, 1/2 from Spare half octet
decoded_size
++
;
// 1/2 octet from ie_ngKSI, 1/2 from Spare half octet
ie_abba
=
new
ABBA
();
// ABBA
decoded_size
+=
decoded_size
+=
ie_abba
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
ie_abba
->
Decode
(
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
);
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
))
{
while
((
octet
!=
0x0
))
{
...
...
src/nas/msgs/AuthenticationRequest.hpp
View file @
a78537c1
...
@@ -43,11 +43,11 @@ class AuthenticationRequest : public NasMmPlainHeader {
...
@@ -43,11 +43,11 @@ class AuthenticationRequest : public NasMmPlainHeader {
void
setAuthentication_Parameter_AUTN
(
uint8_t
*
value
);
void
setAuthentication_Parameter_AUTN
(
uint8_t
*
value
);
public:
public:
NasKeySetIdentifier
ie_ngKSI
;
NasKeySetIdentifier
ie_ngKSI
;
// Mandatory
ABBA
*
ie_abba
;
ABBA
ie_abba
;
// Mandatory
Authentication_Parameter_RAND
*
ie_authentication_parameter_rand
;
Authentication_Parameter_RAND
*
ie_authentication_parameter_rand
;
// Optional
Authentication_Parameter_AUTN
*
ie_authentication_parameter_autn
;
Authentication_Parameter_AUTN
*
ie_authentication_parameter_autn
;
// Optional
EAP_Message
*
ie_eap_message
;
EAP_Message
*
ie_eap_message
;
// Optional
};
};
}
// namespace nas
}
// namespace nas
...
...
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