1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
6 #define NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h"
12 #include "base/win/object_watcher.h"
13 #include "base/threading/non_thread_safe.h"
14 #include "net/base/completion_callback.h"
15 #include "net/base/net_log.h"
16 #include "net/socket/server_socket.h"
22 class NET_EXPORT_PRIVATE TCPServerSocketWin
23 : public ServerSocket
,
24 NON_EXPORTED_BASE(public base::NonThreadSafe
),
25 public base::win::ObjectWatcher::Delegate
{
27 TCPServerSocketWin(net::NetLog
* net_log
,
28 const net::NetLog::Source
& source
);
29 ~TCPServerSocketWin();
31 // net::ServerSocket implementation.
32 virtual void AllowAddressReuse() OVERRIDE
;
33 virtual int Listen(const net::IPEndPoint
& address
, int backlog
) OVERRIDE
;
34 virtual int GetLocalAddress(IPEndPoint
* address
) const OVERRIDE
;
35 virtual int Accept(scoped_ptr
<StreamSocket
>* socket
,
36 const CompletionCallback
& callback
) OVERRIDE
;
38 // base::ObjectWatcher::Delegate implementation.
39 virtual void OnObjectSignaled(HANDLE object
);
42 int SetSocketOptions();
43 int AcceptInternal(scoped_ptr
<StreamSocket
>* socket
);
49 base::win::ObjectWatcher accept_watcher_
;
51 scoped_ptr
<StreamSocket
>* accept_socket_
;
52 CompletionCallback accept_callback_
;
61 #endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_