OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_BASE_CLIENT_SOCKET_H_ | 5 #ifndef NET_BASE_CLIENT_SOCKET_H_ |
6 #define NET_BASE_CLIENT_SOCKET_H_ | 6 #define NET_BASE_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_LINUX) | 10 #if defined(OS_LINUX) |
(...skipping 15 matching lines...) Expand all Loading... |
26 // The socket's Read and Write methods may not be called until Connect | 26 // The socket's Read and Write methods may not be called until Connect |
27 // succeeds. | 27 // succeeds. |
28 // | 28 // |
29 // It is valid to call Connect on an already connected socket, in which case | 29 // It is valid to call Connect on an already connected socket, in which case |
30 // OK is simply returned. | 30 // OK is simply returned. |
31 // | 31 // |
32 // Connect may also be called again after a call to the Disconnect method. | 32 // Connect may also be called again after a call to the Disconnect method. |
33 // | 33 // |
34 virtual int Connect(CompletionCallback* callback) = 0; | 34 virtual int Connect(CompletionCallback* callback) = 0; |
35 | 35 |
36 // If a non-fatal error occurs during Connect, the consumer can call this | |
37 // method to re-Connect ignoring the error that occured. This call is only | |
38 // valid for certain errors. | |
39 virtual int ReconnectIgnoringLastError(CompletionCallback* callback) = 0; | |
40 | |
41 // Called to disconnect a connected socket. Does nothing if the socket is | 36 // Called to disconnect a connected socket. Does nothing if the socket is |
42 // already disconnected. After calling Disconnect it is possible to call | 37 // already disconnected. After calling Disconnect it is possible to call |
43 // Connect again to establish a new connection. | 38 // Connect again to establish a new connection. |
44 virtual void Disconnect() = 0; | 39 virtual void Disconnect() = 0; |
45 | 40 |
46 // Called to test if the connection is still alive. Returns false if a | 41 // Called to test if the connection is still alive. Returns false if a |
47 // connection wasn't established or the connection is dead. | 42 // connection wasn't established or the connection is dead. |
48 virtual bool IsConnected() const = 0; | 43 virtual bool IsConnected() const = 0; |
49 | 44 |
50 // Called to test if the connection is still alive and idle. Returns false | 45 // Called to test if the connection is still alive and idle. Returns false |
51 // if a connection wasn't established, the connection is dead, or some data | 46 // if a connection wasn't established, the connection is dead, or some data |
52 // have been received. | 47 // have been received. |
53 virtual bool IsConnectedAndIdle() const = 0; | 48 virtual bool IsConnectedAndIdle() const = 0; |
54 | 49 |
55 #if defined(OS_LINUX) | 50 #if defined(OS_LINUX) |
56 // Identical to posix system call getpeername(). | 51 // Identical to posix system call getpeername(). |
57 // Needed by ssl_client_socket_nss. | 52 // Needed by ssl_client_socket_nss. |
58 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); | 53 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); |
59 #endif | 54 #endif |
60 }; | 55 }; |
61 | 56 |
62 } // namespace net | 57 } // namespace net |
63 | 58 |
64 #endif // NET_BASE_CLIENT_SOCKET_H_ | 59 #endif // NET_BASE_CLIENT_SOCKET_H_ |
OLD | NEW |