OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_H_ |
6 #define NET_SOCKET_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_LINUX) || defined(OS_MACOSX) | 10 #if defined(OS_POSIX) |
11 #include <sys/socket.h> | 11 #include <sys/socket.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include "net/socket/socket.h" | 14 #include "net/socket/socket.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 class ClientSocket : public Socket { | 18 class ClientSocket : public Socket { |
19 public: | 19 public: |
20 // Called to establish a connection. Returns OK if the connection could be | 20 // Called to establish a connection. Returns OK if the connection could be |
(...skipping 23 matching lines...) Expand all Loading... |
44 | 44 |
45 // Called to test if the connection is still alive. Returns false if a | 45 // Called to test if the connection is still alive. Returns false if a |
46 // connection wasn't established or the connection is dead. | 46 // connection wasn't established or the connection is dead. |
47 virtual bool IsConnected() const = 0; | 47 virtual bool IsConnected() const = 0; |
48 | 48 |
49 // Called to test if the connection is still alive and idle. Returns false | 49 // Called to test if the connection is still alive and idle. Returns false |
50 // if a connection wasn't established, the connection is dead, or some data | 50 // if a connection wasn't established, the connection is dead, or some data |
51 // have been received. | 51 // have been received. |
52 virtual bool IsConnectedAndIdle() const = 0; | 52 virtual bool IsConnectedAndIdle() const = 0; |
53 | 53 |
54 #if defined(OS_LINUX) || defined(OS_MACOSX) | 54 #if defined(OS_POSIX) |
55 // Identical to posix system call getpeername(). | 55 // Identical to posix system call getpeername(). |
56 // Needed by ssl_client_socket_nss and ssl_client_socket_mac. | 56 // Needed by ssl_client_socket_nss and ssl_client_socket_mac. |
57 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); | 57 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); |
58 #endif | 58 #endif |
59 }; | 59 }; |
60 | 60 |
61 } // namespace net | 61 } // namespace net |
62 | 62 |
63 #endif // NET_SOCKET_CLIENT_SOCKET_H_ | 63 #endif // NET_SOCKET_CLIENT_SOCKET_H_ |
OLD | NEW |