blob: 32c7f37f0893f03ab0df6cdc3afc0e2f8db17ae1 [file] [log] [blame]
Ken Turneredb93932018-02-14 05:27:31 +11001// Copyright 2018 The Chromium OS 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 ML_DAEMON_H_
6#define ML_DAEMON_H_
7
8#include <brillo/daemons/daemon.h>
9#include <dbus/exported_object.h>
10
11namespace dbus {
12class MethodCall;
13} // namespace dbus
14
15namespace ml {
16
17class Daemon : public brillo::Daemon {
18 public:
19 Daemon();
20 ~Daemon() override;
21
22 protected:
23 int OnInit() override;
24
25 private:
26 // This function initializes the D-Bus service. The primary function of the
27 // D-Bus interface is to receive a FD from the Chrome process so that we can
28 // bootstrap a Mojo IPC channel. Since we should expect requests for client
29 // registration to occur as soon as the D-Bus channel is up, this
30 // initialization should be the last thing that happens in Daemon::OnInit().
31 void InitDBus();
32
33 // Handles BootstrapMojoConnection D-Bus method calls.
34 void BootstrapMojoConnection(
35 dbus::MethodCall* method_call,
36 dbus::ExportedObject::ResponseSender response_sender);
37
38 DISALLOW_COPY_AND_ASSIGN(Daemon);
39};
40
41} // namespace ml
42
43#endif // ML_DAEMON_H_