/* * Copyright (c) 2013 Remko Tronçon * Licensed under the GNU General Public License. * See the COPYING file for more information. */ #pragma once #include #include #include #include #include #include #include #include #include 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( boost::shared_ptr, const JID& target, FileTransferTransporterFactory*); virtual ~JingleFileTransfer(); protected: virtual void handleTransportInfoReceived(const JingleContentID&, JingleTransportPayload::ref); virtual void handleLocalTransportCandidatesGenerated( const std::string& s5bSessionID, const std::vector&) = 0; virtual void handleProxyActivateFinished( const std::string& s5bSessionID, ErrorPayload::ref error); virtual void decideOnCandidates(); void handleRemoteTransportCandidateSelectFinished( const std::string& s5bSessionID, const boost::optional&); virtual JingleContentID getContentID() const = 0; virtual void startTransferring(boost::shared_ptr) = 0; virtual void terminate(JinglePayload::Reason::Type reason) = 0; virtual void fallback() = 0; virtual bool hasPriorityOnCandidateTie() const = 0; virtual bool isWaitingForPeerProxyActivate() const = 0; virtual bool isWaitingForLocalProxyActivate() const = 0; virtual bool isTryingCandidates() const = 0; virtual boost::shared_ptr createLocalCandidateSession() = 0; virtual boost::shared_ptr createRemoteCandidateSession() = 0; virtual void startTransferViaLocalCandidate() = 0; virtual void startTransferViaRemoteCandidate() = 0; protected: typedef std::map CandidateMap; void setTransporter(FileTransferTransporter* transporter); void fillCandidateMap( CandidateMap& map, const std::vector&); const JID& getInitiator() const; const JID& getResponder() const; static FileTransfer::State::Type getExternalFinishedState(JinglePayload::Reason::Type); static boost::optional getFileTransferError(JinglePayload::Reason::Type); boost::shared_ptr session; JID target; FileTransferTransporterFactory* transporterFactory; FileTransferTransporter* transporter; std::string candidateSelectRequestID; bool ourCandidateSelectFinished; boost::optional ourCandidateChoice; bool theirCandidateSelectFinished; boost::optional theirCandidateChoice; CandidateMap localCandidates; boost::shared_ptr transportSession; boost::bsignals::scoped_connection localTransportCandidatesGeneratedConnection; boost::bsignals::scoped_connection remoteTransportCandidateSelectFinishedConnection; boost::bsignals::scoped_connection proxyActivatedConnection; }; }