blob: eff77f00e3790df3425c41b5e24aaa9ae2a278ba [file] [log] [blame]
// Copyright (c) 2012 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.
#ifndef TPMD_H
#define TPMD_H
#include "adaptors/org.chromium.tpmd.h"
#include "adaptors/org.chromium.tpmd.nvram.h"
namespace tpmd {
class Nvram;
class Tpmd : public org::chromium::tpmd_adaptor,
public org::chromium::tpmd::nvram_adaptor,
public DBus::ObjectAdaptor,
public DBus::IntrospectableAdaptor,
public DBus::PropertiesAdaptor {
public:
Tpmd(DBus::Connection* connection, DBus::BusDispatcher* dispatcher);
virtual ~Tpmd();
virtual bool Init();
virtual void Run();
typedef std::map<std::string, DBus::Variant> VariantMap;
typedef std::vector<uint8_t> Bytes;
// DBus interface: org.chromium.tpmd
virtual DBus::Message Encrypt(const DBus::CallMessage& call,
const Bytes& plaintext);
virtual DBus::Message Decrypt(const DBus::CallMessage& call,
const Bytes& ciphertext);
virtual DBus::Message GetStatus(const DBus::CallMessage& call);
// DBus interface: org.chromium.tpmd.nvram
virtual DBus::Message Allocate(const DBus::CallMessage& call,
const uint32_t& slot, const uint32_t& size,
const VariantMap& opts);
virtual DBus::Message Free(const DBus::CallMessage& call,
const uint32_t& slot);
virtual DBus::Message Write(const DBus::CallMessage& call,
const uint32_t& slot, const Bytes& bytes);
virtual DBus::Message Read(const DBus::CallMessage& call,
const uint32_t& slot);
virtual DBus::Message IsDefined(const DBus::CallMessage& call,
const uint32_t& slot);
virtual DBus::Message IsLocked(const DBus::CallMessage& call,
const uint32_t& slot);
virtual DBus::Message Size(const DBus::CallMessage& call,
const uint32_t& slot);
private:
DBus::Connection* dbus_;
DBus::BusDispatcher* dispatcher_;
Nvram* nvram_;
};
} // namespace tpmd
#endif // !TPMD_H