ldns(3)

πŸ“¦
version 1.9.2 Β· 2 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

🌸 NAME 🌸

okay bestie, welcome to ldns(3) β€” this is the part of the ldns library that does reading and writing buffers ✨ and it's honestly giving "small but mighty" energy.

it's a whole lil squad of functions, and here they all are, no cap:

  • ldns_buffer_write_at
  • ldns_buffer_write
  • ldns_buffer_write_string_at
  • ldns_buffer_write_string
  • ldns_buffer_write_u8_at
  • ldns_buffer_write_u8
  • ldns_buffer_write_u16_at
  • ldns_buffer_write_u16
  • ldns_buffer_read_at
  • ldns_buffer_read
  • ldns_buffer_read_u8_at
  • ldns_buffer_read_u8
  • ldns_buffer_read_u16_at
  • ldns_buffer_read_u16
  • ldns_buffer_read_u32_at
  • ldns_buffer_read_u32
  • ldns_buffer_write_u32
  • ldns_buffer_write_u32_at

✨ SYNOPSIS ✨

first things first, you gotta pull in the headers, periodt:

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

#include <ldns/ldns.h>

and then here's the whole lineup of signatures, copied exactly so you can't mess it up 🫢

void ldns_buffer_write_at(ldns_buffer *buffer, size_t at, const void
*data, size_t count);

void ldns_buffer_write(ldns_buffer *buffer, const void *data, size_t
count);

void ldns_buffer_write_string_at(ldns_buffer *buffer, size_t at, const
char *str);

void ldns_buffer_write_string(ldns_buffer *buffer, const char *str);

void ldns_buffer_write_u8_at(ldns_buffer *buffer, size_t at, uint8_t
data);

void ldns_buffer_write_u8(ldns_buffer *buffer, uint8_t data);

void ldns_buffer_write_u16_at(ldns_buffer *buffer, size_t at, uint16_t
data);

void ldns_buffer_write_u16(ldns_buffer *buffer, uint16_t data);

void ldns_buffer_read_at(const ldns_buffer *buffer, size_t at, void
*data, size_t count);

void ldns_buffer_read(ldns_buffer *buffer, void *data, size_t count);

uint8_t ldns_buffer_read_u8_at(const ldns_buffer *buffer, size_t at);

uint8_t ldns_buffer_read_u8(ldns_buffer *buffer);

uint16_t ldns_buffer_read_u16_at(ldns_buffer *buffer, size_t at);

uint16_t ldns_buffer_read_u16(ldns_buffer *buffer);

uint32_t ldns_buffer_read_u32_at(ldns_buffer *buffer, size_t at);

uint32_t ldns_buffer_read_u32(ldns_buffer *buffer);

void ldns_buffer_write_u32(ldns_buffer *buffer, uint32_t data);

void ldns_buffer_write_u32_at(ldns_buffer *buffer, size_t at, uint32_t
data);

πŸ’– DESCRIPTION πŸ’–

so the vibe here is: you got a buffer, you got data, and you either put data in or take data out. some functions do it at the current position (the main-character spot), and some do it at a position you pick (the _at girlies πŸ‘‘). let's go one by one, no skips.

πŸ¦‹ the writes (at a position you choose) πŸ¦‹

ldns_buffer_write_at() β€” writes the given data to the buffer at the specified position.

  • buffer: the buffer
  • at: the position (in number of bytes) to write the data at
  • data: pointer to the data to write to the buffer
  • count: the number of bytes of data to write

ldns_buffer_write_string_at() β€” copies the given (null-delimited) string to the specified position at the buffer.

  • buffer: the buffer
  • at: the position in the buffer
  • str: the string to write

ldns_buffer_write_u8_at() β€” writes the given byte of data at the given position in the buffer.

  • buffer: the buffer
  • at: the position in the buffer
  • data: the 8 bits to write

ldns_buffer_write_u16_at() β€” writes the given 2 byte integer at the given position in the buffer.

  • buffer: the buffer
  • at: the position in the buffer
  • data: the 16 bits to write

ldns_buffer_write_u32_at() β€” writes the given 4 byte integer at the given position in the buffer.

  • buffer: the buffer
  • at: the position in the buffer
  • data: the 32 bits to write

πŸŽ€ the writes (at the current position) πŸŽ€

ldns_buffer_write() β€” writes count bytes of data to the current position of the buffer.

  • buffer: the buffer
  • data: the data to write
  • count: the length of the data to write

ldns_buffer_write_string() β€” copies the given (null-delimited) string to the current position at the buffer.

  • buffer: the buffer
  • str: the string to write

ldns_buffer_write_u8() β€” writes the given byte of data at the current position in the buffer.

  • buffer: the buffer
  • data: the 8 bits to write

ldns_buffer_write_u16() β€” writes the given 2 byte integer at the current position in the buffer.

  • buffer: the buffer
  • data: the 16 bits to write

ldns_buffer_write_u32() β€” writes the given 4 byte integer at the current position in the buffer.

  • buffer: the buffer
  • data: the 32 bits to write

🌈 the reads (at a position you choose) 🌈

ldns_buffer_read_at() β€” copies count bytes of data at the given position to the given data-array.

  • buffer: the buffer
  • at: the position in the buffer to start
  • data: buffer to copy to
  • count: the length of the data to copy

ldns_buffer_read_u8_at() β€” returns the byte value at the given position in the buffer.

  • buffer: the buffer
  • at: the position in the buffer
  • Returns 1 byte integer

ldns_buffer_read_u16_at() β€” returns the 2-byte integer value at the given position in the buffer.

  • buffer: the buffer
  • at: position in the buffer
  • Returns 2 byte integer

ldns_buffer_read_u32_at() β€” returns the 4-byte integer value at the given position in the buffer.

  • buffer: the buffer
  • at: position in the buffer
  • Returns 4 byte integer

πŸ’… the reads (at the current position) πŸ’…

ldns_buffer_read() β€” copies count bytes of data at the current position to the given data-array.

  • buffer: the buffer
  • data: buffer to copy to
  • count: the length of the data to copy

ldns_buffer_read_u8() β€” returns the byte value at the current position in the buffer.

  • buffer: the buffer
  • Returns 1 byte integer

ldns_buffer_read_u16() β€” returns the 2-byte integer value at the current position in the buffer.

  • buffer: the buffer
  • Returns 2 byte integer

ldns_buffer_read_u32() β€” returns the 4-byte integer value at the current position in the buffer.

  • buffer: the buffer
  • Returns 4 byte integer
lowkey notice how the _at reads take a const ldns_buffer * but the plain ones take a non-const ldns_buffer * πŸ‘€ that's just how they're declared, bestie, we don't question the ancestors.

🫢 AUTHOR 🫢

The ldns team at NLnet Labs. absolute icons, honestly. πŸ‘‘


😭 REPORTING BUGS 😭

Please report bugs to dns-team@nlnetlabs.nl or on GitHub at https://github.com/NLnetLabs/ldns/issues β€” like, pls tell them, they wanna know, fr fr πŸ™ˆ


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.

no cap, that warranty thing is real and it is loud. πŸ’€

🧚 SEE ALSO 🧚

ldns_buffer. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. go read them, iykyk πŸ“šβœ¨


πŸ“ REMARKS πŸ“

This manpage was automatically generated from the ldns source code. so yes bestie, a robot wrote it, and now a very online teenager rewrote it, and somehow every single fact survived the vibe check 🌸


and that's the whole thing! this page came from the Library Functions Manual, dated 30 May 2006, for ldns(3) β€” slay, bye, drink water πŸ’–πŸ¦‹πŸ’