2022-01-11 02:13:59 +01:00
|
|
|
#ifndef LIGHTNING_LIGHTNINGD_PEER_FD_H
|
|
|
|
#define LIGHTNING_LIGHTNINGD_PEER_FD_H
|
|
|
|
#include "config.h"
|
|
|
|
#include <ccan/tal/tal.h>
|
|
|
|
|
2022-01-29 04:33:05 +01:00
|
|
|
/* Tal wrapper for fd connecting subd to connectd */
|
2022-01-11 02:13:59 +01:00
|
|
|
struct peer_fd {
|
|
|
|
/* If not -1, closed on freeing */
|
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
2022-01-29 04:33:05 +01:00
|
|
|
/* Allocate a new per-peer state and add destructor to close fd if set. */
|
|
|
|
struct peer_fd *new_peer_fd(const tal_t *ctx, int peer_fd);
|
2022-01-11 02:13:59 +01:00
|
|
|
|
2022-01-29 04:33:05 +01:00
|
|
|
/* Array version of above: tal_count(fds) must be 1 */
|
|
|
|
struct peer_fd *new_peer_fd_arr(const tal_t *ctx, const int *fd);
|
2022-01-11 02:13:59 +01:00
|
|
|
|
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_PEER_FD_H */
|