blob: 53ca4885305597c541c5d14ea4707a766aaa20b1 [file] [log] [blame]
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdint.h>
#include <memory>
#include <base/macros.h>
#include <base/files/scoped_file.h>
#include <dbus/object_proxy.h>
#include <seneschal/proto_bindings/seneschal_service.pb.h>
namespace vm_tools {
namespace concierge {
// Represents a running shared directory server.
class SeneschalServerProxy final {
// Ask the seneschal service to start a new 9P server. Callers must ensure
// that the |seneschal_proxy| object outlives this object.
static std::unique_ptr<SeneschalServerProxy> CreateVsockProxy(
dbus::ObjectProxy* seneschal_proxy, uint32_t port, uint32_t accept_cid);
static std::unique_ptr<SeneschalServerProxy> CreateFdProxy(
dbus::ObjectProxy* seneschal_proxy, const base::ScopedFD& socket_fd);
uint32_t handle() const { return handle_; }
SeneschalServerProxy(dbus::ObjectProxy* seneschal_proxy, uint32_t handle);
static std::unique_ptr<SeneschalServerProxy> SeneschalCreateProxy(
dbus::ObjectProxy* seneschal_proxy, dbus::MethodCall* method_call);
// Proxy to the seneschal service. Not owned.
dbus::ObjectProxy* seneschal_proxy_;
// The handle for this server.
uint32_t handle_;
} // namespace concierge
} // namespace vm_tools