OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_POLICY_LOW_LEVEL_H__ | 5 #ifndef SANDBOX_SRC_POLICY_LOW_LEVEL_H__ |
6 #define SANDBOX_SRC_POLICY_LOW_LEVEL_H__ | 6 #define SANDBOX_SRC_POLICY_LOW_LEVEL_H__ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/strings/string16.h" |
11 #include "sandbox/win/src/ipc_tags.h" | 12 #include "sandbox/win/src/ipc_tags.h" |
12 #include "sandbox/win/src/policy_engine_params.h" | 13 #include "sandbox/win/src/policy_engine_params.h" |
13 #include "sandbox/win/src/policy_engine_opcodes.h" | 14 #include "sandbox/win/src/policy_engine_opcodes.h" |
14 | 15 |
15 // Low level policy classes. | 16 // Low level policy classes. |
16 // Built on top of the PolicyOpcode and OpcodeFatory, the low level policy | 17 // Built on top of the PolicyOpcode and OpcodeFatory, the low level policy |
17 // provides a way to define rules on strings and numbers but it is unaware | 18 // provides a way to define rules on strings and numbers but it is unaware |
18 // of Windows specific details or how the Interceptions must be set up. | 19 // of Windows specific details or how the Interceptions must be set up. |
19 // To use these classes you construct one or more rules and add them to the | 20 // To use these classes you construct one or more rules and add them to the |
20 // LowLevelPolicy object like this: | 21 // LowLevelPolicy object like this: |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // the last opcode (the action opcode). Returns false if this operation fails. | 157 // the last opcode (the action opcode). Returns false if this operation fails. |
157 bool Done(); | 158 bool Done(); |
158 | 159 |
159 private: | 160 private: |
160 void operator=(const PolicyRule&); | 161 void operator=(const PolicyRule&); |
161 // Called in a loop from AddStringMatch to generate the required string | 162 // Called in a loop from AddStringMatch to generate the required string |
162 // match opcodes. rule_type, match_opts and parameter are the same as | 163 // match opcodes. rule_type, match_opts and parameter are the same as |
163 // in AddStringMatch. | 164 // in AddStringMatch. |
164 bool GenStringOpcode(RuleType rule_type, StringMatchOptions match_opts, | 165 bool GenStringOpcode(RuleType rule_type, StringMatchOptions match_opts, |
165 uint16 parameter, int state, bool last_call, | 166 uint16 parameter, int state, bool last_call, |
166 int* skip_count, std::wstring* fragment); | 167 int* skip_count, base::string16* fragment); |
167 | 168 |
168 // Loop over all generated opcodes and copy them to increasing memory | 169 // Loop over all generated opcodes and copy them to increasing memory |
169 // addresses from opcode_start and copy the extra data (strings usually) into | 170 // addresses from opcode_start and copy the extra data (strings usually) into |
170 // decreasing addresses from data_start. Extra data is only present in the | 171 // decreasing addresses from data_start. Extra data is only present in the |
171 // string evaluation opcodes. | 172 // string evaluation opcodes. |
172 bool RebindCopy(PolicyOpcode* opcode_start, size_t opcode_size, | 173 bool RebindCopy(PolicyOpcode* opcode_start, size_t opcode_size, |
173 char* data_start, size_t* data_size) const; | 174 char* data_start, size_t* data_size) const; |
174 PolicyBuffer* buffer_; | 175 PolicyBuffer* buffer_; |
175 OpcodeFactory* opcode_factory_; | 176 OpcodeFactory* opcode_factory_; |
176 EvalResult action_; | 177 EvalResult action_; |
177 bool done_; | 178 bool done_; |
178 }; | 179 }; |
179 | 180 |
180 } // namespace sandbox | 181 } // namespace sandbox |
181 | 182 |
182 #endif // SANDBOX_SRC_POLICY_LOW_LEVEL_H__ | 183 #endif // SANDBOX_SRC_POLICY_LOW_LEVEL_H__ |
OLD | NEW |