| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MAC_POLICY_H_ | 5 #ifndef SANDBOX_MAC_POLICY_H_ |
| 6 #define SANDBOX_MAC_POLICY_H_ | 6 #define SANDBOX_MAC_POLICY_H_ |
| 7 | 7 |
| 8 #include <mach/mach.h> | 8 #include <mach/mach.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // |substitute_port| must be NULL. If result is POLICY_SUBSTITUTE_PORT, then | 35 // |substitute_port| must be NULL. If result is POLICY_SUBSTITUTE_PORT, then |
| 36 // |substitute_port| must not be NULL. | 36 // |substitute_port| must not be NULL. |
| 37 struct SANDBOX_EXPORT Rule { | 37 struct SANDBOX_EXPORT Rule { |
| 38 Rule(); | 38 Rule(); |
| 39 explicit Rule(PolicyDecision result); | 39 explicit Rule(PolicyDecision result); |
| 40 explicit Rule(mach_port_t override_port); | 40 explicit Rule(mach_port_t override_port); |
| 41 | 41 |
| 42 PolicyDecision result; | 42 PolicyDecision result; |
| 43 | 43 |
| 44 // The Rule does not take ownership of this port, but additional send rights | 44 // The Rule does not take ownership of this port, but additional send rights |
| 45 // will be allocated to it before it is sent to a client. | 45 // will be allocated to it before it is sent to a client. This name must |
| 46 // denote a send right that can duplicated with MACH_MSG_TYPE_COPY_SEND. |
| 46 mach_port_t substitute_port; | 47 mach_port_t substitute_port; |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 // A SandboxPolicy maps bootstrap server names to policy Rules. | 50 // A SandboxPolicy maps bootstrap server names to policy Rules. |
| 50 typedef std::map<std::string, Rule> BootstrapSandboxPolicy; | 51 typedef std::map<std::string, Rule> BootstrapSandboxPolicy; |
| 51 | 52 |
| 52 // Checks that a policy is well-formed. | 53 // Checks that a policy is well-formed. |
| 53 SANDBOX_EXPORT bool IsPolicyValid(const BootstrapSandboxPolicy& policy); | 54 SANDBOX_EXPORT bool IsPolicyValid(const BootstrapSandboxPolicy& policy); |
| 54 | 55 |
| 55 } // namespace sandbox | 56 } // namespace sandbox |
| 56 | 57 |
| 57 #endif // SANDBOX_MAC_POLICY_H_ | 58 #endif // SANDBOX_MAC_POLICY_H_ |
| OLD | NEW |