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_WIN_H_ | 5 #ifndef NET_SOCKET_TCP_SOCKET_WIN_H_ |
6 #define NET_SOCKET_TCP_SOCKET_WIN_H_ | 6 #define NET_SOCKET_TCP_SOCKET_WIN_H_ |
7 | 7 |
8 #include <winsock2.h> | 8 #include <winsock2.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class IOBuffer; | 24 class IOBuffer; |
25 class IPEndPoint; | 25 class IPEndPoint; |
26 | 26 |
27 class NET_EXPORT TCPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe), | 27 class NET_EXPORT TCPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe), |
28 public base::win::ObjectWatcher::Delegate { | 28 public base::win::ObjectWatcher::Delegate { |
29 public: | 29 public: |
30 TCPSocketWin(NetLog* net_log, const NetLog::Source& source); | 30 TCPSocketWin(NetLog* net_log, const NetLog::Source& source); |
31 virtual ~TCPSocketWin(); | 31 virtual ~TCPSocketWin(); |
32 | 32 |
33 int Open(AddressFamily family); | 33 int Open(AddressFamily family); |
34 // Takes ownership of |socket|. | 34 |
| 35 // Both AdoptConnectedSocket and AdoptListenSocket take ownership of an |
| 36 // existing socket. AdoptConnectedSocket takes an already connected |
| 37 // socket. AdoptListenSocket takes a socket that is intended to accept |
| 38 // connection. In some sense, AdoptListenSocket is more similar to Open. |
35 int AdoptConnectedSocket(SOCKET socket, const IPEndPoint& peer_address); | 39 int AdoptConnectedSocket(SOCKET socket, const IPEndPoint& peer_address); |
| 40 int AdoptListenSocket(SOCKET socket); |
36 | 41 |
37 int Bind(const IPEndPoint& address); | 42 int Bind(const IPEndPoint& address); |
38 | 43 |
39 int Listen(int backlog); | 44 int Listen(int backlog); |
40 int Accept(scoped_ptr<TCPSocketWin>* socket, | 45 int Accept(scoped_ptr<TCPSocketWin>* socket, |
41 IPEndPoint* address, | 46 IPEndPoint* address, |
42 const CompletionCallback& callback); | 47 const CompletionCallback& callback); |
43 | 48 |
44 int Connect(const IPEndPoint& address, const CompletionCallback& callback); | 49 int Connect(const IPEndPoint& address, const CompletionCallback& callback); |
45 bool IsConnected() const; | 50 bool IsConnected() const; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 146 |
142 BoundNetLog net_log_; | 147 BoundNetLog net_log_; |
143 | 148 |
144 DISALLOW_COPY_AND_ASSIGN(TCPSocketWin); | 149 DISALLOW_COPY_AND_ASSIGN(TCPSocketWin); |
145 }; | 150 }; |
146 | 151 |
147 } // namespace net | 152 } // namespace net |
148 | 153 |
149 #endif // NET_SOCKET_TCP_SOCKET_WIN_H_ | 154 #endif // NET_SOCKET_TCP_SOCKET_WIN_H_ |
150 | 155 |
OLD | NEW |