From 92476a84180ad4e60c698d21b6f14c368511ce6f Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 25 Apr 2019 01:32:30 -0700 Subject: message: Support prepending payloads Needed solely so that we can support adding the necessary bits for oem and group commands. We shouldn't be using this anywhere else, which is why it is not generalized to non-payload types. Change-Id: I6573f981fbe68cebb89abcdfb3de5de5d139e1e0 Signed-off-by: William A. Kennington III --- include/ipmid/message.hpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'include/ipmid') diff --git a/include/ipmid/message.hpp b/include/ipmid/message.hpp index 9bc1147..92a0c25 100644 --- a/include/ipmid/message.hpp +++ b/include/ipmid/message.hpp @@ -257,6 +257,27 @@ struct Payload return packRet; } + /** + * @brief Prepends another payload to this one + * + * Avoid using this unless absolutely required since it inserts into the + * front of the response payload. + * + * @param p - The payload to prepend + * + * @retunr int - non-zero on prepend errors + */ + int prepend(const ipmi::message::Payload& p) + { + if (bitCount != 0 || p.bitCount != 0) + { + return 1; + } + raw.reserve(raw.size() + p.raw.size()); + raw.insert(raw.begin(), p.raw.begin(), p.raw.end()); + return 0; + } + /****************************************************************** * Request operations *****************************************************************/ @@ -518,6 +539,21 @@ struct Response return payload.pack(t); } + /** + * @brief Prepends another payload to this one + * + * Avoid using this unless absolutely required since it inserts into the + * front of the response payload. + * + * @param p - The payload to prepend + * + * @retunr int - non-zero on prepend errors + */ + int prepend(const ipmi::message::Payload& p) + { + return payload.prepend(p); + } + Payload payload; Context::ptr ctx; Cc cc; -- cgit v1.2.1