Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef SANDBOX_SRC_NAMED_PIPE_POLICY_H__ |
michael@0 | 6 | #define SANDBOX_SRC_NAMED_PIPE_POLICY_H__ |
michael@0 | 7 | |
michael@0 | 8 | #include <string> |
michael@0 | 9 | |
michael@0 | 10 | #include "base/basictypes.h" |
michael@0 | 11 | #include "sandbox/win/src/crosscall_server.h" |
michael@0 | 12 | #include "sandbox/win/src/policy_low_level.h" |
michael@0 | 13 | #include "sandbox/win/src/sandbox_policy.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace sandbox { |
michael@0 | 16 | |
michael@0 | 17 | enum EvalResult; |
michael@0 | 18 | |
michael@0 | 19 | // This class centralizes most of the knowledge related to named pipe creation. |
michael@0 | 20 | class NamedPipePolicy { |
michael@0 | 21 | public: |
michael@0 | 22 | // Creates the required low-level policy rules to evaluate a high-level. |
michael@0 | 23 | // policy rule for named pipe creation |
michael@0 | 24 | // 'name' is the named pipe to be created |
michael@0 | 25 | // 'semantics' is the desired semantics. |
michael@0 | 26 | // 'policy' is the policy generator to which the rules are going to be added. |
michael@0 | 27 | static bool GenerateRules(const wchar_t* name, |
michael@0 | 28 | TargetPolicy::Semantics semantics, |
michael@0 | 29 | LowLevelPolicy* policy); |
michael@0 | 30 | |
michael@0 | 31 | // Processes a 'CreateNamedPipeW()' request from the target. |
michael@0 | 32 | static DWORD CreateNamedPipeAction(EvalResult eval_result, |
michael@0 | 33 | const ClientInfo& client_info, |
michael@0 | 34 | const std::wstring &name, |
michael@0 | 35 | DWORD open_mode, DWORD pipe_mode, |
michael@0 | 36 | DWORD max_instances, |
michael@0 | 37 | DWORD out_buffer_size, |
michael@0 | 38 | DWORD in_buffer_size, |
michael@0 | 39 | DWORD default_timeout, HANDLE* pipe); |
michael@0 | 40 | }; |
michael@0 | 41 | |
michael@0 | 42 | } // namespace sandbox |
michael@0 | 43 | |
michael@0 | 44 | |
michael@0 | 45 | #endif // SANDBOX_SRC_NAMED_PIPE_POLICY_H__ |