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
2921bc4d
Commit
2921bc4d
authored
Jan 11, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Authentication_Parameter_RAND
parent
25d5a587
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
61 deletions
+62
-61
src/nas/ies/Authentication_Parameter_RAND.cpp
src/nas/ies/Authentication_Parameter_RAND.cpp
+49
-47
src/nas/ies/Authentication_Parameter_RAND.hpp
src/nas/ies/Authentication_Parameter_RAND.hpp
+13
-14
No files found.
src/nas/ies/Authentication_Parameter_RAND.cpp
View file @
2921bc4d
...
...
@@ -18,92 +18,94 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Authentication_Parameter_RAND.hpp"
#include "3gpp_24.501.hpp"
#include "common_defs.h"
#include "logger.hpp"
using
namespace
nas
;
//------------------------------------------------------------------------------
Authentication_Parameter_RAND
::
Authentication_Parameter_RAND
()
:
Type3NasIe
(),
_value
()
{
SetIeName
(
kAuthenticationParameterRandIeName
);
}
//------------------------------------------------------------------------------
Authentication_Parameter_RAND
::
Authentication_Parameter_RAND
(
uint8_t
iei
)
:
_value
()
{
_iei
=
iei
;
:
Type3NasIe
(
iei
),
_value
()
{
SetIeName
(
kAuthenticationParameterRandIeName
)
;
}
//------------------------------------------------------------------------------
Authentication_Parameter_RAND
::
Authentication_Parameter_RAND
(
const
uint8_t
iei
,
uint8_t
*
value
)
{
_iei
=
iei
;
uint8_t
iei
,
uint8_t
*
value
)
:
Type3NasIe
(
iei
)
{
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
this
->
_value
[
i
]
=
value
[
i
];
}
SetIeName
(
kAuthenticationParameterRandIeName
);
}
//------------------------------------------------------------------------------
Authentication_Parameter_RAND
::
Authentication_Parameter_RAND
()
:
_iei
(),
_value
()
{}
//------------------------------------------------------------------------------
Authentication_Parameter_RAND
::~
Authentication_Parameter_RAND
()
{}
/*
//------------------------------------------------------------------------------
uint8_t* Authentication_Parameter_RAND::getValue() {
return _value;
}
*/
//------------------------------------------------------------------------------
int
Authentication_Parameter_RAND
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
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
;
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
if
(
len
<
kAuthenticationParameterRandLength
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
kAuthenticationParameterRandLength
);
return
KEncodeDecodeError
;
}
int
encoded_size
=
0
;
if
(
_iei
)
{
*
(
buf
+
encoded_size
)
=
_iei
;
encoded_size
++
;
memcpy
((
void
*
)
(
buf
+
encoded_size
),
(
void
*
)
_value
,
16
);
encoded_size
+=
16
;
// int i = 0;
// for (int i = 0; i < 16; i++) {
// *(buf + encoded_size) = _value[i]; encoded_size++;
//}
return
encoded_size
;
}
else
{
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
// IEI
encoded_size
+=
Type3NasIe
::
Encode
(
buf
+
encoded_size
,
len
);
for
(
int
i
=
0
;
i
<
kAuthenticationParameterRandLength
-
1
;
i
++
)
{
ENCODE_U8
(
buf
+
encoded_size
,
_value
[
i
],
encoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Encoded
Authentication_Parameter_RAND len (%d)"
,
encoded_size
);
"Encoded
%s, len (%d)"
,
GetIeName
().
c_str
()
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
Authentication_Parameter_RAND
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"Decoding Authentication_Parameter_RAND IEI (0x%x)"
,
*
buf
);
int
decoded_size
=
0
;
if
(
is_option
)
{
decoded_size
++
;
int
Authentication_Parameter_RAND
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
if
(
len
<
kAuthenticationParameterRandLength
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
kAuthenticationParameterRandLength
);
return
KEncodeDecodeError
;
}
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
_value
[
i
]
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
int
decoded_size
=
0
;
// IEI and Length
decoded_size
+=
Type3NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_iei
);
for
(
int
i
=
0
;
i
<
kAuthenticationParameterRandLength
-
1
;
i
++
)
{
DECODE_U8
(
buf
+
decoded_size
,
_value
[
i
],
decoded_size
);
}
for
(
int
j
=
0
;
j
<
16
;
j
++
)
{
for
(
int
j
=
0
;
j
<
kAuthenticationParameterRandLength
-
1
;
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
);
"Decoded
%s, len (%d)"
,
GetIeName
().
c_str
()
,
decoded_size
);
return
decoded_size
;
}
src/nas/ies/Authentication_Parameter_RAND.hpp
View file @
2921bc4d
...
...
@@ -19,34 +19,33 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _AUTHENTICATION_PARAMETER_RAND_H_
#define _AUTHENTICATION_PARAMETER_RAND_H_
#ifndef __Authentication_Parameter_RAND_H_
#define __Authentication_Parameter_RAND_H_
#include "Type3NasIe.hpp"
#include <stdint.h>
constexpr
uint8_t
kAuthenticationParameterRandLength
=
17
;
constexpr
auto
kAuthenticationParameterRandIeName
=
"Authentication Parameter RAND"
;
namespace
nas
{
class
Authentication_Parameter_RAND
{
class
Authentication_Parameter_RAND
:
public
Type3NasIe
{
public:
Authentication_Parameter_RAND
();
Authentication_Parameter_RAND
(
uint8_t
iei
);
Authentication_Parameter_RAND
(
const
uint8_t
iei
,
uint8_t
*
value
);
Authentication_Parameter_RAND
(
uint8_t
iei
,
uint8_t
*
value
);
~
Authentication_Parameter_RAND
();
// void setValue(uint8_t iei, uint8_t value);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
uint8_t
*
getValue
();
// uint8_t* getValue();
private:
uint8_t
_iei
;
uint8_t
_value
[
16
];
uint8_t
_value
[
kAuthenticationParameterRandLength
-
1
];
};
}
// 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