/* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include namespace Swift { class RemoteJingleTransportCandidateSelectorFactory; class RemoteJingleTransportCandidateSelector; class LocalJingleTransportCandidateGeneratorFactory; class LocalJingleTransportCandidateGenerator; class IQRouter; class ReadBytestream; class IBBSendSession; class IDGenerator; class IncrementalBytestreamHashCalculator; class SOCKS5BytestreamRegistry; class SOCKS5BytestreamProxy; class OutgoingJingleFileTransfer : public OutgoingFileTransfer { public: OutgoingJingleFileTransfer(JingleSession::ref, RemoteJingleTransportCandidateSelectorFactory*, LocalJingleTransportCandidateGeneratorFactory*, IQRouter*, IDGenerator*, const JID&, boost::shared_ptr, const StreamInitiationFileInfo&, SOCKS5BytestreamRegistry*, SOCKS5BytestreamProxy*); virtual ~OutgoingJingleFileTransfer(); void start(); void stop(); void cancel(); private: void handleSessionAcceptReceived(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref); void handleSessionTerminateReceived(boost::optional reason); void handleTransportAcceptReceived(const JingleContentID&, JingleTransportPayload::ref); void handleTransportInfoReceived(const JingleContentID&, JingleTransportPayload::ref); void handleLocalTransportCandidatesGenerated(JingleTransportPayload::ref); void handleRemoteTransportCandidateSelectFinished(JingleTransportPayload::ref); private: void replaceTransportWithIBB(const JingleContentID&); void handleTransferFinished(boost::optional); void activateProxySession(const JID &proxy); void handleActivateProxySessionResult(boost::shared_ptr request, ErrorPayload::ref error); void proxySessionReady(const JID& proxy, bool error); private: typedef std::map CandidateMap; private: void startTransferViaOurCandidateChoice(JingleS5BTransportPayload::Candidate); void startTransferViaTheirCandidateChoice(JingleS5BTransportPayload::Candidate); void decideOnCandidates(); void fillCandidateMap(CandidateMap& map, JingleS5BTransportPayload::ref s5bPayload); private: void sendSessionInfoHash(); private: JingleSession::ref session; RemoteJingleTransportCandidateSelector* remoteCandidateSelector; RemoteJingleTransportCandidateSelectorFactory* remoteFactory; LocalJingleTransportCandidateGenerator* localCandidateGenerator; LocalJingleTransportCandidateGeneratorFactory* localFactory; IQRouter* router; IDGenerator* idGenerator; JID toJID; boost::shared_ptr readStream; StreamInitiationFileInfo fileInfo; IncrementalBytestreamHashCalculator *hashCalculator; boost::shared_ptr ibbSession; JingleS5BTransportPayload::ref ourCandidateChoice; JingleS5BTransportPayload::ref theirCandidateChoice; CandidateMap ourCandidates; CandidateMap theirCandidates; SOCKS5BytestreamRegistry* s5bRegistry; SOCKS5BytestreamProxy* s5bProxy; SOCKS5BytestreamClientSession::ref clientSession; SOCKS5BytestreamServerSession* serverSession; JingleContentID contentID; std::string s5bSessionID; bool canceled; }; }