summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius 'keldu' Holeksa <mail@keldu.de>2024-10-16 15:59:39 +0200
committerClaudius 'keldu' Holeksa <mail@keldu.de>2024-10-16 15:59:39 +0200
commitb10d0b0e1a30eb02777f5a02b81bf45e09749edb (patch)
tree2de7e372677037e6c8880c1f52ba32d55d1a85a8
parent09e164c02120f05c9364d5d9a8faad2ec0026425 (diff)
Fixing bad includes and changing network abstraction a tiny bit
-rw-r--r--modules/codec/c++/schema.hpp1
-rw-r--r--modules/io-tls/tls.cpp2
-rw-r--r--modules/io-tls/tls.hpp2
-rw-r--r--modules/io/c++/io.hpp7
-rw-r--r--modules/io/c++/io_unix.cpp8
5 files changed, 13 insertions, 7 deletions
diff --git a/modules/codec/c++/schema.hpp b/modules/codec/c++/schema.hpp
index e5560fb..4bd544b 100644
--- a/modules/codec/c++/schema.hpp
+++ b/modules/codec/c++/schema.hpp
@@ -2,6 +2,7 @@
#include <forstio/common.hpp>
#include <forstio/templates.hpp>
+#include <forstio/reduce_templates.hpp>
#include <forstio/string_literal.hpp>
namespace saw {
diff --git a/modules/io-tls/tls.cpp b/modules/io-tls/tls.cpp
index 981aa08..c9c71f4 100644
--- a/modules/io-tls/tls.cpp
+++ b/modules/io-tls/tls.cpp
@@ -292,7 +292,7 @@ conveyor<own<network_address>> tls_network::resolve_address(const std::string &a
return internal.resolve_address(addr, port);
}
-std::optional<own<tls_network>> setup_tls_network(network &network) {
+error_or<own<network<net::Tls>>> setup_tls_network(network &network) {
return std::nullopt;
}
} // namespace saw
diff --git a/modules/io-tls/tls.hpp b/modules/io-tls/tls.hpp
index a04598d..93ec180 100644
--- a/modules/io-tls/tls.hpp
+++ b/modules/io-tls/tls.hpp
@@ -37,6 +37,6 @@ private:
options options_;
};
-std::optional<own<tls_network>> setup_tls_network(network &network);
+error_or<own<network>> setup_tls_network(network &network);
} // namespace saw
diff --git a/modules/io/c++/io.hpp b/modules/io/c++/io.hpp
index 43ef7f0..390ddcc 100644
--- a/modules/io/c++/io.hpp
+++ b/modules/io/c++/io.hpp
@@ -8,6 +8,10 @@
#include <variant>
namespace saw {
+namespace net {
+struct Os {};
+}
+
/**
* Set of error common in io
*/
@@ -166,6 +170,7 @@ public:
network_address::child_variant representation() override { return this; }
};
+template<typename T = net::Os>
class network {
public:
virtual ~network() = default;
@@ -209,7 +214,7 @@ public:
virtual own<input_stream> wrap_input_fd(int fd) = 0;
- virtual network &get_network() = 0;
+ virtual network<net::Os> &get_network() = 0;
};
struct async_io_context {
diff --git a/modules/io/c++/io_unix.cpp b/modules/io/c++/io_unix.cpp
index a715535..73e8e3b 100644
--- a/modules/io/c++/io_unix.cpp
+++ b/modules/io/c++/io_unix.cpp
@@ -430,7 +430,7 @@ public:
size_t unix_address_size() const;
};
-class unix_network final : public network {
+class unix_network final : public network<net::Os> {
private:
unix_event_port &event_port_;
@@ -462,7 +462,7 @@ private:
public:
unix_io_provider(unix_event_port &port_ref, own<event_port> port);
- class network &get_network() override;
+ class network<net::Os> &get_network() override;
own<input_stream> wrap_input_fd(int fd) override;
@@ -895,8 +895,8 @@ own<input_stream> unix_io_provider::wrap_input_fd(int fd) {
return heap<unix_io_stream>(event_port_, fd, 0, EPOLLIN);
}
-class network &unix_io_provider::get_network() {
- return static_cast<class network &>(unix_network_);
+class network<net::Os> &unix_io_provider::get_network() {
+ return static_cast<class network<net::Os> &>(unix_network_);
}
class event_loop &unix_io_provider::event_loop() {