| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 SANDBOX_SRC_CROSSCALL_SERVER_H_ | 5 #ifndef SANDBOX_SRC_CROSSCALL_SERVER_H_ |
| 6 #define SANDBOX_SRC_CROSSCALL_SERVER_H_ | 6 #define SANDBOX_SRC_CROSSCALL_SERVER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 13 #include "sandbox/win/src/crosscall_params.h" | 14 #include "sandbox/win/src/crosscall_params.h" |
| 14 | 15 |
| 15 // This is the IPC server interface for CrossCall: The IPC for the Sandbox | 16 // This is the IPC server interface for CrossCall: The IPC for the Sandbox |
| 16 // On the server, CrossCall needs two things: | 17 // On the server, CrossCall needs two things: |
| 17 // 1) threads: Or better said, someone to provide them, that is what the | 18 // 1) threads: Or better said, someone to provide them, that is what the |
| 18 // ThreadProvider interface is defined for. These thread(s) are | 19 // ThreadProvider interface is defined for. These thread(s) are |
| 19 // the ones that will actually execute the IPC data retrieval. | 20 // the ones that will actually execute the IPC data retrieval. |
| 20 // | 21 // |
| 21 // 2) a dispatcher: This interface represents the way to route and process | 22 // 2) a dispatcher: This interface represents the way to route and process |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Models the server-side of the original input parameters. | 88 // Models the server-side of the original input parameters. |
| 88 // Provides IPC buffer validation and it is capable of reading the parameters | 89 // Provides IPC buffer validation and it is capable of reading the parameters |
| 89 // out of the IPC buffer. | 90 // out of the IPC buffer. |
| 90 class CrossCallParamsEx : public CrossCallParams { | 91 class CrossCallParamsEx : public CrossCallParams { |
| 91 public: | 92 public: |
| 92 // Factory constructor. Pass an IPCbuffer (and buffer size) that contains a | 93 // Factory constructor. Pass an IPCbuffer (and buffer size) that contains a |
| 93 // pending IPCcall. This constructor will: | 94 // pending IPCcall. This constructor will: |
| 94 // 1) validate the IPC buffer. returns NULL is the IPCbuffer is malformed. | 95 // 1) validate the IPC buffer. returns NULL is the IPCbuffer is malformed. |
| 95 // 2) make a copy of the IPCbuffer (parameter capture) | 96 // 2) make a copy of the IPCbuffer (parameter capture) |
| 96 static CrossCallParamsEx* CreateFromBuffer(void* buffer_base, | 97 static CrossCallParamsEx* CreateFromBuffer(void* buffer_base, |
| 97 uint32 buffer_size, | 98 uint32_t buffer_size, |
| 98 uint32* output_size); | 99 uint32_t* output_size); |
| 99 | 100 |
| 100 // Provides IPCinput parameter raw access: | 101 // Provides IPCinput parameter raw access: |
| 101 // index : the parameter to read; 0 is the first parameter | 102 // index : the parameter to read; 0 is the first parameter |
| 102 // returns NULL if the parameter is non-existent. If it exists it also | 103 // returns NULL if the parameter is non-existent. If it exists it also |
| 103 // returns the size in *size | 104 // returns the size in *size |
| 104 void* GetRawParameter(uint32 index, uint32* size, ArgType* type); | 105 void* GetRawParameter(uint32_t index, uint32_t* size, ArgType* type); |
| 105 | 106 |
| 106 // Gets a parameter that is four bytes in size. | 107 // Gets a parameter that is four bytes in size. |
| 107 // Returns false if the parameter does not exist or is not 32 bits wide. | 108 // Returns false if the parameter does not exist or is not 32 bits wide. |
| 108 bool GetParameter32(uint32 index, uint32* param); | 109 bool GetParameter32(uint32_t index, uint32_t* param); |
| 109 | 110 |
| 110 // Gets a parameter that is void pointer in size. | 111 // Gets a parameter that is void pointer in size. |
| 111 // Returns false if the parameter does not exist or is not void pointer sized. | 112 // Returns false if the parameter does not exist or is not void pointer sized. |
| 112 bool GetParameterVoidPtr(uint32 index, void** param); | 113 bool GetParameterVoidPtr(uint32_t index, void** param); |
| 113 | 114 |
| 114 // Gets a parameter that is a string. Returns false if the parameter does not | 115 // Gets a parameter that is a string. Returns false if the parameter does not |
| 115 // exist. | 116 // exist. |
| 116 bool GetParameterStr(uint32 index, base::string16* string); | 117 bool GetParameterStr(uint32_t index, base::string16* string); |
| 117 | 118 |
| 118 // Gets a parameter that is an in/out buffer. Returns false is the parameter | 119 // Gets a parameter that is an in/out buffer. Returns false is the parameter |
| 119 // does not exist or if the size of the actual parameter is not equal to the | 120 // does not exist or if the size of the actual parameter is not equal to the |
| 120 // expected size. | 121 // expected size. |
| 121 bool GetParameterPtr(uint32 index, uint32 expected_size, void** pointer); | 122 bool GetParameterPtr(uint32_t index, uint32_t expected_size, void** pointer); |
| 122 | 123 |
| 123 // Frees the memory associated with the IPC parameters. | 124 // Frees the memory associated with the IPC parameters. |
| 124 static void operator delete(void* raw_memory) throw(); | 125 static void operator delete(void* raw_memory) throw(); |
| 125 | 126 |
| 126 private: | 127 private: |
| 127 // Only the factory method CreateFromBuffer can construct these objects. | 128 // Only the factory method CreateFromBuffer can construct these objects. |
| 128 CrossCallParamsEx(); | 129 CrossCallParamsEx(); |
| 129 | 130 |
| 130 ParamInfo param_info_[1]; | 131 ParamInfo param_info_[1]; |
| 131 DISALLOW_COPY_AND_ASSIGN(CrossCallParamsEx); | 132 DISALLOW_COPY_AND_ASSIGN(CrossCallParamsEx); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 CallbackGeneric callback; | 217 CallbackGeneric callback; |
| 217 }; | 218 }; |
| 218 | 219 |
| 219 // List of IPC Calls supported by the class. | 220 // List of IPC Calls supported by the class. |
| 220 std::vector<IPCCall> ipc_calls_; | 221 std::vector<IPCCall> ipc_calls_; |
| 221 }; | 222 }; |
| 222 | 223 |
| 223 } // namespace sandbox | 224 } // namespace sandbox |
| 224 | 225 |
| 225 #endif // SANDBOX_SRC_CROSSCALL_SERVER_H_ | 226 #endif // SANDBOX_SRC_CROSSCALL_SERVER_H_ |
| OLD | NEW |