core-lightning/devtools/print_wire.h

39 lines
1.9 KiB
C
Raw Normal View History

#ifndef LIGHTNING_DEVTOOLS_PRINT_WIRE_H
#define LIGHTNING_DEVTOOLS_PRINT_WIRE_H
#include <bitcoin/preimage.h>
#include <bitcoin/tx.h>
devtools/decodemsg: decode node_announcement.addresses $ ./devtools/decodemsg 01014bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e97fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab1300005b3315de0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c035180266e4e3838ae383b3e382bbe383b3e382b92031e69daf000000000000000000000000004d010102030404d202000000000000000000000000000000002607039216a8b803f3acd758aa260704e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607 Before: WIRE_NODE_ANNOUNCEMENT: signature=304402204bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e902207fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab13 features=[] timestamp=1530074590 node_id=0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518 rgb_color=[0266e4] alias=[ナンセンス 1杯 e3838ae383b3e382bbe383b3e382b92031e69daf000000000000000000000000 ] addresses=[010102030404d202000000000000000000000000000000002607039216a8b803f3acd758aa260704e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607] After: WIRE_NODE_ANNOUNCEMENT: signature=304402204bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e902207fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab13 features=[] timestamp=1530074590 node_id=0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518 rgb_color=[0266e4] alias=[ナンセンス 1杯 e3838ae383b3e382bbe383b3e382b92031e69daf000000000000000000000000 ] addresses=[ 1.2.3.4:1234 [::]:9735 silkroad6ownowfk.onion:9735 4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion:9735 ] Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-28 03:34:47 +02:00
#include <common/wireaddr.h>
#include <wire/peer_wire.h>
#include <wire/onion_wire.h>
struct tlv_print_record_type {
u64 type;
void (*print)(const char *tlv_name, const u8 **cursor, size_t *plen);
};
typedef u64 bigsize;
#define printwire_bigsize printwire_u64
void printwire_u8(const char *fieldname, const u8 *v);
void printwire_u16(const char *fieldname, const u16 *v);
void printwire_u32(const char *fieldname, const u32 *v);
void printwire_u64(const char *fieldname, const u64 *v);
void printwire_u8_array(const char *fieldname, const u8 **cursor, size_t *plen, size_t len);
void printwire_tlvs(const char *tlv_name, const u8 **cursor, size_t *plen,
const struct tlv_print_record_type types[], size_t num_types);
void printwire_bitcoin_blkid(const char *fieldname, const struct bitcoin_blkid *bitcoin_blkid);
void printwire_bitcoin_txid(const char *fieldname, const struct bitcoin_txid *bitcoin_txid);
void printwire_channel_id(const char *fieldname, const struct channel_id *channel_id);
void printwire_amount_sat(const char *fieldname, const struct amount_sat *sat);
void printwire_amount_msat(const char *fieldname, const struct amount_msat *msat);
void printwire_preimage(const char *fieldname, const struct preimage *preimage);
void printwire_pubkey(const char *fieldname, const struct pubkey *pubkey);
void printwire_node_id(const char *fieldname, const struct node_id *id);
void printwire_secp256k1_ecdsa_signature(const char *fieldname, const secp256k1_ecdsa_signature *);
void printwire_sha256(const char *fieldname, const struct sha256 *sha256);
void printwire_secret(const char *fieldname, const struct secret *secret);
void printwire_short_channel_id(const char *fieldname, const struct short_channel_id *short_channel_id);
#endif /* LIGHTNING_DEVTOOLS_PRINT_WIRE_H */