2017-03-19 21:24:12 +01:00
|
|
|
#ifndef LIGHTNING_LIGHTNINGD_STATUS_H
|
|
|
|
#define LIGHTNING_LIGHTNINGD_STATUS_H
|
2017-01-10 05:54:20 +01:00
|
|
|
#include "config.h"
|
|
|
|
#include <ccan/compiler/compiler.h>
|
|
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2017-03-19 21:32:44 +01:00
|
|
|
struct daemon_conn;
|
|
|
|
|
2017-01-10 05:54:20 +01:00
|
|
|
/* Simple status reporting API. */
|
2017-03-19 21:32:44 +01:00
|
|
|
void status_setup_sync(int fd);
|
|
|
|
void status_setup_async(struct daemon_conn *master);
|
2017-01-10 05:54:20 +01:00
|
|
|
|
|
|
|
/* Convenient context, frees up after every status_update/failed */
|
|
|
|
extern const void *trc;
|
|
|
|
|
|
|
|
/* Special status code for tracing messages. */
|
|
|
|
#define STATUS_TRACE 0x7FFF
|
|
|
|
|
|
|
|
/* Failure codes always have high bit set. */
|
|
|
|
#define STATUS_FAIL 0x8000
|
|
|
|
|
|
|
|
/* Send a message (frees the message). */
|
2017-03-19 21:32:44 +01:00
|
|
|
void status_send_sync(const u8 *msg);
|
2017-01-10 05:54:20 +01:00
|
|
|
/* Send a printf-style debugging trace. */
|
|
|
|
void status_trace(const char *fmt, ...) PRINTF_FMT(1,2);
|
|
|
|
/* Send a failure status code with printf-style msg, and exit. */
|
|
|
|
void status_failed(u16 code, const char *fmt, ...) PRINTF_FMT(2,3) NORETURN;
|
|
|
|
|
2017-03-19 21:24:12 +01:00
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_STATUS_H */
|