core-lightning/lightningd/peer_control.h
Rusty Russell fd258fe495 lightningd: wire up opening daemon.
Now we can actually open a channel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-24 16:22:56 +10:30

54 lines
1.3 KiB
C

#ifndef LIGHTNING_LIGHTNINGD_PEER_CONTROL_H
#define LIGHTNING_LIGHTNINGD_PEER_CONTROL_H
#include "config.h"
#include <ccan/compiler/compiler.h>
#include <daemon/netaddr.h>
#include <stdbool.h>
struct crypto_state;
struct peer {
struct lightningd *ld;
/* Unique ID (works before we know their pubkey) */
u64 unique_id;
/* Inside ld->peers. */
struct list_node list;
/* What stage is this in? NULL during first creation. */
struct subdaemon *owner;
/* What's happening (doubles as error return for connect_cmd) */
const char *condition;
/* History */
struct log_book *log_book;
struct log *log;
/* ID of peer (NULL before initial handshake). */
struct pubkey *id;
/* Our fd to the peer (-1 when we don't have it). */
int fd;
/* Where we connected to, or it connected from. */
struct netaddr netaddr;
/* HSM connection for this peer. */
int hsmfd;
/* Json command which made us connect (if any) */
struct command *connect_cmd;
};
struct peer *peer_by_unique_id(struct lightningd *ld, u64 unique_id);
struct peer *peer_by_id(struct lightningd *ld, const struct pubkey *id);
void peer_accept_open(struct peer *peer,
const struct crypto_state *cs, const u8 *msg);
PRINTF_FMT(2,3) void peer_set_condition(struct peer *peer, const char *fmt, ...);
void setup_listeners(struct lightningd *ld);
#endif /* LIGHTNING_LIGHTNINGD_PEER_CONTROL_H */