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_TCP_CLIENT_SOCKET_WIN_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
7 | 7 |
8 #include <winsock2.h> | 8 #include <winsock2.h> |
9 | 9 |
10 #include "base/object_watcher.h" | 10 #include "base/object_watcher.h" |
11 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/base/net_log.h" |
13 #include "net/socket/client_socket.h" | 14 #include "net/socket/client_socket.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 class LoadLog; | 18 class BoundNetLog; |
18 | 19 |
19 class TCPClientSocketWin : public ClientSocket { | 20 class TCPClientSocketWin : public ClientSocket { |
20 public: | 21 public: |
21 // The IP address(es) and port number to connect to. The TCP socket will try | 22 // The IP address(es) and port number to connect to. The TCP socket will try |
22 // each IP address in the list until it succeeds in establishing a | 23 // each IP address in the list until it succeeds in establishing a |
23 // connection. | 24 // connection. |
24 explicit TCPClientSocketWin(const AddressList& addresses); | 25 explicit TCPClientSocketWin(const AddressList& addresses); |
25 | 26 |
26 ~TCPClientSocketWin(); | 27 ~TCPClientSocketWin(); |
27 | 28 |
28 // ClientSocket methods: | 29 // ClientSocket methods: |
29 virtual int Connect(CompletionCallback* callback, LoadLog* load_log); | 30 virtual int Connect(CompletionCallback* callback, const BoundNetLog& net_log); |
30 virtual void Disconnect(); | 31 virtual void Disconnect(); |
31 virtual bool IsConnected() const; | 32 virtual bool IsConnected() const; |
32 virtual bool IsConnectedAndIdle() const; | 33 virtual bool IsConnectedAndIdle() const; |
33 virtual int GetPeerAddress(AddressList* address) const; | 34 virtual int GetPeerAddress(AddressList* address) const; |
34 | 35 |
35 // Socket methods: | 36 // Socket methods: |
36 // Multiple outstanding requests are not supported. | 37 // Multiple outstanding requests are not supported. |
37 // Full duplex mode (reading and writing at the same time) is supported | 38 // Full duplex mode (reading and writing at the same time) is supported |
38 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 39 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
39 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 40 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // resources to the Windows async IO functions and we have to make sure that | 72 // resources to the Windows async IO functions and we have to make sure that |
72 // they are not destroyed while the OS still references them. | 73 // they are not destroyed while the OS still references them. |
73 scoped_refptr<Core> core_; | 74 scoped_refptr<Core> core_; |
74 | 75 |
75 // External callback; called when connect or read is complete. | 76 // External callback; called when connect or read is complete. |
76 CompletionCallback* read_callback_; | 77 CompletionCallback* read_callback_; |
77 | 78 |
78 // External callback; called when write is complete. | 79 // External callback; called when write is complete. |
79 CompletionCallback* write_callback_; | 80 CompletionCallback* write_callback_; |
80 | 81 |
81 scoped_refptr<LoadLog> load_log_; | 82 BoundNetLog net_log_; |
82 | 83 |
83 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); | 84 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); |
84 }; | 85 }; |
85 | 86 |
86 } // namespace net | 87 } // namespace net |
87 | 88 |
88 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 89 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
OLD | NEW |