aboutsummaryrefslogtreecommitdiff
path: root/libcmix-common
diff options
context:
space:
mode:
Diffstat (limited to 'libcmix-common')
-rw-r--r--libcmix-common/receiver.hpp28
-rw-r--r--libcmix-common/sender.hpp31
-rw-r--r--libcmix-common/senderreceiver.cpp9
-rw-r--r--libcmix-common/senderreceiver.hpp46
4 files changed, 102 insertions, 12 deletions
diff --git a/libcmix-common/receiver.hpp b/libcmix-common/receiver.hpp
index 8a73e9c..efd3753 100644
--- a/libcmix-common/receiver.hpp
+++ b/libcmix-common/receiver.hpp
@@ -21,6 +21,7 @@ struct Receiver : private ProtobufClient<CMixProtoFunctor>
friend SenderReceiver;
using ProtobufClient::ProtobufClient;
+ using ProtobufClient::operator=;
using ProtobufClient::async_receive;
@@ -32,3 +33,30 @@ struct Receiver : private ProtobufClient<CMixProtoFunctor>
using ProtobufClient::is_open;
};
+
+struct SSLSenderReceiver;
+
+/*!
+ * \brief The Receiver struct is a shim around ProtobufClient and only exposes things needed
+ * for receiving messages.
+ */
+struct SSLReceiver : private SSLProtobufClient<CMixProtoFunctor>
+{
+ /*!
+ * \brief friend decleration allowing Receivers to be upgraded to SenderReceivers.
+ */
+ friend SSLSenderReceiver;
+
+ using SSLProtobufClient::SSLProtobufClient;
+ using SSLProtobufClient::operator=;
+
+ using SSLProtobufClient::async_receive;
+
+ using SSLProtobufClient::async_connect;
+
+ using SSLProtobufClient::close;
+
+ using SSLProtobufClient::on_done;
+
+ using SSLProtobufClient::is_open;
+};
diff --git a/libcmix-common/sender.hpp b/libcmix-common/sender.hpp
index ea16a81..c722e30 100644
--- a/libcmix-common/sender.hpp
+++ b/libcmix-common/sender.hpp
@@ -25,6 +25,7 @@ struct Sender : private ProtobufClient<CMixProtoFunctor>
friend SenderReceiver;
using ProtobufClient::ProtobufClient;
+ using ProtobufClient::operator=;
using ProtobufClient::async_send;
@@ -36,3 +37,33 @@ struct Sender : private ProtobufClient<CMixProtoFunctor>
using ProtobufClient::is_open;
};
+
+/*!
+ * \brief forward declaration for SenderReceiver to allow for the friend declaration.
+ */
+struct SSLSenderReceiver;
+
+/*!
+ * \brief The Sender struct is a shim around ProtobufClient and only exposes things needed
+ * for sending messages.
+ */
+struct SSLSender : private SSLProtobufClient<CMixProtoFunctor>
+{
+ /*!
+ * The friend declaration that allows for the Sender to be upgraded to a SenderReceiver.
+ */
+ friend SSLSenderReceiver;
+
+ using SSLProtobufClient::SSLProtobufClient;
+ using SSLProtobufClient::operator=;
+
+ using SSLProtobufClient::async_send;
+
+ using SSLProtobufClient::async_connect;
+
+ using SSLProtobufClient::close;
+
+ using SSLProtobufClient::on_done;
+
+ using SSLProtobufClient::is_open;
+};
diff --git a/libcmix-common/senderreceiver.cpp b/libcmix-common/senderreceiver.cpp
index eafa8a5..8b13789 100644
--- a/libcmix-common/senderreceiver.cpp
+++ b/libcmix-common/senderreceiver.cpp
@@ -1,10 +1 @@
-#include "senderreceiver.hpp"
-
-SenderReceiver::SenderReceiver(Receiver&& r)
-: ProtobufClient(std::move(r))
-{}
-
-SenderReceiver::SenderReceiver(Sender&& s)
-: ProtobufClient(std::move(s))
-{}
diff --git a/libcmix-common/senderreceiver.hpp b/libcmix-common/senderreceiver.hpp
index c7fed3a..6654809 100644
--- a/libcmix-common/senderreceiver.hpp
+++ b/libcmix-common/senderreceiver.hpp
@@ -20,15 +20,20 @@ struct SenderReceiver : private ProtobufClient<CMixProtoFunctor>
* \brief SenderReceiver Explicit conversion to SenderReceiver
* \param r The Receiver to upgrade
*/
- explicit SenderReceiver(Receiver&& r);
+ explicit SenderReceiver(Receiver&& r)
+ : ProtobufClient(std::move(r))
+ {}
/*!
* \brief SenderReceiver Explicit conversion to SenderReceiver
* \param s The Sender to upgrade
*/
- explicit SenderReceiver(Sender&& s);
+ explicit SenderReceiver(Sender&& s)
+ : ProtobufClient(std::move(s))
+ {}
using ProtobufClient::ProtobufClient;
+ using ProtobufClient::operator=;
using ProtobufClient::async_receive;
@@ -41,4 +46,39 @@ struct SenderReceiver : private ProtobufClient<CMixProtoFunctor>
using ProtobufClient::on_done;
using ProtobufClient::is_open;
-}; \ No newline at end of file
+};
+
+struct SSLSenderReceiver : private SSLProtobufClient<CMixProtoFunctor>
+{
+ /*!
+ * \brief SenderReceiver Explicit conversion to SenderReceiver
+ * \param r The Receiver to upgrade
+ */
+ explicit SSLSenderReceiver(SSLReceiver&& r)
+ : SSLProtobufClient(std::move(r))
+ {}
+
+ /*!
+ * \brief SenderReceiver Explicit conversion to SenderReceiver
+ * \param s The Sender to upgrade
+ */
+ explicit SSLSenderReceiver(SSLSender&& s)
+ : SSLProtobufClient(std::move(s))
+ {}
+
+ using SSLProtobufClient::SSLProtobufClient;
+ using SSLProtobufClient::operator=;
+
+ using SSLProtobufClient::async_receive;
+
+ using SSLProtobufClient::async_send;
+
+ using SSLProtobufClient::async_connect;
+
+ using SSLProtobufClient::close;
+
+ using SSLProtobufClient::on_done;
+
+ using SSLProtobufClient::is_open;
+};
+