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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/mount_node_socket.h

Issue 22587003: [NaCl SDK] Add UDP and TCP Sockets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Running tests on package Created 7 years, 4 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) 2013 The Chromium 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 LIBRARIES_NACL_IO_MOUNT_NODE_SOCKET_H_
6 #define LIBRARIES_NACL_IO_MOUNT_NODE_SOCKET_H_
7
8 #include "nacl_io/ossocket.h"
9 #ifdef PROVIDES_SOCKET_API
10
11 #include <ppapi/c/pp_errors.h>
12 #include <ppapi/c/pp_resource.h>
13 #include <ppapi/c/ppb_net_address.h>
14
15 #include "nacl_io/mount.h"
16 #include "nacl_io/pepper_interface.h"
17
18 namespace nacl_io {
19
20 class MountSocket;
21
22 class MountNodeSocket : public MountNode {
23 public:
24 explicit MountNodeSocket(Mount* mount);
25
26 protected:
27 virtual void Destroy();
28 virtual Error Init(int flags) = 0;
29
30 public:
31 virtual uint32_t GetEventStatus();
32
33 // Normal read/write operations on a file (recv/send).
34 virtual Error Read(size_t offs, void* buf, size_t count, int* out_bytes);
35 virtual Error Write(size_t offs,
36 const void* buf,
37 size_t count,
38 int* out_bytes);
39
40 // Unsuported Functions
41 virtual Error Accept(const struct sockaddr* addr, socklen_t len);
42 virtual Error Listen(int backlog);
43 virtual Error GetSockOpt(int lvl, int optname, void* optval, socklen_t* len);
44 virtual Error SetSockOpt(int lvl,
45 int optname,
46 const void* optval,
47 socklen_t len);
48 virtual Error Shutdown(int how);
49 virtual Error MMap(void* addr,
50 size_t length,
51 int prot,
52 int flags,
53 size_t offset,
54 void** out_addr);
55
56 // Normal Functions.
57 virtual Error Bind(const struct sockaddr* addr, socklen_t len);
58 virtual Error Connect(const struct sockaddr* addr, socklen_t len);
59 virtual Error Recv(void* buf, size_t len, int flags, int* out_len);
60 virtual Error RecvFrom(void* buf,
61 size_t len,
62 int flags,
63 struct sockaddr* src_addr,
64 socklen_t* addrlen,
65 int* out_len);
66
67 virtual Error Send(const void* buf, size_t len, int flags, int* out_len);
68 virtual Error SendTo(const void* buf,
69 size_t len,
70 int flags,
71 const struct sockaddr* dest_addr,
72 socklen_t addrlen,
73 int* out_len);
74
75 virtual Error GetPeerName(struct sockaddr* addr, socklen_t* len);
76 virtual Error GetSockName(struct sockaddr* addr, socklen_t* len);
77
78 protected:
79 NetAddressInterface* NetAddress();
80 PP_Resource SockAddrToResource(const struct sockaddr* addr, socklen_t len);
81 socklen_t ResourceToSockAddr(PP_Resource addr,
82 socklen_t len,
83 struct sockaddr* out_addr);
84
85 bool EquivalentAddress(PP_Resource addr1, PP_Resource addr2);
binji 2013/08/09 19:28:06 Maybe IsEquivalentAddress? I prefer functions to s
noelallen1 2013/08/09 22:53:22 Done.
86 Error PPErrorToErrno(int error);
87
88 protected:
89 PP_Resource socket_resource_;
binji 2013/08/09 19:28:06 used ScopedResource instead?
noelallen1 2013/08/09 22:53:22 Can't. mount_->ppapi_ isn't available until Init.
90 PP_Resource local_addr_;
91 PP_Resource remote_addr_;
92
93 friend class KernelProxy;
94 friend class MountSocket;
95 };
96
97
98 } // namespace nacl_io
99
100
101 #endif // PROVIDES_SOCKET_API
102 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698