blob: cd2af8dc7f2f08e6cedeeb0f45f29715f8e75a96 [file] [log] [blame]
Ryan Cairnsea6505f2011-04-10 19:54:53 -07001// Copyright (c) 2011 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 CROS_DISKS_SERVER_IMPL_H__
6#define CROS_DISKS_SERVER_IMPL_H__
7
8#include "cros-disks-server.h"
9#include "disk.h"
10
11#include <string>
12#include <vector>
13
14namespace cros_disks {
15
16// The d-bus server for the cros-disks daemon.
17//
18// Example Usage:
19//
20// DBus::Connection server_conn = DBus::Connection::SystemBus();
21// server_conn.request_name("org.chromium.CrosDisks");
22// CrosDisksServer* server = new(std::nothrow) CrosDisksServer(server_conn);
23//
24// At this point the server should be attached to the main loop.
25//
26class CrosDisksServer : public org::chromium::CrosDisks_adaptor,
27 public DBus::IntrospectableAdaptor,
28 public DBus::ObjectAdaptor {
29 public:
30 CrosDisksServer(DBus::Connection& connection);
31 virtual ~CrosDisksServer();
32
33 // A method for checking if the daemon is running. Always returns true.
34 virtual bool IsAlive(DBus::Error& error); // NOLINT
35
36 // Unmounts a device when invoked.
37 virtual void FilesystemUnmount(const std::vector<std::string>& mountOptions,
38 DBus::Error& error); // NOLINT
39
40 // Mounts a device when invoked.
41 virtual void FilesystemMount(const std::string& nullArgument,
42 const std::vector<std::string>& mountOptions,
43 DBus::Error& error); // NOLINT
44
45 // Returns a description of every disk device attached to the sytem.
46 virtual DBusDisks GetAll(DBus::Error& error); // NOLINT
47};
48} // namespace cros_disks
49
50#endif // CROS_DISKS_SERVER_IMPL_H__