Skip to content

Commit

Permalink
plugin/libplugin: API for C plugins.
Browse files Browse the repository at this point in the history
Doesn't do logging yet.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Jan 17, 2019
1 parent ed356da commit de4043a
Show file tree
Hide file tree
Showing 7 changed files with 712 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ include lightningd/Makefile
include cli/Makefile
include doc/Makefile
include devtools/Makefile
include plugins/Makefile

# Git doesn't maintain timestamps, so we only regen if git says we should.
CHANGED_FROM_GIT = [ x"`git log $@ | head -n1`" != x"`git log $< | head -n1`" -o x"`git diff $<`" != x"" ]
Expand Down
4 changes: 2 additions & 2 deletions common/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ void daemon_shutdown(void)
wally_cleanup(0);
}

void daemon_maybe_debug(int argc, char *argv[])
void daemon_maybe_debug(char *argv[])
{
#if DEVELOPER
for (int i = 1; i < argc; i++) {
for (int i = 1; argv[i]; i++) {
if (!streq(argv[i], "--debugger"))
continue;

Expand Down
2 changes: 1 addition & 1 deletion common/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int daemon_poll(struct pollfd *fds, nfds_t nfds, int timeout);
void daemon_shutdown(void);

/* Kick in a debugger if they set --debugger */
void daemon_maybe_debug(int argc, char *argv[]);
void daemon_maybe_debug(char *argv[]);

struct backtrace_state *backtrace_state;

Expand Down
2 changes: 1 addition & 1 deletion common/subdaemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void subdaemon_setup(int argc, char *argv[])
logging_io = true;
}

daemon_maybe_debug(argc, argv);
daemon_maybe_debug(argv);

#if DEVELOPER
for (int i = 1; i < argc; i++) {
Expand Down
37 changes: 37 additions & 0 deletions plugins/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PLUGIN_LIB_SRC := plugins/libplugin.c
PLUGIN_LIB_HEADER := plugins/libplugin.h
PLUGIN_LIB_OBJS := $(PLUGIN_LIB_SRC:.c=.o)

PLUGIN_COMMON_OBJS := \
bitcoin/chainparams.o \
bitcoin/pubkey.o \
bitcoin/pullpush.o \
bitcoin/script.o \
bitcoin/shadouble.o \
bitcoin/short_channel_id.o \
bitcoin/signature.o \
bitcoin/tx.o \
bitcoin/varint.o \
common/bech32.o \
common/bech32_util.o \
common/bolt11.o \
common/daemon.o \
common/hash_u5.o \
common/json.o \
common/json_escaped.o \
common/json_tok.o \
common/memleak.o \
common/param.o \
common/type_to_string.o \
common/utils.o \
common/version.o \
wire/fromwire.o \
wire/towire.o

# Make sure these depend on everything.
ALL_OBJS += $(PLUGIN_LIB_OBJS)

clean: plugin-clean

plugin-clean:
$(RM) $(PLUGIN_LIB_OBJS)
Loading

0 comments on commit de4043a

Please sign in to comment.