diff options
67 files changed, 105 insertions, 235 deletions
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.h b/Swiften/AdHoc/OutgoingAdHocCommandSession.h index 9a97ed0..da4acf5 100644 --- a/Swiften/AdHoc/OutgoingAdHocCommandSession.h +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.h @@ -1,53 +1,51 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <map> #include <memory> #include <string> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Command.h> #include <Swiften/Elements/ErrorPayload.h> #include <Swiften/JID/JID.h> namespace Swift { class IQRouter; - class MainWindow; - class UIEventStream; class SWIFTEN_API OutgoingAdHocCommandSession { public: /** * Availability of action. */ enum ActionState { Absent /** Action isn't applicable to this command. */ = 0, Present /** Action is applicable to this command */= 1, Enabled /** Action is applicable and currently available */ = 2, EnabledAndPresent = 3}; OutgoingAdHocCommandSession(const JID& to, const std::string& commandNode, IQRouter* iqRouter); ~OutgoingAdHocCommandSession(); /** * Send initial request to the target. */ void start(); /** * Cancel command session with the target. */ void cancel(); /** * Return to the previous stage. */ void goBack(); /** * Send the form to complete the command. * \param form Form for submission - if missing the command will be submitted with no form. diff --git a/Swiften/Base/Debug.h b/Swiften/Base/Debug.h index a6d000f..75575de 100644 --- a/Swiften/Base/Debug.h +++ b/Swiften/Base/Debug.h @@ -1,26 +1,22 @@ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <iosfwd> #include <Swiften/Client/ClientSession.h> namespace Swift { class ClientError; class Element; } -namespace boost { - template<class T> class shared_ptr; -} - SWIFTEN_API std::ostream& operator<<(std::ostream& os, const Swift::ClientError& error); SWIFTEN_API std::ostream& operator<<(std::ostream& os, Swift::Element* ele); SWIFTEN_API std::ostream& operator<<(std::ostream& os, Swift::ClientSession::State state); diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h index 27031c0..8168e7b 100644 --- a/Swiften/Client/CoreClient.h +++ b/Swiften/Client/CoreClient.h @@ -1,68 +1,66 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <string> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/Client/ClientError.h> #include <Swiften/Client/ClientOptions.h> #include <Swiften/Entity/Entity.h> #include <Swiften/JID/JID.h> #include <Swiften/TLS/CertificateWithKey.h> namespace Swift { + class CertificateTrustChecker; class ChainedConnector; - class Message; - class Presence; + class ClientSession; + class ClientSessionStanzaChannel; + class Connection; + class ConnectionFactory; class Error; class IQRouter; - class TLSContextFactory; - class ConnectionFactory; - class Connection; - class TimerFactory; - class ClientSession; - class StanzaChannel; - class Stanza; - class SessionStream; - class CertificateTrustChecker; + class Message; class NetworkFactories; - class ClientSessionStanzaChannel; + class Presence; + class SessionStream; + class Stanza; + class StanzaChannel; /** * The central class for communicating with an XMPP server. * * This class is responsible for setting up the connection with the XMPP * server, authenticating, and initializing the session. * * This class can be used directly in your application, although the Client * subclass provides more functionality and interfaces, and is better suited * for most needs. */ class SWIFTEN_API CoreClient : public Entity { public: /** * Constructs a client for the given JID with the given password. */ CoreClient(const JID& jid, const SafeByteArray& password, NetworkFactories* networkFactories); virtual ~CoreClient(); /** * Set a client certificate to use for strong authentication with the server. * Ensure that it is of the correct type for the TLS engine in use. * This means, largely, PKCS12Certificate for OpenSSL and CAPICertificate for CAPI. */ void setCertificate(CertificateWithKey::ref certificate); /** * Connects the client to the server. * * After the connection is established, the client will set diff --git a/Swiften/Client/DummyNickManager.h b/Swiften/Client/DummyNickManager.h index 52a8401..8ed7701 100644 --- a/Swiften/Client/DummyNickManager.h +++ b/Swiften/Client/DummyNickManager.h @@ -1,23 +1,21 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Client/NickManager.h> namespace Swift { - class VCardManager; - class DummyNickManager : public NickManager { public: std::string getOwnNick() const { return ""; } void setOwnNick(const std::string&) { } }; } diff --git a/Swiften/Component/ComponentSession.h b/Swiften/Component/ComponentSession.h index 9d963a1..dcb9b4a 100644 --- a/Swiften/Component/ComponentSession.h +++ b/Swiften/Component/ComponentSession.h @@ -1,52 +1,51 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <string> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> #include <Swiften/Elements/Stanza.h> #include <Swiften/Elements/ToplevelElement.h> #include <Swiften/JID/JID.h> #include <Swiften/Session/SessionStream.h> namespace Swift { - class ComponentAuthenticator; class CryptoProvider; class SWIFTEN_API ComponentSession : public std::enable_shared_from_this<ComponentSession> { public: enum State { Initial, WaitingForStreamStart, Authenticating, Initialized, Finishing, Finished }; struct Error : public Swift::Error { enum Type { AuthenticationFailedError, UnexpectedElementError } type; Error(Type type) : type(type) {} }; ~ComponentSession(); static std::shared_ptr<ComponentSession> create(const JID& jid, const std::string& secret, std::shared_ptr<SessionStream> stream, CryptoProvider* crypto) { return std::shared_ptr<ComponentSession>(new ComponentSession(jid, secret, stream, crypto)); } State getState() const { return state; } diff --git a/Swiften/Component/CoreComponent.h b/Swiften/Component/CoreComponent.h index 669be97..f673643 100644 --- a/Swiften/Component/CoreComponent.h +++ b/Swiften/Component/CoreComponent.h @@ -1,63 +1,62 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <string> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/Component/ComponentConnector.h> #include <Swiften/Component/ComponentError.h> #include <Swiften/Component/ComponentSession.h> #include <Swiften/Component/ComponentSessionStanzaChannel.h> #include <Swiften/Elements/Message.h> #include <Swiften/Elements/Presence.h> #include <Swiften/Entity/Entity.h> #include <Swiften/JID/JID.h> #include <Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h> #include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h> namespace Swift { - class EventLoop; + class BasicSessionStream; + class ComponentSession; class IQRouter; class NetworkFactories; - class ComponentSession; - class BasicSessionStream; /** * The central class for communicating with an XMPP server as a component. * * This class is responsible for setting up the connection with the XMPP * server and authenticating the component. * * This class can be used directly in your application, although the Component * subclass provides more functionality and interfaces, and is better suited * for most needs. */ class SWIFTEN_API CoreComponent : public Entity { public: CoreComponent(const JID& jid, const std::string& secret, NetworkFactories* networkFactories); virtual ~CoreComponent(); void connect(const std::string& host, int port); void disconnect(); void sendMessage(std::shared_ptr<Message>); void sendPresence(std::shared_ptr<Presence>); void sendData(const std::string& data); IQRouter* getIQRouter() const { return iqRouter_; } StanzaChannel* getStanzaChannel() const { return stanzaChannel_; } diff --git a/Swiften/Elements/MUCOccupant.h b/Swiften/Elements/MUCOccupant.h index c345a49..260502e 100644 --- a/Swiften/Elements/MUCOccupant.h +++ b/Swiften/Elements/MUCOccupant.h @@ -1,45 +1,43 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <string> #include <boost/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> namespace Swift { - class Client; - class SWIFTEN_API MUCOccupant { public: enum Role {Moderator, Participant, Visitor, NoRole}; enum Affiliation {Owner, Admin, Member, Outcast, NoAffiliation}; MUCOccupant(const std::string &nick, Role role, Affiliation affiliation); MUCOccupant(const MUCOccupant& other); ~MUCOccupant(); MUCOccupant& operator=(MUCOccupant other); std::string getNick() const; Role getRole() const; Affiliation getAffiliation() const; boost::optional<JID> getRealJID() const; void setRealJID(const JID& jid); void setNick(const std::string& nick); private: std::string nick_; Role role_; Affiliation affiliation_; boost::optional<JID> realJID_; /* If you add a field, remember to update the const copy constructor */ }; } diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.h b/Swiften/FileTransfer/IncomingJingleFileTransfer.h index 3dd206d..7ddf700 100644 --- a/Swiften/FileTransfer/IncomingJingleFileTransfer.h +++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.h @@ -1,64 +1,62 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <string> #include <boost/cstdint.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/JingleS5BTransportPayload.h> #include <Swiften/FileTransfer/FileTransferOptions.h> #include <Swiften/FileTransfer/IncomingFileTransfer.h> #include <Swiften/FileTransfer/JingleFileTransfer.h> #include <Swiften/Jingle/JingleContentID.h> namespace Swift { - class JID; - class JingleSession; - class JingleContentPayload; - class FileTransferTransporter; - class FileTransferTransporterFactory; - class TimerFactory; - class Timer; class CryptoProvider; + class FileTransferTransporterFactory; class IncrementalBytestreamHashCalculator; + class JID; + class JingleContentPayload; class JingleFileTransferDescription; - class HashElement; + class JingleSession; + class Timer; + class TimerFactory; /** * @brief The IncomingJingleFileTransfer class contains the business logic for managing incoming * Jingle file transfers. * * Calling IncomingJingleFileTransfer::accept will start to negotiate possible transfer * methods and after a working method has been decided among peers the trasnfer is started. */ class SWIFTEN_API IncomingJingleFileTransfer : public IncomingFileTransfer, public JingleFileTransfer { public: typedef std::shared_ptr<IncomingJingleFileTransfer> ref; IncomingJingleFileTransfer( const JID& recipient, std::shared_ptr<JingleSession>, std::shared_ptr<JingleContentPayload> content, FileTransferTransporterFactory*, TimerFactory*, CryptoProvider*); virtual ~IncomingJingleFileTransfer(); virtual void accept(std::shared_ptr<WriteBytestream>, const FileTransferOptions& = FileTransferOptions()) SWIFTEN_OVERRIDE; virtual void cancel() SWIFTEN_OVERRIDE; private: enum State { Initial, GeneratingInitialLocalCandidates, TryingCandidates, WaitingForPeerProxyActivate, diff --git a/Swiften/FileTransfer/JingleFileTransfer.h b/Swiften/FileTransfer/JingleFileTransfer.h index 5b9dd62..dd9bcb9 100644 --- a/Swiften/FileTransfer/JingleFileTransfer.h +++ b/Swiften/FileTransfer/JingleFileTransfer.h @@ -1,55 +1,51 @@ /* - * Copyright (c) 2013-2016 Isode Limited. + * Copyright (c) 2013-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <vector> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ErrorPayload.h> #include <Swiften/Elements/JingleS5BTransportPayload.h> #include <Swiften/FileTransfer/FileTransfer.h> #include <Swiften/Jingle/AbstractJingleSessionListener.h> #include <Swiften/Jingle/JingleContentID.h> namespace Swift { - class CryptoProvider; - class IQRouter; - class RemoteJingleTransportCandidateSelector; - class LocalJingleTransportCandidateGenerator; class JingleSession; class FileTransferTransporter; class FileTransferTransporterFactory; class TransportSession; class SWIFTEN_API JingleFileTransfer : public AbstractJingleSessionListener { public: JingleFileTransfer( std::shared_ptr<JingleSession>, const JID& target, FileTransferTransporterFactory*); virtual ~JingleFileTransfer(); protected: virtual void handleTransportInfoReceived(const JingleContentID&, JingleTransportPayload::ref); virtual void handleLocalTransportCandidatesGenerated( const std::string& s5bSessionID, const std::vector<JingleS5BTransportPayload::Candidate>&, const std::string& dstAddr) = 0; virtual void handleProxyActivateFinished( const std::string& s5bSessionID, ErrorPayload::ref error); virtual void decideOnCandidates(); void handleRemoteTransportCandidateSelectFinished( const std::string& s5bSessionID, const boost::optional<JingleS5BTransportPayload::Candidate>&); virtual JingleContentID getContentID() const = 0; virtual void startTransferring(std::shared_ptr<TransportSession>) = 0; virtual void terminate(JinglePayload::Reason::Type reason) = 0; virtual void fallback() = 0; virtual bool hasPriorityOnCandidateTie() const = 0; diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.h b/Swiften/FileTransfer/OutgoingJingleFileTransfer.h index cd45948..9fd1d76 100644 --- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.h +++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.h @@ -1,60 +1,59 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2013-2016 Isode Limited. + * Copyright (c) 2013-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <boost/optional/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/JingleFileTransferFileInfo.h> #include <Swiften/FileTransfer/FileTransferOptions.h> #include <Swiften/FileTransfer/JingleFileTransfer.h> #include <Swiften/FileTransfer/OutgoingFileTransfer.h> #include <Swiften/Jingle/JingleContentID.h> #include <Swiften/Network/Timer.h> namespace Swift { class CryptoProvider; - class FileTransferTransporter; class FileTransferTransporterFactory; class IDGenerator; class IncrementalBytestreamHashCalculator; class ReadBytestream; class TimerFactory; class TransportSession; class SWIFTEN_API OutgoingJingleFileTransfer : public OutgoingFileTransfer, public JingleFileTransfer { public: OutgoingJingleFileTransfer( const JID& to, std::shared_ptr<JingleSession>, std::shared_ptr<ReadBytestream>, FileTransferTransporterFactory*, TimerFactory*, IDGenerator*, const JingleFileTransferFileInfo&, const FileTransferOptions&, CryptoProvider*); virtual ~OutgoingJingleFileTransfer(); virtual void start() SWIFTEN_OVERRIDE; virtual void cancel() SWIFTEN_OVERRIDE; private: enum State { Initial, GeneratingInitialLocalCandidates, WaitingForAccept, TryingCandidates, diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h index b819910..70a7c9c 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h @@ -1,61 +1,60 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <boost/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/FileTransfer/FileTransferError.h> #include <Swiften/FileTransfer/ReadBytestream.h> #include <Swiften/FileTransfer/WriteBytestream.h> #include <Swiften/JID/JID.h> #include <Swiften/Network/Connection.h> #include <Swiften/Network/HostAddressPort.h> #include <Swiften/Network/Timer.h> namespace Swift { -class SOCKS5BytestreamRegistry; class Connection; class TimerFactory; /** * A session which has been connected to a SOCKS5 server (requester). * */ class SWIFTEN_API SOCKS5BytestreamClientSession { public: enum State { Initial, Hello, Authenticating, Ready, Writing, Reading, Finished }; public: typedef std::shared_ptr<SOCKS5BytestreamClientSession> ref; public: SOCKS5BytestreamClientSession( std::shared_ptr<Connection> connection, const HostAddressPort&, const std::string&, TimerFactory*); ~SOCKS5BytestreamClientSession(); diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h index 2fa67fa..33bc57c 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h @@ -1,35 +1,33 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <map> #include <set> #include <string> #include <Swiften/Base/API.h> #include <Swiften/Base/IDGenerator.h> namespace Swift { - class SOCKS5BytestreamServerSession; - class SWIFTEN_API SOCKS5BytestreamRegistry { public: SOCKS5BytestreamRegistry(); void setHasBytestream(const std::string& destination, bool); bool hasBytestream(const std::string& destination) const; /** * Generate a new session ID to use for new S5B streams. */ std::string generateSessionID(); private: std::set<std::string> availableBytestreams; IDGenerator idGenerator; }; } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.h b/Swiften/FileTransfer/SOCKS5BytestreamServer.h index c8866c4..16d3d29 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServer.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.h @@ -1,48 +1,47 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <map> #include <memory> #include <string> #include <Swiften/Base/API.h> #include <Swiften/FileTransfer/ReadBytestream.h> #include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h> #include <Swiften/JID/JID.h> #include <Swiften/Network/ConnectionServer.h> namespace Swift { class SOCKS5BytestreamServerSession; - class CryptoProvider; class SWIFTEN_API SOCKS5BytestreamServer { public: SOCKS5BytestreamServer( std::shared_ptr<ConnectionServer> connectionServer, SOCKS5BytestreamRegistry* registry); HostAddressPort getAddressPort() const; void start(); void stop(); std::vector< std::shared_ptr<SOCKS5BytestreamServerSession> > getSessions(const std::string& id) const; private: void handleNewConnection(std::shared_ptr<Connection> connection); void handleSessionFinished(std::shared_ptr<SOCKS5BytestreamServerSession>); private: friend class SOCKS5BytestreamServerSession; std::shared_ptr<ConnectionServer> connectionServer; SOCKS5BytestreamRegistry* registry; std::vector<std::shared_ptr<SOCKS5BytestreamServerSession> > sessions; }; } diff --git a/Swiften/Jingle/JingleSessionImpl.h b/Swiften/Jingle/JingleSessionImpl.h index b42b790..ae2458c 100644 --- a/Swiften/Jingle/JingleSessionImpl.h +++ b/Swiften/Jingle/JingleSessionImpl.h @@ -1,47 +1,46 @@ /* - * Copyright (c) 2011-2016 Isode Limited. + * Copyright (c) 2011-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <map> #include <memory> #include <Swiften/Jingle/JingleSession.h> #include <Swiften/Queries/GenericRequest.h> namespace Swift { class IQRouter; - class Request; class JingleSessionImpl : public JingleSession { friend class JingleResponder; public: typedef std::shared_ptr<JingleSessionImpl> ref; JingleSessionImpl(const JID& initiator, const JID&, const std::string& id, IQRouter* router); virtual void sendInitiate(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref); virtual void sendTerminate(JinglePayload::Reason::Type reason); virtual void sendInfo(std::shared_ptr<Payload>); virtual void sendAccept(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref); virtual std::string sendTransportInfo(const JingleContentID&, JingleTransportPayload::ref); virtual void sendTransportAccept(const JingleContentID&, JingleTransportPayload::ref); virtual void sendTransportReject(const JingleContentID&, JingleTransportPayload::ref); virtual void sendTransportReplace(const JingleContentID&, JingleTransportPayload::ref); private: typedef std::shared_ptr<GenericRequest<JinglePayload> > RequestRef; void handleIncomingAction(JinglePayload::ref); std::string sendSetRequest(JinglePayload::ref payload); JinglePayload::ref createPayload() const; void handleRequestResponse(RequestRef); private: IQRouter *iqRouter; JID peerJID; typedef std::map<RequestRef, boost::signals2::connection > RequestsMap; diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h index 633ca6d..5d4fefd 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h @@ -1,53 +1,52 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <list> #include <memory> #include <set> #include <string> #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/EventLoop/EventOwner.h> #include <Swiften/LinkLocal/DNSSD/DNSSDQuerier.h> #include <Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h> #include <Swiften/Network/HostAddress.h> namespace Swift { class FakeDNSSDQuery; - class FakeDNSSDBrowseQuery; class EventLoop; class SWIFTEN_API FakeDNSSDQuerier : public DNSSDQuerier, public EventOwner, public std::enable_shared_from_this<FakeDNSSDQuerier> { public: FakeDNSSDQuerier(const std::string& domain, EventLoop* eventLoop); ~FakeDNSSDQuerier(); void start() {} void stop() {} void clearAllQueriesEverRun() { allQueriesEverRun.clear(); } std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info); std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex); void addRunningQuery(std::shared_ptr<FakeDNSSDQuery>); void removeRunningQuery(std::shared_ptr<FakeDNSSDQuery>); void addService(const DNSSDServiceID& id); void removeService(const DNSSDServiceID& id); diff --git a/Swiften/LinkLocal/LinkLocalConnector.h b/Swiften/LinkLocal/LinkLocalConnector.h index 2c49185..044b74f 100644 --- a/Swiften/LinkLocal/LinkLocalConnector.h +++ b/Swiften/LinkLocal/LinkLocalConnector.h @@ -1,55 +1,52 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <vector> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/LinkLocal/LinkLocalService.h> #include <Swiften/Network/Connection.h> namespace Swift { - class ConnectionFactory; - class HostAddress; - class ToplevelElement; - class PayloadParserFactoryCollection; - class PayloadSerializerCollection; class DNSSDQuerier; class DNSSDResolveHostnameQuery; + class HostAddress; + class ToplevelElement; class SWIFTEN_API LinkLocalConnector : public std::enable_shared_from_this<LinkLocalConnector> { public: LinkLocalConnector( const LinkLocalService& service, std::shared_ptr<DNSSDQuerier> querier, std::shared_ptr<Connection> connection); ~LinkLocalConnector(); const LinkLocalService& getService() const { return service; } void connect(); void cancel(); void queueElement(std::shared_ptr<ToplevelElement> element); const std::vector<std::shared_ptr<ToplevelElement> >& getQueuedElements() const { return queuedElements; } std::shared_ptr<Connection> getConnection() const { return connection; } boost::signals2::signal<void (bool)> onConnectFinished; private: void handleHostnameResolved(const boost::optional<HostAddress>& address); void handleConnected(bool error); diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.h b/Swiften/LinkLocal/OutgoingLinkLocalSession.h index 34f7af9..93f8c9d 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.h +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.h @@ -1,45 +1,44 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <vector> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> #include <Swiften/Session/Session.h> namespace Swift { - class ConnectionFactory; - class XMLParserFactory; - class ToplevelElement; class PayloadParserFactoryCollection; class PayloadSerializerCollection; + class ToplevelElement; + class XMLParserFactory; class SWIFTEN_API OutgoingLinkLocalSession : public Session { public: OutgoingLinkLocalSession( const JID& localJID, const JID& remoteJID, std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory); void queueElement(std::shared_ptr<ToplevelElement> element); private: void handleSessionStarted(); void handleElement(std::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); private: std::vector<std::shared_ptr<ToplevelElement> > queuedElements_; }; } diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h index cfb38f6..d61f369 100644 --- a/Swiften/MUC/MUC.h +++ b/Swiften/MUC/MUC.h @@ -1,60 +1,56 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <map> #include <memory> #include <string> #include <boost/signals2.hpp> #include <boost/signals2/connection.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Form.h> #include <Swiften/Elements/MUCAdminPayload.h> #include <Swiften/Elements/MUCOccupant.h> #include <Swiften/Elements/MUCOwnerPayload.h> #include <Swiften/Elements/Message.h> #include <Swiften/Elements/Presence.h> #include <Swiften/JID/JID.h> #include <Swiften/MUC/MUCRegistry.h> namespace Swift { - class StanzaChannel; - class IQRouter; - class DirectedPresenceSender; - class SWIFTEN_API MUC { public: typedef std::shared_ptr<MUC> ref; enum JoinResult { JoinSucceeded, JoinFailed }; enum LeavingType { LeavePart, LeaveKick, LeaveBan, LeaveDestroy, LeaveNotMember, Disconnect }; public: virtual ~MUC(); /** * Returns the (bare) JID of the MUC. */ virtual JID getJID() const = 0; /** * Returns if the room is unlocked and other people can join the room. * @return True if joinable by others; false otherwise. */ virtual bool isUnlocked() const = 0; virtual void joinAs(const std::string &nick) = 0; virtual void joinWithContextSince(const std::string &nick, const boost::posix_time::ptime& since) = 0; /*virtual void queryRoomInfo(); */ /*virtual void queryRoomItems(); */ /*virtual std::string getCurrentNick() = 0; */ virtual std::map<std::string, MUCOccupant> getOccupants() const = 0; virtual void changeNickname(const std::string& newNickname) = 0; virtual void part() = 0; /*virtual void handleIncomingMessage(Message::ref message) = 0; */ diff --git a/Swiften/MUC/UnitTest/MockMUC.h b/Swiften/MUC/UnitTest/MockMUC.h index 4c5ce8d..39b0f1a 100644 --- a/Swiften/MUC/UnitTest/MockMUC.h +++ b/Swiften/MUC/UnitTest/MockMUC.h @@ -1,61 +1,57 @@ /* - * Copyright (c) 2013-2016 Isode Limited. + * Copyright (c) 2013-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <map> #include <memory> #include <string> #include <boost/signals2.hpp> #include <boost/signals2/connection.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Form.h> #include <Swiften/Elements/MUCAdminPayload.h> #include <Swiften/Elements/MUCOccupant.h> #include <Swiften/Elements/MUCOwnerPayload.h> #include <Swiften/Elements/Message.h> #include <Swiften/Elements/Presence.h> #include <Swiften/JID/JID.h> #include <Swiften/MUC/MUC.h> #include <Swiften/MUC/MUCRegistry.h> namespace Swift { - class StanzaChannel; - class IQRouter; - class DirectedPresenceSender; - class SWIFTEN_API MockMUC : public MUC{ public: typedef std::shared_ptr<MockMUC> ref; public: MockMUC(const JID &muc); virtual ~MockMUC(); /** * Cause a user to appear to have entered the room. For testing only. */ void insertOccupant(const MUCOccupant& occupant); /** * Returns the (bare) JID of the MUC. */ virtual JID getJID() const { return ownMUCJID.toBare(); } /** * Returns if the room is unlocked and other people can join the room. * @return True if joinable by others; false otherwise. */ virtual bool isUnlocked() const { return true; } virtual void joinAs(const std::string&) {} virtual void joinWithContextSince(const std::string&, const boost::posix_time::ptime&) {} /*virtual void queryRoomInfo(); */ /*virtual void queryRoomItems(); */ /*virtual std::string getCurrentNick() = 0; */ diff --git a/Swiften/Network/BOSHConnection.h b/Swiften/Network/BOSHConnection.h index 1409ae6..c492ac4 100644 --- a/Swiften/Network/BOSHConnection.h +++ b/Swiften/Network/BOSHConnection.h @@ -1,64 +1,57 @@ /* * Copyright (c) 2011 Thilo Cestonaro * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* * Copyright (c) 2011-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> #include <Swiften/Base/String.h> #include <Swiften/Base/URL.h> #include <Swiften/Network/Connection.h> #include <Swiften/Network/Connector.h> #include <Swiften/Network/HostAddressPort.h> #include <Swiften/Session/SessionStream.h> #include <Swiften/TLS/TLSError.h> -namespace boost { - class thread; - namespace system { - class error_code; - } -} - class BOSHConnectionTest; namespace Swift { class XMLParserFactory; class TLSContextFactory; class TLSLayer; struct TLSOptions; class HighLayer; class SWIFTEN_API BOSHError : public SessionStream::SessionStreamError { public: enum Type { BadRequest, HostGone, HostUnknown, ImproperAddressing, InternalServerError, ItemNotFound, OtherRequest, PolicyViolation, RemoteConnectionFailed, RemoteStreamError, SeeOtherURI, SystemShutdown, UndefinedCondition, NoError}; BOSHError(Type type) : SessionStream::SessionStreamError(SessionStream::SessionStreamError::ConnectionReadError), type(type) {} Type getType() const {return type;} typedef std::shared_ptr<BOSHError> ref; private: Type type; }; class SWIFTEN_API BOSHConnection : public std::enable_shared_from_this<BOSHConnection> { public: typedef std::shared_ptr<BOSHConnection> ref; static ref create(const URL& boshURL, Connector::ref connector, XMLParserFactory* parserFactory, TLSContextFactory* tlsContextFactory, const TLSOptions& tlsOptions) { return ref(new BOSHConnection(boshURL, connector, parserFactory, tlsContextFactory, tlsOptions)); diff --git a/Swiften/Network/BOSHConnectionPool.h b/Swiften/Network/BOSHConnectionPool.h index c4d827c..a6956fa 100644 --- a/Swiften/Network/BOSHConnectionPool.h +++ b/Swiften/Network/BOSHConnectionPool.h @@ -1,51 +1,50 @@ /* - * Copyright (c) 2011-2016 Isode Limited. + * Copyright (c) 2011-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <vector> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeString.h> #include <Swiften/Network/BOSHConnection.h> #include <Swiften/TLS/CertificateWithKey.h> #include <Swiften/TLS/TLSOptions.h> namespace Swift { class CachingDomainNameResolver; class EventLoop; - class HTTPConnectProxiedConnectionFactory; class HTTPTrafficFilter; class TLSContextFactory; class CachingDomainNameResolver; class EventLoop; class SWIFTEN_API BOSHConnectionPool : public boost::signals2::trackable { public: BOSHConnectionPool(const URL& boshURL, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, std::shared_ptr<HTTPTrafficFilter> trafficFilter = std::shared_ptr<HTTPTrafficFilter>()); ~BOSHConnectionPool(); void open(); void write(const SafeByteArray& data); void writeFooter(); void close(); void restartStream(); void setTLSCertificate(CertificateWithKey::ref certWithKey); bool isTLSEncrypted() const; Certificate::ref getPeerCertificate() const; std::vector<Certificate::ref> getPeerCertificateChain() const; std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; boost::signals2::signal<void ()> onTLSConnectionEstablished; boost::signals2::signal<void (BOSHError::ref)> onSessionTerminated; boost::signals2::signal<void ()> onSessionStarted; boost::signals2::signal<void (const SafeByteArray&)> onXMPPDataRead; boost::signals2::signal<void (const SafeByteArray&)> onBOSHDataRead; boost::signals2::signal<void (const SafeByteArray&)> onBOSHDataWritten; private: diff --git a/Swiften/Network/BoostConnection.h b/Swiften/Network/BoostConnection.h index 03122da..c77b933 100644 --- a/Swiften/Network/BoostConnection.h +++ b/Swiften/Network/BoostConnection.h @@ -1,59 +1,52 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <mutex> #include <boost/asio/io_service.hpp> #include <boost/asio/ip/tcp.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/EventLoop/EventOwner.h> #include <Swiften/Network/Connection.h> #include <Swiften/TLS/Certificate.h> #include <Swiften/TLS/CertificateVerificationError.h> #include <Swiften/TLS/CertificateWithKey.h> -namespace boost { - class thread; - namespace system { - class error_code; - } -} - namespace Swift { class EventLoop; class SWIFTEN_API BoostConnection : public Connection, public EventOwner, public std::enable_shared_from_this<BoostConnection> { public: typedef std::shared_ptr<BoostConnection> ref; virtual ~BoostConnection(); static ref create(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) { return ref(new BoostConnection(ioService, eventLoop)); } virtual void listen(); virtual void connect(const HostAddressPort& address); virtual void disconnect(); virtual void write(const SafeByteArray& data); boost::asio::ip::tcp::socket& getSocket() { return socket_; } virtual HostAddressPort getLocalAddress() const; virtual HostAddressPort getRemoteAddress() const; bool setClientCertificate(CertificateWithKey::ref cert); Certificate::ref getPeerCertificate() const; std::vector<Certificate::ref> getPeerCertificateChain() const; std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; diff --git a/Swiften/Network/BoostConnectionFactory.h b/Swiften/Network/BoostConnectionFactory.h index a4e3b0d..eef0b45 100644 --- a/Swiften/Network/BoostConnectionFactory.h +++ b/Swiften/Network/BoostConnectionFactory.h @@ -1,28 +1,26 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <boost/asio/io_service.hpp> #include <Swiften/Base/API.h> #include <Swiften/Network/BoostConnection.h> #include <Swiften/Network/ConnectionFactory.h> namespace Swift { - class BoostConnection; - class SWIFTEN_API BoostConnectionFactory : public ConnectionFactory { public: BoostConnectionFactory(std::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop); virtual std::shared_ptr<Connection> createConnection(); private: std::shared_ptr<boost::asio::io_service> ioService; EventLoop* eventLoop; }; } diff --git a/Swiften/Network/BoostTimerFactory.h b/Swiften/Network/BoostTimerFactory.h index ca9a833..1e2139b 100644 --- a/Swiften/Network/BoostTimerFactory.h +++ b/Swiften/Network/BoostTimerFactory.h @@ -1,29 +1,28 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <boost/asio/io_service.hpp> #include <Swiften/Base/API.h> #include <Swiften/Network/BoostTimer.h> #include <Swiften/Network/TimerFactory.h> namespace Swift { - class BoostTimer; class EventLoop; class SWIFTEN_API BoostTimerFactory : public TimerFactory { public: BoostTimerFactory(std::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop); virtual std::shared_ptr<Timer> createTimer(int milliseconds); private: std::shared_ptr<boost::asio::io_service> ioService; EventLoop* eventLoop; }; } diff --git a/Swiften/Network/HTTPConnectProxiedConnection.h b/Swiften/Network/HTTPConnectProxiedConnection.h index 21b3960..6592839 100644 --- a/Swiften/Network/HTTPConnectProxiedConnection.h +++ b/Swiften/Network/HTTPConnectProxiedConnection.h @@ -1,54 +1,53 @@ /* * Copyright (c) 2010-2011 Thilo Cestonaro * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2011-2016 Isode Limited. + * Copyright (c) 2011-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Network/ProxiedConnection.h> namespace Swift { class ConnectionFactory; class DomainNameResolver; - class EventLoop; class HTTPTrafficFilter; class TimerFactory; class SWIFTEN_API HTTPConnectProxiedConnection : public ProxiedConnection { public: typedef std::shared_ptr<HTTPConnectProxiedConnection> ref; virtual ~HTTPConnectProxiedConnection(); static ref create(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword) { return ref(new HTTPConnectProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort, authID, authPassword)); } void setHTTPTrafficFilter(std::shared_ptr<HTTPTrafficFilter> trafficFilter); private: HTTPConnectProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword); virtual void initializeProxy(); virtual void handleProxyInitializeData(std::shared_ptr<SafeByteArray> data); void sendHTTPRequest(const std::string& statusLine, const std::vector<std::pair<std::string, std::string> >& headerFields); void parseHTTPHeader(const std::string& data, std::string& statusLine, std::vector<std::pair<std::string, std::string> >& headerFields); private: SafeByteArray authID_; SafeByteArray authPassword_; std::shared_ptr<HTTPTrafficFilter> trafficFilter_; std::string httpResponseBuffer_; std::vector<std::pair<std::string, std::string> > nextHTTPRequestHeaders_; diff --git a/Swiften/Network/HTTPConnectProxiedConnectionFactory.h b/Swiften/Network/HTTPConnectProxiedConnectionFactory.h index 74d6279..395f64f 100644 --- a/Swiften/Network/HTTPConnectProxiedConnectionFactory.h +++ b/Swiften/Network/HTTPConnectProxiedConnectionFactory.h @@ -1,43 +1,42 @@ /* - * Copyright (c) 2012-2016 Isode Limited. + * Copyright (c) 2012-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ /* * Copyright (c) 2010-2011 Thilo Cestonaro * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Base/SafeString.h> #include <Swiften/Network/ConnectionFactory.h> #include <Swiften/Network/HostAddressPort.h> namespace Swift { class DomainNameResolver; - class TimerFactory; - class EventLoop; class HTTPTrafficFilter; + class TimerFactory; class SWIFTEN_API HTTPConnectProxiedConnectionFactory : public ConnectionFactory { public: HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = std::shared_ptr<HTTPTrafficFilter>()); HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = std::shared_ptr<HTTPTrafficFilter>()); virtual std::shared_ptr<Connection> createConnection(); private: DomainNameResolver* resolver_; ConnectionFactory* connectionFactory_; TimerFactory* timerFactory_; std::string proxyHost_; int proxyPort_; SafeString authID_; SafeString authPassword_; std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter_; }; } diff --git a/Swiften/Network/NetworkFactories.h b/Swiften/Network/NetworkFactories.h index 7c76c67..f31c448 100644 --- a/Swiften/Network/NetworkFactories.h +++ b/Swiften/Network/NetworkFactories.h @@ -1,46 +1,45 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> namespace Swift { - class TimerFactory; class ConnectionFactory; - class DomainNameResolver; class ConnectionServerFactory; - class NATTraverser; - class XMLParserFactory; - class TLSContextFactory; - class CertificateFactory; - class ProxyProvider; + class CryptoProvider; + class DomainNameResolver; class EventLoop; class IDNConverter; + class NATTraverser; class NetworkEnvironment; - class CryptoProvider; + class ProxyProvider; + class TLSContextFactory; + class TimerFactory; + class XMLParserFactory; /** * An interface collecting network factories. */ class SWIFTEN_API NetworkFactories { public: virtual ~NetworkFactories(); virtual TimerFactory* getTimerFactory() const = 0; virtual ConnectionFactory* getConnectionFactory() const = 0; virtual DomainNameResolver* getDomainNameResolver() const = 0; virtual ConnectionServerFactory* getConnectionServerFactory() const = 0; virtual NATTraverser* getNATTraverser() const = 0; virtual NetworkEnvironment* getNetworkEnvironment() const = 0; virtual XMLParserFactory* getXMLParserFactory() const = 0; virtual TLSContextFactory* getTLSContextFactory() const = 0; virtual ProxyProvider* getProxyProvider() const = 0; virtual EventLoop* getEventLoop() const = 0; virtual IDNConverter* getIDNConverter() const = 0; virtual CryptoProvider* getCryptoProvider() const = 0; }; } diff --git a/Swiften/Network/PlatformNATTraversalWorker.h b/Swiften/Network/PlatformNATTraversalWorker.h index 3607dac..aee1052 100644 --- a/Swiften/Network/PlatformNATTraversalWorker.h +++ b/Swiften/Network/PlatformNATTraversalWorker.h @@ -1,68 +1,67 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <condition_variable> #include <deque> #include <mutex> #include <thread> #include <boost/logic/tribool.hpp> #include <boost/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Atomic.h> #include <Swiften/Network/HostAddressPort.h> #include <Swiften/Network/NATTraverser.h> #include <Swiften/Network/NullNATTraversalInterface.h> namespace Swift { class EventLoop; class NATTraversalGetPublicIPRequest; class NATTraversalForwardPortRequest; class NATTraversalRemovePortForwardingRequest; class PlatformNATTraversalRequest; class NATPMPInterface; class MiniUPnPInterface; class NATTraversalInterface; - class NATPortMapping; class SWIFTEN_API PlatformNATTraversalWorker : public NATTraverser { friend class PlatformNATTraversalRequest; public: PlatformNATTraversalWorker(EventLoop* eventLoop); virtual ~PlatformNATTraversalWorker(); std::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest(); std::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort); std::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort); private: NATTraversalInterface* getNATTraversalInterface() const; void addRequestToQueue(std::shared_ptr<PlatformNATTraversalRequest>); void start(); void stop(); EventLoop* getEventLoop() const { return eventLoop; } private: EventLoop* eventLoop; Atomic<bool> stopRequested; std::thread* thread; std::deque<std::shared_ptr<PlatformNATTraversalRequest> > queue; std::mutex queueMutex; std::condition_variable queueNonEmpty; diff --git a/Swiften/Network/ProxiedConnection.h b/Swiften/Network/ProxiedConnection.h index 38194aa..440fb86 100644 --- a/Swiften/Network/ProxiedConnection.h +++ b/Swiften/Network/ProxiedConnection.h @@ -1,54 +1,47 @@ /* - * Copyright (c) 2012-2016 Isode Limited. + * Copyright (c) 2012-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeString.h> #include <Swiften/Network/Connection.h> #include <Swiften/Network/Connector.h> #include <Swiften/Network/HostAddressPort.h> -namespace boost { - class thread; - namespace system { - class error_code; - } -} - namespace Swift { class ConnectionFactory; class SWIFTEN_API ProxiedConnection : public Connection, public std::enable_shared_from_this<ProxiedConnection> { public: ProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort); virtual ~ProxiedConnection(); virtual void listen(); virtual void connect(const HostAddressPort& address); virtual void disconnect(); virtual void write(const SafeByteArray& data); virtual HostAddressPort getLocalAddress() const; virtual HostAddressPort getRemoteAddress() const; private: void handleConnectFinished(Connection::ref connection); void handleDataRead(std::shared_ptr<SafeByteArray> data); void handleDisconnected(const boost::optional<Error>& error); void cancelConnector(); protected: void setProxyInitializeFinished(bool success); virtual void initializeProxy() = 0; virtual void handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) = 0; const HostAddressPort& getServer() const { return server_; diff --git a/Swiften/Network/UnboundDomainNameResolver.h b/Swiften/Network/UnboundDomainNameResolver.h index a97e385..988a415 100644 --- a/Swiften/Network/UnboundDomainNameResolver.h +++ b/Swiften/Network/UnboundDomainNameResolver.h @@ -1,59 +1,58 @@ /* * Copyright (c) 2013 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <boost/asio.hpp> #include <Swiften/EventLoop/EventOwner.h> #include <Swiften/Network/DomainNameResolver.h> #include <Swiften/Network/Timer.h> struct ub_ctx; struct ub_result; namespace Swift { class EventLoop; class IDNConverter; - class TimerFactory; class UnboundDomainNameResolver; class UnboundQuery; class UnboundDomainNameResolver : public DomainNameResolver, public EventOwner, public std::enable_shared_from_this<UnboundDomainNameResolver> { public: UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); virtual ~UnboundDomainNameResolver(); virtual std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain); virtual std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name); static void unbound_callback_wrapper(void* data, int err, ub_result* result); private: void unbound_callback(std::shared_ptr<UnboundQuery> query, int err, ub_result* result); void handleUBSocketReadable(boost::system::error_code); void processData(); private: IDNConverter* idnConverter; std::shared_ptr<EventOwner> eventOwner; std::shared_ptr<boost::asio::io_service> ioService; boost::asio::posix::stream_descriptor ubDescriptior; EventLoop* eventLoop; ub_ctx* ubContext; }; } diff --git a/Swiften/Parser/GenericElementParser.h b/Swiften/Parser/GenericElementParser.h index 5aa62c9..1092710 100644 --- a/Swiften/Parser/GenericElementParser.h +++ b/Swiften/Parser/GenericElementParser.h @@ -1,46 +1,44 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Parser/ElementParser.h> namespace Swift { - class PayloadParserFactoryCollection; - template<typename ElementType> class SWIFTEN_API GenericElementParser : public ElementParser { public: GenericElementParser() { stanza_ = std::make_shared<ElementType>(); } virtual std::shared_ptr<ToplevelElement> getElement() const { return stanza_; } virtual std::shared_ptr<ElementType> getElementGeneric() const { return stanza_; } private: virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) { } virtual void handleEndElement(const std::string&, const std::string&) { } virtual void handleCharacterData(const std::string&) { } private: std::shared_ptr<ElementType> stanza_; }; } diff --git a/Swiften/Parser/GenericPayloadParser.h b/Swiften/Parser/GenericPayloadParser.h index ea0a7bd..b72189e 100644 --- a/Swiften/Parser/GenericPayloadParser.h +++ b/Swiften/Parser/GenericPayloadParser.h @@ -1,42 +1,39 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParser.h> namespace Swift { - - class FormParser; - /** * A generic payload parser for payloads of the given type. * * This class provides getPayloadInternal() for retrieving the actual * payload. */ template<typename PAYLOAD_TYPE> class GenericPayloadParser : public PayloadParser { public: GenericPayloadParser() : PayloadParser() { payload_ = std::make_shared<PAYLOAD_TYPE>(); } virtual std::shared_ptr<Payload> getPayload() const { return payload_; } virtual std::shared_ptr<PAYLOAD_TYPE> getPayloadInternal() const { return payload_; } private: std::shared_ptr<PAYLOAD_TYPE> payload_; }; } diff --git a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h index cf226cc..3f9b3d3 100644 --- a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h +++ b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h @@ -1,32 +1,30 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/ChatStateParser.h> namespace Swift { - class PayloadParserFactoryCollection; - class SWIFTEN_API ChatStateParserFactory : public PayloadParserFactory { public: ChatStateParserFactory() { } virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const { return ns == "http://jabber.org/protocol/chatstates" && (element == "active" || element == "composing" || element == "paused" || element == "inactive" || element == "gone"); } virtual PayloadParser* createPayloadParser() { return new ChatStateParser(); } }; } diff --git a/Swiften/Parser/PayloadParsers/ClientStateParserFactory.h b/Swiften/Parser/PayloadParsers/ClientStateParserFactory.h index 95617a1..61f7012 100644 --- a/Swiften/Parser/PayloadParsers/ClientStateParserFactory.h +++ b/Swiften/Parser/PayloadParsers/ClientStateParserFactory.h @@ -1,31 +1,35 @@ /* * Copyright (c) 2017 Tarun Gupta. * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2017 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/ClientStateParser.h> namespace Swift { - class PayloadParserFactoryCollection; - class SWIFTEN_API ClientStateParserFactory : public PayloadParserFactory { public: ClientStateParserFactory() { } virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const { return ns == "urn:xmpp:csi:0" && (element == "active" || element == "inactive"); } virtual PayloadParser* createPayloadParser() { return new ClientStateParser(); } }; } diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h b/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h index dc0c311..322ef94 100644 --- a/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h +++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h @@ -1,36 +1,34 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the BSD license. * See http://www.opensource.org/licenses/bsd-license.php for more information. */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/DeliveryReceiptParser.h> namespace Swift { - class PayloadParserFactoryCollection; - class SWIFTEN_API DeliveryReceiptParserFactory : public PayloadParserFactory { public: DeliveryReceiptParserFactory() { } virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const { return ns == "urn:xmpp:receipts" && element == "received"; } virtual PayloadParser* createPayloadParser() { return new DeliveryReceiptParser(); } }; } diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h b/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h index a858285..cef5d8f 100644 --- a/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h +++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h @@ -1,36 +1,34 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the BSD license. * See http://www.opensource.org/licenses/bsd-license.php for more information. */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParser.h> namespace Swift { - class PayloadParserFactoryCollection; - class SWIFTEN_API DeliveryReceiptRequestParserFactory : public PayloadParserFactory { public: DeliveryReceiptRequestParserFactory() { } virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const { return ns == "urn:xmpp:receipts" && element == "request"; } virtual PayloadParser* createPayloadParser() { return new DeliveryReceiptRequestParser(); } }; } diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h index 28bfff1..9c26310 100644 --- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h +++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h @@ -1,30 +1,32 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Parser/GenericPayloadParser.h> namespace Swift { + class FormParser; + class SWIFTEN_API DiscoInfoParser : public GenericPayloadParser<DiscoInfo> { public: DiscoInfoParser(); virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); virtual void handleEndElement(const std::string& element, const std::string&); virtual void handleCharacterData(const std::string& data); private: enum Level { TopLevel = 0, PayloadLevel = 1 }; int level_; FormParser* formParser_; }; } diff --git a/Swiften/Parser/PayloadParsers/FormParserFactory.h b/Swiften/Parser/PayloadParsers/FormParserFactory.h index 851b302..296fcd1 100644 --- a/Swiften/Parser/PayloadParsers/FormParserFactory.h +++ b/Swiften/Parser/PayloadParsers/FormParserFactory.h @@ -1,30 +1,28 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/FormParser.h> namespace Swift { - class PayloadParserFactoryCollection; - class SWIFTEN_API FormParserFactory : public PayloadParserFactory { public: FormParserFactory() { } virtual bool canParse(const std::string& /*element*/, const std::string& ns, const AttributeMap&) const { return ns == "jabber:x:data"; } virtual PayloadParser* createPayloadParser() { return new FormParser(); } }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubErrorParser.h b/Swiften/Parser/PayloadParsers/PubSubErrorParser.h index adc36e9..9c41095 100644 --- a/Swiften/Parser/PayloadParsers/PubSubErrorParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubErrorParser.h @@ -1,35 +1,32 @@ /* - * Copyright (c) 2013-2016 Isode Limited. + * Copyright (c) 2013-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/PubSubError.h> #include <Swiften/Parser/EnumParser.h> #include <Swiften/Parser/GenericPayloadParser.h> namespace Swift { - class PayloadParserFactoryCollection; - class PayloadParser; - class SWIFTEN_API PubSubErrorParser : public GenericPayloadParser<PubSubError> { public: PubSubErrorParser(); virtual ~PubSubErrorParser(); virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE; virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE; virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE; private: int level; EnumParser<PubSubError::Type> typeParser; EnumParser<PubSubError::UnsupportedFeatureType> unsupportedTypeParser; }; } diff --git a/Swiften/Parser/PayloadParsers/ResultSetParser.h b/Swiften/Parser/PayloadParsers/ResultSetParser.h index aa18ae6..819c0a5 100644 --- a/Swiften/Parser/PayloadParsers/ResultSetParser.h +++ b/Swiften/Parser/PayloadParsers/ResultSetParser.h @@ -1,36 +1,34 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/ResultSet.h> #include <Swiften/Parser/GenericPayloadParser.h> namespace Swift { - class PayloadParserFactoryCollection; - class SWIFTEN_API ResultSetParser : public GenericPayloadParser<ResultSet> { public: ResultSetParser(); virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE; virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE; virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE; enum Level { TopLevel = 0, PayloadLevel = 1 }; private: std::string currentText_; int level_; }; } diff --git a/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h b/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h index 40e010a..1fd1113 100644 --- a/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h +++ b/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h @@ -1,41 +1,39 @@ /* * Copyright (c) 2011 Jan Kaluza * Licensed under the Simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/RosterItemExchangePayload.h> #include <Swiften/Parser/GenericPayloadParser.h> namespace Swift { - class SerializingParser; - class SWIFTEN_API RosterItemExchangeParser : public GenericPayloadParser<RosterItemExchangePayload> { public: RosterItemExchangeParser(); virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); virtual void handleEndElement(const std::string& element, const std::string&); virtual void handleCharacterData(const std::string& data); private: enum Level { TopLevel = 0, PayloadLevel = 1, ItemLevel = 2 }; int level_; bool inItem_; RosterItemExchangePayload::Item currentItem_; std::string currentText_; }; } diff --git a/Swiften/Parser/PayloadParsers/VCardUpdateParser.h b/Swiften/Parser/PayloadParsers/VCardUpdateParser.h index 914f138..91837fb 100644 --- a/Swiften/Parser/PayloadParsers/VCardUpdateParser.h +++ b/Swiften/Parser/PayloadParsers/VCardUpdateParser.h @@ -1,32 +1,30 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/VCardUpdate.h> #include <Swiften/Parser/GenericPayloadParser.h> namespace Swift { - class SerializingParser; - class SWIFTEN_API VCardUpdateParser : public GenericPayloadParser<VCardUpdate> { public: VCardUpdateParser(); virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); virtual void handleEndElement(const std::string& element, const std::string&); virtual void handleCharacterData(const std::string& data); private: enum Level { TopLevel = 0, PayloadLevel = 1 }; int level_; std::string currentText_; }; } diff --git a/Swiften/Presence/PayloadAddingPresenceSender.h b/Swiften/Presence/PayloadAddingPresenceSender.h index 3a55183..010b77e 100644 --- a/Swiften/Presence/PayloadAddingPresenceSender.h +++ b/Swiften/Presence/PayloadAddingPresenceSender.h @@ -1,45 +1,43 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Presence/PresenceSender.h> namespace Swift { - class StanzaChannel; - /** * This presence sender adds payloads to outgoing presences. * * This class isn't meant to be used with directed presence. */ class SWIFTEN_API PayloadAddingPresenceSender : public PresenceSender { public: PayloadAddingPresenceSender(PresenceSender*); void sendPresence(std::shared_ptr<Presence>); bool isAvailable() const; /** * Sets the payload to be added to outgoing presences. * If initial presence has been sent, this will resend the last sent presence * with an updated payload. Initial presence is reset when unavailable presence is * sent, or when reset() is called. */ void setPayload(std::shared_ptr<Payload>); /** * Resets the presence sender. * This puts the presence sender back in the initial state (before initial * presence has been sent). * This also resets the chained sender. */ void reset(); private: std::shared_ptr<Presence> lastSentPresence; diff --git a/Swiften/PubSub/PubSubManagerImpl.h b/Swiften/PubSub/PubSubManagerImpl.h index 58c5fc0..2f2b96b 100644 --- a/Swiften/PubSub/PubSubManagerImpl.h +++ b/Swiften/PubSub/PubSubManagerImpl.h @@ -1,40 +1,39 @@ /* - * Copyright (c) 2013-2016 Isode Limited. + * Copyright (c) 2013-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/PubSub/PubSubManager.h> #define SWIFTEN_PUBSUBMANAGERIMPL_DECLARE_CREATE_REQUEST(payload, container, response) \ virtual std::shared_ptr< PubSubRequest<payload> > \ createRequest(IQ::Type type, const JID& receiver, std::shared_ptr<payload> p) SWIFTEN_OVERRIDE { \ return std::make_shared< PubSubRequest<payload> >(type, receiver, p, router); \ } namespace Swift { - class JID; class StanzaChannel; class Message; class SWIFTEN_API PubSubManagerImpl : public PubSubManager { public: PubSubManagerImpl(StanzaChannel* stanzaChannel, IQRouter* router); virtual ~PubSubManagerImpl(); SWIFTEN_PUBSUB_FOREACH_PUBSUB_PAYLOAD_TYPE( SWIFTEN_PUBSUBMANAGERIMPL_DECLARE_CREATE_REQUEST) private: void handleMessageRecevied(std::shared_ptr<Message>); private: StanzaChannel* stanzaChannel; IQRouter* router; }; } diff --git a/Swiften/Queries/IQHandler.h b/Swiften/Queries/IQHandler.h index 1bfdf0f..b5c1fc3 100644 --- a/Swiften/Queries/IQHandler.h +++ b/Swiften/Queries/IQHandler.h @@ -1,23 +1,21 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/IQ.h> namespace Swift { - class IQRouter; - class SWIFTEN_API IQHandler { public: virtual ~IQHandler(); virtual bool handleIQ(std::shared_ptr<IQ>) = 0; }; } diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h index a62c103..2cf5017 100644 --- a/Swiften/Queries/Request.h +++ b/Swiften/Queries/Request.h @@ -1,51 +1,53 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <string> #include <boost/optional.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ErrorPayload.h> #include <Swiften/Elements/IQ.h> #include <Swiften/Elements/Payload.h> #include <Swiften/JID/JID.h> #include <Swiften/Queries/IQHandler.h> namespace Swift { + class IQRouter; + /** * An IQ get/set request query. */ class SWIFTEN_API Request : public IQHandler, public std::enable_shared_from_this<Request> { public: std::string send(); const JID& getReceiver() const { return receiver_; } /** * Returns the ID of this request. * This will only be set after send() is called. */ const std::string& getID() const { return id_; } protected: /** * Constructs a request of a certain type to a specific receiver, and attaches the given * payload. */ Request( IQ::Type type, const JID& receiver, std::shared_ptr<Payload> payload, IQRouter* router); diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h index 533be61..900d37a 100644 --- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h @@ -1,22 +1,20 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/Bytestreams.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API BytestreamsSerializer : public GenericPayloadSerializer<Bytestreams> { public: BytestreamsSerializer(); virtual std::string serializePayload(std::shared_ptr<Bytestreams>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h index 825a67c..93cf5b3 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h @@ -1,32 +1,30 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleContentPayload.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API JingleContentPayloadSerializer : public GenericPayloadSerializer<JingleContentPayload> { public: JingleContentPayloadSerializer(); virtual std::string serializePayload(std::shared_ptr<JingleContentPayload>) const; private: std::string creatorToString(JingleContentPayload::Creator creator) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h index 65e757b..9e77c0a 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h @@ -1,30 +1,27 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleFileTransferDescription.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class XMLElement; - class SWIFTEN_API JingleFileTransferDescriptionSerializer : public GenericPayloadSerializer<JingleFileTransferDescription> { public: JingleFileTransferDescriptionSerializer(); virtual std::string serializePayload(std::shared_ptr<JingleFileTransferDescription>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h index 6b80235..d0f4c17 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h @@ -1,23 +1,21 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleFileTransferFileInfo.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API JingleFileTransferFileInfoSerializer : public GenericPayloadSerializer<JingleFileTransferFileInfo> { public: JingleFileTransferFileInfoSerializer(); virtual std::string serializePayload(std::shared_ptr<JingleFileTransferFileInfo>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h index bb6eabc..bc978ea 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h @@ -1,30 +1,27 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleFileTransferHash.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class XMLElement; - class SWIFTEN_API JingleFileTransferHashSerializer : public GenericPayloadSerializer<JingleFileTransferHash> { public: JingleFileTransferHashSerializer(); virtual std::string serializePayload(std::shared_ptr<JingleFileTransferHash>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h index e94fb52..27fb5f1 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h @@ -1,30 +1,27 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleIBBTransportPayload.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class XMLElement; - class SWIFTEN_API JingleIBBTransportPayloadSerializer : public GenericPayloadSerializer<JingleIBBTransportPayload> { public: JingleIBBTransportPayloadSerializer(); virtual std::string serializePayload(std::shared_ptr<JingleIBBTransportPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h index a846ebe..7794855 100644 --- a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h @@ -1,37 +1,36 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/JinglePayload.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { class PayloadSerializerCollection; - class XMLElement; class SWIFTEN_API JinglePayloadSerializer : public GenericPayloadSerializer<JinglePayload> { public: JinglePayloadSerializer(PayloadSerializerCollection*); virtual std::string serializePayload(std::shared_ptr<JinglePayload>) const; private: std::string actionToString(JinglePayload::Action action) const; std::string reasonTypeToString(JinglePayload::Reason::Type type) const; private: PayloadSerializerCollection* serializers; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h index cca2f4e..c081c87 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h @@ -1,34 +1,31 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleS5BTransportPayload.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class XMLElement; - class SWIFTEN_API JingleS5BTransportPayloadSerializer : public GenericPayloadSerializer<JingleS5BTransportPayload> { public: JingleS5BTransportPayloadSerializer(); virtual std::string serializePayload(std::shared_ptr<JingleS5BTransportPayload>) const; private: std::string modeToString(JingleS5BTransportPayload::Mode) const; std::string typeToString(JingleS5BTransportPayload::Candidate::Type) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h b/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h index 7e2a7c7..7c5bd29 100644 --- a/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h @@ -1,26 +1,24 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/MAMFin.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API MAMFinSerializer : public GenericPayloadSerializer<MAMFin> { public: MAMFinSerializer(); virtual ~MAMFinSerializer(); virtual std::string serializePayload(std::shared_ptr<MAMFin>) const SWIFTEN_OVERRIDE; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h b/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h index 6af979b..6b2403f 100644 --- a/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h @@ -1,26 +1,24 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/MAMQuery.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API MAMQuerySerializer : public GenericPayloadSerializer<MAMQuery> { public: MAMQuerySerializer(); virtual ~MAMQuerySerializer(); virtual std::string serializePayload(std::shared_ptr<MAMQuery>) const SWIFTEN_OVERRIDE; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h index 2ce8ccc..def362c 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h @@ -1,21 +1,20 @@ /* - * Copyright (c) 2011-2016 Isode Limited. + * Copyright (c) 2011-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/MUCDestroyPayload.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; class SWIFTEN_API MUCDestroyPayloadSerializer : public GenericPayloadSerializer<MUCDestroyPayload> { public: MUCDestroyPayloadSerializer(); virtual std::string serializePayload(std::shared_ptr<MUCDestroyPayload> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h index 6b0882e..d3d1227 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h @@ -1,28 +1,26 @@ /* - * Copyright (c) 2013-2016 Isode Limited. + * Copyright (c) 2013-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/PubSubError.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API PubSubErrorSerializer : public GenericPayloadSerializer<PubSubError> { public: PubSubErrorSerializer(); virtual ~PubSubErrorSerializer(); virtual std::string serializePayload(std::shared_ptr<PubSubError>) const SWIFTEN_OVERRIDE; private: static std::string serializeType(PubSubError::Type); static std::string serializeUnsupportedFeatureType(PubSubError::UnsupportedFeatureType); }; } diff --git a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h index e75b443..6a1429a 100644 --- a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h @@ -1,26 +1,24 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/ResultSet.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API ResultSetSerializer : public GenericPayloadSerializer<ResultSet> { public: ResultSetSerializer(); virtual ~ResultSetSerializer(); virtual std::string serializePayload(std::shared_ptr<ResultSet>) const SWIFTEN_OVERRIDE; }; } diff --git a/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h b/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h index 7058ac1..14cbd14 100644 --- a/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h @@ -1,45 +1,43 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <boost/lexical_cast.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/S5BProxyRequest.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API S5BProxyRequestSerializer : public GenericPayloadSerializer<S5BProxyRequest> { public: virtual std::string serializePayload(std::shared_ptr<S5BProxyRequest> s5bProxyRequest) const { XMLElement queryElement("query", "http://jabber.org/protocol/bytestreams"); if (s5bProxyRequest && s5bProxyRequest->getStreamHost()) { std::shared_ptr<XMLElement> streamHost = std::make_shared<XMLElement>("streamhost"); streamHost->setAttribute("host", s5bProxyRequest->getStreamHost().get().host); streamHost->setAttribute("port", boost::lexical_cast<std::string>(s5bProxyRequest->getStreamHost().get().port)); streamHost->setAttribute("jid", s5bProxyRequest->getStreamHost().get().jid.toString()); queryElement.addNode(streamHost); } else if (s5bProxyRequest && s5bProxyRequest->getActivate()) { queryElement.setAttribute("sid", s5bProxyRequest->getSID()); std::shared_ptr<XMLElement> activate = std::make_shared<XMLElement>("activate", "", s5bProxyRequest->getActivate().get().toString()); queryElement.addNode(activate); } return queryElement.serialize(); } }; } diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h index 51f4227..21c6921 100644 --- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h @@ -1,23 +1,21 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/SearchPayload.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API SearchPayloadSerializer : public GenericPayloadSerializer<SearchPayload> { public: SearchPayloadSerializer(); virtual std::string serializePayload(std::shared_ptr<SearchPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h index de54313..b352f7f 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h @@ -1,30 +1,28 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <Swiften/Base/API.h> #include <Swiften/Elements/StreamInitiationFileInfo.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> namespace Swift { - class PayloadSerializerCollection; - class SWIFTEN_API StreamInitiationFileInfoSerializer : public GenericPayloadSerializer<StreamInitiationFileInfo> { public: StreamInitiationFileInfoSerializer(); virtual std::string serializePayload(std::shared_ptr<StreamInitiationFileInfo>) const; }; } diff --git a/Swiften/Serializer/XMPPSerializer.h b/Swiften/Serializer/XMPPSerializer.h index 8c182e3..d328272 100644 --- a/Swiften/Serializer/XMPPSerializer.h +++ b/Swiften/Serializer/XMPPSerializer.h @@ -1,38 +1,37 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <string> #include <vector> #include <Swiften/Base/API.h> #include <Swiften/Elements/StreamType.h> #include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Serializer/ElementSerializer.h> namespace Swift { class PayloadSerializerCollection; - class CompressRequestSerializer; class ProtocolHeader; class SWIFTEN_API XMPPSerializer { public: XMPPSerializer(PayloadSerializerCollection*, StreamType type, bool setExplictNSonTopLevelElements); std::string serializeHeader(const ProtocolHeader&) const; SafeByteArray serializeElement(std::shared_ptr<ToplevelElement> stanza) const; std::string serializeFooter() const; private: std::string getDefaultNamespace() const; private: StreamType type_; std::vector< std::shared_ptr<ElementSerializer> > serializers_; }; } diff --git a/Swiften/Session/BOSHSessionStream.h b/Swiften/Session/BOSHSessionStream.h index 719f1f0..5b730cf 100644 --- a/Swiften/Session/BOSHSessionStream.h +++ b/Swiften/Session/BOSHSessionStream.h @@ -1,57 +1,54 @@ /* - * Copyright (c) 2011-2016 Isode Limited. + * Copyright (c) 2011-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/Base/SafeString.h> #include <Swiften/Elements/StreamType.h> #include <Swiften/EventLoop/EventOwner.h> #include <Swiften/Network/BOSHConnectionPool.h> #include <Swiften/Session/SessionStream.h> #include <Swiften/TLS/TLSOptions.h> namespace Swift { - class CompressionLayer; - class ConnectionLayer; class EventLoop; class HTTPTrafficFilter; class PayloadParserFactoryCollection; class PayloadSerializerCollection; - class StreamStack; class TLSContextFactory; class TimerFactory; class XMLParserFactory; class XMPPLayer; class SWIFTEN_API BOSHSessionStream : public SessionStream, public EventOwner, public std::enable_shared_from_this<BOSHSessionStream> { public: BOSHSessionStream( const URL& boshURL, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, ConnectionFactory* connectionFactory, TLSContextFactory* tlsContextFactory, TimerFactory* whitespacePingLayerFactory, XMLParserFactory* xmlParserFactory, EventLoop* eventLoop, DomainNameResolver* resolver, const std::string& to, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, std::shared_ptr<HTTPTrafficFilter> trafficFilter ); virtual ~BOSHSessionStream(); void open(); virtual void close(); virtual bool isOpen(); diff --git a/Swiften/Session/Session.h b/Swiften/Session/Session.h index 23cc656..04153ec 100644 --- a/Swiften/Session/Session.h +++ b/Swiften/Session/Session.h @@ -1,55 +1,53 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <boost/optional.hpp> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/Elements/ToplevelElement.h> #include <Swiften/JID/JID.h> #include <Swiften/Network/Connection.h> #include <Swiften/StreamStack/ConnectionLayer.h> namespace Swift { class ProtocolHeader; class StreamStack; - class JID; - class Element; class PayloadParserFactoryCollection; class PayloadSerializerCollection; class XMPPLayer; class XMLParserFactory; class SWIFTEN_API Session : public std::enable_shared_from_this<Session> { public: enum SessionError { ConnectionReadError, ConnectionWriteError, XMLError, AuthenticationFailedError, NoSupportedAuthMechanismsError, UnexpectedElementError, ResourceBindError, SessionStartError, TLSError, ClientCertificateLoadError, ClientCertificateError }; Session( std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory); virtual ~Session(); void startSession(); void finishSession(); diff --git a/Swiften/VCards/VCardManager.h b/Swiften/VCards/VCardManager.h index d987862..e28e8e6 100644 --- a/Swiften/VCards/VCardManager.h +++ b/Swiften/VCards/VCardManager.h @@ -1,52 +1,51 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <set> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ErrorPayload.h> #include <Swiften/Elements/VCard.h> #include <Swiften/JID/JID.h> #include <Swiften/VCards/SetVCardRequest.h> namespace Swift { class IQRouter; - class JID; class VCardStorage; class SWIFTEN_API VCardManager : public boost::signals2::trackable { public: VCardManager(const JID& ownJID, IQRouter* iqRouter, VCardStorage* vcardStorage); ~VCardManager(); VCard::ref getVCard(const JID& jid) const; VCard::ref getVCardAndRequestWhenNeeded(const JID& jid, const boost::posix_time::time_duration& allowedAge = boost::posix_time::time_duration(boost::date_time::pos_infin)); void requestVCard(const JID& jid); void requestOwnVCard(); std::string getPhotoHash(const JID& jid) const; SetVCardRequest::ref createSetVCardRequest(VCard::ref); public: /** * The JID will always be bare. */ boost::signals2::signal<void (const JID&, VCard::ref)> onVCardChanged; /** * Emitted when we received an error on looking up a vCard. */ boost::signals2::signal<void (const JID&, ErrorPayload::ref)> onVCardRetrievalError; /** * Emitted when our own vcard changes. diff --git a/Swiften/Whiteboard/WhiteboardSession.h b/Swiften/Whiteboard/WhiteboardSession.h index 0871f94..1b5d039 100644 --- a/Swiften/Whiteboard/WhiteboardSession.h +++ b/Swiften/Whiteboard/WhiteboardSession.h @@ -1,58 +1,57 @@ /* * Copyright (c) 2012 Mateusz Piękos * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <boost/signals2.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/IDGenerator.h> #include <Swiften/Elements/Whiteboard/WhiteboardElement.h> #include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> #include <Swiften/JID/JID.h> #include <Swiften/Queries/GenericRequest.h> namespace Swift { class IQRouter; - class ErrorPayload; class WhiteboardPayload; class SWIFTEN_API WhiteboardSession { public: typedef std::shared_ptr<WhiteboardSession> ref; public: WhiteboardSession(const JID& jid, IQRouter* router); virtual ~WhiteboardSession(); void handleIncomingAction(std::shared_ptr<WhiteboardPayload> payload); void sendElement(const WhiteboardElement::ref element); virtual void sendOperation(WhiteboardOperation::ref operation) = 0; void cancel(); const JID& getTo() const; public: boost::signals2::signal< void(const WhiteboardElement::ref element)> onElementReceived; boost::signals2::signal< void(const WhiteboardOperation::ref operation)> onOperationReceived; boost::signals2::signal< void(const JID& contact)> onSessionTerminated; boost::signals2::signal< void(const JID& contact)> onRequestAccepted; boost::signals2::signal< void(const JID& contact)> onRequestRejected; private: virtual void handleIncomingOperation(WhiteboardOperation::ref operation) = 0; protected: void sendPayload(std::shared_ptr<WhiteboardPayload> payload); JID toJID_; IQRouter* router_; |