1 #ifndef LIGHTNING_COMMON_PEER_FAILED_H
2 #define LIGHTNING_COMMON_PEER_FAILED_H
3 #include "config.h"
4 #include <ccan/compiler/compiler.h>
5 #include <ccan/short_types/short_types.h>
6 
7 struct channel_id;
8 struct per_peer_state;
9 
10 /**
11  * peer_failed_warn - Send a warning msg and close the connection.
12  * @pps: the per-peer state.
13  * @channel_id: channel with error, or NULL for no particular channel.
14  * @fmt...: format as per status_failed(STATUS_FAIL_PEER_BAD)
15  */
16 void peer_failed_warn(struct per_peer_state *pps,
17 		      const struct channel_id *channel_id,
18 		      const char *fmt, ...)
19 	PRINTF_FMT(3,4) NORETURN;
20 
21 /**
22  * peer_failed_err - Send a warning msg and close the channel.
23  * @pps: the per-peer state.
24  * @channel_id: channel with error.
25  * @fmt...: format as per status_failed(STATUS_FAIL_PEER_BAD)
26  */
27 void peer_failed_err(struct per_peer_state *pps,
28 		     const struct channel_id *channel_id,
29 		     const char *fmt, ...)
30 	PRINTF_FMT(3,4) NORETURN;
31 
32 /* We're failing because peer sent us an error message: NULL
33  * channel_id means all channels. */
34 void peer_failed_received_errmsg(struct per_peer_state *pps,
35 				 const char *desc,
36 				 const struct channel_id *channel_id,
37 				 bool soft_error)
38 	NORETURN;
39 
40 /* I/O error */
41 void peer_failed_connection_lost(void) NORETURN;
42 
43 #endif /* LIGHTNING_COMMON_PEER_FAILED_H */
44