OLD | NEW |
1 // Copyright (c) 2009 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2009 The Native Client 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 NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_WRAPPER_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_WRAPPER_H_ |
6 #define NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_WRAPPER_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_WRAPPER_H_ |
7 | 7 |
8 #include "native_client/src/shared/platform/nacl_log.h" | 8 #include "native_client/src/shared/platform/nacl_log.h" |
9 #include "native_client/src/trusted/desc/nacl_desc_base.h" | 9 #include "native_client/src/trusted/desc/nacl_desc_base.h" |
10 #include "native_client/src/trusted/desc/nrd_xfer.h" | 10 #include "native_client/src/trusted/desc/nrd_xfer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 ~DescWrapperFactory(); | 22 ~DescWrapperFactory(); |
23 | 23 |
24 // Create a bound socket, socket address pair. | 24 // Create a bound socket, socket address pair. |
25 int MakeBoundSock(DescWrapper* pair[2]); | 25 int MakeBoundSock(DescWrapper* pair[2]); |
26 // Create a pair of DescWrappers for a connnected (data-only) socket. | 26 // Create a pair of DescWrappers for a connnected (data-only) socket. |
27 int MakeSocketPair(DescWrapper* pair[2]); | 27 int MakeSocketPair(DescWrapper* pair[2]); |
28 // Create an IMC socket object. | 28 // Create an IMC socket object. |
29 DescWrapper* MakeImcSock(NaClHandle handle); | 29 DescWrapper* MakeImcSock(NaClHandle handle); |
30 // Create a shared memory object. | 30 // Create a shared memory object. |
31 DescWrapper* MakeShm(size_t size); | 31 DescWrapper* MakeShm(size_t size); |
32 // Create a DescWrapper from a socket address string. | |
33 DescWrapper* MakeSocketAddress(const char* addr); | |
34 // Create a DescWrapper from opening a host file. | 32 // Create a DescWrapper from opening a host file. |
35 DescWrapper* OpenHostFile(const char* fname, int flags, int mode); | 33 DescWrapper* OpenHostFile(const char* fname, int flags, int mode); |
36 // Create a DescWrapper for the designated invalid descriptor | 34 // Create a DescWrapper for the designated invalid descriptor |
37 DescWrapper* MakeInvalid(); | 35 DescWrapper* MakeInvalid(); |
38 | 36 |
39 // Create a DescWrapper from a generic Pepper shared memory descriptor. | 37 // Create a DescWrapper from a generic Pepper shared memory descriptor. |
40 DescWrapper* ImportPepperSharedMemory(intptr_t shm, size_t size); | 38 DescWrapper* ImportPepperSharedMemory(intptr_t shm, size_t size); |
41 // Create a DescWrapper from a Pepper2D shared memory descriptor. | 39 // Create a DescWrapper from a Pepper2D shared memory descriptor. |
42 DescWrapper* ImportPepper2DSharedMemory(intptr_t dib); | 40 DescWrapper* ImportPepper2DSharedMemory(intptr_t dib); |
43 // Create a DescWrapper from a Pepper synchronization object. | 41 // Create a DescWrapper from a Pepper synchronization object. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 wrapper->Delete(); | 88 wrapper->Delete(); |
91 } | 89 } |
92 } | 90 } |
93 | 91 |
94 // Extract a NaClDesc from the wrapper. | 92 // Extract a NaClDesc from the wrapper. |
95 struct NaClDesc* desc() const { return desc_; } | 93 struct NaClDesc* desc() const { return desc_; } |
96 | 94 |
97 // Get the type of the wrapped NaClDesc. | 95 // Get the type of the wrapped NaClDesc. |
98 enum NaClDescTypeTag type_tag() const { return desc_->vtbl->typeTag; } | 96 enum NaClDescTypeTag type_tag() const { return desc_->vtbl->typeTag; } |
99 | 97 |
100 // Get the path string from a NaClDescConnCap. Returns NULL if the | |
101 // type of the NaClDesc is not NACL_DESC_CONN_CAP (a socket address). | |
102 const char* conn_cap_path() const; | |
103 | |
104 // We do not replicate the underlying NaClDesc object hierarchy, so there | 98 // We do not replicate the underlying NaClDesc object hierarchy, so there |
105 // are obviously many more methods than a particular derived class | 99 // are obviously many more methods than a particular derived class |
106 // implements. | 100 // implements. |
107 | 101 |
108 // Map a shared memory descriptor. | 102 // Map a shared memory descriptor. |
109 // Sets the address to the place mapped to and the size to the rounded result. | 103 // Sets the address to the place mapped to and the size to the rounded result. |
110 // Returns zero on success, negative NaCl ABI errno on failure. | 104 // Returns zero on success, negative NaCl ABI errno on failure. |
111 int Map(void** addr, size_t* size); | 105 int Map(void** addr, size_t* size); |
112 | 106 |
113 // Unmaps a region of shared memory. | 107 // Unmaps a region of shared memory. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 198 |
205 DescWrapperCommon* common_data_; | 199 DescWrapperCommon* common_data_; |
206 struct NaClDesc* desc_; | 200 struct NaClDesc* desc_; |
207 | 201 |
208 DISALLOW_COPY_AND_ASSIGN(DescWrapper); | 202 DISALLOW_COPY_AND_ASSIGN(DescWrapper); |
209 }; | 203 }; |
210 | 204 |
211 } // namespace nacl | 205 } // namespace nacl |
212 | 206 |
213 #endif // NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_WRAPPER_H_ | 207 #endif // NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_WRAPPER_H_ |
OLD | NEW |