MDEX_DEL(3)

πŸ’– mdex_del(3) πŸ’–

okay so bestie, welcome to the Librecast Programmer's Manual β€” this is the page for mdex_del, and yes it's giving "tiny function, big feelings". sit down, hydrate, let's go 🫢


✨ NAME ✨

mdex_del β€” delete an entry from a multicast index πŸ—‘οΈ


πŸ“š LIBRARY πŸ“š

Librecast library (liblibrecast, -llibrecast) β€” she's the moment, she's the whole vibe πŸ’…


🌸 SYNOPSIS 🌸

#include <librecast/mdex.h>

int mdex_del(mdex_t *mdex, unsigned char *hash, size_t hashlen);

Compile and link with -llibrecast. no cap, that's literally the whole thing ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

So the mdex_del function deletes an entry from the multicast index mdex, using hash (of length hashlen) as the key. like, that's the girl's whole job πŸ”₯

If no matching entry is found in the index, -1 is returned and errno is set to ENOENT. 😭 (we'll get to that in a sec, don't spiral)

okay here's the actually iconic part: hashlen can be shorter than the full length of the hash stored with mdex_put(3), and it will delete the first entry matching the truncated hash. lowkey genius, highkey useful. This allows us to store the full 32 byte hash in the index, but still match against the truncated hash derived from, say, the 14 bytes of an IPv6 multicast group address. 🌈

not me being obsessed with partial matching… it's literally her main character trait πŸŽ€

πŸ‘‘ RETURN VALUE πŸ‘‘

mdex_put() returns zero on success. πŸ’š On error, -1 is returned, and errno is set to indicate the error.

(yes bestie, the original page really does say mdex_put() right there in the RETURN VALUE section. i'm not fixing it, i'm not touching it, i'm just reporting the news πŸ™ˆ we keep every detail, that's the rule.)

πŸ’€ ERRORS πŸ’€

  • EINVAL β€” Invalid argument. Both mdex and hash are required (not NULL), and hashlen > 0. like, you have to actually give her something to work with, she's not a mind reader πŸ’…
  • ENOENT β€” No entry found matching hash. she looked. she found nothing. it's giving empty. it's giving void. it's giving ENOENT 😭

🌟 SEE ALSO 🌟

mdex_init(3), mdex_free(3), mdex_get(3), mdex_put(3), lc_share(3)

go read those too, they're the rest of the friend group and they all ate πŸ’–


and that's the page!! πŸ¦‹βœ¨ this was the LIBRECAST manual, dated 2023-06-20, and she's filed under MDEX_DEL(3) β€” periodt πŸ’…πŸŒΈ

πŸ“¦ where this page comes from