OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef JINGLE_GLUE_PSEUDOTCP_ADAPTER_H_ | 5 #ifndef JINGLE_GLUE_PSEUDOTCP_ADAPTER_H_ |
6 #define JINGLE_GLUE_PSEUDOTCP_ADAPTER_H_ | 6 #define JINGLE_GLUE_PSEUDOTCP_ADAPTER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/timer.h" | 12 #include "base/timer.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "net/base/net_log.h" | 14 #include "net/base/net_log.h" |
15 #include "net/socket/client_socket.h" | 15 #include "net/socket/stream_socket.h" |
16 #include "third_party/libjingle/source/talk/p2p/base/pseudotcp.h" | 16 #include "third_party/libjingle/source/talk/p2p/base/pseudotcp.h" |
17 | 17 |
18 namespace jingle_glue { | 18 namespace jingle_glue { |
19 | 19 |
20 class PseudoTcpAdapter : public net::ClientSocket, | 20 class PseudoTcpAdapter : public net::StreamSocket, |
21 public cricket::IPseudoTcpNotify, | 21 public cricket::IPseudoTcpNotify, |
22 public base::NonThreadSafe { | 22 public base::NonThreadSafe { |
23 public: | 23 public: |
24 // Creates adapter for the specified |socket|. |socket| is assumed | 24 // Creates adapter for the specified |socket|. |socket| is assumed |
25 // to be already connected. Takes ownership of |socket|. | 25 // to be already connected. Takes ownership of |socket|. |
26 PseudoTcpAdapter(net::Socket* socket); | 26 PseudoTcpAdapter(net::Socket* socket); |
27 virtual ~PseudoTcpAdapter(); | 27 virtual ~PseudoTcpAdapter(); |
28 | 28 |
29 // net::Socket implementation. | 29 // net::Socket implementation. |
30 virtual int Read(net::IOBuffer* buffer, int buffer_size, | 30 virtual int Read(net::IOBuffer* buffer, int buffer_size, |
31 net::CompletionCallback* callback) OVERRIDE; | 31 net::CompletionCallback* callback) OVERRIDE; |
32 virtual int Write(net::IOBuffer* buffer, int buffer_size, | 32 virtual int Write(net::IOBuffer* buffer, int buffer_size, |
33 net::CompletionCallback* callback) OVERRIDE; | 33 net::CompletionCallback* callback) OVERRIDE; |
34 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 34 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
35 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 35 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
36 | 36 |
37 // net::ClientSocket implementation. | 37 // net::StreamSocket implementation. |
38 virtual int Connect(net::CompletionCallback* callback) OVERRIDE; | 38 virtual int Connect(net::CompletionCallback* callback) OVERRIDE; |
39 virtual void Disconnect() OVERRIDE; | 39 virtual void Disconnect() OVERRIDE; |
40 virtual bool IsConnected() const OVERRIDE; | 40 virtual bool IsConnected() const OVERRIDE; |
41 virtual bool IsConnectedAndIdle() const OVERRIDE; | 41 virtual bool IsConnectedAndIdle() const OVERRIDE; |
42 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; | 42 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; |
43 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 43 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
44 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 44 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
45 virtual void SetSubresourceSpeculation() OVERRIDE; | 45 virtual void SetSubresourceSpeculation() OVERRIDE; |
46 virtual void SetOmniboxSpeculation() OVERRIDE; | 46 virtual void SetOmniboxSpeculation() OVERRIDE; |
47 virtual bool WasEverUsed() const OVERRIDE; | 47 virtual bool WasEverUsed() const OVERRIDE; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 base::OneShotTimer<PseudoTcpAdapter> timer_; | 86 base::OneShotTimer<PseudoTcpAdapter> timer_; |
87 | 87 |
88 net::BoundNetLog net_log_; | 88 net::BoundNetLog net_log_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(PseudoTcpAdapter); | 90 DISALLOW_COPY_AND_ASSIGN(PseudoTcpAdapter); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace jingle_glue | 93 } // namespace jingle_glue |
94 | 94 |
95 #endif // JINGLE_GLUE_STREAM_SOCKET_ADAPTER_H_ | 95 #endif // JINGLE_GLUE_STREAM_SOCKET_ADAPTER_H_ |
OLD | NEW |