summaryrefslogtreecommitdiffstats
blob: 02dfef52762cf51b5b30b62af7f84eab08d4efca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Copyright (c) 2011 Tobias Markmann
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

/*
 * 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/boost_bsignals.h>
#include <Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.h>

#include <Swiften/Base/IDGenerator.h>
#include <Swiften/Base/Override.h>
#include <Swiften/JID/JID.h>
#include <Swiften/Elements/JingleS5BTransportPayload.h>

namespace Swift {
	class SOCKS5BytestreamServerManager;
	class SOCKS5BytestreamProxiesManager;
	class SOCKS5BytestreamServerInitializeRequest;
	class JingleS5BTransportPayload;

	class LocalJingleTransportCandidateGenerator {
		public:
			LocalJingleTransportCandidateGenerator(
					SOCKS5BytestreamServerManager* s5bServerManager,
					SOCKS5BytestreamProxiesManager* s5bProxy, 
					const JID& ownJID,
					IDGenerator* idGenerator);
			virtual ~LocalJingleTransportCandidateGenerator();

			virtual void start();
			virtual void stop();

			boost::signal<void (const std::vector<JingleS5BTransportPayload::Candidate>&)> onLocalTransportCandidatesGenerated;

		private:
			void handleS5BServerInitialized(bool success);
			void checkS5BCandidatesReady();

		private:
			SOCKS5BytestreamServerManager* s5bServerManager;
			SOCKS5BytestreamProxiesManager* s5bProxy;
			JID ownJID;
			IDGenerator* idGenerator;
			boost::shared_ptr<SOCKS5BytestreamServerInitializeRequest> s5bServerInitializeRequest;
	};
}