From f9fd802147d40b1aa3e0407c0bcfb567fbf4e07b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 20 Nov 2018 12:16:32 +1030 Subject: [PATCH] jsonrpc: make struct json_connection definition private. Signed-off-by: Rusty Russell --- lightningd/jsonrpc.c | 29 +++++++++++++++++++++++++++++ lightningd/jsonrpc.h | 33 ++------------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lightningd/jsonrpc.c b/lightningd/jsonrpc.c index cd746a370..825bc1514 100644 --- a/lightningd/jsonrpc.c +++ b/lightningd/jsonrpc.c @@ -31,6 +31,35 @@ #include #include +struct json_connection { + /* The global state */ + struct lightningd *ld; + + /* This io_conn (and our owner!) */ + struct io_conn *conn; + + /* Logging for this json connection. */ + struct log *log; + + /* The buffer (required to interpret tokens). */ + char *buffer; + + /* Internal state: */ + /* How much is already filled. */ + size_t used; + /* How much has just been filled. */ + size_t len_read; + + /* We've been told to stop. */ + bool stop; + + /* Current command. */ + struct command *command; + + /* Our json_stream */ + struct json_stream *js; +}; + /* jcon and cmd have separate lifetimes: we detach them on either destruction */ static void destroy_jcon(struct json_connection *jcon) { diff --git a/lightningd/jsonrpc.h b/lightningd/jsonrpc.h index d73b978d0..c8f06f463 100644 --- a/lightningd/jsonrpc.h +++ b/lightningd/jsonrpc.h @@ -16,8 +16,8 @@ enum command_mode { CMD_USAGE }; -/* Context for a command (from JSON, but might outlive the connection!) - * You can allocate off this for temporary objects. */ +/* Context for a command (from JSON, but might outlive the connection!). */ +/* FIXME: move definition into jsonrpc.c */ struct command { /* The global state */ struct lightningd *ld; @@ -38,35 +38,6 @@ struct command { bool have_json_stream; }; -struct json_connection { - /* The global state */ - struct lightningd *ld; - - /* This io_conn (and our owner!) */ - struct io_conn *conn; - - /* Logging for this json connection. */ - struct log *log; - - /* The buffer (required to interpret tokens). */ - char *buffer; - - /* Internal state: */ - /* How much is already filled. */ - size_t used; - /* How much has just been filled. */ - size_t len_read; - - /* We've been told to stop. */ - bool stop; - - /* Current command. */ - struct command *command; - - /* Our json_stream */ - struct json_stream *js; -}; - struct json_command { const char *name; void (*dispatch)(struct command *,