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 14 matching lines...) Expand all Loading... |
25 // connection. | 25 // connection. |
26 TCPClientSocket(const AddressList& addresses, | 26 TCPClientSocket(const AddressList& addresses, |
27 net::NetLog* net_log, | 27 net::NetLog* net_log, |
28 const net::NetLog::Source& source); | 28 const net::NetLog::Source& source); |
29 | 29 |
30 // Adopts the given, connected socket and then acts as if Connect() had been | 30 // Adopts the given, connected socket and then acts as if Connect() had been |
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 ~TCPClientSocket() override; |
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 int Connect(const CompletionCallback& callback) override; |
42 virtual void Disconnect() override; | 42 void Disconnect() override; |
43 virtual bool IsConnected() const override; | 43 bool IsConnected() const override; |
44 virtual bool IsConnectedAndIdle() const override; | 44 bool IsConnectedAndIdle() const override; |
45 virtual int GetPeerAddress(IPEndPoint* address) const override; | 45 int GetPeerAddress(IPEndPoint* address) const override; |
46 virtual int GetLocalAddress(IPEndPoint* address) const override; | 46 int GetLocalAddress(IPEndPoint* address) const override; |
47 virtual const BoundNetLog& NetLog() const override; | 47 const BoundNetLog& NetLog() const override; |
48 virtual void SetSubresourceSpeculation() override; | 48 void SetSubresourceSpeculation() override; |
49 virtual void SetOmniboxSpeculation() override; | 49 void SetOmniboxSpeculation() override; |
50 virtual bool WasEverUsed() const override; | 50 bool WasEverUsed() const override; |
51 virtual bool UsingTCPFastOpen() const override; | 51 bool UsingTCPFastOpen() const override; |
52 virtual void EnableTCPFastOpenIfSupported() override; | 52 void EnableTCPFastOpenIfSupported() override; |
53 virtual bool WasNpnNegotiated() const override; | 53 bool WasNpnNegotiated() const override; |
54 virtual NextProto GetNegotiatedProtocol() const override; | 54 NextProto GetNegotiatedProtocol() const override; |
55 virtual bool GetSSLInfo(SSLInfo* ssl_info) override; | 55 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 int Read(IOBuffer* buf, |
61 const CompletionCallback& callback) override; | 61 int buf_len, |
62 virtual int Write(IOBuffer* buf, int buf_len, | 62 const CompletionCallback& callback) override; |
63 const CompletionCallback& callback) override; | 63 int Write(IOBuffer* buf, |
64 virtual int SetReceiveBufferSize(int32 size) override; | 64 int buf_len, |
65 virtual int SetSendBufferSize(int32 size) override; | 65 const CompletionCallback& callback) override; |
| 66 int SetReceiveBufferSize(int32 size) override; |
| 67 int SetSendBufferSize(int32 size) override; |
66 | 68 |
67 virtual bool SetKeepAlive(bool enable, int delay); | 69 virtual bool SetKeepAlive(bool enable, int delay); |
68 virtual bool SetNoDelay(bool no_delay); | 70 virtual bool SetNoDelay(bool no_delay); |
69 | 71 |
70 private: | 72 private: |
71 // State machine for connecting the socket. | 73 // State machine for connecting the socket. |
72 enum ConnectState { | 74 enum ConnectState { |
73 CONNECT_STATE_CONNECT, | 75 CONNECT_STATE_CONNECT, |
74 CONNECT_STATE_CONNECT_COMPLETE, | 76 CONNECT_STATE_CONNECT_COMPLETE, |
75 CONNECT_STATE_NONE, | 77 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 | 115 // Record of connectivity and transmissions, for use in speculative connection |
114 // histograms. | 116 // histograms. |
115 UseHistory use_history_; | 117 UseHistory use_history_; |
116 | 118 |
117 DISALLOW_COPY_AND_ASSIGN(TCPClientSocket); | 119 DISALLOW_COPY_AND_ASSIGN(TCPClientSocket); |
118 }; | 120 }; |
119 | 121 |
120 } // namespace net | 122 } // namespace net |
121 | 123 |
122 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 124 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
OLD | NEW |