| Index: net/socket/tcp_server_socket_win.h
|
| diff --git a/net/socket/tcp_server_socket_win.h b/net/socket/tcp_server_socket_win.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..02dc07227e90fbf169d131e8f231d4173954c510
|
| --- /dev/null
|
| +++ b/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/message_loop.h"
|
| +#include "base/win/object_watcher.h"
|
| +#include "base/threading/non_thread_safe.h"
|
| +#include "net/base/completion_callback.h"
|
| +#include "net/socket/tcp_client_socket.h"
|
| +
|
| +namespace net {
|
| +
|
| +class IPEndPoint;
|
| +
|
| +class TCPServerSocketWin : public base::NonThreadSafe,
|
| + private base::win::ObjectWatcher::Delegate {
|
| + public:
|
| + TCPServerSocketWin(net::NetLog* net_log,
|
| + const net::NetLog::Source& source);
|
| + ~TCPServerSocketWin();
|
| +
|
| + // Bind the socket and start listening.
|
| + int Bind(const net::IPEndPoint& address, int backlog);
|
| +
|
| + // Gets current address the socket is bound to.
|
| + int GetLocalAddress(IPEndPoint* address) const;
|
| +
|
| + // Accept connection. Callback is called when new connection is
|
| + // accepted.
|
| + int Accept(TCPClientSocket** socket, IPEndPoint* address,
|
| + CompletionCallback* callback);
|
| + private:
|
| + int AcceptInternal(TCPClientSocket** socket, net::IPEndPoint* address);
|
| +
|
| + // base::ObjectWatcher::Delegate implementation.
|
| + virtual void OnObjectSignaled(HANDLE object);
|
| +
|
| + SOCKET socket_;
|
| + HANDLE socket_event_;
|
| +
|
| + base::win::ObjectWatcher accept_watcher_;
|
| +
|
| + TCPClientSocket** accept_socket_;
|
| + IPEndPoint* accept_address_;
|
| + CompletionCallback* accept_callback_;
|
| +
|
| + net::NetLog* net_log_;
|
| + net::NetLog::Source net_log_source_;
|
| +};
|
| +
|
| +} // namespace net
|
| +
|
| +#endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
|
|
|