2022-10-17 02:44:39 +02:00
|
|
|
#ifndef LIGHTNING_COMMON_ONION_MESSAGE_PARSE_H
|
|
|
|
#define LIGHTNING_COMMON_ONION_MESSAGE_PARSE_H
|
|
|
|
#include "config.h"
|
|
|
|
#include <bitcoin/privkey.h>
|
|
|
|
#include <common/amount.h>
|
|
|
|
|
|
|
|
struct tlv_onionmsg_tlv;
|
2024-07-10 04:55:49 +02:00
|
|
|
struct sciddir_or_pubkey;
|
2022-10-17 02:44:39 +02:00
|
|
|
struct pubkey;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* onion_message_parse: core routine to check onion_message
|
|
|
|
* @ctx: context to allocate @next_onion_msg or @final_om/@path_id off
|
|
|
|
* @onion_message_packet: Sphinx-encrypted onion
|
2024-10-15 01:24:26 +02:00
|
|
|
* @path_key: Path_Key we were given for @onion_message_packet
|
2022-10-17 02:44:39 +02:00
|
|
|
* @me: my pubkey
|
|
|
|
* @next_onion_msg (out): set if we should forward, otherwise NULL.
|
2024-07-10 04:55:49 +02:00
|
|
|
* @next_node (out): set to node id or scid to fwd to, iff *@next_onion_msg.
|
2022-10-17 02:44:39 +02:00
|
|
|
* @final_om (out): set if we're the final hop, otherwise NULL.
|
|
|
|
* @final_alias (out): our alias (if *@final_om), or our own ID
|
|
|
|
* @final_path_id (out): secret enclosed, if any (iff *@final_om).
|
|
|
|
*
|
2024-07-10 04:52:19 +02:00
|
|
|
* Returns NULL if it was valid, otherwise an error string.
|
2022-10-17 02:44:39 +02:00
|
|
|
*/
|
2024-07-10 04:52:19 +02:00
|
|
|
const char *onion_message_parse(const tal_t *ctx,
|
|
|
|
const u8 *onion_message_packet,
|
2024-10-15 01:24:26 +02:00
|
|
|
const struct pubkey *path_key,
|
2024-07-10 04:52:19 +02:00
|
|
|
const struct pubkey *me,
|
|
|
|
u8 **next_onion_msg,
|
2024-07-10 04:55:49 +02:00
|
|
|
struct sciddir_or_pubkey *next_node,
|
2024-07-10 04:52:19 +02:00
|
|
|
struct tlv_onionmsg_tlv **final_om,
|
|
|
|
struct pubkey *final_alias,
|
|
|
|
struct secret **final_path_id);
|
2022-10-17 02:44:39 +02:00
|
|
|
|
|
|
|
#endif /* LIGHTNING_COMMON_ONION_MESSAGE_PARSE_H */
|