ldns(3)
πΈ 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_atldns_buffer_writeldns_buffer_write_string_atldns_buffer_write_stringldns_buffer_write_u8_atldns_buffer_write_u8ldns_buffer_write_u16_atldns_buffer_write_u16ldns_buffer_read_atldns_buffer_readldns_buffer_read_u8_atldns_buffer_read_u8ldns_buffer_read_u16_atldns_buffer_read_u16ldns_buffer_read_u32_atldns_buffer_read_u32ldns_buffer_write_u32ldns_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 bufferat: the position (in number of bytes) to write the data atdata: pointer to the data to write to the buffercount: 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 bufferat: the position in the bufferstr: the string to write
ldns_buffer_write_u8_at() β writes the given byte of data at the given position in the buffer.
buffer: the bufferat: the position in the bufferdata: 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 bufferat: the position in the bufferdata: 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 bufferat: the position in the bufferdata: 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 bufferdata: the data to writecount: 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 bufferstr: the string to write
ldns_buffer_write_u8() β writes the given byte of data at the current position in the buffer.
buffer: the bufferdata: the 8 bits to write
ldns_buffer_write_u16() β writes the given 2 byte integer at the current position in the buffer.
buffer: the bufferdata: the 16 bits to write
ldns_buffer_write_u32() β writes the given 4 byte integer at the current position in the buffer.
buffer: the bufferdata: 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 bufferat: the position in the buffer to startdata: buffer to copy tocount: 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 bufferat: 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 bufferat: 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 bufferat: 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 bufferdata: buffer to copy tocount: 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_atreads take aconst ldns_buffer *but the plain ones take a non-constldns_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 β
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 ππ¦π
π¦ where this page comes from
- alpine 3.22: ldns-doc 1.8.4-r0 Β· BSD-3-Clause
- alpine 3.23: ldns-doc 1.8.4-r1 Β· BSD-3-Clause
- alpine 3.24: ldns-doc 1.8.4-r1 Β· BSD-3-Clause
- arch rolling: ldns 1.9.2-1 Β· custom:BSD
- debian trixie: libldns-dev 1.8.4-2+b1
- fedora 43: ldns-devel 1.8.4-8.fc43 Β· BSD-3-Clause
- fedora 43: ldns-devel 1.8.4-8.fc43 Β· BSD-3-Clause
- fedora 43: ldns-devel 1.9.2-1.fc43 Β· BSD-3-Clause
- fedora 43: ldns-devel 1.9.2-1.fc43 Β· BSD-3-Clause
- fedora 44: ldns-devel 1.9.0-2.fc44 Β· BSD-3-Clause
- fedora 44: ldns-devel 1.9.0-2.fc44 Β· BSD-3-Clause
- fedora 44: ldns-devel 1.9.2-1.fc44 Β· BSD-3-Clause
- fedora 44: ldns-devel 1.9.2-1.fc44 Β· BSD-3-Clause
- nixos 26.05: ldns 1.9.2
- nixpkgs unstable: ldns 1.9.2
- opensuse-leap 16.0: ldns-devel 1.8.4-160000.3.1 Β· BSD-3-Clause
- opensuse-leap 16.0: ldns-devel 1.8.4-160000.3.1 Β· BSD-3-Clause
- opensuse-leap 16.0: ldns-devel 1.8.4-160000.3.1 Β· BSD-3-Clause
- opensuse-leap 16.0: ldns-devel 1.8.4-160000.3.1 Β· BSD-3-Clause
- ubuntu questing: libldns-dev 1.8.4-2build1
- ubuntu resolute: libldns-dev 1.8.4-2build3
- ubuntu stonking: libldns-dev 1.9.2-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms