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
2f944389
Commit
2f944389
authored
Mar 10, 2021
by
Tien-Thinh Nguyen
Committed by
kharade
May 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for supporting FQDN (from SPGWC)
parent
ff6ce4a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
5 deletions
+99
-5
src/common/3gpp_29.244.h
src/common/3gpp_29.244.h
+37
-0
src/pfcp/3gpp_29.244.hpp
src/pfcp/3gpp_29.244.hpp
+62
-5
No files found.
src/common/3gpp_29.244.h
View file @
2f944389
...
...
@@ -1041,6 +1041,43 @@ struct node_id_s {
return
false
;
}
};
bool
operator
==
(
const
std
::
string
&
f
)
const
{
if
((
NODE_ID_TYPE_FQDN
==
this
->
node_id_type
)
&&
(
fqdn
.
compare
(
f
)
==
0
))
{
return
true
;
}
else
{
return
false
;
}
};
bool
operator
==
(
const
struct
in_addr
&
a
)
const
{
if
((
NODE_ID_TYPE_IPV4_ADDRESS
==
this
->
node_id_type
)
&&
(
a
.
s_addr
==
u1
.
ipv4_address
.
s_addr
))
{
return
true
;
}
else
{
return
false
;
}
};
bool
operator
==
(
const
struct
in6_addr
&
i
)
const
{
if
((
NODE_ID_TYPE_IPV6_ADDRESS
==
this
->
node_id_type
)
&&
(
i
.
s6_addr32
[
0
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
0
])
&&
(
i
.
s6_addr32
[
1
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
1
])
&&
(
i
.
s6_addr32
[
2
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
2
])
&&
(
i
.
s6_addr32
[
3
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
3
]))
{
return
true
;
}
else
{
return
false
;
}
};
std
::
string
toString
()
const
{
if
(
NODE_ID_TYPE_FQDN
==
this
->
node_id_type
)
{
return
fqdn
;
}
if
(
NODE_ID_TYPE_IPV4_ADDRESS
==
this
->
node_id_type
)
{
return
conv
::
toString
(
u1
.
ipv4_address
);
}
else
if
(
NODE_ID_TYPE_IPV6_ADDRESS
==
this
->
node_id_type
)
{
return
conv
::
toString
(
u1
.
ipv6_address
);
}
return
std
::
string
(
"Node id - unknown node id type"
);
}
};
typedef
struct
node_id_s
node_id_t
;
//-------------------------------------
...
...
src/pfcp/3gpp_29.244.hpp
View file @
2f944389
...
...
@@ -123,6 +123,59 @@ class pfcp_ie : public stream_serializable {
};
static
pfcp_ie
*
new_pfcp_ie_from_stream
(
std
::
istream
&
is
);
//from SPGWC
static
bool
string_to_dotted
(
const
std
::
string
&
str
,
std
::
string
&
dotted
)
{
uint8_t
offset
=
0
;
uint8_t
*
last_size
;
uint8_t
word_length
=
0
;
uint8_t
value
[
str
.
length
()
+
1
];
dotted
=
{};
last_size
=
&
value
[
0
];
while
(
str
[
offset
])
{
// We replace the . by the length of the word
if
(
str
[
offset
]
==
'.'
)
{
*
last_size
=
word_length
;
word_length
=
0
;
last_size
=
&
value
[
offset
+
1
];
}
else
{
word_length
++
;
value
[
offset
+
1
]
=
str
[
offset
];
}
offset
++
;
}
*
last_size
=
word_length
;
dotted
.
assign
((
const
char
*
)
value
,
str
.
length
()
+
1
);
return
true
;
};
static
bool
dotted_to_string
(
const
std
::
string
&
dot
,
std
::
string
&
no_dot
)
{
// uint8_t should be enough, but uint16 if length > 255.
uint16_t
offset
=
0
;
bool
result
=
true
;
no_dot
=
{};
while
(
offset
<
dot
.
length
())
{
if
(
dot
[
offset
]
<
64
)
{
if
((
offset
+
dot
[
offset
])
<=
dot
.
length
())
{
if
(
offset
)
{
no_dot
.
push_back
(
'.'
);
}
no_dot
.
append
(
&
dot
[
offset
+
1
],
dot
[
offset
]);
}
offset
=
offset
+
1
+
dot
[
offset
];
}
else
{
// should not happen, consume bytes
no_dot
.
push_back
(
dot
[
offset
++
]);
result
=
false
;
}
}
return
result
;
};
};
//------------------------------------------------------------------------------
class
pfcp_grouped_ie
:
public
pfcp_ie
{
...
...
@@ -3357,7 +3410,7 @@ class pfcp_node_id_ie : public pfcp_ie {
ipv6_address
=
b
.
u1
.
ipv6_address
;
break
;
case
pfcp
:
:
NODE_ID_TYPE_FQDN
:
tlv
.
add_length
(
sizeof
(
b
.
fqdn
)
);
tlv
.
add_length
(
b
.
fqdn
.
length
()
+
1
);
fqdn
=
b
.
fqdn
;
break
;
default:
;
...
...
@@ -3400,9 +3453,11 @@ class pfcp_node_id_ie : public pfcp_ie {
case
pfcp
:
:
NODE_ID_TYPE_IPV6_ADDRESS
:
ipv6_address_dump_to
(
os
,
ipv6_address
);
break
;
case
pfcp
:
:
NODE_ID_TYPE_FQDN
:
os
<<
fqdn
;
break
;
case
pfcp
:
:
NODE_ID_TYPE_FQDN
:
{
std
::
string
dotted
=
{};
pfcp_ie
::
string_to_dotted
(
fqdn
,
dotted
);
os
<<
dotted
;
}
break
;
default:
;
}
}
...
...
@@ -3433,7 +3488,9 @@ class pfcp_node_id_ie : public pfcp_ie {
}
char
e
[
check_length
];
is
.
read
(
e
,
check_length
);
fqdn
.
assign
(
e
,
check_length
);
std
::
string
dot
=
{};
dot
.
assign
(
e
,
check_length
);
pfcp_ie
::
dotted_to_string
(
dot
,
fqdn
);
}
break
;
default:
;
}
...
...
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