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
Show 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 @@
...
@@ -50,6 +50,10 @@
#include "comUt.hpp"
#include "comUt.hpp"
#include "sha256.hpp"
#include "sha256.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
using
namespace
nas
;
using
namespace
nas
;
using
namespace
amf_application
;
using
namespace
amf_application
;
using
namespace
config
;
using
namespace
config
;
...
@@ -820,7 +824,7 @@ bool amf_n1::authentication_vectors_generator_in_udm(std::shared_ptr<nas_context
...
@@ -820,7 +824,7 @@ bool amf_n1::authentication_vectors_generator_in_udm(std::shared_ptr<nas_context
generate_random
(
vector
[
0
].
rand
,
RAND_LENGTH
);
generate_random
(
vector
[
0
].
rand
,
RAND_LENGTH
);
mysql_push_rand_sqn
(
nc
.
get
()
->
imsi
,
vector
[
0
].
rand
,
sqn
);
mysql_push_rand_sqn
(
nc
.
get
()
->
imsi
,
vector
[
0
].
rand
,
sqn
);
mysql_increment_sqn
(
nc
.
get
()
->
imsi
);
mysql_increment_sqn
(
nc
.
get
()
->
imsi
);
free
(
sqn
);
free
_wrapper
((
void
**
)
&
sqn
);
}
}
if
(
!
get_mysql_auth_info
(
nc
.
get
()
->
imsi
,
mysql_resp
))
{
if
(
!
get_mysql_auth_info
(
nc
.
get
()
->
imsi
,
mysql_resp
))
{
Logger
::
amf_n1
().
error
(
"Cannot get data from MySQL"
);
Logger
::
amf_n1
().
error
(
"Cannot get data from MySQL"
);
...
...
src/amf-app/amf_n11.cpp
View file @
aec38a2f
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include <curl/curl.h>
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include <nlohmann/json.hpp>
#include "dynamic_memory_check.h"
#include "amf_n1.hpp"
#include "amf_n1.hpp"
#include "itti.hpp"
#include "itti.hpp"
#include "itti_msg_amf_app.hpp"
#include "itti_msg_amf_app.hpp"
...
@@ -46,20 +45,21 @@
...
@@ -46,20 +45,21 @@
#include "ApiClient.h"
#include "ApiClient.h"
#include "mime_parser.hpp"
#include "mime_parser.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
using
namespace
oai
::
smf
::
model
;
using
namespace
oai
::
smf
::
model
;
using
namespace
oai
::
smf
::
api
;
using
namespace
oai
::
smf
::
api
;
using
namespace
web
;
using
namespace
web
;
// Common features like URIs.
using
namespace
web
::
http
;
// Common features like URIs.
using
namespace
web
::
http
;
using
namespace
web
::
http
::
client
;
// Common HTTP functionality
// Common HTTP functionality
using
namespace
web
::
http
::
client
;
using
namespace
config
;
using
namespace
config
;
using
namespace
amf_application
;
using
namespace
amf_application
;
extern
itti_mw
*
itti_inst
;
extern
itti_mw
*
itti_inst
;
extern
amf_config
amf_cfg
;
extern
amf_config
amf_cfg
;
extern
amf_n11
*
amf_n11_inst
;
extern
amf_n11
*
amf_n11_inst
;
extern
amf_n1
*
amf_n1_inst
;
extern
amf_n1
*
amf_n1_inst
;
extern
void
msg_str_2_msg_hex
(
std
::
string
msg
,
bstring
&
b
);
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) {
...
@@ -219,8 +219,7 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
if
((
smf
.
dnn
!=
nullptr
)
&&
(
blength
(
smf
.
dnn
)
>
0
))
{
if
((
smf
.
dnn
!=
nullptr
)
&&
(
blength
(
smf
.
dnn
)
>
0
))
{
char
*
tmp
=
bstring2charString
(
smf
.
dnn
);
char
*
tmp
=
bstring2charString
(
smf
.
dnn
);
dnn
=
tmp
;
dnn
=
tmp
;
free
(
tmp
);
free_wrapper
((
void
**
)
&
tmp
);
tmp
=
nullptr
;
}
}
Logger
::
amf_n11
().
debug
(
"Requested DNN: %s"
,
dnn
.
c_str
());
Logger
::
amf_n11
().
debug
(
"Requested DNN: %s"
,
dnn
.
c_str
());
...
@@ -431,11 +430,16 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData, std:
...
@@ -431,11 +430,16 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData, std:
std
::
string
header_response
=
*
httpHeaderData
.
get
();
std
::
string
header_response
=
*
httpHeaderData
.
get
();
std
::
string
CRLF
=
"
\r\n
"
;
std
::
string
CRLF
=
"
\r\n
"
;
std
::
size_t
location_pos
=
header_response
.
find
(
"Location"
);
std
::
size_t
location_pos
=
header_response
.
find
(
"Location"
);
if
(
location_pos
!=
std
::
string
::
npos
)
{
std
::
size_t
crlf_pos
=
header_response
.
find
(
CRLF
,
location_pos
);
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
));
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
());
Logger
::
amf_n11
().
info
(
"Location of the created SMF context
: %s"
,
location
.
c_str
());
psc
.
get
()
->
smf_context_location
=
location
;
psc
.
get
()
->
smf_context_location
=
location
;
}
}
}
}
nlohmann
::
json
response_data
=
{
};
nlohmann
::
json
response_data
=
{
};
bstring
n1sm_hex
;
bstring
n1sm_hex
;
...
@@ -464,9 +468,5 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData, std:
...
@@ -464,9 +468,5 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData, std:
}
}
curl_global_cleanup
();
curl_global_cleanup
();
if
(
body_data
!=
nullptr
)
{
free_wrapper
((
void
**
)
&
body_data
);
free
(
body_data
);
body_data
=
NULL
;
}
}
}
src/amf-app/amf_n2.hpp
View file @
aec38a2f
...
@@ -62,17 +62,4 @@ class amf_n2 : public ngap::ngap_app{
...
@@ -62,17 +62,4 @@ class amf_n2 : public ngap::ngap_app{
}
}
#endif
#endif
src/amf-app/amf_statistics.cpp
View file @
aec38a2f
...
@@ -57,7 +57,7 @@ void statistics::display() {
...
@@ -57,7 +57,7 @@ void statistics::display() {
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------------------------------------------------------------------|"
);
Logger
::
amf_app
().
info
(
"|----------------------------------------------------UEs' information--------------------------------------------|"
);
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
++
)
{
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("[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
);
...
...
src/utils/hex_string_convert.cpp
View file @
aec38a2f
...
@@ -4,6 +4,10 @@
...
@@ -4,6 +4,10 @@
#include "conversions.hpp"
#include "conversions.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
void
convert_string_2_hex
(
std
::
string
&
input_str
,
std
::
string
&
output_str
)
void
convert_string_2_hex
(
std
::
string
&
input_str
,
std
::
string
&
output_str
)
{
{
unsigned
char
*
data
=
(
unsigned
char
*
)
malloc
(
input_str
.
length
()
+
1
);
unsigned
char
*
data
=
(
unsigned
char
*
)
malloc
(
input_str
.
length
()
+
1
);
...
@@ -62,9 +66,7 @@ unsigned char * format_string_as_hex(std::string str){
...
@@ -62,9 +66,7 @@ unsigned char * format_string_as_hex(std::string str){
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
free
(
data
);
free_wrapper
((
void
**
)
&
data
);
data
=
nullptr
;
return
datavalue
;
return
datavalue
;
}
}
...
@@ -74,8 +76,7 @@ char* bstring2charString(bstring b){
...
@@ -74,8 +76,7 @@ char* bstring2charString(bstring b){
for
(
int
i
=
0
;
i
<
blength
(
b
);
i
++
)
for
(
int
i
=
0
;
i
<
blength
(
b
);
i
++
)
buf
[
i
]
=
(
char
)
value
[
i
];
buf
[
i
]
=
(
char
)
value
[
i
];
buf
[
blength
(
b
)]
=
'\0'
;
buf
[
blength
(
b
)]
=
'\0'
;
free
(
value
);
free_wrapper
((
void
**
)
&
value
);
value
=
nullptr
;
return
buf
;
return
buf
;
}
}
...
...
src/utils/mime_parser.cpp
View file @
aec38a2f
...
@@ -23,6 +23,10 @@
...
@@ -23,6 +23,10 @@
#include "logger.hpp"
#include "logger.hpp"
#include "conversions.hpp"
#include "conversions.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
bool
mime_parser
::
parse
(
const
std
::
string
&
str
)
{
bool
mime_parser
::
parse
(
const
std
::
string
&
str
)
{
std
::
string
CRLF
=
"
\r\n
"
;
std
::
string
CRLF
=
"
\r\n
"
;
Logger
::
amf_app
().
debug
(
"Parsing the message with Simple Parser"
);
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) {
...
@@ -91,10 +95,7 @@ unsigned char* mime_parser::format_string_as_hex(const std::string &str) {
printf
(
"
\n
"
);
printf
(
"
\n
"
);
#endif
#endif
//free memory
//free memory
//free_wrapper((void**) &data);
free_wrapper
((
void
**
)
&
data
);
free
(
data
);
data
=
NULL
;
return
data_hex
;
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