ldns(3)
π ldns β the ldns(3) girlies' guide to wire β host conversion π
okay bestie so this is the ldns(3) manual page, from the Library Functions Manual, and it's literally the "we're going from wire format to host type" chapter. no cap. four functions, one vibe: take those raw bytes off the network and turn them into actual grown-up structs. slay. π¦
β¨ NAME β¨
ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf, ldns_wire2dname β convert from wire format to host type. that's the whole assignment, and they ate. π
β¨ SYNOPSIS β¨
#include <stdint.h>
#include <stdbool.h>
#include <ldns/ldns.h>
ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max,
size_t *pos, ldns_pkt_section section);
ldns_status ldns_wire2pkt(ldns_pkt **packet, const uint8_t *data, size_t
len);
ldns_status ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max,
size_t *pos);
ldns_status ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire,
size_t max, size_t *pos);
like, that's the whole incantation. include the headers, call the function, get a struct back. periodt. π
β¨ DESCRIPTION β¨
okay so here's the tea on each one of these babies. β
π ldns_wire2rr()
ldns_wire2rr() converts the data on the uint8_t bytearray (in wire format) to a DNS resource record. this function will initialize and allocate memory space for the rr structure. the length of the wiredata of this rr is added to the *pos value. β¨
rr: pointer to the structure to hold the rdata valuewire: pointer to the buffer with the datamax: the length of the data buffer (in bytes)pos: the position of therrin the buffer (ie. the number of bytes from the start of the buffer)section: the section in the packet therris meant for- Returns
LDNS_STATUS_OKif everything succeeds, error otherwise
π ldns_wire2pkt()
ldns_wire2pkt() converts the data on the uint8_t bytearray (in wire format) to a DNS packet. this function will initialize and allocate memory space for the packet structure. π«Ά
packet: pointer to the structure to hold the packetdata: pointer to the buffer with the datalen: the length of the data buffer (in bytes)- Returns
LDNS_STATUS_OKif everything succeeds, error otherwise
π ldns_wire2rdf()
ldns_wire2rdf() converts the data on the uint8_t bytearray (in wire format) to DNS rdata fields, and adds them to the list of rdfs of the given rr. this function will initialize and allocate memory space for the dname structures. the length of the wiredata of these rdfs is added to the *pos value. π§
all rdfs belonging to the RR are read; the rr should have no rdfs yet. an error is returned if the format cannot be parsed. (so like, don't hand it a half-filled rr, bestie, it will simply not cope π)
rr: pointer to theldns_rrstructure to hold the rdata valuewire: pointer to the buffer with the datamax: the length of the data buffer (in bytes)pos: the position of the rdf in the buffer (ie. the number of bytes from the start of the buffer)- Returns
LDNS_STATUS_OKif everything succeeds, error otherwise
π ldns_wire2dname()
ldns_wire2dname() converts the data on the uint8_t bytearray (in wire format) to a DNS dname rdata field. this function will initialize and allocate memory space for the dname structure. the length of the wiredata of this rdf is added to the *pos value. π
dname: pointer to the structure to hold the rdata valuewire: pointer to the buffer with the datamax: the length of the data buffer (in bytes)pos: the position of the rdf in the buffer (ie. the number of bytes from the start of the buffer)- Returns
LDNS_STATUS_OKif everything succeeds, error otherwise
β¨ 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. not me asking you to file an issueβ¦ okay yes it's me, file the issue, it's giving responsible. π
β¨ 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 literally none, bestie, zero, nada. π
β¨ SEE ALSO β¨
ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire, ldns_dname2wire β the reverse girlies, the ones going the other way. π₯
and perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. iykyk, the classic literature. π
β¨ REMARKS β¨
this manpage was automatically generated from the ldns source code. so nobody hand-wrote the boring bits, we just gave them a glow-up. π
and that's the whole page, bestie β <rainbow>30 May 2006, ldns(3)` πΈ mwah, go convert some wire format, you're doing amazing. πβ¨
π¦ 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