This commit is contained in:
Robin Müller 2020-06-24 02:02:57 +02:00
parent 7f3607c3d9
commit 6f2bb4125d

View File

@ -8,21 +8,16 @@ void HousekeepingMessage::setHkReportMessage(CommandMessage* message, sid_t sid,
message->setCommand(HK_REPORT); message->setCommand(HK_REPORT);
message->setMessageSize(HK_MESSAGE_SIZE); message->setMessageSize(HK_MESSAGE_SIZE);
setSid(message, sid); setSid(message, sid);
message->setParameter(storeId.raw); setParameter(message, storeId.raw);
} }
void HousekeepingMessage::setHkDiagnosticsMessage(CommandMessage* message, void HousekeepingMessage::setHkDiagnosticsMessage(CommandMessage* message,
sid_t sid, store_address_t storeId) { sid_t sid, store_address_t storeId) {
message->setCommand(DIAGNOSTICS_REPORT); message->setCommand(DIAGNOSTICS_REPORT);
message->setMessageSize(HK_MESSAGE_SIZE);
setSid(message, sid); setSid(message, sid);
setParameter(message, storeId.raw); setParameter(message, storeId.raw);
} }
sid_t HousekeepingMessage::getSid(const CommandMessage* message) {
sid_t sid;
std::memcpy(&sid.raw, message->getData(), sizeof(sid.raw));
return sid;
}
sid_t HousekeepingMessage::getHkReportMessage(const CommandMessage *message, sid_t HousekeepingMessage::getHkReportMessage(const CommandMessage *message,
store_address_t *storeIdToSet) { store_address_t *storeIdToSet) {
@ -32,6 +27,12 @@ sid_t HousekeepingMessage::getHkReportMessage(const CommandMessage *message,
return getSid(message); return getSid(message);
} }
sid_t HousekeepingMessage::getSid(const CommandMessage* message) {
sid_t sid;
std::memcpy(&sid.raw, message->getData(), sizeof(sid.raw));
return sid;
}
void HousekeepingMessage::setSid(CommandMessage *message, sid_t sid) { void HousekeepingMessage::setSid(CommandMessage *message, sid_t sid) {
std::memcpy(message->getData(), &sid.raw, sizeof(sid.raw)); std::memcpy(message->getData(), &sid.raw, sizeof(sid.raw));
} }