Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UDR
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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-UDR
Commits
5ecea9bc
Commit
5ecea9bc
authored
Jun 24, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
827a7546
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
77 deletions
+7
-77
etc/udr.conf
etc/udr.conf
+1
-1
src/common/common_defs.h
src/common/common_defs.h
+0
-72
src/udr_app/udr_config.cpp
src/udr_app/udr_config.cpp
+6
-4
No files found.
etc/udr.conf
View file @
5ecea9bc
...
...
@@ -12,7 +12,7 @@ UDR =
IPV4_ADDRESS
=
"read"
;
PORT
=
80
;
# YOUR NETWORK CONFIG HERE
HTTP2_PORT
=
8080
;
# YOUR NETWORK CONFIG HERE
API_VERSION
=
"v1"
;
# YOUR
SMF
API VERSION CONFIG HERE
API_VERSION
=
"v1"
;
# YOUR
NUDR
API VERSION CONFIG HERE
};
};
...
...
src/common/common_defs.h
View file @
5ecea9bc
...
...
@@ -36,78 +36,6 @@
#define RETURNerror (int)1
#define RETURNok (int)0
typedef
enum
{
/* Fatal errors - received message should not be processed */
TLV_MAC_MISMATCH
=
-
14
,
TLV_BUFFER_NULL
=
-
13
,
TLV_BUFFER_TOO_SHORT
=
-
12
,
TLV_PROTOCOL_NOT_SUPPORTED
=
-
11
,
TLV_WRONG_MESSAGE_TYPE
=
-
10
,
TLV_OCTET_STRING_TOO_LONG_FOR_IEI
=
-
9
,
TLV_VALUE_DOESNT_MATCH
=
-
4
,
TLV_MANDATORY_FIELD_NOT_PRESENT
=
-
3
,
TLV_UNEXPECTED_IEI
=
-
2
,
TLV_ERROR_OK
=
RETURNok
,
/* Defines error code limit below which received message should be discarded
* because it cannot be further processed */
TLV_FATAL_ERROR
=
TLV_VALUE_DOESNT_MATCH
}
error_code_e
;
//------------------------------------------------------------------------------
#define DECODE_U8(bUFFER, vALUE, sIZE) \
vALUE = *(uint8_t*)(bUFFER); \
sIZE += sizeof(uint8_t)
#define DECODE_U16(bUFFER, vALUE, sIZE) \
vALUE = ntohs(*(uint16_t*)(bUFFER)); \
sIZE += sizeof(uint16_t)
#define DECODE_U24(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*)(bUFFER)) >> 8; \
sIZE += sizeof(uint8_t) + sizeof(uint16_t)
#define DECODE_U32(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*)(bUFFER)); \
sIZE += sizeof(uint32_t)
#if (BYTE_ORDER == LITTLE_ENDIAN)
#define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \
vALUE = ((*(bUFFER)) << 8) | (*((bUFFER) + 1)); \
sIZE += sizeof(uint16_t)
#else
#define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \
vALUE = (*(bUFFER)) | (*((bUFFER) + 1) << 8); \
sIZE += sizeof(uint16_t)
#endif
#define ENCODE_U8(buffer, value, size) \
*(uint8_t*)(buffer) = value; \
size += sizeof(uint8_t)
#define ENCODE_U16(buffer, value, size) \
*(uint16_t*)(buffer) = htons(value); \
size += sizeof(uint16_t)
#define ENCODE_U24(buffer, value, size) \
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint8_t) + sizeof(uint16_t)
#define ENCODE_U32(buffer, value, size) \
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint32_t)
#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR, NwBo, MeSsAgE) \
do { \
struct in_addr inp; \
if (inet_aton(AdDr_StR, &inp) < 0) { \
AssertFatal(0, MeSsAgE); \
} else { \
NwBo = inp.s_addr; \
} \
} while (0)
#define NIPADDR(addr) \
(uint8_t)(addr & 0x000000FF), (uint8_t)((addr & 0x0000FF00) >> 8), \
(uint8_t)((addr & 0x00FF0000) >> 16), \
...
...
src/udr_app/udr_config.cpp
View file @
5ecea9bc
...
...
@@ -39,6 +39,7 @@ namespace config {
udr_config
::
udr_config
()
{}
udr_config
::~
udr_config
()
{}
//------------------------------------------------------------------------------
int
udr_config
::
load
(
const
std
::
string
&
config_file
)
{
Logger
::
udr_app
().
debug
(
"
\n
Load UDR system configuration file(%s)"
,
config_file
.
c_str
());
...
...
@@ -117,6 +118,7 @@ int udr_config::load(const std ::string &config_file) {
return
RETURNok
;
}
//------------------------------------------------------------------------------
int
udr_config
::
load_interface
(
const
libconfig
::
Setting
&
if_cfg
,
interface_cfg_t
&
cfg
)
{
if_cfg
.
lookupValue
(
UDR_CONFIG_STRING_INTERFACE_NAME
,
cfg
.
if_name
);
...
...
@@ -162,6 +164,7 @@ int udr_config::load_interface(const libconfig::Setting &if_cfg,
return
RETURNok
;
}
//------------------------------------------------------------------------------
void
udr_config
::
display
()
{
Logger
::
config
().
info
(
"====================== UDR ====================="
);
...
...
@@ -176,10 +179,9 @@ void udr_config::display() {
Logger
::
config
().
info
(
" Interface name ......: %s"
,
nudr
.
if_name
.
c_str
());
Logger
::
config
().
info
(
" IPv4 Addr ...........: %s"
,
inet_ntoa
(
nudr
.
addr4
));
Logger
::
config
().
info
(
" Port ................: %d"
,
nudr
.
port
);
// Logger::config().info(" HTTP2 port ..........: %d", nudr_http2_port);
/* Logger::config().info(
" API version..........: %s", sbi_api_version.c_str());
*/
Logger
::
config
().
info
(
" HTTP2 port ..........: %d"
,
nudr_http2_port
);
Logger
::
config
().
info
(
" API version..........: %s"
,
nudr_api_version
.
c_str
());
Logger
::
config
().
info
(
"- MYSQL Server Addr...................................: %s"
,
...
...
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