Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AUSF
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-AUSF
Commits
848b0a58
Unverified
Commit
848b0a58
authored
Oct 21, 2021
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix config parse
parent
91472316
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
43 deletions
+44
-43
src/ausf_app/ausf_config.cpp
src/ausf_app/ausf_config.cpp
+44
-43
No files found.
src/ausf_app/ausf_config.cpp
View file @
848b0a58
...
...
@@ -216,55 +216,56 @@ int ausf_config::load(const std::string& config_file) {
}
// NRF
try
{
std
::
string
astring
=
{};
const
Setting
&
nrf_cfg
=
ausf_cfg
[
AUSF_CONFIG_STRING_NRF
];
struct
in_addr
nrf_ipv4_addr
=
{};
unsigned
int
nrf_port
=
0
;
std
::
string
nrf_api_version
=
{};
if
(
!
use_fqdn_dns
)
{
nrf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_NRF_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
nrf_ipv4_addr
,
"BAD IPv4 ADDRESS FORMAT FOR NRF !"
);
nrf_addr
.
ipv4_addr
=
nrf_ipv4_addr
;
if
(
!
(
nrf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_NRF_PORT
,
nrf_port
)))
{
Logger
::
ausf_app
().
error
(
AUSF_CONFIG_STRING_NRF_PORT
"failed"
);
throw
(
AUSF_CONFIG_STRING_NRF_PORT
"failed"
);
}
nrf_addr
.
port
=
nrf_port
;
if
(
register_nrf
)
{
try
{
std
::
string
astring
=
{};
if
(
!
(
nrf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_API_VERSION
,
nrf_api_version
)))
{
Logger
::
ausf_app
().
error
(
AUSF_CONFIG_STRING_API_VERSION
"failed"
);
throw
(
AUSF_CONFIG_STRING_API_VERSION
"failed"
);
}
nrf_addr
.
api_version
=
nrf_api_version
;
const
Setting
&
nrf_cfg
=
ausf_cfg
[
AUSF_CONFIG_STRING_NRF
];
struct
in_addr
nrf_ipv4_addr
=
{};
unsigned
int
nrf_port
=
0
;
std
::
string
nrf_api_version
=
{};
}
else
{
nrf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_FQDN_DNS
,
astring
);
uint8_t
addr_type
=
{
0
};
std
::
string
address
=
{};
fqdn
::
resolve
(
astring
,
address
,
nrf_port
,
addr_type
);
if
(
addr_type
!=
0
)
{
// IPv6
// TODO:
throw
(
"DO NOT SUPPORT IPV6 ADDR FOR NRF!"
);
}
else
{
// IPv4
if
(
!
use_fqdn_dns
)
{
nrf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_NRF_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
a
ddress
).
c_str
(),
nrf_ipv4_addr
,
util
::
trim
(
a
string
).
c_str
(),
nrf_ipv4_addr
,
"BAD IPv4 ADDRESS FORMAT FOR NRF !"
);
nrf_addr
.
ipv4_addr
=
nrf_ipv4_addr
;
nrf_addr
.
port
=
nrf_port
;
nrf_addr
.
api_version
=
"v1"
;
// TODO: to get API version from DNS
nrf_addr
.
fqdn
=
astring
;
nrf_addr
.
ipv4_addr
=
nrf_ipv4_addr
;
if
(
!
(
nrf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_NRF_PORT
,
nrf_port
)))
{
Logger
::
ausf_app
().
error
(
AUSF_CONFIG_STRING_NRF_PORT
"failed"
);
throw
(
AUSF_CONFIG_STRING_NRF_PORT
"failed"
);
}
nrf_addr
.
port
=
nrf_port
;
if
(
!
(
nrf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_API_VERSION
,
nrf_api_version
)))
{
Logger
::
ausf_app
().
error
(
AUSF_CONFIG_STRING_API_VERSION
"failed"
);
throw
(
AUSF_CONFIG_STRING_API_VERSION
"failed"
);
}
nrf_addr
.
api_version
=
nrf_api_version
;
}
else
{
nrf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_FQDN_DNS
,
astring
);
uint8_t
addr_type
=
{
0
};
std
::
string
address
=
{};
fqdn
::
resolve
(
astring
,
address
,
nrf_port
,
addr_type
);
if
(
addr_type
!=
0
)
{
// IPv6
// TODO:
throw
(
"DO NOT SUPPORT IPV6 ADDR FOR NRF!"
);
}
else
{
// IPv4
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
address
).
c_str
(),
nrf_ipv4_addr
,
"BAD IPv4 ADDRESS FORMAT FOR NRF !"
);
nrf_addr
.
ipv4_addr
=
nrf_ipv4_addr
;
nrf_addr
.
port
=
nrf_port
;
nrf_addr
.
api_version
=
"v1"
;
// TODO: to get API version from DNS
nrf_addr
.
fqdn
=
astring
;
}
}
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
ausf_app
().
error
(
"%s : %s"
,
nfex
.
what
(),
nfex
.
getPath
());
return
RETURNerror
;
}
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
ausf_app
().
error
(
"%s : %s"
,
nfex
.
what
(),
nfex
.
getPath
());
return
RETURNerror
;
}
return
RETURNok
;
}
...
...
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