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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « libraries/nacl-mounts/net/SocketSubSystem.cc ('k') | libraries/nacl-mounts/net/TcpServerSocket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libraries/nacl-mounts/net/TcpServerSocket.h
===================================================================
--- libraries/nacl-mounts/net/TcpServerSocket.h (revision 0)
+++ libraries/nacl-mounts/net/TcpServerSocket.h (revision 0)
@@ -0,0 +1,57 @@
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_NET_TCP_SERVER_SOCKET_H_
+#define PACKAGES_LIBRARIES_NACL_MOUNTS_NET_TCP_SERVER_SOCKET_H_
+
+#include <string>
+#include "../net/SocketSubSystem.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "../ppapi/cpp/private/tcp_server_socket_private.h"
+#include "../util/PthreadHelpers.h"
+
+class TCPServerSocket : public Socket {
+ public:
+ TCPServerSocket(SocketSubSystem* sys,
+ int oflag, const sockaddr* saddr, socklen_t addrlen);
+ virtual ~TCPServerSocket();
+
+ bool is_open() { return socket_ != NULL; }
+
+ virtual void addref();
+ virtual void release();
+
+ virtual int read(char* buf, size_t count, size_t* nread);
+ virtual int write(const char* buf, size_t count, size_t* nwrote);
+ virtual void close();
+
+ virtual int fcntl(int cmd, va_list ap);
+
+ virtual bool is_read_ready();
+ virtual bool is_write_ready();
+ virtual bool is_exception();
+
+ bool listen(int backlog);
+ PP_Resource accept();
+
+ private:
+ void Listen(int32_t result, int backlog, int32_t* pres);
+ void Accept(int32_t result, int32_t* pres);
+ void OnAccept(int32_t result);
+ void Close(int32_t result, int32_t* pres);
+ bool CreateNetAddress(const sockaddr* saddr, PP_NetAddress_Private* addr);
+
+ SocketSubSystem* sys_;
+ int ref_;
+ int oflag_;
+ pp::CompletionCallbackFactory<TCPServerSocket, ThreadSafeRefCount> factory_;
+ pp::TCPServerSocketPrivate* socket_;
+ sockaddr_in6 sin6_;
+ PP_Resource resource_;
+
+ DISALLOW_COPY_AND_ASSIGN(TCPServerSocket);
+};
+
+#endif // PACKAGES_LIBRARIES_NACL_MOUNTS_NET_TCP_SERVER_SOCKET_H_
+
« no previous file with comments | « libraries/nacl-mounts/net/SocketSubSystem.cc ('k') | libraries/nacl-mounts/net/TcpServerSocket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698