2016-01-21 21:11:48 +01:00
|
|
|
#ifndef LIGHTNING_DAEMON_CRYPTOPKT_H
|
|
|
|
#define LIGHTNING_DAEMON_CRYPTOPKT_H
|
|
|
|
#include "config.h"
|
|
|
|
#include "lightning.pb-c.h"
|
|
|
|
#include <ccan/io/io.h>
|
2016-03-24 02:33:44 +01:00
|
|
|
#include <ccan/typesafe_cb/typesafe_cb.h>
|
2016-01-21 21:11:48 +01:00
|
|
|
|
2016-08-18 06:53:46 +02:00
|
|
|
struct io_data;
|
|
|
|
struct json_connecting;
|
|
|
|
struct lightningd_state;
|
2016-01-21 21:11:48 +01:00
|
|
|
struct peer;
|
|
|
|
|
2016-08-18 06:53:46 +02:00
|
|
|
struct io_plan *peer_crypto_setup_(struct io_conn *conn,
|
|
|
|
struct lightningd_state *dstate,
|
|
|
|
const struct pubkey *id,
|
|
|
|
struct io_plan *(*cb)(struct io_conn *conn,
|
|
|
|
struct lightningd_state *dstate,
|
|
|
|
struct io_data *iod,
|
|
|
|
const struct pubkey *id,
|
|
|
|
void *arg),
|
|
|
|
void *arg);
|
|
|
|
|
|
|
|
#define peer_crypto_setup(conn, dstate, id, cb, arg) \
|
|
|
|
peer_crypto_setup_((conn), (dstate), (id), \
|
|
|
|
typesafe_cb_preargs(struct io_plan *, void *, \
|
|
|
|
(cb), (arg), \
|
|
|
|
struct io_conn *, \
|
|
|
|
struct lightningd_state *, \
|
|
|
|
struct io_data *, \
|
|
|
|
const struct pubkey *), \
|
|
|
|
(arg))
|
2016-01-21 21:11:48 +01:00
|
|
|
|
|
|
|
/* Reads packet into peer->inpkt/peer->inpkt_len */
|
|
|
|
struct io_plan *peer_read_packet(struct io_conn *conn,
|
|
|
|
struct peer *peer,
|
|
|
|
struct io_plan *(*cb)(struct io_conn *,
|
|
|
|
struct peer *));
|
|
|
|
|
2016-05-26 07:55:24 +02:00
|
|
|
struct io_plan *peer_write_packet(struct io_conn *conn,
|
|
|
|
struct peer *peer,
|
|
|
|
const Pkt *pkt,
|
|
|
|
struct io_plan *(*next)(struct io_conn *,
|
|
|
|
struct peer *));
|
2016-01-21 21:11:48 +01:00
|
|
|
#endif /* LIGHTNING_DAEMON_CRYPTOPKT_H */
|