summaryrefslogtreecommitdiffstats
path: root/net/NetUtil.hpp
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2021-01-12 22:48:26 -0500
committerAshod Nakashian <Ashod@users.noreply.github.com>2021-01-13 22:05:18 -0500
commitce3dd02ef38143c3bebe254bfdd7aa2d3ebe35b8 (patch)
tree4c4f38d53248287b02550e2d83afbb12fbd74e5d /net/NetUtil.hpp
parentwsd: test: don't report test timeout outside of tests (diff)
downloadonline-ce3dd02ef38143c3bebe254bfdd7aa2d3ebe35b8.tar.gz
online-ce3dd02ef38143c3bebe254bfdd7aa2d3ebe35b8.zip
wsd: new NetUtil file for network utilities
Move the connect function into the NetUtil translation unit to aid using it for the upcoming async socket logic. The NetUtil should also come in handy for the miscellaneous network helpers we have. Change-Id: I2ee0c6e3e1769fd87572d7407d3b4979b59ffe6a Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Diffstat (limited to 'net/NetUtil.hpp')
-rw-r--r--net/NetUtil.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/NetUtil.hpp b/net/NetUtil.hpp
new file mode 100644
index 0000000000..547f94a622
--- /dev/null
+++ b/net/NetUtil.hpp
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <string>
+#include <memory>
+
+// This file hosts network related common functionality
+// and helper/utility functions and classes.
+// HTTP-specific helpers are in HttpHeler.hpp.
+
+class StreamSocket;
+class ProtocolHandlerInterface;
+
+namespace net
+{
+/// Connect to an end-point at the given host and port and return StreamSocket.
+std::shared_ptr<StreamSocket>
+connect(const std::string& host, const std::string& port, const bool isSSL,
+ const std::shared_ptr<ProtocolHandlerInterface>& protocolHandler);
+} // namespace net \ No newline at end of file