2019-06-03 20:11:25 +02:00
|
|
|
#ifndef LIGHTNING_COMMON_PER_PEER_STATE_H
|
|
|
|
#define LIGHTNING_COMMON_PER_PEER_STATE_H
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <ccan/tal/tal.h>
|
2019-06-03 20:15:25 +02:00
|
|
|
#include <ccan/time/time.h>
|
2019-06-03 20:11:25 +02:00
|
|
|
#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 04:33:05 +01:00
|
|
|
int peer_fd;
|
2019-06-03 20:11:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Allocate a new per-peer state and add destructor to close fds if set;
|
2022-01-29 04:33:05 +01:00
|
|
|
* sets peer_fd to -1. */
|
2022-01-08 14:24:29 +01:00
|
|
|
struct per_peer_state *new_per_peer_state(const tal_t *ctx);
|
2019-06-03 20:11:25 +02:00
|
|
|
|
|
|
|
/* Initialize the fds (must be -1 previous) */
|
2022-01-29 04:33:05 +01:00
|
|
|
void per_peer_state_set_fd(struct per_peer_state *pps, int peer_fd);
|
2019-06-03 20:11:25 +02:00
|
|
|
|
|
|
|
void per_peer_state_fdpass_send(int fd, const struct per_peer_state *pps);
|
|
|
|
|
|
|
|
#endif /* LIGHTNING_COMMON_PER_PEER_STATE_H */
|