| 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 NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
| 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_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/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // called. This function is used by TCPServerSocket and for testing. | 31 // called. This function is used by TCPServerSocket and for testing. |
| 32 TCPClientSocket(scoped_ptr<TCPSocket> connected_socket, | 32 TCPClientSocket(scoped_ptr<TCPSocket> connected_socket, |
| 33 const IPEndPoint& peer_address); | 33 const IPEndPoint& peer_address); |
| 34 | 34 |
| 35 virtual ~TCPClientSocket(); | 35 virtual ~TCPClientSocket(); |
| 36 | 36 |
| 37 // Binds the socket to a local IP address and port. | 37 // Binds the socket to a local IP address and port. |
| 38 int Bind(const IPEndPoint& address); | 38 int Bind(const IPEndPoint& address); |
| 39 | 39 |
| 40 // StreamSocket implementation. | 40 // StreamSocket implementation. |
| 41 virtual int Connect(const CompletionCallback& callback) OVERRIDE; | 41 virtual int Connect(const CompletionCallback& callback) override; |
| 42 virtual void Disconnect() OVERRIDE; | 42 virtual void Disconnect() override; |
| 43 virtual bool IsConnected() const OVERRIDE; | 43 virtual bool IsConnected() const override; |
| 44 virtual bool IsConnectedAndIdle() const OVERRIDE; | 44 virtual bool IsConnectedAndIdle() const override; |
| 45 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; | 45 virtual int GetPeerAddress(IPEndPoint* address) const override; |
| 46 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; | 46 virtual int GetLocalAddress(IPEndPoint* address) const override; |
| 47 virtual const BoundNetLog& NetLog() const OVERRIDE; | 47 virtual const BoundNetLog& NetLog() const override; |
| 48 virtual void SetSubresourceSpeculation() OVERRIDE; | 48 virtual void SetSubresourceSpeculation() override; |
| 49 virtual void SetOmniboxSpeculation() OVERRIDE; | 49 virtual void SetOmniboxSpeculation() override; |
| 50 virtual bool WasEverUsed() const OVERRIDE; | 50 virtual bool WasEverUsed() const override; |
| 51 virtual bool UsingTCPFastOpen() const OVERRIDE; | 51 virtual bool UsingTCPFastOpen() const override; |
| 52 virtual void EnableTCPFastOpenIfSupported() OVERRIDE; | 52 virtual void EnableTCPFastOpenIfSupported() override; |
| 53 virtual bool WasNpnNegotiated() const OVERRIDE; | 53 virtual bool WasNpnNegotiated() const override; |
| 54 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; | 54 virtual NextProto GetNegotiatedProtocol() const override; |
| 55 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; | 55 virtual bool GetSSLInfo(SSLInfo* ssl_info) override; |
| 56 | 56 |
| 57 // Socket implementation. | 57 // Socket implementation. |
| 58 // Multiple outstanding requests are not supported. | 58 // Multiple outstanding requests are not supported. |
| 59 // Full duplex mode (reading and writing at the same time) is supported. | 59 // Full duplex mode (reading and writing at the same time) is supported. |
| 60 virtual int Read(IOBuffer* buf, int buf_len, | 60 virtual int Read(IOBuffer* buf, int buf_len, |
| 61 const CompletionCallback& callback) OVERRIDE; | 61 const CompletionCallback& callback) override; |
| 62 virtual int Write(IOBuffer* buf, int buf_len, | 62 virtual int Write(IOBuffer* buf, int buf_len, |
| 63 const CompletionCallback& callback) OVERRIDE; | 63 const CompletionCallback& callback) override; |
| 64 virtual int SetReceiveBufferSize(int32 size) OVERRIDE; | 64 virtual int SetReceiveBufferSize(int32 size) override; |
| 65 virtual int SetSendBufferSize(int32 size) OVERRIDE; | 65 virtual int SetSendBufferSize(int32 size) override; |
| 66 | 66 |
| 67 virtual bool SetKeepAlive(bool enable, int delay); | 67 virtual bool SetKeepAlive(bool enable, int delay); |
| 68 virtual bool SetNoDelay(bool no_delay); | 68 virtual bool SetNoDelay(bool no_delay); |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // State machine for connecting the socket. | 71 // State machine for connecting the socket. |
| 72 enum ConnectState { | 72 enum ConnectState { |
| 73 CONNECT_STATE_CONNECT, | 73 CONNECT_STATE_CONNECT, |
| 74 CONNECT_STATE_CONNECT_COMPLETE, | 74 CONNECT_STATE_CONNECT_COMPLETE, |
| 75 CONNECT_STATE_NONE, | 75 CONNECT_STATE_NONE, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // Record of connectivity and transmissions, for use in speculative connection | 113 // Record of connectivity and transmissions, for use in speculative connection |
| 114 // histograms. | 114 // histograms. |
| 115 UseHistory use_history_; | 115 UseHistory use_history_; |
| 116 | 116 |
| 117 DISALLOW_COPY_AND_ASSIGN(TCPClientSocket); | 117 DISALLOW_COPY_AND_ASSIGN(TCPClientSocket); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace net | 120 } // namespace net |
| 121 | 121 |
| 122 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 122 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
| OLD | NEW |