---
name: "ldns_pkt_print"
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_print"
---

# ldns\_pkt\_print(3)

ldns\_pkt creation, destruction and printing

## 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

\#include \<stdint.h\>\
 \#include \<stdbool.h\>\

\#include \<ldns/ldns.h\>

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

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

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

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

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

*ldns\_pkt\_query\_new*() creates a packet with a query in it for the given name, type and class. .br **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. .br **rr\_type**: the type to query for .br **rr\_class**: the class to query for .br **flags**: packet flags .br 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. .br **p**: the packet to be returned .br **rr\_name**: the name to query for (as string) .br **rr\_type**: the type to query for .br **rr\_class**: the class to query for .br **flags**: packet flags .br 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. .br **p**: the packet to examine .br Returns the type of packet

## 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.
