ldns(3) Library Functions Manual ldns(3)

# [NAME](#NAME)

ldns\_wire2rr, ldns\_wire2pkt, ldns\_wire2rdf, ldns\_wire2dname - convert from wire format to host type

# [SYNOPSIS](#SYNOPSIS)

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

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

ldns\_status ldns\_wire2rr(ldns\_rr \*\*rr, const uint8\_t \*wire, size\_t max, size\_t \*pos, ldns\_pkt\_section section);

ldns\_status ldns\_wire2pkt(ldns\_pkt \*\*packet, const uint8\_t \*data, size\_t len);

ldns\_status ldns\_wire2rdf(ldns\_rr \*rr, const uint8\_t \*wire, size\_t max, size\_t \*pos);

ldns\_status ldns\_wire2dname(ldns\_rdf \*\*dname, const uint8\_t \*wire, size\_t max, size\_t \*pos);

# [DESCRIPTION](#DESCRIPTION)

*ldns\_wire2rr*() converts the data on the uint8\_t bytearray (in wire format) to a DNS resource record. This function will initialize and allocate memory space for the rr structure. The length of the wiredata of this rr is added to the \*pos value.

**rr**: pointer to the structure to hold the rdata value  
**wire**: pointer to the buffer with the data  
**max**: the length of the data buffer (in bytes)  
**pos**: the position of the rr in the buffer (ie. the number of bytes from the start of the buffer)  
**section**: the section in the packet the rr is meant for  
Returns LDNS\_STATUS\_OK if everything succeeds, error otherwise

*ldns\_wire2pkt*() converts the data on the uint8\_t bytearray (in wire format) to a DNS packet. This function will initialize and allocate memory space for the packet structure.

**packet**: pointer to the structure to hold the packet  
**data**: pointer to the buffer with the data  
**len**: the length of the data buffer (in bytes)  
Returns LDNS\_STATUS\_OK if everything succeeds, error otherwise

*ldns\_wire2rdf*() converts the data on the uint8\_t bytearray (in wire format) to DNS rdata fields, and adds them to the list of rdfs of the given rr. This function will initialize and allocate memory space for the dname structures. The length of the wiredata of these rdfs is added to the \*pos value.

All rdfs belonging to the RR are read; the rr should have no rdfs yet. An error is returned if the format cannot be parsed.

**rr**: pointer to the ldns\_rr structure to hold the rdata value  
**wire**: pointer to the buffer with the data  
**max**: the length of the data buffer (in bytes)  
**pos**: the position of the rdf in the buffer (ie. the number of bytes from the start of the buffer)  
Returns LDNS\_STATUS\_OK if everything succeeds, error otherwise

*ldns\_wire2dname*() converts the data on the uint8\_t bytearray (in wire format) to a DNS dname rdata field. This function will initialize and allocate memory space for the dname structure. The length of the wiredata of this rdf is added to the \*pos value.

**dname**: pointer to the structure to hold the rdata value  
**wire**: pointer to the buffer with the data  
**max**: the length of the data buffer (in bytes)  
**pos**: the position of the rdf in the buffer (ie. the number of bytes from the start of the buffer)  
Returns LDNS\_STATUS\_OK if everything succeeds, error otherwise

# [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\_rr2wire*, *ldns\_pkt2wire*, *ldns\_rdf2wire*, *ldns\_dname2wire*. 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_wire2rr(3) from ldns 1.9.2-r2 (Chainguard OS)
Source: https://github.com/NLnetLabs/ldns.git
