LC_HASHTOADDR(3)

πŸ’– LC_HASHTOADDR(3) πŸ’–

okay so bestie, we're in the Librecast Programmer's Manual today and the page we're reading is lc_hashtoaddr β€” and ngl it's a little one but she's important, so let's get into it ✨


🌸 NAME 🌸

lc_hashtoaddr β€” create IPv6 multicast addr from supplied hash and flags

like. it literally does what it says on the tin. a hash goes in, an address comes out. the way that she's just a converter and she's still the moment?? πŸ’…


πŸ“š LIBRARY πŸ“š

Librecast library (liblibrecast, -llibrecast)


πŸŽ€ SYNOPSIS πŸŽ€

#include <librecast/net.h>

void lc_hashtoaddr(struct in6_addr *addr, unsigned char *hash, size_t hashlen,
                   unsigned char flags);

Compile and link with -llibrecast. 🫢


✨ DESCRIPTION ✨

so the lc_hashtoaddr() function creates and returns an IPv6 multicast address in addr, built from the supplied hash of length hashlen plus your flags. it's giving assembly line but make it networking πŸ’–

the address that lands back in addr is a valid IPv6 multicast address. here's the breakdown, no cap:

  • the first 8 bits are set to 1 ⭐
  • the following 8 bits are set to flags β€” and lowkey important: this should be the valid IPv6 multicast 4-bit flags field as defined in IETF RFC 4291, followed by the 4 bits for multicast scope πŸ‘‘
  • the first 14 bytes of hash are used for the remaining 14 bytes of the address πŸ¦‹

so yeah, 14 + 2 = 16 bytes, a whole IPv6 address, slay πŸŽ€


🫧 RETURN VALUE 🫧

the lc_hashtoaddr () function returns no value. it's a void girlie. she does the work and says nothing. iconic, honestly πŸ’…


πŸ’€ ERRORS πŸ’€

None. not a single one. she simply does not miss ✨


πŸ”₯ SEE ALSO πŸ”₯

(yes bestie, lc_channel_new(3) is listed twice in the original and I am not the one who's gonna touch that. we respect the source material fr fr πŸ™ˆπŸ’œ)


and that's the whole page! short, sweet, absolutely ate. go build some multicast addresses and be the main character of your own network 🌈

LIBRECAST Β· 2023-07-23 Β· LC_HASHTOADDR(3) β€” mwah, love u, bye πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from