Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef NET_SOCKET_SERVER_SOCKET_H_ | |
| 6 #define NET_SOCKET_SERVER_SOCKET_H_ | |
| 7 | |
| 8 #include "base/scoped_ptr.h" | |
| 9 #include "net/base/completion_callback.h" | |
| 10 | |
| 11 namespace net { | |
| 12 | |
| 13 class ClientSocket; | |
| 14 class IPEndPoint; | |
| 15 | |
| 16 class ServerSocket { | |
|
willchan no longer on Chromium
2011/04/18 18:07:17
Can you justify the need for this abstraction?
Sergey Ulanov
2011/04/18 19:40:28
That's mainly to make it easier to unittest code t
willchan no longer on Chromium
2011/04/18 20:08:56
I see. I had thought you were planning on using th
| |
| 17 public: | |
| 18 ServerSocket() { } | |
| 19 virtual ~ServerSocket() { } | |
| 20 | |
| 21 // Bind the socket and start listening. Destroy the socket to stop | |
| 22 // listening. | |
| 23 virtual int Listen(const net::IPEndPoint& address, int backlog) = 0; | |
| 24 | |
| 25 // Gets current address the socket is bound to. | |
| 26 virtual int GetLocalAddress(IPEndPoint* address) const = 0; | |
| 27 | |
| 28 // Accept connection. Callback is called when new connection is | |
| 29 // accepted. | |
| 30 virtual int Accept(scoped_ptr<ClientSocket>* socket, | |
| 31 CompletionCallback* callback) = 0; | |
| 32 | |
| 33 private: | |
| 34 DISALLOW_COPY_AND_ASSIGN(ServerSocket); | |
| 35 }; | |
| 36 | |
| 37 } // namespace net | |
| 38 | |
| 39 #endif // NET_SOCKET_TCP_SERVER_SOCKET_H_ | |
| OLD | NEW |