---
name: "ldns_pkt_answerfrom"
section: "3"
platform: "linux"
package: "ldns"
version: "1.9.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ldns_pkt_answerfrom"
---

# ldns\_pkt\_answerfrom(3)

get ldns\_pkt attributes

## NAME

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 - get ldns\_pkt attributes

## SYNOPSIS

\#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);

## DESCRIPTION

*ldns\_pkt\_id*()

*ldns\_pkt\_qr*() Read the packet's qr bit .br **p**: the packet .br Returns value of the bit

*ldns\_pkt\_aa*() Read the packet's aa bit .br **p**: the packet .br Returns value of the bit

*ldns\_pkt\_tc*() Read the packet's tc bit .br **p**: the packet .br Returns value of the bit

*ldns\_pkt\_rd*() Read the packet's rd bit .br **p**: the packet .br Returns value of the bit

*ldns\_pkt\_cd*() Read the packet's cd bit .br **p**: the packet .br Returns value of the bit

*ldns\_pkt\_ra*() Read the packet's ra bit .br **p**: the packet .br Returns value of the bit

*ldns\_pkt\_ad*() Read the packet's ad bit .br **p**: the packet .br Returns value of the bit

*ldns\_pkt\_get\_opcode*() Read the packet's code .br **p**: the packet .br Returns the opcode

*ldns\_pkt\_get\_rcode*() Return the packet's response code .br **p**: the packet .br Returns the response code

*ldns\_pkt\_qdcount*() Return the packet's qd count  .br **p**: the packet .br Returns the qd count

*ldns\_pkt\_ancount*() Return the packet's an count .br **p**: the packet .br Returns the an count

*ldns\_pkt\_nscount*() Return the packet's ns count .br **p**: the packet .br Returns the ns count

*ldns\_pkt\_arcount*() Return the packet's ar count .br **p**: the packet .br Returns the ar count

*ldns\_pkt\_answerfrom*() Return the packet's answerfrom .br **p**: packet .br Returns the name of the server

*ldns\_pkt\_querytime*() Return the packet's querytime .br **p**: the packet .br Returns the querytime

*ldns\_pkt\_size*() Return the packet's size in bytes .br **p**: the packet .br Returns the size

*ldns\_pkt\_tsig*() Return the packet's tsig pseudo rr's .br **p**: the packet .br Returns the tsig rr

*ldns\_pkt\_question*() Return the packet's question section .br **p**: the packet .br Returns the section

*ldns\_pkt\_answer*() Return the packet's answer section .br **p**: the packet .br Returns the section

*ldns\_pkt\_authority*() Return the packet's authority section .br **p**: the packet .br Returns the section

*ldns\_pkt\_additional*() Return the packet's additional section .br **p**: the packet .br Returns the section

*ldns\_pkt\_get\_section\_clone*() return all the rr\_list's in the packet. Clone the lists, instead of returning pointers.  .br **p**: the packet to look in .br **s**: what section(s) to return .br Returns ldns\_rr\_list with the rr's or NULL if none were found

*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 .br **p**: the packet .br **r**: the name .br **s**: the packet's section .br 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 .br **p**: the packet .br **t**: the type .br **s**: the packet's section .br 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 type and type from a packet. Optionally specify from which section in the packet .br **packet**: the packet .br **ownername**: the name .br **type**: the type .br **sec**: the packet's section .br Returns a list with the rr's or NULL if none were found

## AUTHOR

The ldns team at NLnet Labs.

## REPORTING BUGS

Please report bugs to 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.

## SEE ALSO

*ldns\_pkt*. And **perldoc Net::DNS**, **RFC1034**, **RFC1035**, **RFC4033**, **RFC4034**  and **RFC4035**.

## REMARKS

This manpage was automatically generated from the ldns source code.
