ldns(3)
π ldns β buffer limits and pointers π
okay bestie, welcome to ldns(3), the Library Functions Manual page for the ldns buffer squad π«Ά this is the one where we talk about limits, capacity, and all the little pointers that go brr inside your DNS buffer. it's giving very "I know where my bytes live" energy and honestly? iconic.
β¨ NAME β¨
ldns_buffer_limit, ldns_buffer_set_limit, ldns_buffer_capacity, ldns_buffer_set_capacity, ldns_buffer_reserve, ldns_buffer_at, ldns_buffer_begin, ldns_buffer_end, ldns_buffer_current β buffer limits and pointers π
β¨ SYNOPSIS β¨
#include <stdint.h>
#include <stdbool.h>
#include <ldns/ldns.h>
size_t ldns_buffer_limit(const ldns_buffer *buffer);
void ldns_buffer_set_limit(ldns_buffer *buffer, size_t limit);
size_t ldns_buffer_capacity(const ldns_buffer *buffer);
bool ldns_buffer_set_capacity(ldns_buffer *buffer, size_t capacity);
bool ldns_buffer_reserve(ldns_buffer *buffer, size_t amount);
uint8_t * ldns_buffer_at(const ldns_buffer *buffer, size_t at);
uint8_t * ldns_buffer_begin(const ldns_buffer *buffer);
uint8_t * ldns_buffer_end(const ldns_buffer *buffer);
uint8_t * ldns_buffer_current(const ldns_buffer *buffer);
β¨ DESCRIPTION β¨
okay so let's go function by function, no cap. π
ldns_buffer_limit()β returns the max size of the buffer.- buffer: the buffer
- Returns the size
ldns_buffer_set_limit()β changes the buffer's limit. and listen: if the buffer's position is greater than the new limit, the position gets set to the limit. so it's not gonna leave you stranded past the edge, bestie π¦- buffer: the buffer
- limit: the new limit
ldns_buffer_capacity()β returns the number of bytes the buffer can hold.- buffer: the buffer
- Returns the number of bytes
ldns_buffer_set_capacity()β changes the buffer's capacity.
π¨ bestie WARNING: the data is reallocated, so any pointers to the data may become invalid. if you were holding a pointer, it's gone, it's not coming back, mourn it π
The buffer's limit is set to the buffer's new capacity.
- buffer: the buffer
- capacity: the capacity to use
- Returns whether this failed or succeeded
ldns_buffer_reserve()β makes sure BUFFER can contain at least AMOUNT more bytes. the buffer's capacity is increased if necessary usingbuffer_set_capacity().
And the buffer's limit is always set to the (possibly increased) capacity. always. periodt.
- buffer: the buffer
- amount: amount to use
- Returns whether this failed or succeeded
ldns_buffer_at()β returns a pointer to the data at the indicated position. π- buffer: the buffer
- at: position
- Returns the pointer to the data
ldns_buffer_begin()β returns a pointer to the beginning of the buffer (the data at position0). like, the very start, the origin story π«- buffer: the buffer
- Returns the pointer
ldns_buffer_end()β returns a pointer to the end of the buffer (the data at the buffer's limit).- buffer: the buffer
- Returns the pointer
ldns_buffer_current()β returns a pointer to the data at the buffer's current position. main character position energy π- buffer: the buffer
- Returns the pointer
β¨ AUTHOR β¨
The ldns team at NLnet Labs. π«Ά absolute legends, fr fr.
β¨ REPORTING BUGS β¨
Please report bugs to dns-team@nlnetlabs.nl or on GitHub at https://github.com/NLnetLabs/ldns/issues β they want the tea, spill it π
β¨ 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.
like, zero warranty. none. nada. you're on your own bestie π
β¨ SEE ALSO β¨
ldns_buffer. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. go read, iykyk πβ¨
β¨ REMARKS β¨
This manpage was automatically generated from the ldns source code. not me getting generated by a machine and still serving this hard π€π
aaaand that's the whole page bestie, you ate it, you understood buffers, slay ππ
signing off: this was ldns(3), dated 30 May 2006, and yes the manual name is right there in the title so we been knew πβ¨
π¦ 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