rrdef.c File Reference

Defines resource record types and constants. More...

#include "config.h"
#include "sldns/rrdef.h"
#include "sldns/parseutil.h"

Macros

#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT    (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0]))
 computes the number of rdata fields
 

Functions

const sldns_rr_descriptorsldns_rr_descript (uint16_t type)
 returns the resource record descriptor for the given rr type. More...
 
size_t sldns_rr_descriptor_minimum (const sldns_rr_descriptor *descriptor)
 returns the minimum number of rdata fields of the rr type this descriptor describes. More...
 
size_t sldns_rr_descriptor_maximum (const sldns_rr_descriptor *descriptor)
 returns the maximum number of rdata fields of the rr type this descriptor describes. More...
 
sldns_rdf_type sldns_rr_descriptor_field_type (const sldns_rr_descriptor *descriptor, size_t index)
 returns the rdf type for the given rdata field number of the rr type for the given descriptor. More...
 
sldns_rr_type sldns_get_rr_type_by_name (const char *name)
 retrieves a rrtype by looking up its name. More...
 
sldns_rr_class sldns_get_rr_class_by_name (const char *name)
 retrieves a class by looking up its name. More...
 

Variables

static sldns_lookup_table sldns_rr_classes_data []
 
sldns_lookup_tablesldns_rr_classes = sldns_rr_classes_data
 lookuptable for rr classes

 
static const sldns_rdf_type type_0_wireformat [] = { LDNS_RDF_TYPE_UNKNOWN }
 
static const sldns_rdf_type type_a_wireformat [] = { LDNS_RDF_TYPE_A }
 
static const sldns_rdf_type type_ns_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_md_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_mf_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_cname_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_soa_wireformat []
 
static const sldns_rdf_type type_mb_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_mg_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_mr_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_wks_wireformat []
 
static const sldns_rdf_type type_ptr_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_hinfo_wireformat []
 
static const sldns_rdf_type type_minfo_wireformat []
 
static const sldns_rdf_type type_mx_wireformat []
 
static const sldns_rdf_type type_rp_wireformat []
 
static const sldns_rdf_type type_afsdb_wireformat []
 
static const sldns_rdf_type type_x25_wireformat [] = { LDNS_RDF_TYPE_STR }
 
static const sldns_rdf_type type_isdn_wireformat []
 
static const sldns_rdf_type type_rt_wireformat []
 
static const sldns_rdf_type type_nsap_wireformat []
 
static const sldns_rdf_type type_nsap_ptr_wireformat []
 
static const sldns_rdf_type type_sig_wireformat []
 
static const sldns_rdf_type type_key_wireformat []
 
static const sldns_rdf_type type_px_wireformat []
 
static const sldns_rdf_type type_gpos_wireformat []
 
static const sldns_rdf_type type_aaaa_wireformat [] = { LDNS_RDF_TYPE_AAAA }
 
static const sldns_rdf_type type_loc_wireformat [] = { LDNS_RDF_TYPE_LOC }
 
static const sldns_rdf_type type_nxt_wireformat []
 
static const sldns_rdf_type type_eid_wireformat []
 
static const sldns_rdf_type type_nimloc_wireformat []
 
static const sldns_rdf_type type_srv_wireformat []
 
static const sldns_rdf_type type_atma_wireformat []
 
static const sldns_rdf_type type_naptr_wireformat []
 
static const sldns_rdf_type type_kx_wireformat []
 
static const sldns_rdf_type type_cert_wireformat []
 
static const sldns_rdf_type type_a6_wireformat [] = { LDNS_RDF_TYPE_UNKNOWN }
 
static const sldns_rdf_type type_dname_wireformat [] = { LDNS_RDF_TYPE_DNAME }
 
static const sldns_rdf_type type_sink_wireformat []
 
static const sldns_rdf_type type_apl_wireformat []
 
static const sldns_rdf_type type_ds_wireformat []
 
static const sldns_rdf_type type_sshfp_wireformat []
 
static const sldns_rdf_type type_ipseckey_wireformat []
 
static const sldns_rdf_type type_rrsig_wireformat []
 
static const sldns_rdf_type type_nsec_wireformat []
 
