dns_ip4_qualify(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ dns_ip4_qualify ✨

okay bestie, pull up a chair, because we're diving into dns_ip4_qualify(3) from the Library Functions Manual and honestly? it's giving main character energy in the DNS world. πŸ’…


🌸 NAME 🌸

dns_ip4_qualify β€” qualify a name and look up IPv4 addresses, bestie. that's the whole vibe. πŸ¦‹


πŸŽ€ SYNTAX πŸŽ€

here's the exact summoning ritual, copy it character for character or it WILL not work:

#include <libowfat/dns.h>

int dns_ip4_qualify(stralloc* out,stralloc* fqdn,
                    const stralloc* udn);

πŸ’– DESCRIPTION πŸ’–

so here's the tea. dns_ip4_qualify takes your name udn and feeds it through qualification, then looks up the 4-byte IP addresses for whatever comes out the other side. it's a two-for-one deal, iconic behavior honestly. πŸ‘‘

when it's done:

  • it drops the fully qualified domain name into fqdn ✨
  • it drops the concatenation of the IP addresses into out πŸ’…
  • and it returns 0 🫢
lowkey important: if the domain does not exist in DNS, or it just has no IP addresses, then out will be empty. no addresses, no drama, just an empty stralloc.

and now the part we don't love 😭 β€” if dns_ip4_qualify has trouble with the qualification, or trouble with DNS, or it runs out of memory, it returns -1 and sets errno appropriately. and get this: it may or may not change out and fqdn. like, it's not promising you anything. so don't go assuming those buffers are pristine, okay? πŸ™ˆ


🧚 QUALIFICATION 🧚

for the full lore on how qualification actually works, go read this:

http://cr.yp.to/djbdns/qualification.html

(not me sending you homework but like... it's right there πŸ“)


🌈 SEE ALSO 🌈

the whole friend group, go say hi:


and that's a wrap on dns_ip4_qualify(3) from the Library Functions Manual πŸ’œ slay, go qualify some names, and remember: no cap, it really does return 0 on success. periodt. πŸ’–βœ¨πŸŽ€