Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
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-SMF
Commits
89b5f827
Commit
89b5f827
authored
Apr 01, 2022
by
KARIM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backup before adding qos rule update
parent
f443d4e9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
1 deletion
+115
-1
src/smf_app/smf_app.hpp
src/smf_app/smf_app.hpp
+8
-0
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+32
-0
src/smf_app/smf_config.hpp
src/smf_app/smf_config.hpp
+5
-1
src/smf_app/smf_pco.cpp
src/smf_app/smf_pco.cpp
+68
-0
src/smf_app/smf_pco.hpp
src/smf_app/smf_pco.hpp
+2
-0
No files found.
src/smf_app/smf_app.hpp
View file @
89b5f827
...
...
@@ -203,6 +203,14 @@ class smf_app {
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
);
int
process_pco_p_cscf_request
(
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
);
int
process_pco_p_cscf_v6_request
(
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
);
public:
explicit
smf_app
(
const
std
::
string
&
config_file
);
smf_app
(
smf_app
const
&
)
=
delete
;
...
...
src/smf_app/smf_config.cpp
View file @
89b5f827
...
...
@@ -508,12 +508,37 @@ int smf_config::load(const string& config_file) {
util
::
trim
(
astring
).
c_str
(),
default_dnsv4
,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"
);
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
default_dns_secv4
,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"
);
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_CSCF_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
default_cscfv4
,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT CSCF !"
);
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_CSCF_IPV6_ADDRESS
,
astring
);
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
astring
).
c_str
(),
buf_in6_addr
)
==
1
)
{
memcpy
(
&
default_cscfv6
,
buf_in6_addr
,
sizeof
(
struct
in6_addr
));
}
else
{
Logger
::
smf_app
().
error
(
"CONFIG : BAD ADDRESS in "
SMF_CONFIG_STRING_DEFAULT_CSCF_IPV6_ADDRESS
" %s"
,
astring
.
c_str
());
throw
(
"CONFIG : BAD ADDRESS in "
SMF_CONFIG_STRING_DEFAULT_CSCF_IPV6_ADDRESS
" %s"
,
astring
.
c_str
());
}
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS
,
astring
);
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
astring
).
c_str
(),
buf_in6_addr
)
==
1
)
{
memcpy
(
&
default_dnsv6
,
buf_in6_addr
,
sizeof
(
struct
in6_addr
));
...
...
@@ -857,6 +882,13 @@ void smf_config::display() {
Logger
::
smf_app
().
info
(
" Secondary DNS v6 ....: %s"
,
str_addr6
);
}
Logger
::
smf_app
().
info
(
" CSCF .........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
default_cscfv4
)));
if
(
inet_ntop
(
AF_INET6
,
&
default_cscfv6
,
str_addr6
,
sizeof
(
str_addr6
)))
{
Logger
::
smf_app
().
info
(
" CSCF v6 ......: %s"
,
str_addr6
);
}
Logger
::
smf_app
().
info
(
"- "
SMF_CONFIG_STRING_DNN_LIST
":"
);
for
(
int
i
=
0
;
i
<
num_dnn
;
i
++
)
{
Logger
::
smf_app
().
info
(
" DNN %d:"
,
i
);
...
...
src/smf_app/smf_config.hpp
View file @
89b5f827
...
...
@@ -66,6 +66,9 @@
#define SMF_CONFIG_STRING_IPV4_ADDRESS_RANGE_DELIMITER "-"
#define SMF_CONFIG_STRING_IPV6_ADDRESS_PREFIX_DELIMITER "/"
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV4_ADDRESS "DEFAULT_DNS_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_CSCF_IPV4_ADDRESS "DEFAULT_CSCF_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_CSCF_IPV6_ADDRESS "DEFAULT_CSCF_IPV6_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS \
"DEFAULT_DNS_SEC_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS "DEFAULT_DNS_IPV6_ADDRESS"
...
...
@@ -181,9 +184,10 @@ class smf_config {
struct
in_addr
default_dnsv4
;
struct
in_addr
default_dns_secv4
;
struct
in_addr
default_cscfv4
;
struct
in6_addr
default_dnsv6
;
struct
in6_addr
default_dns_secv6
;
struct
in6_addr
default_cscfv6
;
#define SMF_NUM_DNN_MAX 5
int
num_dnn
;
struct
{
...
...
src/smf_app/smf_pco.cpp
View file @
89b5f827
...
...
@@ -335,6 +335,63 @@ int smf_app::process_pco_link_mtu_request(
return
pco_push_protocol_or_container_id
(
pco_resp
,
&
poc_id_resp
);
}
//------------------------------------------------------------------------------
int
smf_app
::
process_pco_p_cscf_request
(
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
)
{
in_addr_t
cscf_ipv4_addr
=
smf_cfg
.
default_cscfv4
.
s_addr
;
pco_protocol_or_container_id_t
poc_id_resp
=
{
0
};
uint8_t
cscf_array
[
4
];
Logger
::
smf_app
().
debug
(
"PCO: Protocol identifier P CSCF Request"
);
poc_id_resp
.
protocol_id
=
PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV4_ADDRESS
;
poc_id_resp
.
length_of_protocol_id_contents
=
4
;
cscf_array
[
0
]
=
(
uint8_t
)(
cscf_ipv4_addr
&
0x000000FF
);
cscf_array
[
1
]
=
(
uint8_t
)((
cscf_ipv4_addr
>>
8
)
&
0x000000FF
);
cscf_array
[
2
]
=
(
uint8_t
)((
cscf_ipv4_addr
>>
16
)
&
0x000000FF
);
cscf_array
[
3
]
=
(
uint8_t
)((
cscf_ipv4_addr
>>
24
)
&
0x000000FF
);
std
::
string
tmp_s
((
const
char
*
)
&
cscf_array
[
0
],
sizeof
(
cscf_array
));
poc_id_resp
.
protocol_id_contents
=
tmp_s
;
return
pco_push_protocol_or_container_id
(
pco_resp
,
&
poc_id_resp
);
}
//------------------------------------------------------------------------------
int
smf_app
::
process_pco_p_cscf_v6_request
(
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
)
{
in6_addr
cscf_ipv6_addr
=
smf_cfg
.
default_cscfv6
;
pco_protocol_or_container_id_t
poc_id_resp
=
{
0
};
uint8_t
cscfv6_array
[
16
];
Logger
::
smf_app
().
debug
(
"PCO: Protocol identifier P CSCF v6 Request"
);
poc_id_resp
.
protocol_id
=
PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV6_ADDRESS
;
poc_id_resp
.
length_of_protocol_id_contents
=
16
;
char
str_addr6
[
INET6_ADDRSTRLEN
];
if
(
inet_ntop
(
AF_INET6
,
&
cscf_ipv6_addr
,
str_addr6
,
sizeof
(
str_addr6
)))
{
std
::
string
ipv6_addr_str
((
char
*
)
str_addr6
,
INET6_ADDRSTRLEN
);
Logger
::
smf_app
().
info
(
" CSCF Ipv6 address....: %s"
,
ipv6_addr_str
.
c_str
());
unsigned
char
buf_in6_addr
[
sizeof
(
struct
in6_addr
)];
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
ipv6_addr_str
).
c_str
(),
buf_in6_addr
)
==
1
)
{
for
(
int
i
=
0
;
i
<=
15
;
i
++
)
cscfv6_array
[
i
]
=
(
uint8_t
)(
buf_in6_addr
[
i
]);
}
}
std
::
string
tmp_s
((
const
char
*
)
&
cscfv6_array
[
0
],
sizeof
(
cscfv6_array
));
poc_id_resp
.
protocol_id_contents
=
tmp_s
;
return
pco_push_protocol_or_container_id
(
pco_resp
,
&
poc_id_resp
);
}
//------------------------------------------------------------------------------
int
smf_app
::
process_pco_request
(
const
protocol_configuration_options_t
&
pco_req
,
...
...
@@ -384,6 +441,17 @@ int smf_app::process_pco_request(
pco_ids
.
ci_ipv4_link_mtu_request
=
true
;
break
;
case
PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV6_ADDRESS_REQUEST
:
process_pco_p_cscf_v6_request
(
pco_resp
,
&
pco_req
.
protocol_or_container_ids
[
id
]);
pco_ids
.
ci_ipv6_p_cscf_request
=
true
;
break
;
case
PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV4_ADDRESS_REQUEST
:
process_pco_p_cscf_request
(
pco_resp
,
&
pco_req
.
protocol_or_container_ids
[
id
]);
pco_ids
.
ci_ipv4_p_cscf_request
=
true
;
break
;
default:
Logger
::
smf_app
().
warn
(
"PCO: Protocol/container identifier 0x%04X not supported now"
,
...
...
src/smf_app/smf_pco.hpp
View file @
89b5f827
...
...
@@ -48,6 +48,8 @@ typedef struct protocol_configuration_options_ids_s {
uint8_t
ci_ipv4_address_allocation_via_dhcpv4
:
1
;
uint8_t
ci_ipv4_link_mtu_request
:
1
;
uint8_t
ci_dns_server_ipv6_address_request
:
1
;
uint8_t
ci_ipv6_p_cscf_request
:
1
;
uint8_t
ci_ipv4_p_cscf_request
:
1
;
}
protocol_configuration_options_ids_t
;
#endif
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