| 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_NAMED_PIPE_POLICY_H__ | 5 #ifndef SANDBOX_SRC_NAMED_PIPE_POLICY_H__ |
| 6 #define SANDBOX_SRC_NAMED_PIPE_POLICY_H__ | 6 #define SANDBOX_SRC_NAMED_PIPE_POLICY_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "sandbox/win/src/crosscall_server.h" | 11 #include "sandbox/win/src/crosscall_server.h" |
| 12 #include "sandbox/win/src/policy_low_level.h" | 12 #include "sandbox/win/src/policy_low_level.h" |
| 13 #include "sandbox/win/src/sandbox_policy.h" | 13 #include "sandbox/win/src/sandbox_policy.h" |
| 14 | 14 |
| 15 namespace sandbox { | 15 namespace sandbox { |
| 16 | 16 |
| 17 enum EvalResult; | |
| 18 | |
| 19 // This class centralizes most of the knowledge related to named pipe creation. | 17 // This class centralizes most of the knowledge related to named pipe creation. |
| 20 class NamedPipePolicy { | 18 class NamedPipePolicy { |
| 21 public: | 19 public: |
| 22 // Creates the required low-level policy rules to evaluate a high-level. | 20 // Creates the required low-level policy rules to evaluate a high-level. |
| 23 // policy rule for named pipe creation | 21 // policy rule for named pipe creation |
| 24 // 'name' is the named pipe to be created | 22 // 'name' is the named pipe to be created |
| 25 // 'semantics' is the desired semantics. | 23 // 'semantics' is the desired semantics. |
| 26 // 'policy' is the policy generator to which the rules are going to be added. | 24 // 'policy' is the policy generator to which the rules are going to be added. |
| 27 static bool GenerateRules(const wchar_t* name, | 25 static bool GenerateRules(const wchar_t* name, |
| 28 TargetPolicy::Semantics semantics, | 26 TargetPolicy::Semantics semantics, |
| 29 LowLevelPolicy* policy); | 27 LowLevelPolicy* policy); |
| 30 | 28 |
| 31 // Processes a 'CreateNamedPipeW()' request from the target. | 29 // Processes a 'CreateNamedPipeW()' request from the target. |
| 32 static DWORD CreateNamedPipeAction(EvalResult eval_result, | 30 static DWORD CreateNamedPipeAction(EvalResult eval_result, |
| 33 const ClientInfo& client_info, | 31 const ClientInfo& client_info, |
| 34 const base::string16 &name, | 32 const base::string16 &name, |
| 35 DWORD open_mode, DWORD pipe_mode, | 33 DWORD open_mode, DWORD pipe_mode, |
| 36 DWORD max_instances, | 34 DWORD max_instances, |
| 37 DWORD out_buffer_size, | 35 DWORD out_buffer_size, |
| 38 DWORD in_buffer_size, | 36 DWORD in_buffer_size, |
| 39 DWORD default_timeout, HANDLE* pipe); | 37 DWORD default_timeout, HANDLE* pipe); |
| 40 }; | 38 }; |
| 41 | 39 |
| 42 } // namespace sandbox | 40 } // namespace sandbox |
| 43 | 41 |
| 44 | 42 |
| 45 #endif // SANDBOX_SRC_NAMED_PIPE_POLICY_H__ | 43 #endif // SANDBOX_SRC_NAMED_PIPE_POLICY_H__ |
| OLD | NEW |