MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / sendMessage

Method sendMessage

edrav2/iprj/libcore/src/core.cpp:367–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365 //
366 //
367 void sendMessage(std::string_view sId, Variant vData) override
368 {
369 TRACE_BEGIN;
370 std::string sMessageId(sId);
371 SubscriberList commands;
372 {
373 collectSubscribers(sMessageId, commands);
374 // Add broadcast commands support (when it is needed)
375 // collectSubscribers("", commands);
376 }
377
378 Variant vParam = Dictionary({ {"messageId", sMessageId} });
379 if (!vData.isNull())
380 vParam.put("data", vData);
381
382 LOGLVL(Detailed, "Process message <" << sMessageId << ">");
383
384 for (auto& pCmd : commands)
385 {
386 try
387 {
388 std::string sInfo = pCmd->getDescriptionString();
389 if (sInfo.empty())
390 LOGLVL(Detailed, "Call command <" <<
391 pCmd->getClassId() << ":" << hex(pCmd->getId()) << ">");
392 else
393 LOGLVL(Detailed, "Call command <" << sInfo << ">");
394 (void)pCmd->execute(vParam);
395 }
396 catch (error::Exception& ex)
397 {
398 ex.log(SL, FMT("Can't process message <" << sMessageId << ">"));
399 }
400 }
401 TRACE_END(FMT("Error during processing a message <" << sId << ">"));
402 }
403
404 //
405 //

Callers 1

sendMessageFunction · 0.80

Calls 10

getClassIdMethod · 0.80
DictionaryClass · 0.50
hexFunction · 0.50
isNullMethod · 0.45
putMethod · 0.45
getDescriptionStringMethod · 0.45
emptyMethod · 0.45
getIdMethod · 0.45
executeMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected