ldns(3) Library Functions Manual ldns(3)

# [NAME](#NAME)

ldns\_pkt\_new, ldns\_pkt\_free, ldns\_pkt\_print, ldns\_pkt\_query\_new, ldns\_pkt\_query\_new\_frm\_str, ldns\_pkt\_reply\_type - ldns\_pkt creation, destruction and printing

# [SYNOPSIS](#SYNOPSIS)

#include &lt;stdint.h&gt;  
#include &lt;stdbool.h&gt;

#include &lt;ldns/ldns.h&gt;

ldns\_pkt* ldns\_pkt\_new(void);

void ldns\_pkt\_free(ldns\_pkt \*packet);

void ldns\_pkt\_print(FILE \*output, const ldns\_pkt \*pkt);

ldns\_pkt* ldns\_pkt\_query\_new(ldns\_rdf \*rr\_name, ldns\_rr\_type rr\_type, ldns\_rr\_class rr\_class, uint16\_t flags);

ldns\_status ldns\_pkt\_query\_new\_frm\_str(ldns\_pkt \*\*p, const char \*rr\_name, ldns\_rr\_type rr\_type, ldns\_rr\_class rr\_class , uint16\_t flags);

ldns\_pkt\_type ldns\_pkt\_reply\_type(const ldns\_pkt \*p);

# [DESCRIPTION](#DESCRIPTION)

*ldns\_pkt\_new*() allocates and initializes a ldns\_pkt structure.  
Returns pointer to the new packet

*ldns\_pkt\_free*() frees the packet structure and all data that it contains.  
**packet**: The packet structure to free  
Returns void

*ldns\_pkt\_print*() Prints the data in the DNS packet to the given file stream (in presentation format)

**output**: the file stream to print to  
**pkt**: the packet to print  
Returns void

*ldns\_pkt\_query\_new*() creates a packet with a query in it for the given name, type and class.  
**rr\_name**: the name to query for (not copied). The returned packet will take ownership of rr\_name, so the caller should not free it.  
**rr\_type**: the type to query for  
**rr\_class**: the class to query for  
**flags**: packet flags  
Returns ldns\_pkt* a pointer to the new pkt

*ldns\_pkt\_query\_new\_frm\_str*() creates a query packet for the given name, type, class.  
**p**: the packet to be returned  
**rr\_name**: the name to query for (as string)  
**rr\_type**: the type to query for  
**rr\_class**: the class to query for  
**flags**: packet flags  
Returns LDNS\_STATUS\_OK or a ldns\_status mesg with the error

*ldns\_pkt\_reply\_type*() looks inside the packet to determine what kind of packet it is, AUTH, NXDOMAIN, REFERRAL, etc.  
**p**: the packet to examine  
Returns the type of packet

# [AUTHOR](#AUTHOR)

The ldns team at NLnet Labs.

# [REPORTING BUGS](#REPORTING_BUGS)

Please report bugs to dns-team@nlnetlabs.nl or on GitHub at https://github.com/NLnetLabs/ldns/issues

# [COPYRIGHT](#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](#SEE_ALSO)

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

# [REMARKS](#REMARKS)

This manpage was automatically generated from the ldns source code.

30 May 2006

---

Document: ldns_pkt_query_new(3) from ldns 1.9.2-r3 (Chainguard OS)
Source: https://github.com/NLnetLabs/ldns.git
