OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2012 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/include/nacl_base.h" | 8 #include "native_client/src/include/nacl_base.h" |
9 #include "native_client/src/public/nacl_file_info.h" | |
9 #include "native_client/src/trusted/desc/nacl_desc_base.h" | 10 #include "native_client/src/trusted/desc/nacl_desc_base.h" |
10 #include "native_client/src/trusted/desc/nrd_xfer.h" | 11 #include "native_client/src/trusted/desc/nrd_xfer.h" |
11 | 12 |
12 namespace nacl { | 13 namespace nacl { |
13 // Forward declarations. | 14 // Forward declarations. |
14 class DescWrapper; | 15 class DescWrapper; |
15 class DescWrapperCommon; | 16 class DescWrapperCommon; |
16 | 17 |
17 // We also create a utility class that allows creation of wrappers for the | 18 // We also create a utility class that allows creation of wrappers for the |
18 // NaClDescs. | 19 // NaClDescs. |
19 class DescWrapperFactory { | 20 class DescWrapperFactory { |
20 public: | 21 public: |
21 DescWrapperFactory(); | 22 DescWrapperFactory(); |
22 ~DescWrapperFactory(); | 23 ~DescWrapperFactory(); |
23 | 24 |
24 // Create a bound socket, socket address pair. | 25 // Create a bound socket, socket address pair. |
25 int MakeBoundSock(DescWrapper* pair[2]); | 26 int MakeBoundSock(DescWrapper* pair[2]); |
26 // Create a pair of DescWrappers for a connnected (data-only) socket. | 27 // Create a pair of DescWrappers for a connnected (data-only) socket. |
27 int MakeSocketPair(DescWrapper* pair[2]); | 28 int MakeSocketPair(DescWrapper* pair[2]); |
28 // Create an IMC socket object. | 29 // Create an IMC socket object. |
29 DescWrapper* MakeImcSock(NaClHandle handle); | 30 DescWrapper* MakeImcSock(NaClHandle handle); |
30 // Create a file descriptor object. | 31 // Create a file descriptor object. |
31 DescWrapper* MakeFileDesc(int host_os_desc, int mode); | 32 DescWrapper* MakeFileDesc(int host_os_desc, int mode); |
33 // As with MakeFileDesc, but with NaClFileInfo metadata. | |
34 DescWrapper* MakeFileDescMetadata(struct NaClFileInfo file_info, | |
Mark Seaborn
2014/05/02 20:50:40
Is it your intention to use this new method from t
jvoung (off chromium)
2014/05/14 23:42:47
Yes, this was to make the desc and token ownership
| |
35 int mode); | |
32 // As with MakeFileDesc, but with quota management. | 36 // As with MakeFileDesc, but with quota management. |
33 DescWrapper* MakeFileDescQuota(int host_os_desc, int mode, | 37 DescWrapper* MakeFileDescQuota(int host_os_desc, int mode, |
34 const uint8_t* file_id); | 38 const uint8_t* file_id); |
35 // Create a DescWrapper from opening a host file. | 39 // Create a DescWrapper from opening a host file. |
36 DescWrapper* OpenHostFile(const char* fname, int flags, int mode); | 40 DescWrapper* OpenHostFile(const char* fname, int flags, int mode); |
37 // As with OpenHostFile, but with quota management. | 41 // As with OpenHostFile, but with quota management. |
38 DescWrapper* OpenHostFileQuota(const char* fname, int flags, int mode, | 42 DescWrapper* OpenHostFileQuota(const char* fname, int flags, int mode, |
39 const uint8_t* file_id); | 43 const uint8_t* file_id); |
40 // Create a DescWrapper for a random number generator. | 44 // Create a DescWrapper for a random number generator. |
41 DescWrapper* OpenRng(); | 45 DescWrapper* OpenRng(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 | 190 |
187 DescWrapperCommon* common_data_; | 191 DescWrapperCommon* common_data_; |
188 struct NaClDesc* desc_; | 192 struct NaClDesc* desc_; |
189 | 193 |
190 DISALLOW_COPY_AND_ASSIGN(DescWrapper); | 194 DISALLOW_COPY_AND_ASSIGN(DescWrapper); |
191 }; | 195 }; |
192 | 196 |
193 } // namespace nacl | 197 } // namespace nacl |
194 | 198 |
195 #endif // NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_WRAPPER_H_ | 199 #endif // NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_WRAPPER_H_ |
OLD | NEW |