diff options
Diffstat (limited to 'Swiften/FileTransfer/OutgoingJingleFileTransfer.h')
-rw-r--r-- | Swiften/FileTransfer/OutgoingJingleFileTransfer.h | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.h b/Swiften/FileTransfer/OutgoingJingleFileTransfer.h index 96b465b..a8dad1e 100644 --- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.h +++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.h @@ -25,98 +25,98 @@ #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, - boost::shared_ptr<JingleSession>, - boost::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, - WaitingForPeerProxyActivate, - WaitingForLocalProxyActivate, - WaitingForCandidateAcknowledge, - FallbackRequested, - Transferring, - WaitForTermination, - Finished - }; - - virtual void handleSessionAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleDescription>, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; - virtual void handleSessionTerminateReceived(boost::optional<JinglePayload::Reason> reason) SWIFTEN_OVERRIDE; - virtual void handleTransportAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; - virtual void handleTransportRejectReceived(const JingleContentID &, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; - virtual void startTransferViaRemoteCandidate() SWIFTEN_OVERRIDE; - virtual void startTransferViaLocalCandidate() SWIFTEN_OVERRIDE; - void startTransferringIfCandidateAcknowledged(); - - virtual void handleLocalTransportCandidatesGenerated(const std::string& s5bSessionID, const std::vector<JingleS5BTransportPayload::Candidate>&, const std::string& dstAddr) SWIFTEN_OVERRIDE; - virtual void handleTransportInfoAcknowledged(const std::string& id) SWIFTEN_OVERRIDE; - - virtual JingleContentID getContentID() const SWIFTEN_OVERRIDE; - - virtual void terminate(JinglePayload::Reason::Type reason) SWIFTEN_OVERRIDE; - - virtual void fallback() SWIFTEN_OVERRIDE; - void handleTransferFinished(boost::optional<FileTransferError>); - - void sendSessionInfoHash(); - - virtual void startTransferring(boost::shared_ptr<TransportSession>) SWIFTEN_OVERRIDE; - - virtual bool hasPriorityOnCandidateTie() const SWIFTEN_OVERRIDE; - virtual bool isWaitingForPeerProxyActivate() const SWIFTEN_OVERRIDE; - virtual bool isWaitingForLocalProxyActivate() const SWIFTEN_OVERRIDE; - virtual bool isTryingCandidates() const SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession() SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession() SWIFTEN_OVERRIDE; - - void handleWaitForRemoteTerminationTimeout(); - - void stopAll(); - void setInternalState(State state); - void setFinishedState(FileTransfer::State::Type, const boost::optional<FileTransferError>& error); - - static FileTransfer::State::Type getExternalState(State state); - - private: - IDGenerator* idGenerator; - boost::shared_ptr<ReadBytestream> stream; - JingleFileTransferFileInfo fileInfo; - FileTransferOptions options; - JingleContentID contentID; - IncrementalBytestreamHashCalculator* hashCalculator; - State state; - bool candidateAcknowledged; - - Timer::ref waitForRemoteTermination; - - boost::bsignals::connection processedBytesConnection; - boost::bsignals::connection transferFinishedConnection; - }; + 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, + boost::shared_ptr<JingleSession>, + boost::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, + WaitingForPeerProxyActivate, + WaitingForLocalProxyActivate, + WaitingForCandidateAcknowledge, + FallbackRequested, + Transferring, + WaitForTermination, + Finished + }; + + virtual void handleSessionAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleDescription>, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleSessionTerminateReceived(boost::optional<JinglePayload::Reason> reason) SWIFTEN_OVERRIDE; + virtual void handleTransportAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleTransportRejectReceived(const JingleContentID &, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void startTransferViaRemoteCandidate() SWIFTEN_OVERRIDE; + virtual void startTransferViaLocalCandidate() SWIFTEN_OVERRIDE; + void startTransferringIfCandidateAcknowledged(); + + virtual void handleLocalTransportCandidatesGenerated(const std::string& s5bSessionID, const std::vector<JingleS5BTransportPayload::Candidate>&, const std::string& dstAddr) SWIFTEN_OVERRIDE; + virtual void handleTransportInfoAcknowledged(const std::string& id) SWIFTEN_OVERRIDE; + + virtual JingleContentID getContentID() const SWIFTEN_OVERRIDE; + + virtual void terminate(JinglePayload::Reason::Type reason) SWIFTEN_OVERRIDE; + + virtual void fallback() SWIFTEN_OVERRIDE; + void handleTransferFinished(boost::optional<FileTransferError>); + + void sendSessionInfoHash(); + + virtual void startTransferring(boost::shared_ptr<TransportSession>) SWIFTEN_OVERRIDE; + + virtual bool hasPriorityOnCandidateTie() const SWIFTEN_OVERRIDE; + virtual bool isWaitingForPeerProxyActivate() const SWIFTEN_OVERRIDE; + virtual bool isWaitingForLocalProxyActivate() const SWIFTEN_OVERRIDE; + virtual bool isTryingCandidates() const SWIFTEN_OVERRIDE; + virtual boost::shared_ptr<TransportSession> createLocalCandidateSession() SWIFTEN_OVERRIDE; + virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession() SWIFTEN_OVERRIDE; + + void handleWaitForRemoteTerminationTimeout(); + + void stopAll(); + void setInternalState(State state); + void setFinishedState(FileTransfer::State::Type, const boost::optional<FileTransferError>& error); + + static FileTransfer::State::Type getExternalState(State state); + + private: + IDGenerator* idGenerator; + boost::shared_ptr<ReadBytestream> stream; + JingleFileTransferFileInfo fileInfo; + FileTransferOptions options; + JingleContentID contentID; + IncrementalBytestreamHashCalculator* hashCalculator; + State state; + bool candidateAcknowledged; + + Timer::ref waitForRemoteTermination; + + boost::bsignals::connection processedBytesConnection; + boost::bsignals::connection transferFinishedConnection; + }; } |