mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 16:44:20 +01:00
daemon/packets.h: create from prototypes which were in state.h.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -67,6 +67,7 @@ DAEMON_HEADERS := \
|
|||||||
daemon/netaddr.h \
|
daemon/netaddr.h \
|
||||||
daemon/onion.h \
|
daemon/onion.h \
|
||||||
daemon/opt_time.h \
|
daemon/opt_time.h \
|
||||||
|
daemon/packets.h \
|
||||||
daemon/pay.h \
|
daemon/pay.h \
|
||||||
daemon/payment.h \
|
daemon/payment.h \
|
||||||
daemon/peer.h \
|
daemon/peer.h \
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "lightningd.h"
|
#include "lightningd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "names.h"
|
#include "names.h"
|
||||||
|
#include "packets.h"
|
||||||
#include "peer.h"
|
#include "peer.h"
|
||||||
#include "protobuf_convert.h"
|
#include "protobuf_convert.h"
|
||||||
#include "secrets.h"
|
#include "secrets.h"
|
||||||
|
|||||||
62
daemon/packets.h
Normal file
62
daemon/packets.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#ifndef LIGHTNING_DAEMON_PACKETS_H
|
||||||
|
#define LIGHTNING_DAEMON_PACKETS_H
|
||||||
|
#include "config.h"
|
||||||
|
#include "lightning.pb-c.h"
|
||||||
|
|
||||||
|
struct peer;
|
||||||
|
struct htlc;
|
||||||
|
struct sha256;
|
||||||
|
struct bitcoin_signature;
|
||||||
|
struct commit_info;
|
||||||
|
|
||||||
|
/* Inform peer have an unexpected packet. */
|
||||||
|
void peer_unexpected_pkt(struct peer *peer, const Pkt *pkt);
|
||||||
|
|
||||||
|
/* Send various kinds of packets */
|
||||||
|
void queue_pkt_open(struct peer *peer, OpenChannel__AnchorOffer anchor);
|
||||||
|
void queue_pkt_anchor(struct peer *peer);
|
||||||
|
void queue_pkt_open_commit_sig(struct peer *peer);
|
||||||
|
void queue_pkt_open_complete(struct peer *peer);
|
||||||
|
void queue_pkt_htlc_add(struct peer *peer, struct htlc *htlc);
|
||||||
|
void queue_pkt_htlc_fulfill(struct peer *peer, struct htlc *htlc);
|
||||||
|
void queue_pkt_htlc_fail(struct peer *peer, struct htlc *htlc);
|
||||||
|
void queue_pkt_commit(struct peer *peer);
|
||||||
|
void queue_pkt_revocation(struct peer *peer,
|
||||||
|
const struct sha256 *preimage,
|
||||||
|
const struct sha256 *next_hash);
|
||||||
|
void queue_pkt_close_clearing(struct peer *peer);
|
||||||
|
void queue_pkt_close_signature(struct peer *peer);
|
||||||
|
|
||||||
|
Pkt *pkt_err(struct peer *peer, const char *msg, ...);
|
||||||
|
void queue_pkt_err(struct peer *peer, Pkt *err);
|
||||||
|
Pkt *pkt_err_unexpected(struct peer *peer, const Pkt *pkt);
|
||||||
|
|
||||||
|
/* Process various packets: return an error packet on failure. */
|
||||||
|
Pkt *accept_pkt_open(struct peer *peer, const Pkt *pkt,
|
||||||
|
struct sha256 *revocation_hash,
|
||||||
|
struct sha256 *next_revocation_hash);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_anchor(struct peer *peer, const Pkt *pkt);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_open_commit_sig(struct peer *peer, const Pkt *pkt,
|
||||||
|
struct bitcoin_signature **sig);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_open_complete(struct peer *peer, const Pkt *pkt);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_htlc_add(struct peer *peer, const Pkt *pkt, struct htlc **h);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_htlc_fail(struct peer *peer, const Pkt *pkt, struct htlc **h);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_htlc_fulfill(struct peer *peer, const Pkt *pkt, struct htlc **h);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_update_accept(struct peer *peer, const Pkt *pkt);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_commit(struct peer *peer, const Pkt *pkt,
|
||||||
|
struct bitcoin_signature *sig);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_revocation(struct peer *peer, const Pkt *pkt,
|
||||||
|
struct commit_info *ci);
|
||||||
|
|
||||||
|
Pkt *accept_pkt_close_clearing(struct peer *peer, const Pkt *pkt);
|
||||||
|
|
||||||
|
#endif /* LIGHTNING_DAEMON_PACKETS_H */
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "names.h"
|
#include "names.h"
|
||||||
#include "onion.h"
|
#include "onion.h"
|
||||||
|
#include "packets.h"
|
||||||
#include "pay.h"
|
#include "pay.h"
|
||||||
#include "payment.h"
|
#include "payment.h"
|
||||||
#include "peer.h"
|
#include "peer.h"
|
||||||
|
|||||||
1
state.c
1
state.c
@@ -1,6 +1,7 @@
|
|||||||
#include <ccan/build_assert/build_assert.h>
|
#include <ccan/build_assert/build_assert.h>
|
||||||
#include <daemon/lightningd.h>
|
#include <daemon/lightningd.h>
|
||||||
#include <daemon/log.h>
|
#include <daemon/log.h>
|
||||||
|
#include <daemon/packets.h>
|
||||||
#include <daemon/peer.h>
|
#include <daemon/peer.h>
|
||||||
#include <daemon/secrets.h>
|
#include <daemon/secrets.h>
|
||||||
#include <names.h>
|
#include <names.h>
|
||||||
|
|||||||
53
state.h
53
state.h
@@ -91,59 +91,6 @@ static inline bool input_is(enum state_input a, enum state_input b)
|
|||||||
return a == b;
|
return a == b;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rval;
|
|
||||||
|
|
||||||
/* Inform peer have an unexpected packet. */
|
|
||||||
void peer_unexpected_pkt(struct peer *peer, const Pkt *pkt);
|
|
||||||
|
|
||||||
/* Send various kinds of packets */
|
|
||||||
void queue_pkt_open(struct peer *peer, OpenChannel__AnchorOffer anchor);
|
|
||||||
void queue_pkt_anchor(struct peer *peer);
|
|
||||||
void queue_pkt_open_commit_sig(struct peer *peer);
|
|
||||||
void queue_pkt_open_complete(struct peer *peer);
|
|
||||||
void queue_pkt_htlc_add(struct peer *peer, struct htlc *htlc);
|
|
||||||
void queue_pkt_htlc_fulfill(struct peer *peer, struct htlc *htlc);
|
|
||||||
void queue_pkt_htlc_fail(struct peer *peer, struct htlc *htlc);
|
|
||||||
void queue_pkt_commit(struct peer *peer);
|
|
||||||
void queue_pkt_revocation(struct peer *peer,
|
|
||||||
const struct sha256 *preimage,
|
|
||||||
const struct sha256 *next_hash);
|
|
||||||
void queue_pkt_close_clearing(struct peer *peer);
|
|
||||||
void queue_pkt_close_signature(struct peer *peer);
|
|
||||||
|
|
||||||
Pkt *pkt_err(struct peer *peer, const char *msg, ...);
|
|
||||||
void queue_pkt_err(struct peer *peer, Pkt *err);
|
|
||||||
Pkt *pkt_err_unexpected(struct peer *peer, const Pkt *pkt);
|
|
||||||
|
|
||||||
/* Process various packets: return an error packet on failure. */
|
|
||||||
Pkt *accept_pkt_open(struct peer *peer, const Pkt *pkt,
|
|
||||||
struct sha256 *revocation_hash,
|
|
||||||
struct sha256 *next_revocation_hash);
|
|
||||||
|
|
||||||
|
|
||||||
Pkt *accept_pkt_anchor(struct peer *peer, const Pkt *pkt);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_open_commit_sig(struct peer *peer, const Pkt *pkt,
|
|
||||||
struct bitcoin_signature **sig);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_open_complete(struct peer *peer, const Pkt *pkt);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_htlc_add(struct peer *peer, const Pkt *pkt, struct htlc **h);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_htlc_fail(struct peer *peer, const Pkt *pkt, struct htlc **h);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_htlc_fulfill(struct peer *peer, const Pkt *pkt, struct htlc **h);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_update_accept(struct peer *peer, const Pkt *pkt);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_commit(struct peer *peer, const Pkt *pkt,
|
|
||||||
struct bitcoin_signature *sig);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_revocation(struct peer *peer, const Pkt *pkt,
|
|
||||||
struct commit_info *ci);
|
|
||||||
|
|
||||||
Pkt *accept_pkt_close_clearing(struct peer *peer, const Pkt *pkt);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* peer_watch_anchor: create a watch for the anchor transaction.
|
* peer_watch_anchor: create a watch for the anchor transaction.
|
||||||
* @peer: the state data for this peer.
|
* @peer: the state data for this peer.
|
||||||
|
|||||||
Reference in New Issue
Block a user