ldns(3)

πŸ“¦
version 1.9.2 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– ldns β€” the library functions manual, bestie edition πŸ’–

okay so this is ldns(3), the manual for the ldns library. it's giving "DNS but make it a C library", and honestly? iconic. we're talking about conversion functions today β€” the ones that take your nice cozy structs and yeet them into raw wireformat bytes. let's get into it πŸ¦‹


✨ NAME ✨

ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire β€” conversion functions πŸ’…


✨ SYNOPSIS ✨

#include <stdint.h>
#include <stdbool.h>

#include <ldns/ldns.h>

ldns_status ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int section,
size_t *size);

ldns_status ldns_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t
*size);

ldns_status ldns_rdf2wire(uint8_t **dest, const ldns_rdf *rdf, size_t
*size);

like yes bestie, three functions, one vibe: turn stuff into wireformat. no cap. πŸŽ€


✨ DESCRIPTION ✨

🩷 ldns_rr2wire()

it allocates an array of uint8_t at dest, and puts the wireformat of the given rr in that array. the result_size value contains the length of the array, if it succeeds, and 0 otherwise β€” and in that sad little failure case, the function also returns NULL. 😭

if the section argument is LDNS_SECTION_QUESTION, data like ttl and rdata are not put into the result. periodt.

  • dest β€” pointer to the array of bytes to be created
  • rr β€” the rr to convert
  • section β€” the rr section, determines how the rr is written
  • size β€” the size of the converted result

🩷 ldns_pkt2wire()

it allocates an array of uint8_t at dest, and puts the wireformat of the given packet in that array. the result_size value contains the length of the array, if it succeeds, and 0 otherwise β€” and again, in that case the function also returns NULL. 🫢

  • dest β€” pointer to the array of bytes to be created
  • p β€” the packet to convert
  • size β€” the size of the converted result

🩷 ldns_rdf2wire()

it allocates an array of uint8_t at dest, and puts the wireformat of the given rdf in that array. the result_size value contains the length of the array, if it succeeds, and 0 otherwise β€” yep, and in that case the function also returns NULL. πŸ’€

  • dest β€” pointer to the array of bytes to be created
  • rdf β€” the rdata field to convert
  • size β€” the size of the converted result
lowkey the pattern here is: allocate, convert, and if it flops you get 0 size + NULL. check your return values, bestie, i'm begging πŸ™ˆ

✨ AUTHOR ✨

the ldns team at NLnet Labs. πŸ‘‘


✨ REPORTING BUGS ✨

please report bugs to dns-team@nlnetlabs.nl or on GitHub at https://github.com/NLnetLabs/ldns/issues πŸ›


Copyright (c) 2004 - 2006 NLnet Labs.

licensed under the BSD License. there is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ⚠️


✨ SEE ALSO ✨

ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf. and perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. 🌈


✨ REMARKS ✨

this manpage was automatically generated from the ldns source code. πŸ€–


okay bestie that's the whole page, mwah πŸ’‹ this lil beauty is from the ldns(3) manual, dated 30 May 2006 β€” yes she's vintage, yes she still slays. go convert some bytes, you've got this πŸŽ€πŸ’–βœ¨