core-lightning/daemon/cryptopkt.h
Rusty Russell 0f35441a29 protocol: move ack out of header into specific packets.
This reflects the BOLT #1/#2 protocol change, as suggeted by Pierre.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-11 16:31:43 +09:30

43 lines
1.3 KiB
C

#ifndef LIGHTNING_DAEMON_CRYPTOPKT_H
#define LIGHTNING_DAEMON_CRYPTOPKT_H
#include "config.h"
#include "lightning.pb-c.h"
#include <ccan/io/io.h>
#include <ccan/typesafe_cb/typesafe_cb.h>
struct peer;
struct io_plan *peer_crypto_setup(struct io_conn *conn,
struct peer *peer,
struct io_plan *(*cb)(struct io_conn *,
struct peer *));
/* 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 *));
struct io_plan *peer_write_packet_(struct io_conn *conn,
struct peer *peer,
const Pkt *pkt,
void (*ack_cb)(struct peer *peer, void *),
void *ack_arg,
struct io_plan *(*next)(struct io_conn *,
struct peer *));
#define peer_write_packet(conn, peer, pkt, ack_cb, ack_arg, next) \
peer_write_packet_((conn), (peer), (pkt), \
typesafe_cb_preargs(void, void *, \
(ack_cb), (ack_arg), \
struct peer *), \
(ack_arg), (next))
/* Acknowledgements are contained in some messages: caller must call this */
void peer_process_acks(struct peer *peer, uint64_t ack);
/* Ack counter for outgoing packets. */
uint64_t peer_outgoing_ack(const struct peer *peer);
#endif /* LIGHTNING_DAEMON_CRYPTOPKT_H */