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

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

Issue 23498015: [NaCl SDK] Support non blocking TCP/UDP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_UDP_H_ 5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_UDP_H_
6 #define LIBRARIES_NACL_IO_MOUNT_NODE_UDP_H_ 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_UDP_H_
7 7
8 #include "nacl_io/ossocket.h" 8 #include "nacl_io/ossocket.h"
9 #ifdef PROVIDES_SOCKET_API 9 #ifdef PROVIDES_SOCKET_API
10 10
11 #include <ppapi/c/pp_resource.h> 11 #include <ppapi/c/pp_resource.h>
12 #include <ppapi/c/ppb_udp_socket.h> 12 #include <ppapi/c/ppb_udp_socket.h>
13 13
14 #include "nacl_io/event_emitter_udp.h"
14 #include "nacl_io/mount_node.h" 15 #include "nacl_io/mount_node.h"
15 #include "nacl_io/mount_node_socket.h" 16 #include "nacl_io/mount_node_socket.h"
16 17
17 namespace nacl_io { 18 namespace nacl_io {
18 19
20 class UDPSendWork;
21 class UDPRecvWork;
22
19 class MountNodeUDP : public MountNodeSocket { 23 class MountNodeUDP : public MountNodeSocket {
20 public: 24 public:
21 explicit MountNodeUDP(Mount* mount); 25 explicit MountNodeUDP(Mount* mount);
22 26
27 protected:
23 virtual Error Init(int flags); 28 virtual Error Init(int flags);
29 virtual void Destroy();
30
31 public:
32 virtual EventEmitterUDP* GetEventEmitter();
33
34 virtual void QueueInput();
35 virtual void QueueOutput();
36
24 37
25 virtual Error Bind(const struct sockaddr* addr, socklen_t len); 38 virtual Error Bind(const struct sockaddr* addr, socklen_t len);
26 virtual Error Connect(const struct sockaddr* addr, socklen_t len); 39 virtual Error Connect(const struct sockaddr* addr, socklen_t len);
27 40
28 virtual Error Recv(void* buf, size_t len, int flags, int* out_len); 41 virtual Error Recv(void* buf, size_t len, int flags, int* out_len);
29 virtual Error RecvFrom(void* buf, 42 virtual Error RecvFrom(void* buf,
30 size_t len, 43 size_t len,
31 int flags, 44 int flags,
32 struct sockaddr* src_addr, 45 struct sockaddr* src_addr,
33 socklen_t* addrlen, 46 socklen_t* addrlen,
34 int* out_len); 47 int* out_len);
35 48
36 virtual Error Send(const void* buf, size_t len, int flags, int* out_len); 49 virtual Error Send(const void* buf, size_t len, int flags, int* out_len);
37 virtual Error SendTo(const void* buf, 50 virtual Error SendTo(const void* buf,
38 size_t len, 51 size_t len,
39 int flags, 52 int flags,
40 const struct sockaddr* dest_addr, 53 const struct sockaddr* dest_addr,
41 socklen_t addrlen, 54 socklen_t addrlen,
42 int* out_len); 55 int* out_len);
43 56
44 protected: 57 protected:
45 UDPSocketInterface* UDPSocket();
46
47 Error RecvFromHelper(void* buf, 58 Error RecvFromHelper(void* buf,
48 size_t len, 59 size_t len,
49 int flags, 60 int flags,
50 PP_Resource* addr, 61 PP_Resource* addr,
51 int* out_len); 62 int* out_len);
52 63
53 Error SendToHelper(const void* buf, 64 Error SendToHelper(const void* buf,
54 size_t len, 65 size_t len,
55 int flags, 66 int flags,
56 PP_Resource dest_addr, 67 PP_Resource dest_addr,
57 int* out_len); 68 int* out_len);
69
70 ScopedEventEmitterUDP emitter_;
71 friend class UDPSendWork;
72 friend class UDPRecvWork;
58 }; 73 };
59 74
60 75
61 } // namespace nacl_io 76 } // namespace nacl_io
62 77
63 #endif // PROVIDES_SOCKET_API 78 #endif // PROVIDES_SOCKET_API
64 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_UDP_H_ 79 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_UDP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698