michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef SANDBOX_SRC_SYNC_POLICY_H__ michael@0: #define SANDBOX_SRC_SYNC_POLICY_H__ michael@0: michael@0: #include michael@0: michael@0: #include "base/basictypes.h" michael@0: #include "sandbox/win/src/crosscall_server.h" michael@0: #include "sandbox/win/src/nt_internals.h" michael@0: #include "sandbox/win/src/policy_low_level.h" michael@0: #include "sandbox/win/src/sandbox_policy.h" michael@0: michael@0: namespace sandbox { michael@0: michael@0: enum EvalResult; michael@0: michael@0: // This class centralizes most of the knowledge related to sync policy michael@0: class SyncPolicy { michael@0: public: michael@0: // Creates the required low-level policy rules to evaluate a high-level michael@0: // policy rule for sync calls, in particular open or create actions. michael@0: // name is the sync object name, semantics is the desired semantics for the michael@0: // open or create and policy is the policy generator to which the rules are michael@0: // going to be added. michael@0: static bool GenerateRules(const wchar_t* name, michael@0: TargetPolicy::Semantics semantics, michael@0: LowLevelPolicy* policy); michael@0: michael@0: // Performs the desired policy action on a request. michael@0: // client_info is the target process that is making the request and michael@0: // eval_result is the desired policy action to accomplish. michael@0: static DWORD CreateEventAction(EvalResult eval_result, michael@0: const ClientInfo& client_info, michael@0: const std::wstring &event_name, michael@0: uint32 manual_reset, michael@0: uint32 initial_state, michael@0: HANDLE *handle); michael@0: static DWORD OpenEventAction(EvalResult eval_result, michael@0: const ClientInfo& client_info, michael@0: const std::wstring &event_name, michael@0: uint32 desired_access, michael@0: uint32 inherit_handle, michael@0: HANDLE *handle); michael@0: }; michael@0: michael@0: } // namespace sandbox michael@0: michael@0: #endif // SANDBOX_SRC_SYNC_POLICY_H__