ldns(3)

πŸ“¦
version 1.9.2 Β· 3 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, 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_ad
  • ldns_pkt_get_opcode, ldns_pkt_get_rcode
  • ldns_pkt_qdcount, ldns_pkt_ancount, ldns_pkt_nscount, ldns_pkt_arcount
  • ldns_pkt_answerfrom, ldns_pkt_querytime, ldns_pkt_size, ldns_pkt_tsig
  • ldns_pkt_question, ldns_pkt_answer, ldns_pkt_authority, ldns_pkt_additional
  • ldns_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_list with the rr's or NULL if 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 NULL if 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 NULL if 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 NULL if 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:


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 πŸ’…πŸ’–