31 #define LDNS_MAX_LABELLEN 63
33 #define LDNS_MAX_DOMAINLEN 255
35 #define LDNS_MAX_POINTERS 65535
37 #define LDNS_RR_OVERHEAD 10
254 #define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON (LDNS_RR_TYPE_WALLET + 1)
432 uint32_t default_ttl,
const ldns_rdf *origin,
This file contains the definition of ldns_buffer, and functions to manipulate those.
Common definitions for LDNS.
Defines error numbers and functions to translate those to a readable string.
enum ldns_enum_status ldns_status
Defines ldns_rdf and functions to manipulate those.
enum ldns_enum_rdf_type ldns_rdf_type
void ldns_rr_list_free(ldns_rr_list *rr_list)
frees an rr_list structure.
ldns_rr * ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr)
returns a specific rr of an rrlist.
ldns_rr * ldns_rr_list_pop_rr(ldns_rr_list *rr_list)
pops the last rr from an rrlist.
ldns_rr_class ldns_get_rr_class_by_name(const char *name)
retrieves a class by looking up its name.
uint32_t ldns_rr_ttl(const ldns_rr *rr)
returns the ttl of an rr structure.
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
ldns_rr_type ldns_rdf2rr_type(const ldns_rdf *rd)
convert an rdf of type LDNS_RDF_TYPE_TYPE to an actual LDNS_RR_TYPE.
ldns_enum_rr_compress
Used to specify whether compression is allowed.
@ LDNS_RR_COMPRESS
compression is allowed
void ldns_rr_list_deep_free(ldns_rr_list *rr_list)
frees an rr_list structure and all rrs contained therein.
const ldns_rr_descriptor * ldns_rr_descript(uint16_t type)
returns the resource record descriptor for the given rr type.
void ldns_rr_free(ldns_rr *rr)
frees an RR structure
ldns_rr * ldns_rr_set_pop_rr(ldns_rr_list *rr_list)
pops the last rr from an rrset.
void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner)
sets the owner in the rr structure.
ldns_rr_list * ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t size)
pops an rr_list of size s from an rrlist.
ldns_rr_type ldns_rr_list_type(const ldns_rr_list *rr_list)
Returns the type of the first element of the RR If there are no elements present, 0 is returned.
ldns_status ldns_rr_new_frm_str(ldns_rr **n, const char *str, uint32_t default_ttl, const ldns_rdf *origin, ldns_rdf **prev)
creates an rr from a string.
ldns_rr_list * ldns_rr_list_pop_rrset(ldns_rr_list *rr_list)
pops the first rrset from the list, the list must be sorted, so that all rr's from each rrset are nex...
ldns_rr * ldns_rr_new_frm_type(ldns_rr_type t)
creates a new rr structure, based on the given type.
signed char ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr)
pushes an rr to an rrset (which really are rr_list's).
signed char ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, const ldns_rr *rr)
returns true if the given rr is one of the rrs in the list, or if it is equal to one
void ldns_rr_list_sort(ldns_rr_list *unsorted)
sorts an rr_list (canonical wire format).
enum ldns_enum_rr_type ldns_rr_type
void ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type)
sets the type in the rr.
ldns_enum_rr_type
The different RR types.
@ LDNS_RR_TYPE_MF
a mail forwarder (Obsolete - use MX)
@ LDNS_RR_TYPE_CERT
RFC2538.
@ LDNS_RR_TYPE_RP
RFC1183.
@ LDNS_RR_TYPE_KX
RFC2230.
@ LDNS_RR_TYPE_RESINFO
RFC 9606.
@ LDNS_RR_TYPE_OPT
OPT record RFC 6891.
@ LDNS_RR_TYPE_RRSIG
DNSSEC.
@ LDNS_RR_TYPE_SINK
dnsind-kitchen-sink-02.txt
@ LDNS_RR_TYPE_A
a host address
@ LDNS_RR_TYPE_ISDN
RFC1183.
@ LDNS_RR_TYPE_MINFO
mailbox or mail list information
@ LDNS_RR_TYPE_GPOS
RFC1712.
@ LDNS_RR_TYPE_SOA
marks the start of a zone of authority
@ LDNS_RR_TYPE_SSHFP
SSH Key Fingerprint.
@ LDNS_RR_TYPE_X25
RFC1183.
@ LDNS_RR_TYPE_WKS
a well known service description
@ LDNS_RR_TYPE_PX
RFC2163.
@ LDNS_RR_TYPE_RT
RFC1183.
@ LDNS_RR_TYPE_DNAME
RFC2672.
@ LDNS_RR_TYPE_OPENPGPKEY
@ LDNS_RR_TYPE_AMTRELAY
RFC 8777.
@ LDNS_RR_TYPE_DS
RFC4034, RFC3658.
@ LDNS_RR_TYPE_KEY
2535typecode
@ LDNS_RR_TYPE_NULL
a null RR (EXPERIMENTAL)
@ LDNS_RR_TYPE_NSEC3PARAM
@ LDNS_RR_TYPE_RKEY
draft-reid-dnsext-rkey
@ LDNS_RR_TYPE_NXT
2535typecode
@ LDNS_RR_TYPE_SIG
2535typecode
@ LDNS_RR_TYPE_CNAME
the canonical name for an alias
@ LDNS_RR_TYPE_MAILA
A request for mail agent RRs (Obsolete - see MX)
@ LDNS_RR_TYPE_NSEC3PARAMS
@ LDNS_RR_TYPE_TA
DNSSEC Trust Authorities.
@ LDNS_RR_TYPE_LOC
LOC record RFC1876.
@ LDNS_RR_TYPE_TXT
text strings
@ LDNS_RR_TYPE_PTR
a domain name pointer
@ LDNS_RR_TYPE_AAAA
ipv6 address
@ LDNS_RR_TYPE_MD
a mail destination (Obsolete - use MX)
@ LDNS_RR_TYPE_A6
RFC2874.
@ LDNS_RR_TYPE_NS
an authoritative name server
@ LDNS_RR_TYPE_MR
a mail rename domain name (EXPERIMENTAL)
@ LDNS_RR_TYPE_ANY
any type (wildcard)
@ LDNS_RR_TYPE_WALLET
https://iana.org/assignments/dns-parameters/WALLET/wallet-completed-template
@ LDNS_RR_TYPE_MB
a mailbox domain name (EXPERIMENTAL)
@ LDNS_RR_TYPE_NINFO
draft-reid-dnsext-zs
@ LDNS_RR_TYPE_TALINK
draft-ietf-dnsop-trust-history
@ LDNS_RR_TYPE_ATMA
http://www.jhsoft.com/rfc/af-saa-0069.000.rtf
@ LDNS_RR_TYPE_HINFO
host information
@ LDNS_RR_TYPE_EID
draft-ietf-nimrod-dns-01.txt
@ LDNS_RR_TYPE_AFSDB
RFC1183.
@ LDNS_RR_TYPE_NSAP
RFC1706.
@ LDNS_RR_TYPE_NAPTR
RFC2915.
@ LDNS_RR_TYPE_SRV
SRV record RFC2782.
@ LDNS_RR_TYPE_IPSECKEY
IPsec Key.
@ LDNS_RR_TYPE_MAILB
A request for mailbox-related records (MB, MG or MR)
@ LDNS_RR_TYPE_APL
RFC3123.
@ LDNS_RR_TYPE_MX
mail exchange
@ LDNS_RR_TYPE_NIMLOC
draft-ietf-nimrod-dns-01.txt
@ LDNS_RR_TYPE_MG
a mail group member (EXPERIMENTAL)
@ LDNS_RR_TYPE_NSAP_PTR
RFC1348.
signed char ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr)
pushes an rr to an rrlist.
signed char ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list)
pushes an rr_list to an rrlist.
signed char ldns_rr_is_question(const ldns_rr *rr)
returns the question flag of an rr structure.
void ldns_rr2canonical(ldns_rr *rr)
converts each dname in a rr to its canonical form.
size_t ldns_rr_rd_count(const ldns_rr *rr)
returns the rd_count of an rr structure.
ldns_rdf_type ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor, size_t field)
returns the rdf type for the given rdata field number of the rr type for the given descriptor.
uint8_t ldns_rr_label_count(const ldns_rr *rr)
counts the number of labels of the ownername.
ldns_rdf * ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position)
sets a rdf member, it will be set on the position given.
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.
int ldns_rr_compare_wire(const ldns_buffer *rr1_buf, const ldns_buffer *rr2_buf)
compares the wireformat of two rrs, contained in the given buffers.
void ldns_rr_list2canonical(const ldns_rr_list *rr_list)
converts each dname in each rr in a rr_list to its canonical form.
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl)
sets the ttl in the rr structure.
ldns_rdf * ldns_rr_list_owner(const ldns_rr_list *rr_list)
Returns the owner domain name rdf of the first element of the RR If there are no elements present,...
void ldns_rr_set_question(ldns_rr *rr, signed char question)
sets the question flag in the rr structure.
size_t ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor)
returns the maximum number of rdata fields of the rr type this descriptor describes.
signed char ldns_rr_compare_ds(const ldns_rr *rr1, const ldns_rr *rr2)
returns true of the given rr's are equal.
int ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2)
compares two rrs, up to the rdata.
ldns_rr_class ldns_rr_get_class(const ldns_rr *rr)
returns the class of the rr.
ldns_rr_list * ldns_rr_list_cat_clone(const ldns_rr_list *left, const ldns_rr_list *right)
concatenates two ldns_rr_lists together, but makes clones of the rr's (instead of pointer copying).
enum ldns_enum_rr_class ldns_rr_class
void ldns_rr_set_rd_count(ldns_rr *rr, size_t count)
sets the rd_count in the rr.
ldns_status ldns_rr_new_frm_fp(ldns_rr **rr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev)
creates a new rr from a file containing a string.
ldns_status ldns_rdf_bitmap_known_rr_types_space(ldns_rdf **rdf)
Create a rr type bitmap rdf providing enough space to set all known (to ldns) rr types.
void ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class)
sets the class in the rr.
signed char ldns_is_rrset(const ldns_rr_list *rr_list)
checks if an rr_list is a rrset.
ldns_rr * ldns_rr_list_set_rr(ldns_rr_list *rr_list, const ldns_rr *r, size_t count)
set a rr on a specific index in a ldns_rr_list
ldns_rr_list * ldns_rr_list_new(void)
creates a new rr_list structure.
ldns_rr_list * ldns_rr_list_subtype_by_rdf(const ldns_rr_list *l, const ldns_rdf *r, size_t pos)
Return the rr_list which matches the rdf at position field.
signed char ldns_rr_list_cat(ldns_rr_list *left, const ldns_rr_list *right)
concatenates two ldns_rr_lists together.
int ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2)
compares two rr lists.
ldns_status ldns_rr_new_frm_fp_l(ldns_rr **rr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr)
creates a new rr from a file containing a string.
signed char ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f)
sets rd_field member, it will be placed in the next available spot.
int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2)
compares two rrs.
ldns_status ldns_rr_new_question_frm_str(ldns_rr **n, const char *str, const ldns_rdf *origin, ldns_rdf **prev)
creates an rr for the question section from a string, i.e.
void ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, size_t count)
sets the number of rr's in an rr_list.
enum ldns_enum_rr_compress ldns_rr_compress
ldns_enum_rr_class
The different RR classes.
@ LDNS_RR_CLASS_NONE
None class, dynamic update.
@ LDNS_RR_CLASS_IN
the Internet
@ LDNS_RR_CLASS_CH
Chaos class.
@ LDNS_RR_CLASS_HS
Hesiod (Dyer 87)
@ LDNS_RR_CLASS_ANY
Any class.
ldns_rr * ldns_rr_clone(const ldns_rr *rr)
clones a rr and all its data
ldns_rr_list * ldns_rr_list_clone(const ldns_rr_list *rrlist)
clones an rrlist.
size_t ldns_rr_descriptor_minimum(const ldns_rr_descriptor *descriptor)
returns the minimum number of rdata fields of the rr type this descriptor describes.
ldns_rdf * ldns_rr_rdf(const ldns_rr *rr, size_t nr)
returns the rdata field member counter.
ldns_rr * ldns_rr_new(void)
creates a new rr structure.
size_t ldns_rr_uncompressed_size(const ldns_rr *r)
calculates the uncompressed size of an RR.
ldns_rdf * ldns_rr_pop_rdf(ldns_rr *rr)
removes a rd_field member, it will be popped from the last position.
ldns_status ldns_rdf_bitmap_known_rr_types(ldns_rdf **rdf)
Create a rr type bitmap rdf with at least all known (to ldns) rr types set.
ldns_rr_type ldns_get_rr_type_by_name(const char *name)
retrieves a rrtype by looking up its name.
implementation of buffers to ease operations
Resource record data field.
Contains all information about resource record types.
uint8_t _maximum
Maximum number of rdata fields in the RRs of this type.
ldns_rr_compress _compress
Specifies whether compression can be used for dnames in this RR type.
const char * _name
Textual name of the RR type.
ldns_rdf_type _variable
Special rdf types.
ldns_rr_type _type
Type of the RR that is described here.
uint8_t _dname_count
The number of DNAMEs in the _wireformat string, for parsing.
uint8_t _minimum
Minimum number of rdata fields in the RRs of this type.
const ldns_rdf_type * _wireformat
Wireformat specification for the rr, i.e.
List or Set of Resource Records.
ldns_rr_type _rr_type
the type of the RR.
ldns_rdf * _owner
Owner name, uncompressed.
ldns_rdf ** _rdata_fields
The array of rdata's.
signed char _rr_question
question rr [it would be nicer if thous is after _rd_count] ABI change: Fix this in next major releas...
uint32_t _ttl
Time to live
ldns_rr_class _rr_class
Class of the resource record.
size_t _rd_count
Number of data fields.