summaryrefslogtreecommitdiffstats
path: root/security/sandbox/chromium/sandbox/win/src/top_level_dispatcher.h
blob: a80ce1ef5d3ad7ae61fccc9189e9fc0ce28974f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SANDBOX_SRC_TOP_LEVEL_DISPATCHER_H__
#define SANDBOX_SRC_TOP_LEVEL_DISPATCHER_H__

#include <memory>

#include "base/macros.h"
#include "sandbox/win/src/crosscall_server.h"
#include "sandbox/win/src/interception.h"
#include "sandbox/win/src/ipc_tags.h"
#include "sandbox/win/src/sandbox_policy_base.h"

namespace sandbox {

// Top level dispatcher which hands requests to the appropriate service
// dispatchers.
class TopLevelDispatcher : public Dispatcher {
 public:
  // |policy| must outlive this class.
  explicit TopLevelDispatcher(PolicyBase* policy);
  ~TopLevelDispatcher() override;

  Dispatcher* OnMessageReady(IPCParams* ipc,
                             CallbackGeneric* callback) override;
  bool SetupService(InterceptionManager* manager, IpcTag service) override;

 private:
  // Test IPC provider.
  bool Ping(IPCInfo* ipc, void* cookie);

  // Returns a dispatcher from ipc_targets_.
  Dispatcher* GetDispatcher(IpcTag ipc_tag);

  PolicyBase* policy_;
  std::unique_ptr<Dispatcher> filesystem_dispatcher_;
  std::unique_ptr<Dispatcher> named_pipe_dispatcher_;
  std::unique_ptr<Dispatcher> thread_process_dispatcher_;
  std::unique_ptr<Dispatcher> sync_dispatcher_;
  std::unique_ptr<Dispatcher> registry_dispatcher_;
  std::unique_ptr<Dispatcher> handle_dispatcher_;
  std::unique_ptr<Dispatcher> process_mitigations_win32k_dispatcher_;
  std::unique_ptr<Dispatcher> signed_dispatcher_;
  std::unique_ptr<Dispatcher> line_break_dispatcher_;
  Dispatcher* ipc_targets_[kMaxIpcTag];

  DISALLOW_COPY_AND_ASSIGN(TopLevelDispatcher);
};

}  // namespace sandbox

#endif  // SANDBOX_SRC_TOP_LEVEL_DISPATCHER_H__