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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 IPEndPoint* address, | 53 IPEndPoint* address, |
54 const CompletionCallback& callback); | 54 const CompletionCallback& callback); |
55 | 55 |
56 int Connect(const IPEndPoint& address, const CompletionCallback& callback); | 56 int Connect(const IPEndPoint& address, const CompletionCallback& callback); |
57 bool IsConnected() const; | 57 bool IsConnected() const; |
58 bool IsConnectedAndIdle() const; | 58 bool IsConnectedAndIdle() const; |
59 | 59 |
60 // Multiple outstanding requests are not supported. | 60 // Multiple outstanding requests are not supported. |
61 // Full duplex mode (reading and writing at the same time) is supported. | 61 // Full duplex mode (reading and writing at the same time) is supported. |
62 int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback); | 62 int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback); |
| 63 int ReadIfReady(IOBuffer* buf, |
| 64 int buf_len, |
| 65 const CompletionCallback& callback); |
63 int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback); | 66 int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback); |
64 | 67 |
65 int GetLocalAddress(IPEndPoint* address) const; | 68 int GetLocalAddress(IPEndPoint* address) const; |
66 int GetPeerAddress(IPEndPoint* address) const; | 69 int GetPeerAddress(IPEndPoint* address) const; |
67 | 70 |
68 // Sets various socket options. | 71 // Sets various socket options. |
69 // The commonly used options for server listening sockets: | 72 // The commonly used options for server listening sockets: |
70 // - SetAddressReuse(true). | 73 // - SetAddressReuse(true). |
71 int SetDefaultOptionsForServer(); | 74 int SetDefaultOptionsForServer(); |
72 // The commonly used options for client sockets and accepted sockets: | 75 // The commonly used options for client sockets and accepted sockets: |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 IPEndPoint* address); | 196 IPEndPoint* address); |
194 | 197 |
195 void ConnectCompleted(const CompletionCallback& callback, int rv); | 198 void ConnectCompleted(const CompletionCallback& callback, int rv); |
196 int HandleConnectCompleted(int rv); | 199 int HandleConnectCompleted(int rv); |
197 void LogConnectBegin(const AddressList& addresses) const; | 200 void LogConnectBegin(const AddressList& addresses) const; |
198 void LogConnectEnd(int net_error) const; | 201 void LogConnectEnd(int net_error) const; |
199 | 202 |
200 void ReadCompleted(const scoped_refptr<IOBuffer>& buf, | 203 void ReadCompleted(const scoped_refptr<IOBuffer>& buf, |
201 const CompletionCallback& callback, | 204 const CompletionCallback& callback, |
202 int rv); | 205 int rv); |
| 206 void ReadIfReadyCompleted(const CompletionCallback& callback, int rv); |
203 int HandleReadCompleted(IOBuffer* buf, int rv); | 207 int HandleReadCompleted(IOBuffer* buf, int rv); |
204 | 208 |
205 void WriteCompleted(const scoped_refptr<IOBuffer>& buf, | 209 void WriteCompleted(const scoped_refptr<IOBuffer>& buf, |
206 const CompletionCallback& callback, | 210 const CompletionCallback& callback, |
207 int rv); | 211 int rv); |
208 int HandleWriteCompleted(IOBuffer* buf, int rv); | 212 int HandleWriteCompleted(IOBuffer* buf, int rv); |
209 int TcpFastOpenWrite(IOBuffer* buf, | 213 int TcpFastOpenWrite(IOBuffer* buf, |
210 int buf_len, | 214 int buf_len, |
211 const CompletionCallback& callback); | 215 const CompletionCallback& callback); |
212 | 216 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 bool logging_multiple_connect_attempts_; | 253 bool logging_multiple_connect_attempts_; |
250 | 254 |
251 NetLogWithSource net_log_; | 255 NetLogWithSource net_log_; |
252 | 256 |
253 DISALLOW_COPY_AND_ASSIGN(TCPSocketPosix); | 257 DISALLOW_COPY_AND_ASSIGN(TCPSocketPosix); |
254 }; | 258 }; |
255 | 259 |
256 } // namespace net | 260 } // namespace net |
257 | 261 |
258 #endif // NET_SOCKET_TCP_SOCKET_POSIX_H_ | 262 #endif // NET_SOCKET_TCP_SOCKET_POSIX_H_ |
OLD | NEW |