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_NAMED_PIPE_POLICY_H__ michael@0: #define SANDBOX_SRC_NAMED_PIPE_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/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 named pipe creation. michael@0: class NamedPipePolicy { michael@0: public: michael@0: // Creates the required low-level policy rules to evaluate a high-level. michael@0: // policy rule for named pipe creation michael@0: // 'name' is the named pipe to be created michael@0: // 'semantics' is the desired semantics. michael@0: // 'policy' is the policy generator to which the rules are 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: // Processes a 'CreateNamedPipeW()' request from the target. michael@0: static DWORD CreateNamedPipeAction(EvalResult eval_result, michael@0: const ClientInfo& client_info, michael@0: const std::wstring &name, michael@0: DWORD open_mode, DWORD pipe_mode, michael@0: DWORD max_instances, michael@0: DWORD out_buffer_size, michael@0: DWORD in_buffer_size, michael@0: DWORD default_timeout, HANDLE* pipe); michael@0: }; michael@0: michael@0: } // namespace sandbox michael@0: michael@0: michael@0: #endif // SANDBOX_SRC_NAMED_PIPE_POLICY_H__