static const sldns_rdf_type type_dhcid_wireformat []
 
static const sldns_rdf_type type_talink_wireformat []
 
static const sldns_rdf_type type_openpgpkey_wireformat []
 
static const sldns_rdf_type type_csync_wireformat []
 
static const sldns_rdf_type type_zonemd_wireformat []
 
static const sldns_rdf_type type_svcb_wireformat []
 
static const sldns_rdf_type type_nsec3_wireformat []
 
static const sldns_rdf_type type_nsec3param_wireformat []
 
static const sldns_rdf_type type_dnskey_wireformat []
 
static const sldns_rdf_type type_tkey_wireformat []
 
static const sldns_rdf_type type_tsig_wireformat []
 
static const sldns_rdf_type type_tlsa_wireformat []
 
static const sldns_rdf_type type_hip_wireformat []
 
static const sldns_rdf_type type_nid_wireformat []
 
static const sldns_rdf_type type_l32_wireformat []
 
static const sldns_rdf_type type_l64_wireformat []
 
static const sldns_rdf_type type_lp_wireformat []
 
static const sldns_rdf_type type_eui48_wireformat []
 
static const sldns_rdf_type type_eui64_wireformat []
 
static const sldns_rdf_type type_uri_wireformat []
 
static const sldns_rdf_type type_caa_wireformat []
 
static sldns_rr_descriptor rdata_field_descriptors []
 

Detailed Description

Defines resource record types and constants.

Function Documentation

◆ sldns_rr_descript()

const sldns_rr_descriptor* sldns_rr_descript ( uint16_t  type)

returns the resource record descriptor for the given rr type.

Parameters
[in]typethe type value of the rr type
Returns
the sldns_rr_descriptor for this type

Referenced by analyze_rr(), calc_size(), canonical_compare(), decompress_rr_into_buffer(), lowercase_rdata(), print_ext(), rrinternal_parse_rdata(), sldns_wire2str_rdata_scan(), sldns_wire2str_type_print(), and type_rdata_compressable().

◆ sldns_rr_descriptor_minimum()

size_t sldns_rr_descriptor_minimum ( const sldns_rr_descriptor descriptor)

returns the minimum number of rdata fields of the rr type this descriptor describes.

Parameters
[in]descriptorfor an rr type
Returns
the minimum number of rdata fields

References sldns_struct_rr_descriptor::_minimum.

Referenced by sldns_wire2str_rdata_scan().

◆ sldns_rr_descriptor_maximum()

size_t sldns_rr_descriptor_maximum ( const sldns_rr_descriptor descriptor)

returns the maximum number of rdata fields of the rr type this descriptor describes.

Parameters
[in]descriptorfor an rr type
Returns
the maximum number of rdata fields

References sldns_struct_rr_descriptor::_maximum, sldns_struct_rr_descriptor::_variable, and LDNS_RDF_TYPE_NONE.

Referenced by sldns_wire2str_rdata_scan().

◆ sldns_rr_descriptor_field_type()

sldns_rdf_type sldns_rr_descriptor_field_type ( const sldns_rr_descriptor descriptor,
size_t  field 
)

returns the rdf type for the given rdata field number of the rr type for the given descriptor.

Parameters
[in]descriptorfor an rr type
[in]fieldthe field number
Returns
the rdf type for the field

References sldns_struct_rr_descriptor::_variable, sldns_struct_rr_descriptor::_wireformat, and LDNS_RDF_TYPE_NONE.

Referenced by lowercase_rdata(), and sldns_wire2str_rdata_scan().

◆ sldns_get_rr_type_by_name()

sldns_rr_type sldns_get_rr_type_by_name ( const char *  name)

retrieves a rrtype by looking up its name.

Parameters
[in]namea string with the name
Returns
the type which corresponds with the name

Referenced by do_flush_type(), massage_type(), and qlist_parse_line().

◆ sldns_get_rr_class_by_name()

sldns_rr_class sldns_get_rr_class_by_name ( const char *  name)

retrieves a class by looking up its name.

Parameters
[in]namestring with the name
Returns
the cass which corresponds with the name

Referenced by massage_class(), and qlist_parse_line().

