Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
cpp-libs
Actor Framework
Commits
f0f4ee65
Commit
f0f4ee65
authored
Aug 21, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add requested changes
parent
4bbc4e19
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
28 deletions
+22
-28
libcaf_core/caf/ip_endpoint.hpp
libcaf_core/caf/ip_endpoint.hpp
+1
-1
libcaf_core/caf/ipv4_endpoint.hpp
libcaf_core/caf/ipv4_endpoint.hpp
+5
-3
libcaf_core/caf/ipv6_endpoint.hpp
libcaf_core/caf/ipv6_endpoint.hpp
+9
-5
libcaf_core/src/ipv4_endpoint.cpp
libcaf_core/src/ipv4_endpoint.cpp
+3
-9
libcaf_core/src/ipv6_endpoint.cpp
libcaf_core/src/ipv6_endpoint.cpp
+4
-10
No files found.
libcaf_core/caf/ip_endpoint.hpp
View file @
f0f4ee65
...
...
@@ -22,7 +22,7 @@
namespace
caf
{
/// An IP endpoint that contains an ipv6_address and a port.
/// An IP endpoint that contains an
::
ipv6_address and a port.
using
ip_endpoint
=
ipv6_endpoint
;
}
// namespace caf
libcaf_core/caf/ipv4_endpoint.hpp
View file @
f0f4ee65
...
...
@@ -18,12 +18,13 @@
#pragma once
#include "caf/detail/comparable.hpp"
#include "caf/ipv4_address.hpp"
#include "caf/meta/type_name.hpp"
namespace
caf
{
/// A
hashable endpoint abstraction for ipv4
/// A
n IP endpoint that contains an ::ipv4_address and a port.
struct
ipv4_endpoint
:
detail
::
comparable
<
ipv4_endpoint
>
{
public:
// -- constructors -----------------------------------------------------------
...
...
@@ -53,8 +54,9 @@ public:
/// Returns a hash for this object
size_t
hash_code
()
const
noexcept
;
/// compares This endpoint to another.
/// Returns 0 if equal, otherwise >0 if this > x and <0 if this < x
/// Compares this endpoint to `x`.
/// @returns 0 if `*this == x`, a positive value if `*this > x` and a negative
/// value otherwise.
long
compare
(
ipv4_endpoint
x
)
const
noexcept
;
template
<
class
Inspector
>
...
...
libcaf_core/caf/ipv6_endpoint.hpp
View file @
f0f4ee65
...
...
@@ -18,12 +18,13 @@
#pragma once
#include "caf/detail/comparable.hpp"
#include "caf/ipv6_address.hpp"
#include "caf/meta/type_name.hpp"
namespace
caf
{
/// A
hashable endpoint abstraction for ipv6
.
/// A
n IP endpoint that contains an ::ipv6_address and a port
.
struct
ipv6_endpoint
:
detail
::
comparable
<
ipv6_endpoint
>
{
public:
// -- constructors -----------------------------------------------------------
...
...
@@ -53,8 +54,9 @@ public:
/// Returns a hash for this object.
size_t
hash_code
()
const
noexcept
;
/// compares This endpoint to another.
/// Returns 0 if equal, otherwise >0 if this > x and <0 if this < x.
/// Compares this endpoint to `x`.
/// @returns 0 if `*this == x`, a positive value if `*this > x` and a negative
/// value otherwise.
long
compare
(
ipv6_endpoint
x
)
const
noexcept
;
template
<
class
Inspector
>
...
...
@@ -64,8 +66,10 @@ public:
}
private:
ipv6_address
address_
;
/// The address of this endpoint.
uint16_t
port_
;
/// The port of this endpoint.
/// The address of this endpoint.
ipv6_address
address_
;
/// The port of this endpoint.
uint16_t
port_
;
};
std
::
string
to_string
(
const
ipv6_endpoint
&
ep
);
...
...
libcaf_core/src/ipv4_endpoint.cpp
View file @
f0f4ee65
...
...
@@ -20,9 +20,6 @@
#include "caf/detail/fnv_hash.hpp"
using
caf
::
detail
::
fnv_hash
;
using
caf
::
detail
::
fnv_hash_append
;
namespace
caf
{
ipv4_endpoint
::
ipv4_endpoint
(
ipv4_address
address
,
uint16_t
port
)
...
...
@@ -47,16 +44,13 @@ void ipv4_endpoint::port(uint16_t x) noexcept {
}
size_t
ipv4_endpoint
::
hash_code
()
const
noexcept
{
auto
result
=
fnv_hash
(
address_
.
data
());
return
fnv_hash_append
(
result
,
port_
);
auto
result
=
detail
::
fnv_hash
(
address_
.
data
());
return
detail
::
fnv_hash_append
(
result
,
port_
);
}
long
ipv4_endpoint
::
compare
(
ipv4_endpoint
x
)
const
noexcept
{
auto
res
=
address_
.
compare
(
x
.
address
());
if
(
res
!=
0
)
return
port_
-
x
.
port
();
else
return
res
;
return
res
==
0
?
port_
-
x
.
port
()
:
res
;
}
std
::
string
to_string
(
const
ipv4_endpoint
&
ep
)
{
...
...
libcaf_core/src/ipv6_endpoint.cpp
View file @
f0f4ee65
...
...
@@ -20,9 +20,6 @@
#include "caf/detail/fnv_hash.hpp"
using
caf
::
detail
::
fnv_hash
;
using
caf
::
detail
::
fnv_hash_append
;
namespace
caf
{
ipv6_endpoint
::
ipv6_endpoint
(
ipv6_address
address
,
uint16_t
port
)
...
...
@@ -47,20 +44,17 @@ void ipv6_endpoint::port(uint16_t x) noexcept {
}
size_t
ipv6_endpoint
::
hash_code
()
const
noexcept
{
auto
result
=
fnv_hash
(
address_
.
data
());
return
fnv_hash_append
(
result
,
port_
);
auto
result
=
detail
::
fnv_hash
(
address_
.
data
());
return
detail
::
fnv_hash_append
(
result
,
port_
);
}
long
ipv6_endpoint
::
compare
(
ipv6_endpoint
x
)
const
noexcept
{
auto
res
=
address_
.
compare
(
x
.
address
());
if
(
res
!=
0
)
return
port_
-
x
.
port
();
else
return
res
;
return
res
==
0
?
port_
-
x
.
port
()
:
res
;
}
std
::
string
to_string
(
const
ipv6_endpoint
&
ep
)
{
return
to_string
(
ep
.
address
())
+
"
:"
+
std
::
to_string
(
ep
.
port
());
return
"["
+
to_string
(
ep
.
address
())
+
"]
:"
+
std
::
to_string
(
ep
.
port
());
}
}
// namespace caf
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