|
@ -4,7 +4,15 @@ |
|
|
void fromwire_gossip_getnodes_entry(const tal_t *ctx, const u8 **pptr, size_t *max, struct gossip_getnodes_entry *entry) |
|
|
void fromwire_gossip_getnodes_entry(const tal_t *ctx, const u8 **pptr, size_t *max, struct gossip_getnodes_entry *entry) |
|
|
{ |
|
|
{ |
|
|
u8 hostnamelen; |
|
|
u8 hostnamelen; |
|
|
|
|
|
u8 numaddresses, i; |
|
|
fromwire_pubkey(pptr, max, &entry->nodeid); |
|
|
fromwire_pubkey(pptr, max, &entry->nodeid); |
|
|
|
|
|
numaddresses = fromwire_u8(pptr, max); |
|
|
|
|
|
|
|
|
|
|
|
entry->addresses = tal_arr(ctx, struct ipaddr, numaddresses); |
|
|
|
|
|
for (i=0; i<numaddresses; i++) { |
|
|
|
|
|
fromwire_ipaddr(pptr, max, entry->addresses); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
hostnamelen = fromwire_u8(pptr, max); |
|
|
hostnamelen = fromwire_u8(pptr, max); |
|
|
entry->hostname = tal_arr(ctx, char, hostnamelen); |
|
|
entry->hostname = tal_arr(ctx, char, hostnamelen); |
|
|
fromwire_u8_array(pptr, max, (u8*)entry->hostname, hostnamelen); |
|
|
fromwire_u8_array(pptr, max, (u8*)entry->hostname, hostnamelen); |
|
@ -13,7 +21,14 @@ void fromwire_gossip_getnodes_entry(const tal_t *ctx, const u8 **pptr, size_t *m |
|
|
void towire_gossip_getnodes_entry(u8 **pptr, const struct gossip_getnodes_entry *entry) |
|
|
void towire_gossip_getnodes_entry(u8 **pptr, const struct gossip_getnodes_entry *entry) |
|
|
{ |
|
|
{ |
|
|
u8 hostnamelen; |
|
|
u8 hostnamelen; |
|
|
|
|
|
u8 i, numaddresses = tal_count(entry->addresses); |
|
|
towire_pubkey(pptr, &entry->nodeid); |
|
|
towire_pubkey(pptr, &entry->nodeid); |
|
|
|
|
|
towire_u8(pptr, numaddresses); |
|
|
|
|
|
|
|
|
|
|
|
for (i=0; i<numaddresses; i++) { |
|
|
|
|
|
towire_ipaddr(pptr, &entry->addresses[i]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (entry->hostname) { |
|
|
if (entry->hostname) { |
|
|
hostnamelen = strlen(entry->hostname); |
|
|
hostnamelen = strlen(entry->hostname); |
|
|
towire_u8(pptr, hostnamelen); |
|
|
towire_u8(pptr, hostnamelen); |
|
|