| OLD | NEW | 
|---|
| 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 | 
| 19 class MountNodeUDP : public MountNodeSocket { | 20 class MountNodeUDP : public MountNodeSocket { | 
| 20  public: | 21  public: | 
| 21   explicit MountNodeUDP(Mount* mount); | 22   explicit MountNodeUDP(Mount* mount); | 
| 22 | 23 | 
|  | 24  protected: | 
| 23   virtual Error Init(int flags); | 25   virtual Error Init(int flags); | 
|  | 26   virtual void Destroy(); | 
|  | 27 | 
|  | 28  public: | 
|  | 29   virtual EventEmitterUDP* GetEventEmitter(); | 
|  | 30 | 
|  | 31   virtual void QueueInput(); | 
|  | 32   virtual void QueueOutput(); | 
| 24 | 33 | 
| 25   virtual Error Bind(const struct sockaddr* addr, socklen_t len); | 34   virtual Error Bind(const struct sockaddr* addr, socklen_t len); | 
| 26   virtual Error Connect(const struct sockaddr* addr, socklen_t len); | 35   virtual Error Connect(const struct sockaddr* addr, socklen_t len); | 
| 27 | 36 | 
| 28   virtual Error Recv(void* buf, size_t len, int flags, int* out_len); | 37  protected: | 
| 29   virtual Error RecvFrom(void* buf, | 38   virtual Error Recv_Locked(void* buf, | 
| 30                          size_t len, | 39                             size_t len, | 
| 31                          int flags, | 40                             PP_Resource* addr, | 
| 32                          struct sockaddr* src_addr, | 41                             int* out_len); | 
| 33                          socklen_t* addrlen, |  | 
| 34                          int* out_len); |  | 
| 35 | 42 | 
| 36   virtual Error Send(const void* buf, size_t len, int flags, int* out_len); | 43   virtual Error Send_Locked(const void* buf, | 
| 37   virtual Error SendTo(const void* buf, | 44                             size_t len, | 
| 38                        size_t len, | 45                             PP_Resource addr, | 
| 39                        int flags, | 46                             int* out_len); | 
| 40                        const struct sockaddr* dest_addr, |  | 
| 41                        socklen_t addrlen, |  | 
| 42                        int* out_len); |  | 
| 43 | 47 | 
| 44  protected: | 48   ScopedEventEmitterUDP emitter_; | 
| 45   UDPSocketInterface* UDPSocket(); |  | 
| 46 |  | 
| 47   Error RecvFromHelper(void* buf, |  | 
| 48                        size_t len, |  | 
| 49                        int flags, |  | 
| 50                        PP_Resource* addr, |  | 
| 51                        int* out_len); |  | 
| 52 |  | 
| 53   Error SendToHelper(const void* buf, |  | 
| 54                      size_t len, |  | 
| 55                      int flags, |  | 
| 56                      PP_Resource dest_addr, |  | 
| 57                      int* out_len); |  | 
| 58 }; | 49 }; | 
| 59 | 50 | 
| 60 | 51 | 
| 61 }  // namespace nacl_io | 52 }  // namespace nacl_io | 
| 62 | 53 | 
| 63 #endif  // PROVIDES_SOCKET_API | 54 #endif  // PROVIDES_SOCKET_API | 
| 64 #endif  // LIBRARIES_NACL_IO_MOUNT_NODE_UDP_H_ | 55 #endif  // LIBRARIES_NACL_IO_MOUNT_NODE_UDP_H_ | 
| OLD | NEW | 
|---|