core-lightning/gossipd/handshake.h
Rusty Russell 73cd009a4c gossipd/lightningd: use wireaddr_internal.
This replacement is a little menial, but it explicitly catches all
the places where we allow a local socket.  The actual implementation of
opening a AF_UNIX socket is almost hidden in the patch.

The detection of "valid address" is now more complex:

	p->addr.itype != ADDR_INTERNAL_WIREADDR || p->addr.u.wireaddr.type != ADDR_TYPE_PADDING

But most places we do this, we should audit: I'm pretty sure we can't
get an invalid address any more from gossipd (they may be in db, but
we should fix that too).

Closes: #1323
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-05-07 22:37:28 +02:00

55 lines
1.7 KiB
C

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