OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TCP_SOCKET_LIBEVENT_H_ | 5 #ifndef NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ |
6 #define NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ | 6 #define NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // TODO(yzshen): This class is incomplete. TCP client operations (Connect/Read/ | 22 // TODO(yzshen): This class is incomplete. TCP client operations (Connect/Read/ |
23 // Write/etc.) will be added. And TCPClientSocket will be changed to be a | 23 // Write/etc.) will be added. And TCPClientSocket will be changed to be a |
24 // wrapper around TCPSocket. | 24 // wrapper around TCPSocket. |
25 class NET_EXPORT TCPSocketLibevent : public base::NonThreadSafe, | 25 class NET_EXPORT TCPSocketLibevent : public base::NonThreadSafe, |
26 public base::MessageLoopForIO::Watcher { | 26 public base::MessageLoopForIO::Watcher { |
27 public: | 27 public: |
28 TCPSocketLibevent(NetLog* net_log, const NetLog::Source& source); | 28 TCPSocketLibevent(NetLog* net_log, const NetLog::Source& source); |
29 virtual ~TCPSocketLibevent(); | 29 virtual ~TCPSocketLibevent(); |
30 | 30 |
31 int Create(AddressFamily family); | 31 int Open(AddressFamily family); |
32 // Takes ownership of |socket|. | 32 // Takes ownership of |socket|. |
33 int Adopt(int socket); | 33 int Adopt(int socket); |
34 // Returns a socket file descriptor. The ownership is transferred to the | 34 // Returns a socket file descriptor. The ownership is transferred to the |
35 // caller. | 35 // caller. |
36 int Release(); | 36 int Release(); |
37 int Bind(const IPEndPoint& address); | 37 int Bind(const IPEndPoint& address); |
38 int GetLocalAddress(IPEndPoint* address) const; | 38 int GetLocalAddress(IPEndPoint* address) const; |
39 int Listen(int backlog); | 39 int Listen(int backlog); |
40 int Accept(scoped_ptr<TCPSocketLibevent>* socket, | 40 int Accept(scoped_ptr<TCPSocketLibevent>* socket, |
41 IPEndPoint* address, | 41 IPEndPoint* address, |
(...skipping 21 matching lines...) Expand all Loading... |
63 CompletionCallback accept_callback_; | 63 CompletionCallback accept_callback_; |
64 | 64 |
65 BoundNetLog net_log_; | 65 BoundNetLog net_log_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(TCPSocketLibevent); | 67 DISALLOW_COPY_AND_ASSIGN(TCPSocketLibevent); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace net | 70 } // namespace net |
71 | 71 |
72 #endif // NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ | 72 #endif // NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ |
OLD | NEW |