Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dhtnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
dhtnet
Commits
80c14e14
Commit
80c14e14
authored
1 year ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
build ip utils
Change-Id: Ie4a7482794298204b6137ea8367cb183fdbc23d2
parent
ea1e6932
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+2
-1
2 additions, 1 deletion
CMakeLists.txt
src/ip_utils.cpp
+5
-4
5 additions, 4 deletions
src/ip_utils.cpp
with
7 additions
and
5 deletions
CMakeLists.txt
+
2
−
1
View file @
80c14e14
...
...
@@ -36,6 +36,7 @@ list (APPEND dhtnet_SOURCES
src/peer_connection.cpp
src/string_utils.cpp
src/fileutils.cpp
src/ip_utils.cpp
src/security/tls_session.cpp
src/security/certstore.cpp
src/security/threadloop.cpp
...
...
@@ -46,7 +47,7 @@ list (APPEND dhtnet_SOURCES
src/upnp/protocol/mapping.cpp
src/upnp/upnp_context.cpp
src/upnp/upnp_control.cpp
src/upnp/protocol/igd.cpp
src/upnp/protocol/igd.cpp
)
list
(
APPEND dhtnet_HEADERS
...
...
This diff is collapsed.
Click to expand it.
src/ip_utils.cpp
+
5
−
4
View file @
80c14e14
...
...
@@ -15,9 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include
"ip_utils.h"
#include
"logger.h"
#include
"sip_utils.h"
#include
"string_utils.h"
#include
"connectivity/sip_utils
.h
"
#include
<fmt/format
.h
>
#include
<sys/types.h>
#include
<unistd.h>
...
...
@@ -52,7 +53,7 @@ std::string_view
sip_strerror
(
pj_status_t
code
)
{
thread_local
char
err_msg
[
PJ_ERR_MSG_SIZE
];
return
as_view
(
pj_strerror
(
code
,
err_msg
,
sizeof
err_msg
));
return
sip_utils
::
as_view
(
pj_strerror
(
code
,
err_msg
,
sizeof
err_msg
));
}
...
...
@@ -185,7 +186,7 @@ ip_utils::getGateway(char* localHost, ip_utils::subnet_mask prefix)
std
::
vector
<
std
::
string_view
>
tokens
=
split_string
(
localHostStr
,
'.'
);
// Build a gateway address from the individual ip components.
for
(
unsigned
i
=
0
;
i
<=
(
unsigned
)
prefix
;
i
++
)
defaultGw
+
=
tokens
[
i
]
+
"."
;
defaultGw
=
fmt
::
format
(
"{:s}{:s}."
,
defaultGw
,
tokens
[
i
]
)
;
for
(
unsigned
i
=
(
unsigned
)
ip_utils
::
subnet_mask
::
prefix_32bit
;
i
>
(
unsigned
)
prefix
+
1
;
i
--
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment