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

Unified Diff: native_client_sdk/src/libraries/nacl_io/socket/unix_socketpair_node.h

Issue 1335783005: [NaCl SDK] nacl_io: Add support for basic socketpairs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: native_client_sdk/src/libraries/nacl_io/socket/unix_socketpair_node.h
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/unix_socketpair_node.h b/native_client_sdk/src/libraries/nacl_io/socket/unix_socketpair_node.h
new file mode 100644
index 0000000000000000000000000000000000000000..27ff0b1f47938e52d5d2c13b4e54aabf32765257
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_io/socket/unix_socketpair_node.h
@@ -0,0 +1,59 @@
+// Copyright 2015 The Chromium 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 LIBRARIES_NACL_IO_SOCKET_UNIX_SOCKETPAIR_NODE_H_
+#define LIBRARIES_NACL_IO_SOCKET_UNIX_SOCKETPAIR_NODE_H_
+
+#include "nacl_io/ossocket.h"
+#ifdef PROVIDES_SOCKET_API
+
+#include "nacl_io/node.h"
+#include "nacl_io/socket/socket_node.h"
+#include "nacl_io/socket/unix_event_emitter.h"
+
+namespace nacl_io {
+
+class UnixSocketpairNode : public SocketNode {
+ public:
+ explicit UnixSocketpairNode(Filesystem* filesystem);
Sam Clegg 2015/09/17 09:40:39 Should we just call this UnixSocketNode, since it
avallee 2015/09/17 16:18:01 Sounds fair.
binji 2015/09/18 23:30:13 Please rename the class as well.
+ UnixSocketpairNode(Filesystem* filesystem, const UnixSocketpairNode& peer);
+
+ virtual EventEmitter* GetEventEmitter();
+
+ protected:
+ virtual Error Recv_Locked(void* buffer,
+ size_t len,
+ PP_Resource* out_addr,
+ int* out_len);
+ virtual Error Send_Locked(const void* buffer,
+ size_t len,
+ PP_Resource addr,
+ int* out_len);
+ virtual Error RecvFrom(const HandleAttr& attr,
+ void* buf,
+ size_t len,
+ int flags,
+ struct sockaddr* src_addr,
+ socklen_t* addrlen,
+ int* out_len);
+ virtual Error Send(const HandleAttr& attr,
+ const void* buf,
+ size_t len,
+ int flags,
+ int* out_len);
+ virtual Error SendTo(const HandleAttr& attr,
+ const void* buf,
+ size_t len,
+ int flags,
+ const struct sockaddr* dest_addr,
+ socklen_t addrlen,
+ int* out_len);
+ private:
+ ScopedUnixEventEmitter emitter_;
+};
+
+} // namespace nacl_io
+
+#endif // PROVIDES_SOCKET_API
+#endif // LIBRARIES_NACL_IO_SOCKET_UNIX_SOCKETPAIR_NODE_H_

Powered by Google App Engine
This is Rietveld 408576698