21#include <sys/socket.h>
74 std::optional<Json::Value>
parse(std::string msg) {
76 std::unique_ptr<Json::CharReader> reader(
reader_builder.newCharReader());
77 std::string errorMessage;
78 if (!reader->parse(&*msg.begin(), &*msg.end(), &ret, &errorMessage)) {
79 LOG(
WARNING) <<
"Received invalid JSON object in input channel: "
81 LOG(
INFO) <<
"Invalid JSON: " << msg;
Provides a wrapper around libjson's Reader to additionally log errors.
Definition: request.h:68
~JsonRequestReader()=default
std::optional< Json::Value > parse(std::string msg)
Definition: request.h:74
Json::CharReaderBuilder reader_builder
Definition: request.h:88
JsonRequestReader()=default
#define INFO(x...)
Definition: image.h:29
#define LOG(severity)
Definition: logging.h:223
@ WARNING
Definition: logging.h:91
Definition: alloc_utils.cpp:23
RequestType
Defines operations supported by allocd.
Definition: request.h:34
RequestStatus
Definition: request.h:54
IfaceType
Defines interface types supported by allocd.
Definition: request.h:44