core-lightning/gossipd/handshake.h
Rusty Russell a88ac22711 gossipd: include ccan/io version of handshake code, with tests.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-20 18:31:32 +02:00

48 lines
1.4 KiB
C

#ifndef LIGHTNING_LIGHTNINGD_GOSSIP_HANDSHAKE_H
#define LIGHTNING_LIGHTNINGD_GOSSIP_HANDSHAKE_H
#include "config.h"
#include <ccan/typesafe_cb/typesafe_cb.h>
struct crypto_state;
struct io_conn;
struct pubkey;
#define initiator_handshake(conn, my_id, their_id, cb, cbarg) \
initiator_handshake_((conn), (my_id), (their_id), \
typesafe_cb_preargs(struct io_plan *, void *, \
(cb), (cbarg), \
struct io_conn *, \
const struct pubkey *, \
const struct crypto_state *), \
(cbarg))
struct io_plan *initiator_handshake_(struct io_conn *conn,
const struct pubkey *my_id,
const struct pubkey *their_id,
struct io_plan *(*cb)(struct io_conn *,
const struct pubkey *,
const struct crypto_state *,
void *cbarg),
void *cbarg);
#define responder_handshake(conn, my_id, cb, cbarg) \
responder_handshake_((conn), (my_id), \
typesafe_cb_preargs(struct io_plan *, void *, \
(cb), (cbarg), \
struct io_conn *, \
const struct pubkey *, \
const struct crypto_state *), \
(cbarg))
struct io_plan *responder_handshake_(struct io_conn *conn,
const struct pubkey *my_id,
struct io_plan *(*cb)(struct io_conn *,
const struct pubkey *,
const struct crypto_state *,
void *cbarg),
void *cbarg);
#endif /* LIGHTNING_LIGHTNINGD_GOSSIP_HANDSHAKE_H */