2019-06-04 03:41:25 +09:30
|
|
|
#ifndef LIGHTNING_COMMON_PER_PEER_STATE_H
|
|
|
|
#define LIGHTNING_COMMON_PER_PEER_STATE_H
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <ccan/tal/tal.h>
|
2019-06-04 03:45:25 +09:30
|
|
|
#include <ccan/time/time.h>
|
2019-06-04 03:41:25 +09:30
|
|
|
#include <common/crypto_state.h>
|
|
|
|
|
|
|
|
/* Things we hand between daemons to talk to peers. */
|
|
|
|
struct per_peer_state {
|
|
|
|
/* If not -1, closed on freeing */
|
2022-01-29 14:03:05 +10:30
|
|
|
int peer_fd;
|
2019-06-04 03:41:25 +09:30
|
|
|
};
|
|
|
|
|
|
|
|
/* Allocate a new per-peer state and add destructor to close fds if set;
|
2022-01-29 14:03:05 +10:30
|
|
|
* sets peer_fd to -1. */
|
2022-01-08 23:54:29 +10:30
|
|
|
struct per_peer_state *new_per_peer_state(const tal_t *ctx);
|
2019-06-04 03:41:25 +09:30
|
|
|
|
|
|
|
/* Initialize the fds (must be -1 previous) */
|
2022-01-29 14:03:05 +10:30
|
|
|
void per_peer_state_set_fd(struct per_peer_state *pps, int peer_fd);
|
2019-06-04 03:41:25 +09:30
|
|
|
|
|
|
|
void per_peer_state_fdpass_send(int fd, const struct per_peer_state *pps);
|
|
|
|
|
|
|
|
#endif /* LIGHTNING_COMMON_PER_PEER_STATE_H */
|