MCPcopy Create free account
hub / github.com/ElementsProject/lightning / handle_custommsg

Function handle_custommsg

plugins/commando.c:570–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568}
569
570static struct command_result *handle_custommsg(struct command *cmd,
571 const char *buf,
572 const jsmntok_t *params)
573{
574 struct node_id peer;
575 const u8 *msg;
576 size_t len;
577 enum commando_msgtype mtype;
578 u64 idnum;
579
580 json_to_node_id(buf, json_get_member(buf, params, "peer_id"), &peer);
581 msg = json_tok_bin_from_hex(cmd, buf,
582 json_get_member(buf, params, "payload"));
583
584 len = tal_bytelen(msg);
585 mtype = fromwire_u16(&msg, &len);
586 idnum = fromwire_u64(&msg, &len);
587
588 if (msg) {
589 switch (mtype) {
590 case COMMANDO_MSG_CMD_CONTINUES:
591 case COMMANDO_MSG_CMD_TERM:
592 return handle_incmd(cmd, &peer, idnum, msg, len,
593 mtype == COMMANDO_MSG_CMD_TERM);
594 case COMMANDO_MSG_REPLY_CONTINUES:
595 case COMMANDO_MSG_REPLY_TERM:
596 handle_reply(&peer, idnum, msg, len,
597 mtype == COMMANDO_MSG_REPLY_TERM);
598 break;
599 }
600 }
601
602 return command_hook_success(cmd);
603}
604
605static u64 custommsg_types[] = {
606 COMMANDO_MSG_CMD_CONTINUES,

Callers

nothing calls this directly

Calls 9

json_get_memberFunction · 0.85
tal_bytelenFunction · 0.85
handle_incmdFunction · 0.85
handle_replyFunction · 0.85
command_hook_successFunction · 0.70
json_to_node_idFunction · 0.50
json_tok_bin_from_hexFunction · 0.50
fromwire_u16Function · 0.50
fromwire_u64Function · 0.50

Tested by

no test coverage detected