diff options
author | Zeno Albisser <zeno.albisser@digia.com> | 2013-08-15 21:46:11 +0200 |
---|---|---|
committer | Zeno Albisser <zeno.albisser@digia.com> | 2013-08-15 21:46:11 +0200 |
commit | 679147eead574d186ebf3069647b4c23e8ccace6 (patch) | |
tree | fc247a0ac8ff119f7c8550879ebb6d3dd8d1ff69 /chromium/net/socket/tcp_server_socket_win.h | |
download | qtwebengine-chromium-679147eead574d186ebf3069647b4c23e8ccace6.tar.gz |
Initial import.
Diffstat (limited to 'chromium/net/socket/tcp_server_socket_win.h')
-rw-r--r-- | chromium/net/socket/tcp_server_socket_win.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/chromium/net/socket/tcp_server_socket_win.h b/chromium/net/socket/tcp_server_socket_win.h new file mode 100644 index 00000000000..5a1d378ad9b --- /dev/null +++ b/chromium/net/socket/tcp_server_socket_win.h @@ -0,0 +1,58 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ +#define NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ + +#include <winsock2.h> + +#include "base/memory/scoped_ptr.h" +#include "base/message_loop/message_loop.h" +#include "base/threading/non_thread_safe.h" +#include "base/win/object_watcher.h" +#include "net/base/completion_callback.h" +#include "net/base/net_log.h" +#include "net/socket/server_socket.h" + +namespace net { + +class IPEndPoint; + +class NET_EXPORT_PRIVATE TCPServerSocketWin + : public ServerSocket, + NON_EXPORTED_BASE(public base::NonThreadSafe), + public base::win::ObjectWatcher::Delegate { + public: + TCPServerSocketWin(net::NetLog* net_log, + const net::NetLog::Source& source); + ~TCPServerSocketWin(); + + // net::ServerSocket implementation. + virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE; + virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; + virtual int Accept(scoped_ptr<StreamSocket>* socket, + const CompletionCallback& callback) OVERRIDE; + + // base::ObjectWatcher::Delegate implementation. + virtual void OnObjectSignaled(HANDLE object); + + private: + int SetSocketOptions(); + int AcceptInternal(scoped_ptr<StreamSocket>* socket); + void Close(); + + SOCKET socket_; + HANDLE socket_event_; + + base::win::ObjectWatcher accept_watcher_; + + scoped_ptr<StreamSocket>* accept_socket_; + CompletionCallback accept_callback_; + + BoundNetLog net_log_; +}; + +} // namespace net + +#endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ |