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 ldns_rdf glow-up guide ✨

okay bestie, so this is the ldns library functions manual, and today's episode is all about ldns_rdf β€” making them, copying them, destroying them, and showing them off. πŸ’… the functions we're covering: ldns_rdf_new, ldns_rdf_clone, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_free, ldns_rdf_deep_free, and ldns_rdf_print. that's the whole squad. 🫢


🌸 SYNOPSIS 🌸

so first things first, you gotta bring the headers in:

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

#include <ldns/ldns.h>

and here's every single signature, verbatim, no cap:

ldns_rdf* ldns_rdf_new(ldns_rdf_type type, size_t size, void *data);

ldns_rdf* ldns_rdf_clone(const ldns_rdf *rd);

ldns_rdf* ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const
void *data);

ldns_rdf* ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str);

ldns_status ldns_rdf_new_frm_fp(ldns_rdf **r, ldns_rdf_type type, FILE
*fp);

void ldns_rdf_free(ldns_rdf *rd);

void ldns_rdf_deep_free(ldns_rdf *rd);

void ldns_rdf_print(FILE *output, const ldns_rdf *rdf);

πŸ’– DESCRIPTION πŸ’–

this is the main character section, let's go function by function. πŸŽ€

ldns_rdf_new()

allocates a new rdf structure and fills it. but listen β€” this function DOES NOT copy the contents from the buffer, unlike ldns_rdf_new_frm_data(). that's the whole plot twist, remember it. 😭

  • type β€” type of the rdf
  • size β€” size of the buffer
  • data β€” pointer to the buffer to be copied

Returns the new rdf structure or NULL on failure.

ldns_rdf_clone()

clones a rdf structure. the data is copied. it's giving photocopy machine energy. πŸ¦‹

  • rd β€” rdf to be copied

Returns a new rdf structure.

ldns_rdf_new_frm_data()

allocates a new rdf structure and fills it. this one _does_ copy the contents from the buffer, unlike ldns_rdf_new(). the two are literally opposites, iykyk. πŸ’€

  • type β€” type of the rdf
  • size β€” size of the buffer
  • data β€” pointer to the buffer to be copied

Returns the new rdf structure or NULL on failure.

ldns_rdf_new_frm_str()

creates a new rdf from a string. string in, rdf out, slay. ✨

  • type β€” type to use
  • str β€” string to use

Returns ldns_rdf* or NULL in case of an error.

ldns_rdf_new_frm_fp()

creates a new rdf from a file containing a string. very "reading the assignment off the file" of it. πŸ“–

  • r β€” the new rdf
  • type β€” type to use
  • fp β€” the file pointer to use

Returns LDNS_STATUS_OK or the error.

ldns_rdf_free()

frees a rdf structure, leaving the data pointer intact. it's a shallow goodbye, not a deep one. πŸ™ˆ

  • rd β€” the pointer to be freed

Returns void.

ldns_rdf_deep_free()

frees a rdf structure _and_ frees the data. so this one goes all the way. rdf should be created with _new_frm_data β€” remember that, because if you didn't make it that way, that's a whole situation. πŸ‘‘

  • rd β€” the rdf structure to be freed

Returns void.

ldns_rdf_print()

prints the data in the rdata field to the given file stream (in presentation format). the rdf's little red-carpet moment. 🌈

  • output β€” the file stream to print to
  • rdf β€” the rdata field to print

Returns void.


πŸ‘‘ AUTHOR πŸ‘‘

the ldns team at NLnet Labs. iconic behaviour, honestly.


😭 REPORTING BUGS 😭

please report bugs to dns-team@nlnetlabs.nl or on GitHub at https://github.com/NLnetLabs/ldns/issues. besties, tell them everything, they want to know. 🫢


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. fr fr, none. zero. don't come for them. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹


πŸ’… REMARKS πŸ’…

This manpage was automatically generated from the ldns source code. not me getting a whole page written about me by a robot, we love a hands-off queen. ⭐


and that's the tea, bestie β€” this little love letter came from the 30 May 2006 release of the ldns(3) manual. go forth and rdf responsibly. πŸ’–πŸŒΈβœ¨