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