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_SYNC_POLICY_H__ | 5 #ifndef SANDBOX_SRC_SYNC_POLICY_H__ |
6 #define SANDBOX_SRC_SYNC_POLICY_H__ | 6 #define SANDBOX_SRC_SYNC_POLICY_H__ |
7 | 7 |
8 #include <stdint.h> | |
9 | |
10 #include <string> | 8 #include <string> |
11 | 9 |
| 10 #include "base/basictypes.h" |
12 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
13 #include "sandbox/win/src/crosscall_server.h" | 12 #include "sandbox/win/src/crosscall_server.h" |
14 #include "sandbox/win/src/nt_internals.h" | 13 #include "sandbox/win/src/nt_internals.h" |
15 #include "sandbox/win/src/policy_low_level.h" | 14 #include "sandbox/win/src/policy_low_level.h" |
16 #include "sandbox/win/src/sandbox_policy.h" | 15 #include "sandbox/win/src/sandbox_policy.h" |
17 | 16 |
18 namespace sandbox { | 17 namespace sandbox { |
19 | 18 |
20 enum EvalResult; | 19 enum EvalResult; |
21 | 20 |
22 // This class centralizes most of the knowledge related to sync policy | 21 // This class centralizes most of the knowledge related to sync policy |
23 class SyncPolicy { | 22 class SyncPolicy { |
24 public: | 23 public: |
25 // Creates the required low-level policy rules to evaluate a high-level | 24 // Creates the required low-level policy rules to evaluate a high-level |
26 // policy rule for sync calls, in particular open or create actions. | 25 // policy rule for sync calls, in particular open or create actions. |
27 // name is the sync object name, semantics is the desired semantics for the | 26 // name is the sync object name, semantics is the desired semantics for the |
28 // open or create and policy is the policy generator to which the rules are | 27 // open or create and policy is the policy generator to which the rules are |
29 // going to be added. | 28 // going to be added. |
30 static bool GenerateRules(const wchar_t* name, | 29 static bool GenerateRules(const wchar_t* name, |
31 TargetPolicy::Semantics semantics, | 30 TargetPolicy::Semantics semantics, |
32 LowLevelPolicy* policy); | 31 LowLevelPolicy* policy); |
33 | 32 |
34 // Performs the desired policy action on a request. | 33 // Performs the desired policy action on a request. |
35 // client_info is the target process that is making the request and | 34 // client_info is the target process that is making the request and |
36 // eval_result is the desired policy action to accomplish. | 35 // eval_result is the desired policy action to accomplish. |
37 static NTSTATUS CreateEventAction(EvalResult eval_result, | 36 static NTSTATUS CreateEventAction(EvalResult eval_result, |
38 const ClientInfo& client_info, | 37 const ClientInfo& client_info, |
39 const base::string16& event_name, | 38 const base::string16 &event_name, |
40 uint32_t event_type, | 39 uint32 event_type, |
41 uint32_t initial_state, | 40 uint32 initial_state, |
42 HANDLE* handle); | 41 HANDLE *handle); |
43 static NTSTATUS OpenEventAction(EvalResult eval_result, | 42 static NTSTATUS OpenEventAction(EvalResult eval_result, |
44 const ClientInfo& client_info, | 43 const ClientInfo& client_info, |
45 const base::string16& event_name, | 44 const base::string16 &event_name, |
46 uint32_t desired_access, | 45 uint32 desired_access, |
47 HANDLE* handle); | 46 HANDLE *handle); |
48 }; | 47 }; |
49 | 48 |
50 } // namespace sandbox | 49 } // namespace sandbox |
51 | 50 |
52 #endif // SANDBOX_SRC_SYNC_POLICY_H__ | 51 #endif // SANDBOX_SRC_SYNC_POLICY_H__ |
OLD | NEW |