int fds[];
};
-static const char* json_stream_description(const JsonStream *s) {
- return (s ? s->description : NULL) ?: "json-stream";
-}
-
/* Returns the size of the framing delimiter in bytes: strlen(delimiter) for multi-char
* delimiters (e.g. "\r\n"), or 1 for the default NUL-byte delimiter (delimiter == NULL). */
static size_t json_stream_delimiter_size(const JsonStream *s) {
return now(CLOCK_MONOTONIC);
}
-#define json_stream_log(s, fmt, ...) \
- log_debug("%s: " fmt, json_stream_description(s), ##__VA_ARGS__)
-
-#define json_stream_log_errno(s, error, fmt, ...) \
- log_debug_errno((error), "%s: " fmt, json_stream_description(s), ##__VA_ARGS__)
-
sd_json_variant** json_stream_queue_item_get_data(JsonStreamQueueItem *q) {
assert(q);
return &q->data;
#include "sd-forward.h"
#include "list.h"
+#include "log.h"
/* JsonStream provides the transport layer used by sd-varlink (and other consumers like
* the QMP client) for exchanging length-delimited JSON messages over a pair of file
int json_stream_set_description(JsonStream *s, const char *description);
const char* json_stream_get_description(const JsonStream *s);
+static inline const char* json_stream_description(const JsonStream *s) {
+ return (s ? s->description : NULL) ?: "json-stream";
+}
+
+#define json_stream_log(s, fmt, ...) \
+ log_debug("%s: " fmt, json_stream_description(s), ##__VA_ARGS__)
+
+#define json_stream_log_errno(s, error, fmt, ...) \
+ log_debug_errno((error), "%s: " fmt, json_stream_description(s), ##__VA_ARGS__)
+
/* fd ownership */
int json_stream_attach_fds(JsonStream *s, int input_fd, int output_fd);