summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-12-25 14:39:48 (GMT)
committerRemko Tronçon <git@el-tramo.be>2013-05-11 10:22:56 (GMT)
commit927d62cc54c8a5087dba6b61afa9ad30dc528a23 (patch)
treee67dc911bd30c0519d31a542d8e085bbb209879d /Swiften/FileTransfer/JingleFileTransfer.h
parent17b188343e7208b875af7af30d94f0bf948f6b93 (diff)
downloadswift-927d62cc54c8a5087dba6b61afa9ad30dc528a23.zip
swift-927d62cc54c8a5087dba6b61afa9ad30dc528a23.tar.bz2
File Transfer refactoring.
Allocate S5B server lazily. Forward forts lazily. Various state machine fixes. Temporarily disabling S5B proxy support. Change-Id: I3145e85a99b15a7e457306bbfbe9c0eb570191e4
Diffstat (limited to 'Swiften/FileTransfer/JingleFileTransfer.h')
-rw-r--r--Swiften/FileTransfer/JingleFileTransfer.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/Swiften/FileTransfer/JingleFileTransfer.h b/Swiften/FileTransfer/JingleFileTransfer.h
new file mode 100644
index 0000000..ee646c1
--- /dev/null
+++ b/Swiften/FileTransfer/JingleFileTransfer.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013 Remko Tronçon
+ * Licensed under the GNU General Public License.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+#include <Swiften/Base/boost_bsignals.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(
+ boost::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>&) = 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(boost::shared_ptr<TransportSession>) = 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<TransportSession> createLocalCandidateSession() = 0;
+ virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession() = 0;
+ virtual void startTransferViaLocalCandidate() = 0;
+ virtual void startTransferViaRemoteCandidate() = 0;
+
+ protected:
+ typedef std::map<std::string, JingleS5BTransportPayload::Candidate> CandidateMap;
+
+ void setTransporter(FileTransferTransporter* transporter);
+ void fillCandidateMap(
+ CandidateMap& map,
+ const std::vector<JingleS5BTransportPayload::Candidate>&);
+ const JID& getInitiator() const;
+ const JID& getResponder() const;
+
+ static FileTransfer::State::Type getExternalFinishedState(JinglePayload::Reason::Type);
+ static boost::optional<FileTransferError> getFileTransferError(JinglePayload::Reason::Type);
+
+ boost::shared_ptr<JingleSession> session;
+ JID target;
+ FileTransferTransporterFactory* transporterFactory;
+ FileTransferTransporter* transporter;
+
+ std::string candidateSelectRequestID;
+ bool ourCandidateSelectFinished;
+ boost::optional<JingleS5BTransportPayload::Candidate> ourCandidateChoice;
+ bool theirCandidateSelectFinished;
+ boost::optional<JingleS5BTransportPayload::Candidate> theirCandidateChoice;
+ CandidateMap localCandidates;
+
+ boost::shared_ptr<TransportSession> transportSession;
+
+ boost::bsignals::scoped_connection localTransportCandidatesGeneratedConnection;
+ boost::bsignals::scoped_connection remoteTransportCandidateSelectFinishedConnection;
+ boost::bsignals::scoped_connection proxyActivatedConnection;
+ };
+}