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
8681cc92
Commit
8681cc92
authored
Apr 23, 2022
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix OpenSSL test compilation in CAF::net
parent
33fbaf1a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
30 deletions
+44
-30
.typos-config.toml
.typos-config.toml
+1
-1
CMakeLists.txt
CMakeLists.txt
+8
-0
libcaf_net/CMakeLists.txt
libcaf_net/CMakeLists.txt
+20
-5
libcaf_net/caf/net/openssl_transport.hpp
libcaf_net/caf/net/openssl_transport.hpp
+3
-2
libcaf_net/test/net/openssl_transport.cpp
libcaf_net/test/net/openssl_transport.cpp
+2
-16
libcaf_net/test/pem.cpp
libcaf_net/test/pem.cpp
+0
-0
libcaf_net/test/pem.hpp
libcaf_net/test/pem.hpp
+10
-0
libcaf_openssl/CMakeLists.txt
libcaf_openssl/CMakeLists.txt
+0
-6
No files found.
.typos-config.toml
View file @
8681cc92
[files]
extend-exclude
=
["*.pem"]
\ No newline at end of file
extend-exclude
=
[
"*.pem"
,
"libcaf_net/test/pem.cpp"
]
CMakeLists.txt
View file @
8681cc92
...
...
@@ -74,6 +74,14 @@ if(MSVC AND CAF_SANITIZERS)
message
(
FATAL_ERROR
"Sanitizer builds are currently not supported on MSVC"
)
endif
()
# -- get dependencies that are used in more than one module --------------------
if
(
CAF_ENABLE_OPENSSL_MODULE OR CAF_ENABLE_NET_MODULE
)
if
(
NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto
)
find_package
(
OpenSSL REQUIRED
)
endif
()
endif
()
# -- base target setup ---------------------------------------------------------
# This target propagates compiler flags, extra dependencies, etc. All other CAF
...
...
libcaf_net/CMakeLists.txt
View file @
8681cc92
...
...
@@ -8,8 +8,10 @@ caf_add_component(
net
DEPENDENCIES
PUBLIC
CAF::core
$<$<CXX_COMPILER_ID:MSVC>:ws2_32>
CAF::core
OpenSSL::Crypto
OpenSSL::SSL
PRIVATE
CAF::internal
ENUM_TYPES
...
...
@@ -48,6 +50,7 @@ caf_add_component(
src/udp_datagram_socket.cpp
TEST_SOURCES
test/net-test.cpp
test/pem.cpp
TEST_SUITES
detail.convert_ip_endpoint
detail.rfc6455
...
...
@@ -74,8 +77,20 @@ caf_add_component(
net.web_socket.handshake
net.web_socket.server
)
if
(
CAF_INC_ENABLE_TESTING AND TARGET OpenSSL::SSL AND TARGET OpenSSL::Crypto
)
caf_incubator_add_test_suites
(
caf-net-test net.openssl_transport
)
target_sources
(
caf-net-test PRIVATE test/net/openssl_transport_constants.cpp
)
target_link_libraries
(
caf-net-test PRIVATE OpenSSL::SSL OpenSSL::Crypto
)
# Our OpenSSL test currently depends on <filesystem>.
check_cxx_source_compiles
(
"
#include <cstdlib>
#include <filesystem>
int main(int, char**) {
auto cwd = std::filesystem::current_path();
auto str = cwd.string();
return str.empty() ? EXIT_FAILURE : EXIT_SUCCESS;
}
"
CAF_NET_HAS_STD_FILESYSTEM
)
if
(
CAF_NET_HAS_STD_FILESYSTEM
)
caf_add_test_suites
(
caf-net-test net.openssl_transport
)
else
()
message
(
STATUS
"<filesystem> not working, skip OpenSSL test in CAF::net"
)
endif
()
libcaf_net/caf/net/openssl_transport.hpp
View file @
8681cc92
...
...
@@ -5,6 +5,7 @@
#pragma once
#include "caf/byte_buffer.hpp"
#include "caf/byte_span.hpp"
#include "caf/defaults.hpp"
#include "caf/detail/has_after_reading.hpp"
#include "caf/fwd.hpp"
...
...
@@ -189,12 +190,12 @@ public:
}
/// Reads data from the SSL connection into the buffer.
ptrdiff_t
read
(
stream_socket
,
span
<
byte
>
buf
)
{
ptrdiff_t
read
(
stream_socket
,
byte_span
buf
)
{
return
SSL_read
(
conn_
.
get
(),
buf
.
data
(),
static_cast
<
int
>
(
buf
.
size
()));
}
/// Writes data from the buffer to the SSL connection.
ptrdiff_t
write
(
stream_socket
,
span
<
const
byte
>
buf
)
{
ptrdiff_t
write
(
stream_socket
,
const_byte_span
buf
)
{
return
SSL_write
(
conn_
.
get
(),
buf
.
data
(),
static_cast
<
int
>
(
buf
.
size
()));
}
...
...
libcaf_net/test/net/openssl_transport.cpp
View file @
8681cc92
...
...
@@ -7,32 +7,18 @@
#include "caf/net/openssl_transport.hpp"
#include "net-test.hpp"
#include "pem.hpp"
#include "caf/binary_deserializer.hpp"
#include "caf/binary_serializer.hpp"
#include "caf/byte.hpp"
#include "caf/byte_buffer.hpp"
#include "caf/detail/scope_guard.hpp"
#include "caf/make_actor.hpp"
#include "caf/net/actor_proxy_impl.hpp"
#include "caf/net/multiplexer.hpp"
#include "caf/net/socket_guard.hpp"
#include "caf/net/socket_manager.hpp"
#include "caf/net/stream_socket.hpp"
#include "caf/span.hpp"
#include <filesystem>
#include <random>
// Note: these constants are defined in openssl_transport_constants.cpp.
extern
std
::
string_view
ca_pem
;
extern
std
::
string_view
cert_1_pem
;
extern
std
::
string_view
cert_2_pem
;
extern
std
::
string_view
key_1_enc_pem
;
extern
std
::
string_view
key_1_pem
;
extern
std
::
string_view
key_2_pem
;
using
namespace
caf
;
using
namespace
caf
::
net
;
...
...
@@ -139,7 +125,7 @@ public:
}
template
<
class
ParentPtr
>
size_t
consume
(
ParentPtr
down
,
span
<
const
byte
>
data
,
span
<
const
byte
>
)
{
size_t
consume
(
ParentPtr
down
,
const_byte_span
data
,
const_byte_span
)
{
MESSAGE
(
"dummy app received "
<<
data
.
size
()
<<
" bytes"
);
// Store the received bytes.
recv_buf_
->
insert
(
recv_buf_
->
begin
(),
data
.
begin
(),
data
.
end
());
...
...
libcaf_net/test/
net/openssl_transport_constants
.cpp
→
libcaf_net/test/
pem
.cpp
View file @
8681cc92
File moved
libcaf_net/test/pem.hpp
0 → 100644
View file @
8681cc92
#pragma once
#include <string_view>
extern
std
::
string_view
ca_pem
;
extern
std
::
string_view
cert_1_pem
;
extern
std
::
string_view
cert_2_pem
;
extern
std
::
string_view
key_1_enc_pem
;
extern
std
::
string_view
key_1_pem
;
extern
std
::
string_view
key_2_pem
;
libcaf_openssl/CMakeLists.txt
View file @
8681cc92
...
...
@@ -2,12 +2,6 @@
file
(
GLOB_RECURSE CAF_OPENSSL_HEADERS
"caf/*.hpp"
)
# -- dependencies --------------------------------------------------------------
if
(
NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto
)
find_package
(
OpenSSL REQUIRED
)
endif
()
# -- add targets ---------------------------------------------------------------
caf_add_component
(
...
...
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