-
Notifications
You must be signed in to change notification settings - Fork 984
Expand file tree
/
Copy pathdev_disconnect.h
More file actions
42 lines (34 loc) · 1.32 KB
/
dev_disconnect.h
File metadata and controls
42 lines (34 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef LIGHTNING_COMMON_DEV_DISCONNECT_H
#define LIGHTNING_COMMON_DEV_DISCONNECT_H
#include "config.h"
#include <stdbool.h>
struct node_id;
enum dev_disconnect_out {
/* Do nothing. */
DEV_DISCONNECT_OUT_NORMAL = '=',
/* Close connection before sending packet. */
DEV_DISCONNECT_OUT_BEFORE = '-',
/* Close connection after sending packet. */
DEV_DISCONNECT_OUT_AFTER = '+',
/* Drop message (don't send to peer) */
DEV_DISCONNECT_OUT_DROP = '$',
/* Swallow all writes from now on, and do no more reads. */
DEV_DISCONNECT_OUT_BLACKHOLE = '0',
/* Don't use connection after sending packet, but don't close. */
DEV_DISCONNECT_OUT_DISABLE_AFTER = 'x',
};
/* Force a close fd before or after a certain packet type */
enum dev_disconnect_out dev_disconnect_out(const struct node_id *id, int pkt_type);
enum dev_disconnect_in {
/* Do nothing. */
DEV_DISCONNECT_IN_NORMAL = '=',
/* Close connection after receiving packet. */
DEV_DISCONNECT_IN_AFTER_RECV = '<',
};
/* Force a close fd after receiving a certain packet type */
enum dev_disconnect_in dev_disconnect_in(const struct node_id *id, int pkt_type);
/* Make next write on fd fail as if they'd disconnected. */
void dev_sabotage_fd(int fd, bool close_fd);
/* For debug code to set in daemon. */
void dev_disconnect_init(int fd);
#endif /* LIGHTNING_COMMON_DEV_DISCONNECT_H */