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
aec38a2f
Commit
aec38a2f
authored
Sep 12, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use free_wrapper instead of naked free
parent
3fea6ab9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
43 deletions
+36
-43
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+5
-1
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+17
-17
src/amf-app/amf_n2.hpp
src/amf-app/amf_n2.hpp
+0
-13
src/amf-app/amf_statistics.cpp
src/amf-app/amf_statistics.cpp
+3
-3
src/utils/hex_string_convert.cpp
src/utils/hex_string_convert.cpp
+6
-5
src/utils/mime_parser.cpp
src/utils/mime_parser.cpp
+5
-4
No files found.
src/amf-app/amf_n1.cpp
View file @
aec38a2f
...
...
@@ -50,6 +50,10 @@
#include "comUt.hpp"
#include "sha256.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
using
namespace
nas
;
using
namespace
amf_application
;
using
namespace
config
;
...
...
@@ -820,7 +824,7 @@ bool amf_n1::authentication_vectors_generator_in_udm(std::shared_ptr<nas_context
generate_random
(
vector
[
0
].
rand
,
RAND_LENGTH
);
mysql_push_rand_sqn
(
nc
.
get
()
->
imsi
,
vector
[
0
].
rand
,
sqn
);
mysql_increment_sqn
(
nc
.
get
()
->
imsi
);
free
(
sqn
);
free
_wrapper
((
void
**
)
&
sqn
);
}
if
(
!
get_mysql_auth_info
(
nc
.
get
()
->
imsi
,
mysql_resp
))
{
Logger
::
amf_n1
().
error
(
"Cannot get data from MySQL"
);
...
...
src/amf-app/amf_n11.cpp
View file @
aec38a2f
...
...
@@ -31,7 +31,6 @@
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include "dynamic_memory_check.h"
#include "amf_n1.hpp"
#include "itti.hpp"
#include "itti_msg_amf_app.hpp"
...
...
@@ -46,20 +45,21 @@
#include "ApiClient.h"
#include "mime_parser.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
using
namespace
oai
::
smf
::
model
;
using
namespace
oai
::
smf
::
api
;
using
namespace
web
;
// Common features like URIs.
using
namespace
web
::
http
;
// Common HTTP functionality
using
namespace
web
::
http
::
client
;
using
namespace
web
::
http
;
// Common features like URIs.
using
namespace
web
::
http
::
client
;
// Common HTTP functionality
using
namespace
config
;
using
namespace
amf_application
;
extern
itti_mw
*
itti_inst
;
extern
amf_config
amf_cfg
;
extern
amf_n11
*
amf_n11_inst
;
extern
amf_n1
*
amf_n1_inst
;
extern
void
msg_str_2_msg_hex
(
std
::
string
msg
,
bstring
&
b
);
...
...
@@ -219,8 +219,7 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
if
((
smf
.
dnn
!=
nullptr
)
&&
(
blength
(
smf
.
dnn
)
>
0
))
{
char
*
tmp
=
bstring2charString
(
smf
.
dnn
);
dnn
=
tmp
;
free
(
tmp
);
tmp
=
nullptr
;
free_wrapper
((
void
**
)
&
tmp
);
}
Logger
::
amf_n11
().
debug
(
"Requested DNN: %s"
,
dnn
.
c_str
());
...
...
@@ -431,10 +430,15 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData, std:
std
::
string
header_response
=
*
httpHeaderData
.
get
();
std
::
string
CRLF
=
"
\r\n
"
;
std
::
size_t
location_pos
=
header_response
.
find
(
"Location"
);
std
::
size_t
crlf_pos
=
header_response
.
find
(
CRLF
,
location_pos
);
std
::
string
location
=
header_response
.
substr
(
location_pos
+
10
,
crlf_pos
-
(
location_pos
+
10
));
Logger
::
amf_n11
().
info
(
"Location of the SMF context created: %s"
,
location
.
c_str
());
psc
.
get
()
->
smf_context_location
=
location
;
if
(
location_pos
!=
std
::
string
::
npos
)
{
std
::
size_t
crlf_pos
=
header_response
.
find
(
CRLF
,
location_pos
);
if
(
crlf_pos
!=
std
::
string
::
npos
)
{
std
::
string
location
=
header_response
.
substr
(
location_pos
+
10
,
crlf_pos
-
(
location_pos
+
10
));
Logger
::
amf_n11
().
info
(
"Location of the created SMF context: %s"
,
location
.
c_str
());
psc
.
get
()
->
smf_context_location
=
location
;
}
}
}
nlohmann
::
json
response_data
=
{
};
...
...
@@ -464,9 +468,5 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData, std:
}
curl_global_cleanup
();
if
(
body_data
!=
nullptr
)
{
free
(
body_data
);
body_data
=
NULL
;
}
free_wrapper
((
void
**
)
&
body_data
);
}
src/amf-app/amf_n2.hpp
View file @
aec38a2f
...
...
@@ -62,17 +62,4 @@ class amf_n2 : public ngap::ngap_app{
}
#endif
src/amf-app/amf_statistics.cpp
View file @
aec38a2f
...
...
@@ -44,7 +44,7 @@ void statistics::display() {
Logger
::
amf_app
().
info
(
"|----------------------------------------------------gNBs' information--------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"| Index | Status | Global ID | gNB Name | Tracking Area (PLMN, TAC)| "
);
if
(
gnbs
.
size
()
==
0
)
{
Logger
::
amf_app
().
info
(
"| - | - | - | -
| -
| "
);
Logger
::
amf_app
().
info
(
"| - | - | - | -
| -
| "
);
}
//TODO: Show the list of common PLMNs
...
...
@@ -57,10 +57,10 @@ void statistics::display() {
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------UEs' information--------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"| Index | Connection state | Registration state | IMSI | GUTI |
RAN UE NGAP ID | AMF UE ID
|"
);
Logger
::
amf_app
().
info
(
"| Index | Connection state | Registration state | IMSI | GUTI |
RAN UE NGAP ID|AMF UE ID
|"
);
for
(
int
i
=
0
;
i
<
ues
.
size
();
i
++
)
{
//Logger::amf_app().info("[index %d][%s][%s][imsi %s][guti %s]", i + 1, ues[i].connStatus.c_str(), ues[i].registerStatus.c_str(), ues[i].imsi.c_str(), ues[i].guti.c_str());
Logger
::
amf_app
().
info
(
"| %d |
%s | %s | %s | %s | %d | %d
| "
,
i
+
1
,
ues
[
i
].
connStatus
.
c_str
(),
ues
[
i
].
registerStatus
.
c_str
(),
ues
[
i
].
imsi
.
c_str
(),
ues
[
i
].
guti
.
c_str
(),
ues
[
i
].
ranid
,
ues
[
i
].
amfid
);
Logger
::
amf_app
().
info
(
"| %d |
%s | %s | %s | %s | %d | %d
| "
,
i
+
1
,
ues
[
i
].
connStatus
.
c_str
(),
ues
[
i
].
registerStatus
.
c_str
(),
ues
[
i
].
imsi
.
c_str
(),
ues
[
i
].
guti
.
c_str
(),
ues
[
i
].
ranid
,
ues
[
i
].
amfid
);
//Logger::amf_app().info("Current ran_ue_ngap_id[%d]; Current amf_ue_ngap_id[%d]", ues[i].ranid, ues[i].amfid);
Logger
::
amf_app
().
info
(
"Location[NrCgi][PLMN(%s), cellID(%d)]"
,
(
ues
[
i
].
mcc
+
ues
[
i
].
mnc
).
c_str
(),
ues
[
i
].
cellId
);
...
...
src/utils/hex_string_convert.cpp
View file @
aec38a2f
...
...
@@ -4,6 +4,10 @@
#include "conversions.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
void
convert_string_2_hex
(
std
::
string
&
input_str
,
std
::
string
&
output_str
)
{
unsigned
char
*
data
=
(
unsigned
char
*
)
malloc
(
input_str
.
length
()
+
1
);
...
...
@@ -62,9 +66,7 @@ unsigned char * format_string_as_hex(std::string str){
}
printf
(
"
\n
"
);
free
(
data
);
data
=
nullptr
;
free_wrapper
((
void
**
)
&
data
);
return
datavalue
;
}
...
...
@@ -74,8 +76,7 @@ char* bstring2charString(bstring b){
for
(
int
i
=
0
;
i
<
blength
(
b
);
i
++
)
buf
[
i
]
=
(
char
)
value
[
i
];
buf
[
blength
(
b
)]
=
'\0'
;
free
(
value
);
value
=
nullptr
;
free_wrapper
((
void
**
)
&
value
);
return
buf
;
}
...
...
src/utils/mime_parser.cpp
View file @
aec38a2f
...
...
@@ -23,6 +23,10 @@
#include "logger.hpp"
#include "conversions.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
bool
mime_parser
::
parse
(
const
std
::
string
&
str
)
{
std
::
string
CRLF
=
"
\r\n
"
;
Logger
::
amf_app
().
debug
(
"Parsing the message with Simple Parser"
);
...
...
@@ -91,10 +95,7 @@ unsigned char* mime_parser::format_string_as_hex(const std::string &str) {
printf
(
"
\n
"
);
#endif
//free memory
//free_wrapper((void**) &data);
free
(
data
);
data
=
NULL
;
free_wrapper
((
void
**
)
&
data
);
return
data_hex
;
}
...
...
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