ldns(3)
β¨ NAME β¨
okay bestie, gather round π this is ldns(3), the library functions manual, and today's whole vibe is get ldns_pkt attributes. Like, just peeking at a packet. Iconic behaviour tbh.
The full girl squad of functions:
ldns_pkt_id,ldns_pkt_qr,ldns_pkt_aa,ldns_pkt_tc,ldns_pkt_rd,ldns_pkt_cd,ldns_pkt_ra,ldns_pkt_adldns_pkt_get_opcode,ldns_pkt_get_rcodeldns_pkt_qdcount,ldns_pkt_ancount,ldns_pkt_nscount,ldns_pkt_arcountldns_pkt_answerfrom,ldns_pkt_querytime,ldns_pkt_size,ldns_pkt_tsigldns_pkt_question,ldns_pkt_answer,ldns_pkt_authority,ldns_pkt_additionalldns_pkt_get_section_clone,ldns_pkt_rr_list_by_name,ldns_pkt_rr_list_by_type,ldns_pkt_rr_list_by_name_and_type
and what do they do? get ldns_pkt attributes. periodt. π
π«Ά SYNOPSIS π«Ά
first you gotta include the girlies, no cap:
#include <stdint.h>
#include <stdbool.h>
#include <ldns/ldns.h>
ldns_pkt_id();
bool ldns_pkt_qr(const ldns_pkt *p);
bool ldns_pkt_aa(const ldns_pkt *p);
bool ldns_pkt_tc(const ldns_pkt *p);
bool ldns_pkt_rd(const ldns_pkt *p);
bool ldns_pkt_cd(const ldns_pkt *p);
bool ldns_pkt_ra(const ldns_pkt *p);
bool ldns_pkt_ad(const ldns_pkt *p);
ldns_pkt_opcode ldns_pkt_get_opcode(const ldns_pkt *p);
ldns_pkt_rcode ldns_pkt_get_rcode(const ldns_pkt *p);
uint16_t ldns_pkt_qdcount(const ldns_pkt *p);
uint16_t ldns_pkt_ancount(const ldns_pkt *p);
uint16_t ldns_pkt_nscount(const ldns_pkt *p);
uint16_t ldns_pkt_arcount(const ldns_pkt *p);
ldns_rdf* ldns_pkt_answerfrom(const ldns_pkt *p);
uint32_t ldns_pkt_querytime(const ldns_pkt *p);
size_t ldns_pkt_size(const ldns_pkt *p);
ldns_rr* ldns_pkt_tsig(const ldns_pkt *p);
ldns_rr_list* ldns_pkt_question(const ldns_pkt *p);
ldns_rr_list* ldns_pkt_answer(const ldns_pkt *p);
ldns_rr_list* ldns_pkt_authority(const ldns_pkt *p);
ldns_rr_list* ldns_pkt_additional(const ldns_pkt *p);
ldns_rr_list* ldns_pkt_get_section_clone(const ldns_pkt *p,
ldns_pkt_section s);
ldns_rr_list* ldns_pkt_rr_list_by_name(const ldns_pkt *p, const ldns_rdf
*r, ldns_pkt_section s);
ldns_rr_list* ldns_pkt_rr_list_by_type(const ldns_pkt *p, ldns_rr_type
t, ldns_pkt_section s);
ldns_rr_list* ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet,
const ldns_rdf *ownername, ldns_rr_type type, ldns_pkt_section sec);
copy it exactly, don't be out here freestyling the signatures, that's not the assignment π₯
π DESCRIPTION π
so every single one of these is a lil getter that reads something off a packet. here's the whole roster, one by one, nothing skipped, we're thorough like that π
ldns_pkt_id()
ngl the manpage literally lists this one and then says nothing else π no description, no params, no return. it's giving mystery. it's giving enigma. we respect it tho.
ldns_pkt_qr()β read the packet's qr bit πΈ- p: the packet
- Returns value of the bit
ldns_pkt_aa()β read the packet's aa bit β¨- p: the packet
- Returns value of the bit
ldns_pkt_tc()β read the packet's tc bit π¦- p: the packet
- Returns value of the bit
ldns_pkt_rd()β read the packet's rd bit π- p: the packet
- Returns value of the bit
ldns_pkt_cd()β read the packet's cd bit π- p: the packet
- Returns value of the bit
ldns_pkt_ra()β read the packet's ra bit β- p: the packet
- Returns value of the bit
ldns_pkt_ad()β read the packet's ad bit π- p: the packet
- Returns value of the bit
ldns_pkt_get_opcode()β read the packet's code π- p: the packet
- Returns the opcode
ldns_pkt_get_rcode()β return the packet's response code π₯- p: the packet
- Returns the response code
ldns_pkt_qdcount()β return the packet's qd count π- p: the packet
- Returns the qd count
ldns_pkt_ancount()β return the packet's an count πΈ- p: the packet
- Returns the an count
ldns_pkt_nscount()β return the packet's ns count π§- p: the packet
- Returns the ns count
ldns_pkt_arcount()β return the packet's ar count π- p: the packet
- Returns the ar count
ldns_pkt_answerfrom()β return the packet's answerfrom π¦- p: packet
- Returns the name of the server
ldns_pkt_querytime()β return the packet's querytime β- p: the packet
- Returns the querytime
ldns_pkt_size()β return the packet's size in bytes π- p: the packet
- Returns the size
ldns_pkt_tsig()β return the packet's tsig pseudo rr's π- p: the packet
- Returns the tsig rr
ldns_pkt_question()β return the packet's question section π- p: the packet
- Returns the section
ldns_pkt_answer()β return the packet's answer section π- p: the packet
- Returns the section
ldns_pkt_authority()β return the packet's authority section β¨- p: the packet
- Returns the section
ldns_pkt_additional()β return the packet's additional section π- p: the packet
- Returns the section
ldns_pkt_get_section_clone()β return all the rr_list's in the packet. clone the lists, instead of returning pointers π§- p: the packet to look in
- s: what section(s) to return
- Returns
ldns_rr_listwith the rr's orNULLif none were found
bestie listen. this one clones. it does not hand you the pointers. if you were expecting pointers you are in the wrong section, no cap π
ldns_pkt_rr_list_by_name()β return all the rr with a specific name from a packet. optionally specify from which section in the packet π- p: the packet
- r: the name
- s: the packet's section
- Returns a list with the rr's or
NULLif none were found
ldns_pkt_rr_list_by_type()β return all the rr with a specific type from a packet. optionally specify from which section in the packet π₯- p: the packet
- t: the type
- s: the packet's section
- Returns a list with the rr's or
NULLif none were found
ldns_pkt_rr_list_by_name_and_type()β return all the rr with a specific name and type from a packet. optionally specify from which section in the packet π- packet: the packet
- ownername: the name
- type: the type
- sec: the packet's section
- Returns a list with the rr's or
NULLif none were found
and that's the whole list, all 26, accounted for, we do not skip entries in this household π
π AUTHOR π
the ldns team at NLnet Labs. legends, honestly. main character energy fr fr.
π REPORTING BUGS π
found a bug? don't suffer in silence bestie π tell the people:
- email:
dns-team@nlnetlabs.nl - or on GitHub at
https://github.com/NLnetLabs/ldns/issues
π 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. none. it's giving "use at your own risk" and we mean it π
π SEE ALSO π
go read ldns_pkt. and perldoc Net::DNS, plus RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. required reading, bestie, iykyk π
π REMARKS π
heads up: this manpage was automatically generated from the ldns source code. so if it's a little dry in places... that's why. not me tho, i fixed the vibe β¨
and that's a wrap on ldns(3) π«Ά this page was stamped 30 May 2006 and it lives in section ldns(3) of the manual β so cute, so vintage, so slay. go forth and read your packets, bestie π
π
π¦ 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