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_SOCKET_H_ | 5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_SOCKET_H_ |
6 #define LIBRARIES_NACL_IO_MOUNT_NODE_SOCKET_H_ | 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_SOCKET_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 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Unsupported Functions | 54 // Unsupported Functions |
55 virtual Error Shutdown(int how); | 55 virtual Error Shutdown(int how); |
56 virtual Error MMap(void* addr, | 56 virtual Error MMap(void* addr, |
57 size_t length, | 57 size_t length, |
58 int prot, | 58 int prot, |
59 int flags, | 59 int flags, |
60 size_t offset, | 60 size_t offset, |
61 void** out_addr); | 61 void** out_addr); |
62 | 62 |
63 // Socket Functions. | 63 // Socket Functions. |
64 virtual Error Accept(PP_Resource* new_sock, | 64 virtual Error Accept(const HandleAttr& attr, |
| 65 PP_Resource* new_sock, |
65 struct sockaddr* addr, | 66 struct sockaddr* addr, |
66 socklen_t* len); | 67 socklen_t* len); |
67 virtual Error Bind(const struct sockaddr* addr, socklen_t len); | 68 virtual Error Bind(const struct sockaddr* addr, socklen_t len); |
68 virtual Error Connect(const struct sockaddr* addr, socklen_t len); | 69 virtual Error Connect(const HandleAttr& attr, |
| 70 const struct sockaddr* addr, |
| 71 socklen_t len); |
69 virtual Error Listen(int backlog); | 72 virtual Error Listen(int backlog); |
70 virtual Error Recv(const HandleAttr& attr, | 73 virtual Error Recv(const HandleAttr& attr, |
71 void* buf, | 74 void* buf, |
72 size_t len, | 75 size_t len, |
73 int flags, | 76 int flags, |
74 int* out_len); | 77 int* out_len); |
75 virtual Error RecvFrom(const HandleAttr& attr, | 78 virtual Error RecvFrom(const HandleAttr& attr, |
76 void* buf, | 79 void* buf, |
77 size_t len, | 80 size_t len, |
78 int flags, | 81 int flags, |
(...skipping 11 matching lines...) Expand all Loading... |
90 size_t len, | 93 size_t len, |
91 int flags, | 94 int flags, |
92 const struct sockaddr* dest_addr, | 95 const struct sockaddr* dest_addr, |
93 socklen_t addrlen, | 96 socklen_t addrlen, |
94 int* out_len); | 97 int* out_len); |
95 | 98 |
96 virtual Error GetPeerName(struct sockaddr* addr, socklen_t* len); | 99 virtual Error GetPeerName(struct sockaddr* addr, socklen_t* len); |
97 virtual Error GetSockName(struct sockaddr* addr, socklen_t* len); | 100 virtual Error GetSockName(struct sockaddr* addr, socklen_t* len); |
98 | 101 |
99 PP_Resource socket_resource() { return socket_resource_; } | 102 PP_Resource socket_resource() { return socket_resource_; } |
| 103 PP_Resource remote_addr() { return remote_addr_; } |
100 | 104 |
101 // Updates socket's state, recording last error. | 105 // Updates socket's state, recording last error. |
102 void SetError_Locked(int pp_error_num); | 106 void SetError_Locked(int pp_error_num); |
103 | 107 |
| 108 |
104 protected: | 109 protected: |
105 | 110 |
106 // Wraps common error checks, timeouts, work pump for send. | 111 // Wraps common error checks, timeouts, work pump for send. |
107 Error SendHelper(const HandleAttr& attr, | 112 Error SendHelper(const HandleAttr& attr, |
108 const void* buf, | 113 const void* buf, |
109 size_t len, | 114 size_t len, |
110 int flags, | 115 int flags, |
111 PP_Resource addr, | 116 PP_Resource addr, |
112 int* out_len); | 117 int* out_len); |
113 | 118 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 friend class KernelProxy; | 158 friend class KernelProxy; |
154 friend class MountStream; | 159 friend class MountStream; |
155 }; | 160 }; |
156 | 161 |
157 | 162 |
158 } // namespace nacl_io | 163 } // namespace nacl_io |
159 | 164 |
160 | 165 |
161 #endif // PROVIDES_SOCKET_API | 166 #endif // PROVIDES_SOCKET_API |
162 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_SOCKET_H_ | 167 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_SOCKET_H_ |
OLD | NEW |