Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: webkit/glue/p2p_transport.h

Issue 6676101: Add P2PTransport interface in webkit_glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more comments Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/p2p_transport.h
diff --git a/webkit/glue/p2p_transport.h b/webkit/glue/p2p_transport.h
new file mode 100644
index 0000000000000000000000000000000000000000..5cd30c530527951c12465bda3adb4a70f5793842
--- /dev/null
+++ b/webkit/glue/p2p_transport.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_P2P_TRANSPORT_H_
+#define WEBKIT_GLUE_P2P_TRANSPORT_H_
+
+#include <string>
+
+namespace webkit_glue {
+
+// Interface for P2P transport.
+class P2PTransport {
+ public:
+ enum State {
+ STATE_NONE = 0,
+ STATE_WRITABLE = 1,
+ STATE_READABLE = 2,
+ };
+
+ class EventHandler {
+ public:
+ virtual ~EventHandler() {}
+
+ // Called for each local candidate.
+ virtual void OnCandidateReady(const std::string& address) = 0;
mallinath 2011/03/29 22:41:44 We might need some additional parameter to this fu
+
+ // Called when readable of writable state of the stream changes.
+ virtual void OnStateChange(State state) = 0;
+
+ // Called when a message received from the peer. P2PTransport keeps
+ // owneship of |data|.
+ virtual void OnMessageReceived(const char* data, size_t data_size) = 0;
+ };
+
+ virtual ~P2PTransport() {}
+
+ // Initialize transport using specified configuration.
+ virtual void Init(const std::string& config,
+ EventHandler* event_handler) = 0;
+
+ // Add candidate received from the remote peer.
+ virtual void AddRemoteCandidate(const std::string& address) = 0;
+
+ // Send data to the other end. Caller keeps ownership of |data|.
+ virtual void Send(const char* data, int data_size) = 0;
+};
+
+} // namespace webkit_glue
+
+#endif // WEBKIT_GLUE_P2P_TRANSPORT_H_
« no previous file with comments | « no previous file | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698