mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
common/json_stream: support filtering don't print fields not allowed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <ccan/time/time.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/jsonrpc_errors.h>
|
||||
#include <common/utils.h>
|
||||
|
||||
struct command;
|
||||
struct io_conn;
|
||||
@@ -48,6 +49,9 @@ struct json_stream {
|
||||
void *reader_arg;
|
||||
size_t len_read;
|
||||
|
||||
/* If non-NULL, reflects the current filter position */
|
||||
struct json_filter *filter;
|
||||
|
||||
/* Where to log I/O */
|
||||
struct log *log;
|
||||
};
|
||||
@@ -78,6 +82,14 @@ struct json_stream *json_stream_dup(const tal_t *ctx,
|
||||
struct json_stream *original,
|
||||
struct log *log);
|
||||
|
||||
/* Attach a filter. Usually this works at the result level: you don't
|
||||
* want to filter out id, etc! */
|
||||
void json_stream_attach_filter(struct json_stream *js,
|
||||
struct json_filter *filter STEALS);
|
||||
|
||||
/* Detach the filter: returns non-NULL string if it was misused. */
|
||||
const char *json_stream_detach_filter(const tal_t *ctx, struct json_stream *js);
|
||||
|
||||
/**
|
||||
* json_stream_close - finished writing to a JSON stream.
|
||||
* @js: the json_stream.
|
||||
|
||||
Reference in New Issue
Block a user