OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_GLUE_P2P_TRANSPORT_H_ | |
6 #define WEBKIT_GLUE_P2P_TRANSPORT_H_ | |
7 | |
8 #include <string> | |
9 | |
10 namespace webkit_glue { | |
11 | |
12 // Interface for P2P transport. | |
13 class P2PTransport { | |
14 public: | |
15 enum State { | |
16 STATE_NONE = 0, | |
17 STATE_WRITABLE = 1, | |
18 STATE_READABLE = 2, | |
19 }; | |
20 | |
21 class EventHandler { | |
22 public: | |
23 virtual ~EventHandler() {} | |
24 | |
25 // Called for each local candidate. | |
26 virtual void OnCandidateReady(const std::string& address) = 0; | |
27 | |
28 // Called when readable of writable state of the stream changes. | |
29 virtual void OnStateChange(State state) = 0; | |
30 | |
31 // Callen when a message received from the peer. | |
32 virtual void OnMessageReceived(const char* data, size_t data_size) = 0; | |
brettw
2011/03/26 20:04:00
For this and the Send function below, can you clar
| |
33 }; | |
34 | |
35 virtual ~P2PTransport() {} | |
36 | |
37 // Initialize transport using specified configuration. | |
38 virtual void Init(const std::string& config, | |
39 EventHandler* event_handler) = 0; | |
40 | |
41 // Add candidate received from the remote peer. | |
42 virtual void AddRemoteCandidate(const std::string& address) = 0; | |
43 | |
44 // Send data to the other end. | |
45 virtual void Send(const char* data, int data_size) = 0; | |
46 }; | |
47 | |
48 } // namespace webkit_glue | |
49 | |
50 #endif // WEBKIT_GLUE_P2P_TRANSPORT_H_ | |
OLD | NEW |