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

Side by Side Diff: libraries/nacl-mounts/net/TcpServerSocket.h

Issue 10392070: Socket subsystem implementation (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
(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);
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 Mutex mutex_;
40 void Listen(int32_t result, int backlog, int32_t* pres);
41 void Accept(int32_t result, int32_t* pres);
42 void OnAccept(int32_t result);
43 void Close(int32_t result, int32_t* pres);
44
45 SocketSubSystem* sys;
46 int ref_;
47 int oflag_;
48 pp::CompletionCallbackFactory<TCPServerSocket, ThreadSafeRefCount> factory_;
49 pp::TCPServerSocketPrivate* socket_;
50 std::string host_;
51 uint16_t port_;
52 PP_Resource resource_;
53
54 DISALLOW_COPY_AND_ASSIGN(TCPServerSocket);
55 };
56
57 #endif // TCP_SERVER_SOCKET_H
58
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698