summaryrefslogtreecommitdiff
path: root/src/components/transport_manager/include/transport_manager
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2019-03-27 17:04:24 -0400
committerGitHub <noreply@github.com>2019-03-27 17:04:24 -0400
commit91d2c60cd368a5c974caa8af39c4a8233409ade5 (patch)
tree5f59a6250ebc36b58e8f573d29144cb61e764b71 /src/components/transport_manager/include/transport_manager
parentc647e9437881e2cba6f84e7add2510e7ec2a6256 (diff)
parent74ba1df3e93e33b4a3dcb799ce66142f9e9728d2 (diff)
downloadsdl_core-91d2c60cd368a5c974caa8af39c4a8233409ade5.tar.gz
Merge pull request #2861 from smartdevicelink/fix/5.1.0_build_failures
Fix build failures depending on options
Diffstat (limited to 'src/components/transport_manager/include/transport_manager')
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h
index aa608312a0..a726524af2 100644
--- a/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h
+++ b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h
@@ -38,11 +38,13 @@
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
-#include <boost/beast/websocket/ssl.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
-#include <boost/asio/ssl/stream.hpp>
#include <boost/asio/thread_pool.hpp>
+#ifdef ENABLE_SECURITY
+#include <boost/asio/ssl/stream.hpp>
+#include <boost/beast/websocket/ssl.hpp>
+#endif // ENABLE_SECURITY
#include <cstdlib>
#include <functional>
#include <iostream>
@@ -55,16 +57,21 @@
#include "utils/threads/message_loop_thread.h"
#include "utils/message_queue.h"
-using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
-namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
namespace websocket =
boost::beast::websocket; // from <boost/beast/websocket.hpp>
+
+using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
+typedef websocket::stream<tcp::socket> WS;
+
+#ifdef ENABLE_SECURITY
+namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
+typedef websocket::stream<ssl::stream<tcp::socket> > WSS;
+#endif // ENABLE_SECURITY
+
using ::utils::MessageQueue;
typedef std::queue<protocol_handler::RawMessagePtr> AsyncQueue;
typedef protocol_handler::RawMessagePtr Message;
-typedef websocket::stream<tcp::socket> WS;
-typedef websocket::stream<ssl::stream<tcp::socket> > WSS;
namespace transport_manager {
namespace transport_adapter {
@@ -106,12 +113,12 @@ class WebsocketClientConnection
TransportAdapter::Error Start();
/**
- * @brief Send data frame.
- *
- * @param message Smart pointer to the raw message.
- *
- * @return Error Information about possible reason of sending data failure.
- */
+ * @brief Send data frame.
+ *
+ * @param message Smart pointer to the raw message.
+ *
+ * @return Error Information about possible reason of sending data failure.
+ */
TransportAdapter::Error SendData(::protocol_handler::RawMessagePtr message);
/**
@@ -121,12 +128,14 @@ class WebsocketClientConnection
*/
TransportAdapter::Error Disconnect();
+#ifdef ENABLE_SECURITY
/**
* @brief Attempt to add provided certificate to the ssl::context
*
* @param cert Certificate string from policy table
*/
void AddCertificateAuthority(std::string cert, boost::system::error_code& ec);
+#endif // ENABLE_SECURITY
void Shutdown();
@@ -137,13 +146,15 @@ class WebsocketClientConnection
private:
TransportAdapterController* controller_;
boost::asio::io_context ioc_;
- ssl::context ctx_;
tcp::resolver resolver_;
boost::beast::flat_buffer buffer_;
std::string host_;
std::string text_;
WS ws_;
+#ifdef ENABLE_SECURITY
+ ssl::context ctx_;
WSS wss_;
+#endif // ENABLE_SECURITY
std::atomic_bool shutdown_;