Ken Turner | edb9393 | 2018-02-14 05:27:31 +1100 | [diff] [blame] | 1 | // 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 | |
| 11 | namespace dbus { |
| 12 | class MethodCall; |
| 13 | } // namespace dbus |
| 14 | |
| 15 | namespace ml { |
| 16 | |
| 17 | class 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_ |