2017-08-28 18:06:01 +02:00
|
|
|
#ifndef LIGHTNING_COMMON_PEER_FAILED_H
|
|
|
|
#define LIGHTNING_COMMON_PEER_FAILED_H
|
2017-02-24 06:52:55 +01:00
|
|
|
#include "config.h"
|
|
|
|
#include <ccan/compiler/compiler.h>
|
|
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
|
|
|
|
struct channel_id;
|
2019-06-03 20:11:25 +02:00
|
|
|
struct per_peer_state;
|
2017-02-24 06:52:55 +01:00
|
|
|
|
|
|
|
/**
|
2021-02-02 13:49:01 +01:00
|
|
|
* peer_failed_warn - Send a warning msg and close the connection.
|
2019-06-03 20:11:25 +02:00
|
|
|
* @pps: the per-peer state.
|
2021-02-02 13:49:01 +01:00
|
|
|
* @channel_id: channel with error, or NULL for no particular channel.
|
2018-02-19 02:06:14 +01:00
|
|
|
* @fmt...: format as per status_failed(STATUS_FAIL_PEER_BAD)
|
2017-02-24 06:52:55 +01:00
|
|
|
*/
|
2021-02-02 13:49:01 +01:00
|
|
|
void peer_failed_warn(struct per_peer_state *pps,
|
|
|
|
const struct channel_id *channel_id,
|
|
|
|
const char *fmt, ...)
|
|
|
|
PRINTF_FMT(3,4) NORETURN;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* peer_failed_err - Send a warning msg and close the channel.
|
|
|
|
* @pps: the per-peer state.
|
|
|
|
* @channel_id: channel with error.
|
|
|
|
* @fmt...: format as per status_failed(STATUS_FAIL_PEER_BAD)
|
|
|
|
*/
|
|
|
|
void peer_failed_err(struct per_peer_state *pps,
|
|
|
|
const struct channel_id *channel_id,
|
|
|
|
const char *fmt, ...)
|
2019-06-03 20:11:25 +02:00
|
|
|
PRINTF_FMT(3,4) NORETURN;
|
2018-02-19 02:06:15 +01:00
|
|
|
|
2018-08-02 08:49:55 +02:00
|
|
|
/* We're failing because peer sent us an error message: NULL
|
|
|
|
* channel_id means all channels. */
|
2019-06-03 20:11:25 +02:00
|
|
|
void peer_failed_received_errmsg(struct per_peer_state *pps,
|
2018-02-19 02:06:15 +01:00
|
|
|
const char *desc,
|
2019-12-13 11:16:14 +01:00
|
|
|
const struct channel_id *channel_id,
|
|
|
|
bool soft_error)
|
|
|
|
NORETURN;
|
2018-02-19 02:06:15 +01:00
|
|
|
|
|
|
|
/* I/O error */
|
|
|
|
void peer_failed_connection_lost(void) NORETURN;
|
|
|
|
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_COMMON_PEER_FAILED_H */
|