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
1acbf231
Commit
1acbf231
authored
May 21, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fix for mime parser
parent
cb3d3da7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
61 deletions
+41
-61
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+1
-4
src/ngap/ngapMsgs/DownLinkNasTransport.cpp
src/ngap/ngapMsgs/DownLinkNasTransport.cpp
+16
-4
src/utils/CMakeLists.txt
src/utils/CMakeLists.txt
+1
-2
src/utils/http_multi_parser.cpp
src/utils/http_multi_parser.cpp
+0
-51
src/utils/mime_parser.cpp
src/utils/mime_parser.cpp
+19
-0
src/utils/mime_parser.hpp
src/utils/mime_parser.hpp
+4
-0
No files found.
src/amf-app/amf_n11.cpp
View file @
1acbf231
...
@@ -71,9 +71,6 @@ extern void msg_str_2_msg_hex(std::string msg, bstring& b);
...
@@ -71,9 +71,6 @@ extern void msg_str_2_msg_hex(std::string msg, bstring& b);
extern
void
convert_string_2_hex
(
std
::
string
&
input
,
std
::
string
&
output
);
extern
void
convert_string_2_hex
(
std
::
string
&
input
,
std
::
string
&
output
);
extern
void
print_buffer
(
extern
void
print_buffer
(
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
extern
bool
multipart_parser
(
std
::
string
input
,
std
::
string
&
jsonData
,
std
::
string
&
n1sm
,
std
::
string
&
n2sm
);
extern
unsigned
char
*
format_string_as_hex
(
std
::
string
str
);
extern
unsigned
char
*
format_string_as_hex
(
std
::
string
str
);
extern
char
*
bstring2charString
(
bstring
b
);
extern
char
*
bstring2charString
(
bstring
b
);
...
@@ -595,7 +592,7 @@ void amf_n11::curl_http_client(
...
@@ -595,7 +592,7 @@ void amf_n11::curl_http_client(
}
}
if
(
response
.
size
()
>
0
)
{
if
(
response
.
size
()
>
0
)
{
number_parts
=
multipart_parser
(
response
,
json_data_response
,
n1sm
,
n2sm
);
number_parts
=
parser
.
parse
(
response
,
json_data_response
,
n1sm
,
n2sm
);
}
}
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
!=
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
!=
...
...
src/ngap/ngapMsgs/DownLinkNasTransport.cpp
View file @
1acbf231
...
@@ -386,12 +386,18 @@ bool DownLinkNasTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
...
@@ -386,12 +386,18 @@ bool DownLinkNasTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
unsigned
long
DownLinkNasTransportMsg
::
getAmfUeNgapId
()
{
unsigned
long
DownLinkNasTransportMsg
::
getAmfUeNgapId
()
{
return
amfUeNgapId
->
getAMF_UE_NGAP_ID
();
if
(
amfUeNgapId
)
return
amfUeNgapId
->
getAMF_UE_NGAP_ID
();
else
return
0
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
uint32_t
DownLinkNasTransportMsg
::
getRanUeNgapId
()
{
uint32_t
DownLinkNasTransportMsg
::
getRanUeNgapId
()
{
return
ranUeNgapId
->
getRanUeNgapId
();
if
(
ranUeNgapId
)
return
ranUeNgapId
->
getRanUeNgapId
();
else
return
0
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -403,7 +409,10 @@ bool DownLinkNasTransportMsg::getOldAmfName(std::string& name) {
...
@@ -403,7 +409,10 @@ bool DownLinkNasTransportMsg::getOldAmfName(std::string& name) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
uint8_t
DownLinkNasTransportMsg
::
getRanPagingPriority
()
{
uint8_t
DownLinkNasTransportMsg
::
getRanPagingPriority
()
{
return
ranPagingPriority
->
getRANPagingPriority
();
if
(
ranPagingPriority
)
return
ranPagingPriority
->
getRANPagingPriority
();
else
return
0
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -415,7 +424,10 @@ bool DownLinkNasTransportMsg::getNasPdu(uint8_t*& nas, size_t& sizeofnas) {
...
@@ -415,7 +424,10 @@ bool DownLinkNasTransportMsg::getNasPdu(uint8_t*& nas, size_t& sizeofnas) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
uint8_t
DownLinkNasTransportMsg
::
getIndex2Rat_Frequency_SelectionPriority
()
{
uint8_t
DownLinkNasTransportMsg
::
getIndex2Rat_Frequency_SelectionPriority
()
{
return
indexToRFSP
->
getIndexToRFSP
();
if
(
indexToRFSP
)
return
indexToRFSP
->
getIndexToRFSP
();
else
return
0
;
}
}
}
// namespace ngap
}
// namespace ngap
src/utils/CMakeLists.txt
View file @
1acbf231
...
@@ -29,9 +29,8 @@ include_directories(${SRC_TOP_DIR}/utils/bstr)
...
@@ -29,9 +29,8 @@ include_directories(${SRC_TOP_DIR}/utils/bstr)
add_library
(
AMF_UTILS STATIC
add_library
(
AMF_UTILS STATIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/backtrace.c
${
CMAKE_CURRENT_SOURCE_DIR
}
/backtrace.c
${
CMAKE_CURRENT_SOURCE_DIR
}
/conversions.c
${
CMAKE_CURRENT_SOURCE_DIR
}
/conversions.c
${
CMAKE_CURRENT_SOURCE_DIR
}
/dynamic_memory_check.c
${
CMAKE_CURRENT_SOURCE_DIR
}
/dynamic_memory_check.c
${
CMAKE_CURRENT_SOURCE_DIR
}
/hex_string_convert.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/hex_string_convert.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/http_multi_parser.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/if.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/if.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/string.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/string.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/thread_sched.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/thread_sched.cpp
...
...
src/utils/http_multi_parser.cpp
deleted
100644 → 0
View file @
cb3d3da7
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <iostream>
#include <string>
#include "mime_parser.hpp"
uint8_t
multipart_parser
(
std
::
string
input
,
std
::
string
&
jsonData
,
std
::
string
&
n1sm
,
std
::
string
&
n2sm
)
{
// simple parser
mime_parser
sp
=
{};
sp
.
parse
(
input
);
std
::
vector
<
mime_part
>
parts
=
{};
sp
.
get_mime_parts
(
parts
);
uint8_t
size
=
parts
.
size
();
// at least 2 parts for Json data and N1 (+ N2)
if
(
size
<
2
)
{
return
size
;
}
jsonData
=
parts
[
0
].
body
;
n1sm
=
parts
[
1
].
body
;
bool
is_ngap
=
false
;
if
(
size
>
2
)
{
n2sm
=
parts
[
2
].
body
;
}
return
size
;
}
src/utils/mime_parser.cpp
View file @
1acbf231
...
@@ -72,6 +72,25 @@ bool mime_parser::parse(const std::string& str) {
...
@@ -72,6 +72,25 @@ bool mime_parser::parse(const std::string& str) {
return
true
;
return
true
;
}
}
//------------------------------------------------------------------------------
uint8_t
mime_parser
::
parse
(
std
::
string
input
,
std
::
string
&
jsonData
,
std
::
string
&
n1sm
,
std
::
string
&
n2sm
)
{
if
(
!
parse
(
input
))
return
0
;
uint8_t
size
=
mime_parts
.
size
();
if
(
size
>
0
)
{
jsonData
=
mime_parts
[
0
].
body
;
}
if
(
size
>
1
)
{
n1sm
=
mime_parts
[
1
].
body
;
}
if
(
size
>
2
)
{
n2sm
=
mime_parts
[
2
].
body
;
}
return
size
;
}
//------------------------------------------------------------------------------
void
mime_parser
::
get_mime_parts
(
std
::
vector
<
mime_part
>&
parts
)
const
{
void
mime_parser
::
get_mime_parts
(
std
::
vector
<
mime_part
>&
parts
)
const
{
for
(
auto
it
:
mime_parts
)
{
for
(
auto
it
:
mime_parts
)
{
parts
.
push_back
(
it
);
parts
.
push_back
(
it
);
...
...
src/utils/mime_parser.hpp
View file @
1acbf231
...
@@ -50,6 +50,10 @@ class mime_parser {
...
@@ -50,6 +50,10 @@ class mime_parser {
*/
*/
bool
parse
(
const
std
::
string
&
str
);
bool
parse
(
const
std
::
string
&
str
);
uint8_t
parse
(
std
::
string
input
,
std
::
string
&
jsonData
,
std
::
string
&
n1sm
,
std
::
string
&
n2sm
);
/*
/*
* Get vector of Mime parts
* Get vector of Mime parts
* @param [std::vector<mime_part> &] parts: store vector of Mime parts
* @param [std::vector<mime_part> &] parts: store vector of Mime parts
...
...
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