| 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_TCP_H_ | 5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_TCP_H_ |
| 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_TCP_H_ | 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_TCP_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_tcp_socket.h> | 12 #include <ppapi/c/ppb_tcp_socket.h> |
| 13 | 13 |
| 14 #include "nacl_io/event_emitter_tcp.h" | 14 #include "nacl_io/event_emitter_tcp.h" |
| 15 #include "nacl_io/mount_node.h" | 15 #include "nacl_io/mount_node.h" |
| 16 #include "nacl_io/mount_node_socket.h" | 16 #include "nacl_io/mount_node_socket.h" |
| 17 | 17 |
| 18 namespace nacl_io { | 18 namespace nacl_io { |
| 19 | 19 |
| 20 class MountNodeTCP : public MountNodeSocket { | 20 class MountNodeTCP : public MountNodeSocket { |
| 21 public: | 21 public: |
| 22 explicit MountNodeTCP(Mount* mount); | 22 explicit MountNodeTCP(Mount* mount); |
| 23 MountNodeTCP(Mount* mount, PP_Resource socket); | 23 MountNodeTCP(Mount* mount, PP_Resource socket); |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 virtual Error Init(int open_flags); | 26 virtual Error Init(int open_flags); |
| 27 virtual void Destroy(); | 27 virtual void Destroy(); |
| 28 | 28 |
| 29 public: | 29 public: |
| 30 virtual EventEmitterTCP* GetEventEmitter(); | 30 virtual EventEmitter* GetEventEmitter(); |
| 31 | 31 |
| 32 virtual void QueueAccept(); |
| 33 virtual void QueueConnect(); |
| 32 virtual void QueueInput(); | 34 virtual void QueueInput(); |
| 33 virtual void QueueOutput(); | 35 virtual void QueueOutput(); |
| 34 | 36 |
| 35 virtual Error Accept(PP_Resource* out_sock, | 37 virtual Error Accept(const HandleAttr& attr, |
| 38 PP_Resource* out_sock, |
| 36 struct sockaddr* addr, | 39 struct sockaddr* addr, |
| 37 socklen_t* len); | 40 socklen_t* len); |
| 38 virtual Error Bind(const struct sockaddr* addr, socklen_t len); | 41 virtual Error Bind(const struct sockaddr* addr, socklen_t len); |
| 39 virtual Error Listen(int backlog); | 42 virtual Error Listen(int backlog); |
| 40 virtual Error Connect(const struct sockaddr* addr, socklen_t len); | 43 virtual Error Connect(const HandleAttr& attr, |
| 44 const struct sockaddr* addr, |
| 45 socklen_t len); |
| 46 |
| 47 void ConnectDone_Locked(); |
| 48 void ConnectFailed_Locked(); |
| 41 | 49 |
| 42 protected: | 50 protected: |
| 43 void ConnectDone(); | |
| 44 virtual Error Recv_Locked(void* buf, | 51 virtual Error Recv_Locked(void* buf, |
| 45 size_t len, | 52 size_t len, |
| 46 PP_Resource* out_addr, | 53 PP_Resource* out_addr, |
| 47 int* out_len); | 54 int* out_len); |
| 48 | 55 |
| 49 virtual Error Send_Locked(const void* buf, | 56 virtual Error Send_Locked(const void* buf, |
| 50 size_t len, | 57 size_t len, |
| 51 PP_Resource addr, | 58 PP_Resource addr, |
| 52 int* out_len); | 59 int* out_len); |
| 53 | 60 |
| 54 ScopedEventEmitterTCP emitter_; | 61 ScopedEventEmitterTCP emitter_; |
| 62 PP_Resource accepted_socket_; |
| 55 }; | 63 }; |
| 56 | 64 |
| 57 | 65 |
| 58 } // namespace nacl_io | 66 } // namespace nacl_io |
| 59 | 67 |
| 60 #endif // PROVIDES_SOCKET_API | 68 #endif // PROVIDES_SOCKET_API |
| 61 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_TCP_H_ | 69 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_TCP_H_ |
| OLD | NEW |