summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-04-24 14:45:20 -0700
committerWilliam A. Kennington III <wak@google.com>2019-04-29 12:06:35 -0700
commite15e53eb5b3e8b279504710b5759fdfdd32bb128 (patch)
tree306f0ea70df5f16d4eccb0f9bcdb8cd17a09e95e /include
parente2aec26caacdc65711a96ce3b6dbaa5ea526fc1f (diff)
downloadphosphor-host-ipmid-e15e53eb5b3e8b279504710b5759fdfdd32bb128.tar.gz
phosphor-host-ipmid-e15e53eb5b3e8b279504710b5759fdfdd32bb128.zip
message/pack: Allow packing payloads
Some IPMI handlers need the ability to support variable return types. The easiest way to do that is to be able to return payloads and pack them into the final payload. Change-Id: I5098a1ab0998ada712096929eae40a3c88a6dea0 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/ipmid/message/pack.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index 388bf2f..598e650 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -280,6 +280,22 @@ struct PackSingle<std::variant<T...>>
}
};
+/** @brief Specialization of PackSingle for Payload */
+template <>
+struct PackSingle<Payload>
+{
+ static int op(Payload& p, const Payload& t)
+ {
+ if (p.bitCount != 0 || t.bitCount != 0)
+ {
+ return 1;
+ }
+ p.raw.reserve(p.raw.size() + t.raw.size());
+ p.raw.insert(p.raw.end(), t.raw.begin(), t.raw.end());
+ return 0;
+ }
+};
+
} // namespace details
} // namespace message
OpenPOWER on IntegriCloud