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

Function wireaddr_internal_eq

common/wireaddr.c:605–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603}
604
605bool wireaddr_internal_eq(const struct wireaddr_internal *a,
606 const struct wireaddr_internal *b)
607{
608 if (a->itype != b->itype)
609 return false;
610
611 switch (a->itype) {
612 case ADDR_INTERNAL_SOCKNAME:
613 return streq(a->u.sockname, b->u.sockname);
614 case ADDR_INTERNAL_ALLPROTO:
615 return a->u.allproto.is_websocket == b->u.allproto.is_websocket
616 && a->u.allproto.port == b->u.allproto.port;
617 case ADDR_INTERNAL_STATICTOR:
618 if (!memeq(a->u.torservice.blob, sizeof(a->u.torservice.blob),
619 b->u.torservice.blob, sizeof(b->u.torservice.blob)))
620 return false;
621 /* fall thru */
622 case ADDR_INTERNAL_AUTOTOR:
623 if (!wireaddr_eq(&a->u.torservice.address,
624 &b->u.torservice.address))
625 return false;
626 return a->u.torservice.port == b->u.torservice.port;
627 case ADDR_INTERNAL_FORPROXY:
628 if (!streq(a->u.unresolved.name, b->u.unresolved.name))
629 return false;
630 return a->u.unresolved.port == b->u.unresolved.port;
631 case ADDR_INTERNAL_WIREADDR:
632 return a->u.wireaddr.is_websocket == b->u.wireaddr.is_websocket
633 && wireaddr_eq(&a->u.wireaddr.wireaddr, &b->u.wireaddr.wireaddr);
634 }
635 abort();
636}
637
638const char *parse_wireaddr_internal(const tal_t *ctx,
639 const char *arg,

Callers 3

addr_inFunction · 0.85
opt_add_addr_withtypeFunction · 0.85
mainFunction · 0.85

Calls 3

memeqFunction · 0.85
wireaddr_eqFunction · 0.85
abortFunction · 0.85

Tested by 1

mainFunction · 0.68