#pragma once #include #include #include #include #include "Swiften/LinkLocal/LinkLocalSession.h" #include "Swiften/JID/JID.h" namespace Swift { class ConnectionFactory; class HostAddress; class String; class Element; class PayloadParserFactoryCollection; class PayloadSerializerCollection; class DNSSDService; class OutgoingLinkLocalSession : public LinkLocalSession { public: OutgoingLinkLocalSession( const JID& localJID, const JID& remoteJID, const String& hostname, int port, boost::shared_ptr resolver, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, ConnectionFactory* connectionFactory); const JID& getRemoteJID() const { return remoteJID_; } void start(); void sendElement(boost::shared_ptr stanza); private: void handleElement(boost::shared_ptr); void handleStreamStart(const ProtocolHeader&); void handleHostnameResolved(const String& hostname, const boost::optional& address); void handleConnected(bool error); private: bool resolving_; JID remoteJID_; String hostname_; int port_; boost::shared_ptr resolver_; std::vector > queuedElements_; ConnectionFactory* connectionFactory_; }; }