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

Function wireaddr_internal_eq

common/wireaddr.c:583–614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583bool wireaddr_internal_eq(const struct wireaddr_internal *a,
584 const struct wireaddr_internal *b)
585{
586 if (a->itype != b->itype)
587 return false;
588
589 switch (a->itype) {
590 case ADDR_INTERNAL_SOCKNAME:
591 return streq(a->u.sockname, b->u.sockname);
592 case ADDR_INTERNAL_ALLPROTO:
593 return a->u.allproto.is_websocket == b->u.allproto.is_websocket
594 && a->u.allproto.port == b->u.allproto.port;
595 case ADDR_INTERNAL_STATICTOR:
596 if (!memeq(a->u.torservice.blob, sizeof(a->u.torservice.blob),
597 b->u.torservice.blob, sizeof(b->u.torservice.blob)))
598 return false;
599 /* fall thru */
600 case ADDR_INTERNAL_AUTOTOR:
601 if (!wireaddr_eq(&a->u.torservice.address,
602 &b->u.torservice.address))
603 return false;
604 return a->u.torservice.port == b->u.torservice.port;
605 case ADDR_INTERNAL_FORPROXY:
606 if (!streq(a->u.unresolved.name, b->u.unresolved.name))
607 return false;
608 return a->u.unresolved.port == b->u.unresolved.port;
609 case ADDR_INTERNAL_WIREADDR:
610 return a->u.wireaddr.is_websocket == b->u.wireaddr.is_websocket
611 && wireaddr_eq(&a->u.wireaddr.wireaddr, &b->u.wireaddr.wireaddr);
612 }
613 abort();
614}
615
616const char *parse_wireaddr_internal(const tal_t *ctx,
617 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