Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1304)

Side by Side Diff: net/socket/server_socket.h

Issue 348803003: Refactor tcp socket and unix domain socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert the behavior change of calling RecordFastOpenStatus() Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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_SERVER_SOCKET_H_ 5 #ifndef NET_SOCKET_SERVER_SOCKET_H_
6 #define NET_SOCKET_SERVER_SOCKET_H_ 6 #define NET_SOCKET_SERVER_SOCKET_H_
7 7
8 #include <string>
9
8 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
9 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
10 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
11 13
12 namespace net { 14 namespace net {
13 15
14 class IPEndPoint; 16 class IPEndPoint;
15 class StreamSocket; 17 class StreamSocket;
16 18
17 class NET_EXPORT ServerSocket { 19 class NET_EXPORT ServerSocket {
18 public: 20 public:
19 ServerSocket() { } 21 ServerSocket();
20 virtual ~ServerSocket() { } 22 virtual ~ServerSocket();
21 23
22 // Bind the socket and start listening. Destroy the socket to stop 24 // Binds the socket and starts listening. Destroy the socket to stop
23 // listening. 25 // listening.
24 virtual int Listen(const net::IPEndPoint& address, int backlog) = 0; 26 virtual int Listen(const net::IPEndPoint& address, int backlog) = 0;
25 27
28 // Binds the socket with address and port, and starts listening. It expects
29 // a valid IPv4 or IPv6 address. Otherwise, it returns ERR_ADDRESS_INVALID.
30 // Subclasses may override this function if |address_string| is in a different
31 // format, for example, unix domain socket path.
32 virtual int ListenWithAddressAndPort(const std::string& address_string,
33 int port,
34 int backlog);
35
26 // Gets current address the socket is bound to. 36 // Gets current address the socket is bound to.
27 virtual int GetLocalAddress(IPEndPoint* address) const = 0; 37 virtual int GetLocalAddress(IPEndPoint* address) const = 0;
28 38
29 // Accept connection. Callback is called when new connection is 39 // Accepts connection. Callback is called when new connection is
30 // accepted. 40 // accepted.
31 virtual int Accept(scoped_ptr<StreamSocket>* socket, 41 virtual int Accept(scoped_ptr<StreamSocket>* socket,
32 const CompletionCallback& callback) = 0; 42 const CompletionCallback& callback) = 0;
33 43
34 private: 44 private:
35 DISALLOW_COPY_AND_ASSIGN(ServerSocket); 45 DISALLOW_COPY_AND_ASSIGN(ServerSocket);
36 }; 46 };
37 47
38 } // namespace net 48 } // namespace net
39 49
40 #endif // NET_SOCKET_SERVER_SOCKET_H_ 50 #endif // NET_SOCKET_SERVER_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698