Variable Documentation

◆ sldns_rr_classes_data

sldns_lookup_table sldns_rr_classes_data[]
static
Initial value:
= {
{ LDNS_RR_CLASS_IN, "IN" },
{ LDNS_RR_CLASS_CH, "CH" },
{ LDNS_RR_CLASS_HS, "HS" },
{ LDNS_RR_CLASS_NONE, "NONE" },
{ LDNS_RR_CLASS_ANY, "ANY" },
{ 0, NULL }
}
@ LDNS_RR_CLASS_NONE
None class, dynamic update.
Definition: rrdef.h:58
@ LDNS_RR_CLASS_IN
the Internet
Definition: rrdef.h:52
@ LDNS_RR_CLASS_CH
Chaos class.
Definition: rrdef.h:54
@ LDNS_RR_CLASS_HS
Hesiod (Dyer 87)
Definition: rrdef.h:56
@ LDNS_RR_CLASS_ANY
Any class.
Definition: rrdef.h:60

◆ type_soa_wireformat

const sldns_rdf_type type_soa_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_INT32
32 bits
Definition: rrdef.h:277
@ LDNS_RDF_TYPE_PERIOD
period
Definition: rrdef.h:307
@ LDNS_RDF_TYPE_DNAME
domain name
Definition: rrdef.h:271

◆ type_wks_wireformat

const sldns_rdf_type type_wks_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_WKS
well known services
Definition: rrdef.h:322
@ LDNS_RDF_TYPE_A
A record.
Definition: rrdef.h:279

◆ type_hinfo_wireformat

const sldns_rdf_type type_hinfo_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_STR
txt string
Definition: rrdef.h:283

◆ type_minfo_wireformat

const sldns_rdf_type type_minfo_wireformat[]
static

◆ type_mx_wireformat

const sldns_rdf_type type_mx_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_INT16
16 bits
Definition: rrdef.h:275

◆ type_rp_wireformat

const sldns_rdf_type type_rp_wireformat[]
static

◆ type_afsdb_wireformat

const sldns_rdf_type type_afsdb_wireformat[]
static

◆ type_isdn_wireformat

const sldns_rdf_type type_isdn_wireformat[]
static
Initial value:

◆ type_rt_wireformat

const sldns_rdf_type type_rt_wireformat[]
static

◆ type_nsap_wireformat

const sldns_rdf_type type_nsap_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_NSAP
NSAP.
Definition: rrdef.h:324

◆ type_nsap_ptr_wireformat

const sldns_rdf_type type_nsap_ptr_wireformat[]
static
Initial value:

◆ type_sig_wireformat

const sldns_rdf_type type_sig_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_B64
b64 string
Definition: rrdef.h:289
@ LDNS_RDF_TYPE_TIME
time (32 bits)
Definition: rrdef.h:305
@ LDNS_RDF_TYPE_INT8
8 bits
Definition: rrdef.h:273
@ LDNS_RDF_TYPE_ALG
a key algorithm
Definition: rrdef.h:301
@ LDNS_RDF_TYPE_TYPE
a RR type
Definition: rrdef.h:295

◆ type_key_wireformat

const sldns_rdf_type type_key_wireformat[]
static

◆ type_px_wireformat

const sldns_rdf_type type_px_wireformat[]
static

◆ type_gpos_wireformat

const sldns_rdf_type type_gpos_wireformat[]
static

◆ type_nxt_wireformat

const sldns_rdf_type type_nxt_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_UNKNOWN
unknown types
Definition: rrdef.h:303

◆ type_eid_wireformat

const sldns_rdf_type type_eid_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_HEX
hex string
Definition: rrdef.h:291

◆ type_nimloc_wireformat

const sldns_rdf_type type_nimloc_wireformat[]
static
Initial value:

◆ type_srv_wireformat

const sldns_rdf_type type_srv_wireformat[]
static

◆ type_atma_wireformat

const sldns_rdf_type type_atma_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_ATMA
ATMA.
Definition: rrdef.h:326

◆ type_naptr_wireformat

const sldns_rdf_type type_naptr_wireformat[]
static

◆ type_kx_wireformat

const sldns_rdf_type type_kx_wireformat[]
static

