From 6e0e61f43e82813341d69c7c5589b301f8fdbc36 Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Wed, 6 Apr 2011 01:36:18 +0000 Subject: P2P Transport implementation. TEST=Unittests. BUG=None Review URL: http://codereview.chromium.org/6791023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80567 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/p2p_transport.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'webkit/glue') diff --git a/webkit/glue/p2p_transport.h b/webkit/glue/p2p_transport.h index 5cd30c5..e80ffb5 100644 --- a/webkit/glue/p2p_transport.h +++ b/webkit/glue/p2p_transport.h @@ -7,6 +7,10 @@ #include +namespace net { +class Socket; +} // namespace net + namespace webkit_glue { // Interface for P2P transport. @@ -27,23 +31,24 @@ class P2PTransport { // 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, + // Initialize transport using specified configuration. Returns true + // if initialization succeeded. + virtual bool Init(const std::string& name, + const std::string& config, EventHandler* event_handler) = 0; - // Add candidate received from the remote peer. - virtual void AddRemoteCandidate(const std::string& address) = 0; + // Add candidate received from the remote peer. Returns false if the + // provided address is not in a valid format. + virtual bool 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; + // Returns socket interface that can be used to send/receive + // data. Returned object is owned by the transport. Pending calls on + // the socket are canceled when the transport is destroyed. + virtual net::Socket* GetChannel() = 0; }; } // namespace webkit_glue -- cgit v1.1