OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium OS 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 TCP_SERVER_SOCKET_H | |
6 #define TCP_SERVER_SOCKET_H | |
7 | |
8 #include <string> | |
9 #include "base/PthreadHelpers.h" | |
10 #include "include/ppapi/cpp/private/tcp_server_socket_private.h" | |
11 #include "net/SocketSubSystem.h" | |
12 #include "ppapi/cpp/completion_callback.h" | |
13 | |
14 class TCPServerSocket : public FileStream { | |
15 public: | |
16 TCPServerSocket(SocketSubSystem* sys, | |
17 int oflag, const char* host, uint16_t port); | |
Dmitry Polukhin
2012/05/29 15:00:51
+ ident
vissi
2012/05/30 08:10:51
Done.
| |
18 virtual ~TCPServerSocket(); | |
19 | |
20 bool is_open() { return socket_ != NULL; } | |
21 | |
22 virtual void addref(); | |
23 virtual void release(); | |
24 | |
25 virtual int read(char* buf, size_t count, size_t* nread); | |
26 virtual int write(const char* buf, size_t count, size_t* nwrote); | |
27 virtual void close(); | |
28 | |
29 virtual int fcntl(int cmd, va_list ap); | |
30 | |
31 virtual bool is_read_ready(); | |
32 virtual bool is_write_ready(); | |
33 virtual bool is_exception(); | |
34 | |
35 bool listen(int backlog); | |
36 PP_Resource accept(); | |
37 | |
38 private: | |
39 void Listen(int32_t result, int backlog, int32_t* pres); | |
40 void Accept(int32_t result, int32_t* pres); | |
41 void OnAccept(int32_t result); | |
42 void Close(int32_t result, int32_t* pres); | |
43 | |
44 SocketSubSystem* sys; | |
45 int ref_; | |
46 int oflag_; | |
47 pp::CompletionCallbackFactory<TCPServerSocket, ThreadSafeRefCount> factory_; | |
48 pp::TCPServerSocketPrivate* socket_; | |
49 std::string host_; | |
50 uint16_t port_; | |
51 PP_Resource resource_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(TCPServerSocket); | |
54 }; | |
55 | |
56 #endif // TCP_SERVER_SOCKET_H | |
57 | |
OLD | NEW |