◆ type_cert_wireformat

const sldns_rdf_type type_cert_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_CERT_ALG
certificate algorithm
Definition: rrdef.h:299

◆ type_sink_wireformat

const sldns_rdf_type type_sink_wireformat[]
static

◆ type_apl_wireformat

const sldns_rdf_type type_apl_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_APL
apl data
Definition: rrdef.h:285

◆ type_ds_wireformat

const sldns_rdf_type type_ds_wireformat[]
static

◆ type_sshfp_wireformat

const sldns_rdf_type type_sshfp_wireformat[]
static

◆ type_ipseckey_wireformat

const sldns_rdf_type type_ipseckey_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_IPSECKEY
IPSECKEY.
Definition: rrdef.h:328

◆ type_rrsig_wireformat

◆ type_nsec_wireformat

const sldns_rdf_type type_nsec_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_NSEC
nsec type codes
Definition: rrdef.h:293

◆ type_dhcid_wireformat

const sldns_rdf_type type_dhcid_wireformat[]
static
Initial value:

◆ type_talink_wireformat

const sldns_rdf_type type_talink_wireformat[]
static

◆ type_openpgpkey_wireformat

const sldns_rdf_type type_openpgpkey_wireformat[]
static
Initial value:

◆ type_csync_wireformat

const sldns_rdf_type type_csync_wireformat[]
static

◆ type_zonemd_wireformat

const sldns_rdf_type type_zonemd_wireformat[]
static

◆ type_svcb_wireformat

const sldns_rdf_type type_svcb_wireformat[]
static

◆ type_nsec3_wireformat

const sldns_rdf_type type_nsec3_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_NSEC3_NEXT_OWNER
nsec3 base32 string (with length byte on wire
Definition: rrdef.h:332
@ LDNS_RDF_TYPE_NSEC3_SALT
nsec3 hash salt
Definition: rrdef.h:330

◆ type_nsec3param_wireformat

const sldns_rdf_type type_nsec3param_wireformat[]
static

◆ type_dnskey_wireformat

const sldns_rdf_type type_dnskey_wireformat[]
static

◆ type_tkey_wireformat

const sldns_rdf_type type_tkey_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_TSIGERROR
TSIG extended 16bit error value.
Definition: rrdef.h:356
@ LDNS_RDF_TYPE_INT16_DATA
variable length any type rdata where the length is specified by the first 2 bytes
Definition: rrdef.h:316

◆ type_tsig_wireformat

const sldns_rdf_type type_tsig_wireformat[]
static

◆ type_tlsa_wireformat

const sldns_rdf_type type_tlsa_wireformat[]
static

◆ type_hip_wireformat

const sldns_rdf_type type_hip_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_HIP
Represents the Public Key Algorithm, HIT and Public Key fields for the HIP RR types.
Definition: rrdef.h:313

◆ type_nid_wireformat

const sldns_rdf_type type_nid_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_ILNP64
4 shorts represented as 4 * 16 bit hex numbers separated by colons.
Definition: rrdef.h:337

◆ type_l32_wireformat

const sldns_rdf_type type_l32_wireformat[]
static
Initial value:

◆ type_l64_wireformat

const sldns_rdf_type type_l64_wireformat[]
static

◆ type_lp_wireformat

const sldns_rdf_type type_lp_wireformat[]
static

◆ type_eui48_wireformat

const sldns_rdf_type type_eui48_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_EUI48
6 * 8 bit hex numbers separated by dashes.
Definition: rrdef.h:340

◆ type_eui64_wireformat

const sldns_rdf_type type_eui64_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_EUI64
8 * 8 bit hex numbers separated by dashes.
Definition: rrdef.h:342

◆ type_uri_wireformat

const sldns_rdf_type type_uri_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_LONG_STR
A <character-string> encoding of the value field as specified [RFC1035], Section 5....
Definition: rrdef.h:353

◆ type_caa_wireformat

const sldns_rdf_type type_caa_wireformat[]
static
Initial value:
= {
}
@ LDNS_RDF_TYPE_TAG
A non-zero sequence of US-ASCII letters and numbers in lower case.
Definition: rrdef.h:347