OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SOCKET_POSIX_H_ | 5 #ifndef NET_SOCKET_TCP_SOCKET_POSIX_H_ |
6 #define NET_SOCKET_TCP_SOCKET_POSIX_H_ | 6 #define NET_SOCKET_TCP_SOCKET_POSIX_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 IPEndPoint* address, | 52 IPEndPoint* address, |
53 const CompletionCallback& callback); | 53 const CompletionCallback& callback); |
54 | 54 |
55 int Connect(const IPEndPoint& address, const CompletionCallback& callback); | 55 int Connect(const IPEndPoint& address, const CompletionCallback& callback); |
56 bool IsConnected() const; | 56 bool IsConnected() const; |
57 bool IsConnectedAndIdle() const; | 57 bool IsConnectedAndIdle() const; |
58 | 58 |
59 // Multiple outstanding requests are not supported. | 59 // Multiple outstanding requests are not supported. |
60 // Full duplex mode (reading and writing at the same time) is supported. | 60 // Full duplex mode (reading and writing at the same time) is supported. |
61 int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback); | 61 int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback); |
| 62 int ReadIfReady(IOBuffer* buf, |
| 63 int buf_len, |
| 64 const CompletionCallback& callback); |
62 int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback); | 65 int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback); |
63 | 66 |
64 int GetLocalAddress(IPEndPoint* address) const; | 67 int GetLocalAddress(IPEndPoint* address) const; |
65 int GetPeerAddress(IPEndPoint* address) const; | 68 int GetPeerAddress(IPEndPoint* address) const; |
66 | 69 |
67 // Sets various socket options. | 70 // Sets various socket options. |
68 // The commonly used options for server listening sockets: | 71 // The commonly used options for server listening sockets: |
69 // - SetAddressReuse(true). | 72 // - SetAddressReuse(true). |
70 int SetDefaultOptionsForServer(); | 73 int SetDefaultOptionsForServer(); |
71 // The commonly used options for client sockets and accepted sockets: | 74 // The commonly used options for client sockets and accepted sockets: |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 IPEndPoint* address); | 193 IPEndPoint* address); |
191 | 194 |
192 void ConnectCompleted(const CompletionCallback& callback, int rv); | 195 void ConnectCompleted(const CompletionCallback& callback, int rv); |
193 int HandleConnectCompleted(int rv); | 196 int HandleConnectCompleted(int rv); |
194 void LogConnectBegin(const AddressList& addresses) const; | 197 void LogConnectBegin(const AddressList& addresses) const; |
195 void LogConnectEnd(int net_error) const; | 198 void LogConnectEnd(int net_error) const; |
196 | 199 |
197 void ReadCompleted(const scoped_refptr<IOBuffer>& buf, | 200 void ReadCompleted(const scoped_refptr<IOBuffer>& buf, |
198 const CompletionCallback& callback, | 201 const CompletionCallback& callback, |
199 int rv); | 202 int rv); |
| 203 void ReadIfReadyCompleted(const CompletionCallback& callback, int rv); |
200 int HandleReadCompleted(IOBuffer* buf, int rv); | 204 int HandleReadCompleted(IOBuffer* buf, int rv); |
| 205 void HandleReadCompletedHelper(int rv); |
201 | 206 |
202 void WriteCompleted(const scoped_refptr<IOBuffer>& buf, | 207 void WriteCompleted(const scoped_refptr<IOBuffer>& buf, |
203 const CompletionCallback& callback, | 208 const CompletionCallback& callback, |
204 int rv); | 209 int rv); |
205 int HandleWriteCompleted(IOBuffer* buf, int rv); | 210 int HandleWriteCompleted(IOBuffer* buf, int rv); |
206 int TcpFastOpenWrite(IOBuffer* buf, | 211 int TcpFastOpenWrite(IOBuffer* buf, |
207 int buf_len, | 212 int buf_len, |
208 const CompletionCallback& callback); | 213 const CompletionCallback& callback); |
209 | 214 |
210 // Notifies |socket_performance_watcher_| of the latest RTT estimate available | 215 // Notifies |socket_performance_watcher_| of the latest RTT estimate available |
(...skipping 25 matching lines...) Expand all Loading... |
236 bool logging_multiple_connect_attempts_; | 241 bool logging_multiple_connect_attempts_; |
237 | 242 |
238 NetLogWithSource net_log_; | 243 NetLogWithSource net_log_; |
239 | 244 |
240 DISALLOW_COPY_AND_ASSIGN(TCPSocketPosix); | 245 DISALLOW_COPY_AND_ASSIGN(TCPSocketPosix); |
241 }; | 246 }; |
242 | 247 |
243 } // namespace net | 248 } // namespace net |
244 | 249 |
245 #endif // NET_SOCKET_TCP_SOCKET_POSIX_H_ | 250 #endif // NET_SOCKET_TCP_SOCKET_POSIX_H_ |
OLD | NEW |