MCPcopy Create free account
hub / github.com/Icinga/icinga2 / DecodeMessage

Method DecodeMessage

lib/remote/jsonrpc.cpp:148–160  ·  view source on GitHub ↗

* Decode message, enforce a Dictionary * * @param message JSON string * * @return Dictionary ptr */

Source from the content-addressed store, hash-verified

146 * @return Dictionary ptr
147 */
148Dictionary::Ptr JsonRpc::DecodeMessage(const String& message)
149{
150 // Use something a bit higher than the default limit to accommodate for data that was accepted by Icinga 2 elsewhere
151 // and gained some additional nesting levels when being wrapped in a JSON-RPC message.
152 Value value = JsonDecode(message, JsonDecodeDefaultDepthLimit + 8);
153
154 if (!value.IsObjectType<Dictionary>()) {
155 BOOST_THROW_EXCEPTION(std::invalid_argument("JSON-RPC"
156 " message must be a dictionary."));
157 }
158
159 return value;
160}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected