forked from openbmc/pldm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdbus_impl_requester.hpp
60 lines (49 loc) · 1.65 KB
/
dbus_impl_requester.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include "instance_id.hpp"
#include "xyz/openbmc_project/PLDM/Requester/server.hpp"
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
#include <map>
namespace pldm
{
namespace dbus_api
{
using RequesterIntf = sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::PLDM::server::Requester>;
/** @class Requester
* @brief OpenBMC PLDM.Requester implementation.
* @details A concrete implementation for the
* xyz.openbmc_project.PLDM.Requester DBus APIs.
*/
class Requester : public RequesterIntf
{
public:
Requester() = delete;
Requester(const Requester&) = delete;
Requester& operator=(const Requester&) = delete;
Requester(Requester&&) = delete;
Requester& operator=(Requester&&) = delete;
virtual ~Requester() = default;
/** @brief Constructor to put object onto bus at a dbus path.
* @param[in] bus - Bus to attach to.
* @param[in] path - Path to attach at.
*/
Requester(sdbusplus::bus::bus& bus, const std::string& path) :
RequesterIntf(bus, path.c_str()){};
/** @brief Implementation for RequesterIntf.GetInstanceId */
uint8_t getInstanceId(uint8_t eid) override;
/** @brief Mark an instance id as unused
* @param[in] eid - MCTP eid to which this instance id belongs
* @param[in] instanceId - PLDM instance id to be freed
* @note will throw std::out_of_range if instanceId > 31
*/
void markFree(uint8_t eid, uint8_t instanceId)
{
ids[eid].markFree(instanceId);
}
private:
/** @brief EID to PLDM Instance ID map */
std::map<uint8_t, InstanceId> ids;
};
} // namespace dbus_api
} // namespace pldm