summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/LinkLocal/LinkLocalConnector.h')
-rw-r--r--Swiften/LinkLocal/LinkLocalConnector.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/Swiften/LinkLocal/LinkLocalConnector.h b/Swiften/LinkLocal/LinkLocalConnector.h
new file mode 100644
index 0000000..d296804
--- /dev/null
+++ b/Swiften/LinkLocal/LinkLocalConnector.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+#include <boost/signal.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <vector>
+
+#include "Swiften/JID/JID.h"
+#include "Swiften/Network/Connection.h"
+
+namespace Swift {
+ class ConnectionFactory;
+ class HostAddress;
+ class String;
+ class Element;
+ class PayloadParserFactoryCollection;
+ class PayloadSerializerCollection;
+ class DNSSDService;
+
+ class LinkLocalConnector : public boost::enable_shared_from_this<LinkLocalConnector> {
+ public:
+ LinkLocalConnector(
+ const JID& remoteJID,
+ const String& hostname,
+ int port,
+ boost::shared_ptr<DNSSDService> resolver,
+ boost::shared_ptr<Connection> connection);
+
+ const JID& getRemoteJID() const {
+ return remoteJID_;
+ }
+
+ void connect();
+ void queueElement(boost::shared_ptr<Element> element);
+
+ const std::vector<boost::shared_ptr<Element> >& getQueuedElements() const {
+ return queuedElements_;
+ }
+
+ boost::shared_ptr<Connection> getConnection() const {
+ return connection_;
+ }
+
+ boost::signal<void (bool)> onConnectFinished;
+
+ private:
+ void handleHostnameResolved(const String& hostname, const boost::optional<HostAddress>& address);
+ void handleConnected(bool error);
+
+ private:
+ JID remoteJID_;
+ String hostname_;
+ int port_;
+ boost::shared_ptr<DNSSDService> resolver_;
+ boost::shared_ptr<Connection> connection_;
+ bool resolving_;
+ std::vector<boost::shared_ptr<Element> > queuedElements_;
+ };
+}