-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConnectionPeer.hpp
More file actions
85 lines (72 loc) · 2.95 KB
/
ConnectionPeer.hpp
File metadata and controls
85 lines (72 loc) · 2.95 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* This file is part of WebP2P.
*
* WebP2P is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WebP2P is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebP2P. If not, see <http://www.gnu.org/licenses/>.
*
* Filename: ConnectionPeer.hpp
* Author(s): Dries Staelens
* Copyright: Copyright (c) 2010 Dries Staelens
* Description: Definition for the class that implements the javascript
* ConnectionPeer object.
**/
#pragma once
/* firebreath headers */
#include "JSAPIAuto.h"
#include "JSObject.h"
/* web_p2p headers */
#include "ICEClient.hpp"
class ConnectionPeer :
public FB::JSAPIAuto,
public ICEClient::Callbacks {
private:
ICEClient iceClient;
/* configuration properties */
std::string serverConfiguration;
std::string localConfiguration;
std::vector<std::string> remoteConfigurations;
FB::JSObjectPtr localConfigurationCallback;
/* HTML5 Stream objects */
//std::vector<FB:JSAPIPtr> localStreams;
//std::vector<FB:JSAPIPtr> remoteStreams;
public:
ConnectionPeer(const std::string& server_configuration);
~ConnectionPeer();
virtual void setLocalCandidates(const std::string& localConfiguration);
virtual void negotiationComplete();
virtual void dataReceived(const std::string& text);
// if second arg is true, then use unreliable low-latency transport
// (UDP-like), otherwise guarantee delivery (TCP-like)
void sendText(const std::string& text, const /*optional*/ bool unimportant);
void sendBitmap(const FB::JSAPIPtr& /*HTMLImageElement*/ image);
void sendFile(const FB::JSAPIPtr& /*File*/ file);
void addStream(const FB::JSAPIPtr& /*Stream*/ stream);
void removeStream(const FB::JSAPIPtr& /*Stream*/ stream);
FB::JSAPIPtr /*Stream[]*/ getLocalStreams();
FB::JSAPIPtr /*Stream[]*/ getRemoteStreams();
// maybe this should be in the constructor, or be an event
void getLocalConfiguration(const FB::JSObjectPtr& callback);
// remote origin is assumed to be same-origin if not specified.
// If specified, has to match remote origin (checked in handshake).
// Should support leading "*." to mean "any subdomain of".
void addRemoteConfiguration(
const std::string& configuration
/*, const optional std::string& remoteOrigin*/);
// disconnects and stops listening
void close();
};
/*
[Callback=FunctionOnly, NoInterfaceObject]
interface ConnectionPeerConfigurationCallback {
void handleEvent(in ConnectionPeer server, in DOMString configuration);
};*/