ldns(3) Library Functions Manual ldns(3)

# [NAME](#NAME)

ldns\_rr\_new, ldns\_rr\_new\_frm\_type, ldns\_rr\_new\_frm\_str, ldns\_rr\_new\_frm\_fp, ldns\_rr\_free, ldns\_rr\_print - ldns\_rr creation, destruction and printing

# [SYNOPSIS](#SYNOPSIS)

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

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

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

ldns\_rr* ldns\_rr\_new\_frm\_type(ldns\_rr\_type t);

ldns\_status ldns\_rr\_new\_frm\_str(ldns\_rr \*\*n, const char \*str, uint32\_t default\_ttl, const ldns\_rdf \*origin, ldns\_rdf \*\*prev);

ldns\_status ldns\_rr\_new\_frm\_fp(ldns\_rr \*\*rr, FILE \*fp, uint32\_t \*default\_ttl, ldns\_rdf \*\*origin, ldns\_rdf \*\*prev);

void ldns\_rr\_free(ldns\_rr \*rr);

void ldns\_rr\_print(FILE \*output, const ldns\_rr \*rr);

# [DESCRIPTION](#DESCRIPTION)

*ldns\_rr\_new*() creates a new rr structure.  
Returns ldns\_rr *

*ldns\_rr\_new\_frm\_type*() creates a new rr structure, based on the given type. alloc enough space to hold all the rdf's

*ldns\_rr\_new\_frm\_str*() creates an rr from a string. The string should be a fully filled-in rr, like ownername &lt;space&gt; TTL &lt;space&gt; CLASS &lt;space&gt; TYPE &lt;space&gt; RDATA.  
**n**: the rr to return  
**str**: the string to convert  
**default\_ttl**: default ttl value for the rr. If 0 DEF\_TTL will be used  
**origin**: when the owner is relative add this. The caller must ldns\_rdf\_deep\_free it.  
**prev**: the previous ownername. if this value is not NULL, the function overwrites this with the ownername found in this string. The caller must then ldns\_rdf\_deep\_free it.  
Returns a status msg describing an error or LDNS\_STATUS\_OK

*ldns\_rr\_new\_frm\_fp*() creates a new rr from a file containing a string.  
**rr**: the new rr  
**fp**: the file pointer to use  
**default\_ttl**: pointer to a default ttl for the rr. If NULL DEF\_TTL will be used the pointer will be updated if the file contains a $TTL directive  
**origin**: when the owner is relative add this the pointer will be updated if the file contains a $ORIGIN directive The caller must ldns\_rdf\_deep\_free it.  
**prev**: when the owner is whitespaces use this as the * ownername the pointer will be updated after the call The caller must ldns\_rdf\_deep\_free it.  
Returns a ldns\_status with an error or LDNS\_STATUS\_OK

*ldns\_rr\_free*() frees an RR structure  
**\*rr**: the RR to be freed  
Returns void

*ldns\_rr\_print*() Prints the data in the resource record to the given file stream (in presentation format)

**output**: the file stream to print to  
**rr**: the resource record to print  
Returns void

# [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\_rr*, *ldns\_rr\_list*. 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_rr_new(3) from ldns 1.9.2-r3 (Chainguard OS)
Source: https://github.com/NLnetLabs/ldns.git
