unbound: sldns/str2wire.c File Reference

unbound 0.1

Macros | Functions
str2wire.c File Reference

str2wire.c - read txt presentation of RRs More...

`#include "config.h"`
`#include "sldns/str2wire.h"`
`#include "sldns/wire2str.h"`
`#include "sldns/sbuffer.h"`
`#include "sldns/parse.h"`
`#include "sldns/parseutil.h"`
`#include <ctype.h>`

## Macros
#define | RET_OFFSET_MASK (((unsigned)(~LDNS_WIREPARSE_MASK))>>LDNS_WIREPARSE_SHIFT)
| bits for the offset
#define | RET_ERR(e, off)
| return an error
#define | RET_ERR_SHIFT(e, move)
| Move parse error but keep its ID.

## Functions
static int | sldns_str2wire_dname_buf_rel (const char *str, uint8_t *buf, size_t *olen, int *rel)
int | sldns_str2wire_dname_buf (const char *str, uint8_t *buf, size_t *len)
| Convert text string into dname wireformat, mallocless, with user buffer.
int | sldns_str2wire_dname_buf_origin (const char *str, uint8_t *buf, size_t *len, uint8_t *origin, size_t origin_len)
| Same as sldns_str2wire_dname_buf, but concatenates origin if the domain name is relative (does not end in '.
uint8_t * | sldns_str2wire_dname (const char *str, size_t *len)
| Convert text string into dname wireformat.
static int | rrinternal_get_owner (sldns_buffer *strbuf, uint8_t *rr, size_t *len, size_t *dname_len, uint8_t *origin, size_t origin_len, uint8_t *prev, size_t prev_len, char *token, size_t token_len)
| read owner name
static int | rrinternal_get_ttl (sldns_buffer *strbuf, char *token, size_t token_len, int *not_there, uint32_t *ttl, uint32_t default_ttl)
| read ttl
static int | rrinternal_get_class (sldns_buffer *strbuf, char *token, size_t token_len, int *not_there, uint16_t *cl)
| read class
static int | rrinternal_get_type (sldns_buffer *strbuf, char *token, size_t token_len, int *not_there, uint16_t *tp)
| read type
static int | rrinternal_write_typeclassttl (sldns_buffer *strbuf, uint8_t *rr, size_t len, size_t dname_len, uint16_t tp, uint16_t cl, uint32_t ttl, int question)
| put type, class, ttl into rr buffer
static const char * | rrinternal_get_delims (sldns_rdf_type rdftype, size_t r_cnt, size_t r_max)
| find delimiters for type
static int | sldns_rdf_type_maybe_quoted (sldns_rdf_type rdf_type)
static int | rrinternal_get_quoted (sldns_buffer *strbuf, const char **delimiters, sldns_rdf_type rdftype)
| see if rdata is quoted
static int | rrinternal_spool_hex (char *token, uint8_t *rr, size_t rr_len, size_t rr_cur_len, size_t *cur_hex_data_size, size_t hex_data_size)
| spool hex data into rdata
static int | rrinternal_parse_unknown (sldns_buffer *strbuf, char *token, size_t token_len, uint8_t *rr, size_t *rr_len, size_t *rr_cur_len, size_t pre_data_pos)
| read unknown rr type format
static int | rrinternal_parse_rdf (sldns_buffer *strbuf, char *token, size_t token_len, uint8_t *rr, size_t rr_len, size_t *rr_cur_len, sldns_rdf_type rdftype, uint16_t rr_type, size_t r_cnt, size_t r_max, size_t dname_len, uint8_t *origin, size_t origin_len)
| parse normal RR rdata element
static int | sldns_parse_rdf_token (sldns_buffer *strbuf, char *token, size_t token_len, int *quoted, int *parens, size_t *pre_data_pos, const char *delimiters, sldns_rdf_type rdftype, size_t *token_strlen)
| Parse one rdf token.
static int | sldns_affix_token (sldns_buffer *strbuf, char *token, size_t *token_len, int *quoted, int *parens, size_t *pre_data_pos, const char *delimiters, sldns_rdf_type rdftype, size_t *token_strlen)
| Add space and one more rdf token onto the existing token string.
static int | sldns_str2wire_svcparam_key_cmp (const void *a, const void *b)
static int | sldns_str2wire_check_svcbparams (uint8_t *rdata, uint16_t rdata_len)
| Add constraints to the SVCB RRs which involve the whole set.
static int | rrinternal_parse_rdata (sldns_buffer *strbuf, char *token, size_t token_len, uint8_t *rr, size_t *rr_len, size_t dname_len, uint16_t rr_type, uint8_t *origin, size_t origin_len)
| parse rdata from string into rr buffer(-remainder after dname).
static int | sldns_str2wire_rr_buf_internal (const char *str, uint8_t *rr, size_t *len, size_t *dname_len, uint32_t default_ttl, uint8_t *origin, size_t origin_len, uint8_t *prev, size_t prev_len, int question)
int | sldns_str2wire_rr_buf (const char *str, uint8_t *rr, size_t *len, size_t *dname_len, uint32_t default_ttl, uint8_t *origin, size_t origin_len, uint8_t *prev, size_t prev_len)
| Convert text RR to wireformat, with user buffer.
int | sldns_str2wire_rr_question_buf (const char *str, uint8_t *rr, size_t *len, size_t *dname_len, uint8_t *origin, size_t origin_len, uint8_t *prev, size_t prev_len)
| Same as sldns_str2wire_rr_buf, but there is no rdata, it returns an RR with zero rdata and no ttl.
uint16_t | sldns_wirerr_get_type (uint8_t *rr, size_t len, size_t dname_len)
| Get the type of the RR.
uint16_t | sldns_wirerr_get_class (uint8_t *rr, size_t len, size_t dname_len)
| Get the class of the RR.
uint32_t | sldns_wirerr_get_ttl (uint8_t *rr, size_t len, size_t dname_len)
| Get the ttl of the RR.
uint16_t | sldns_wirerr_get_rdatalen (uint8_t *rr, size_t len, size_t dname_len)
| Get the rdata length of the RR.
uint8_t * | sldns_wirerr_get_rdata (uint8_t *rr, size_t len, size_t dname_len)
| Get the rdata pointer of the RR.
uint8_t * | sldns_wirerr_get_rdatawl (uint8_t *rr, size_t len, size_t dname_len)
| Get the rdata pointer of the RR.
const char * | sldns_get_errorstr_parse (int e)
| Get reference to a constant string for the (parse) error.
char * | sldns_strip_ws (char *line)
| Strip whitespace from the start and the end of line.
int | sldns_fp2wire_rr_buf (FILE *in, uint8_t *rr, size_t *len, size_t *dname_len, struct sldns_file_parse_state *parse_state)
| Read one RR from zonefile with buffer for the data.
static int | sldns_str2wire_svcparam_key_lookup (const char *key, size_t key_len)
static int | sldns_str2wire_svcparam_port (const char *val, uint8_t *rd, size_t *rd_len)
static int | sldns_str2wire_svcbparam_ipv4hint (const char *val, uint8_t *rd, size_t *rd_len)
static int | sldns_str2wire_svcbparam_ipv6hint (const char *val, uint8_t *rd, size_t *rd_len)
static int | sldns_network_uint16_cmp (const void *a, const void *b)
static int | sldns_str2wire_svcbparam_mandatory (const char *val, uint8_t *rd, size_t *rd_len)
static int | sldns_str2wire_svcbparam_ech_value (const char *val, uint8_t *rd, size_t *rd_len)
static const char * | sldns_str2wire_svcbparam_parse_next_unescaped_comma (const char *val)
static size_t | sldns_str2wire_svcbparam_parse_copy_unescaped (uint8_t *dst, const char *src, size_t len)
static int | sldns_str2wire_svcbparam_alpn_value (const char *val, uint8_t *rd, size_t *rd_len)
static int | sldns_str2wire_svcbparam_dohpath_value (const char *val, uint8_t *rd, size_t *rd_len)
static int | sldns_str2wire_svcparam_value (const char *key, size_t key_len, const char *val, uint8_t *rd, size_t *rd_len)
static int | sldns_str2wire_svcparam_buf (const char *str, uint8_t *rd, size_t *rd_len)
int | sldns_str2wire_rdf_buf (const char *str, uint8_t *rd, size_t *len, sldns_rdf_type rdftype)
| Convert one rdf in rdata to wireformat and parse from string.
int | sldns_str2wire_int8_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_INT8 from string to wireformat.
int | sldns_str2wire_int16_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_INT16 from string to wireformat.
int | sldns_str2wire_int32_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_INT32 from string to wireformat.
int | sldns_str2wire_a_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_A from string to wireformat.
int | sldns_str2wire_aaaa_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_AAAA from string to wireformat.
int | sldns_str2wire_str_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_STR from string to wireformat.
int | sldns_str2wire_apl_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_APL from string to wireformat.
int | sldns_str2wire_b64_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_B64 from string to wireformat.
int | sldns_str2wire_b32_ext_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_B32_EXT from string to wireformat.
static int | sldns_is_last_of_string (const char *str)
| see if the string ends, or ends in whitespace
int | sldns_str2wire_hex_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_HEX from string to wireformat.
int | sldns_str2wire_nsec_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_NSEC from string to wireformat.
int | sldns_str2wire_type_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_TYPE from string to wireformat.
int | sldns_str2wire_class_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_CLASS from string to wireformat.
int | sldns_str2wire_cert_alg_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_CERT_ALG from string to wireformat.
int | sldns_str2wire_alg_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_ALG from string to wireformat.
int | sldns_str2wire_tsigerror_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_TSIGERROR from string to wireformat.
int | sldns_str2wire_time_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_TIME from string to wireformat.
int | sldns_str2wire_tsigtime_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_TSIGTIME from string to wireformat.
int | sldns_str2wire_period_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_PERIOD from string to wireformat.
static int | loc_parse_cm (char *my_str, char **endstr, uint8_t *m, uint8_t *e)
| read "<digits>[.<digits>][mM]" into mantissa exponent format for LOC type
int | sldns_str2wire_loc_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_LOC from string to wireformat.
static void | ldns_tolower_str (char *s)
int | sldns_str2wire_wks_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_WKS from string to wireformat.
int | sldns_str2wire_nsap_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_NSAP from string to wireformat.
int | sldns_str2wire_atma_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_ATMA from string to wireformat.
int | sldns_str2wire_ipseckey_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_IPSECKEY from string to wireformat.
int | sldns_str2wire_nsec3_salt_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_NSEC3_SALT from string to wireformat.
int | sldns_str2wire_ilnp64_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_ILNP64 from string to wireformat.
int | sldns_str2wire_eui48_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_EUI48 from string to wireformat.
int | sldns_str2wire_eui64_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_EUI64 from string to wireformat.
int | sldns_str2wire_unquoted_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_UNQUOTED from string to wireformat.
int | sldns_str2wire_tag_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_TAG from string to wireformat.
int | sldns_str2wire_long_str_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_LONG_STR from string to wireformat.
int | sldns_str2wire_hip_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_HIP from string to wireformat.
int | sldns_str2wire_int16_data_buf (const char *str, uint8_t *rd, size_t *len)
| Convert rdf of type LDNS_RDF_TYPE_INT16_DATA from string to wireformat.

## Detailed Description

str2wire.c - read txt presentation of RRs

(c) NLnet Labs, 2005-2006

See the file LICENSE for the license

Parses text to wireformat.

## Macro Definition Documentation

## ◆ RET_ERR

#define RET_ERR | ( |  | e,
|  |  | off )

Value:
((int)(((e)&LDNS_WIREPARSE_MASK)|(((off)&RET_OFFSET_MASK)<<LDNS_WIREPARSE_SHIFT)))
RET_OFFSET_MASK
#define RET_OFFSET_MASK
bits for the offset
Definition str2wire.c:29
LDNS_WIREPARSE_MASK
#define LDNS_WIREPARSE_MASK
Parse result codes.
Definition str2wire.h:188

return an error

Referenced by rrinternal_get_class(), rrinternal_get_owner(), rrinternal_get_ttl(), rrinternal_get_type(), rrinternal_parse_rdata(), rrinternal_parse_rdf(), rrinternal_parse_unknown(), rrinternal_spool_hex(), rrinternal_write_typeclassttl(), sldns_str2wire_atma_buf(), sldns_str2wire_dname_buf_origin(), sldns_str2wire_hex_buf(), sldns_str2wire_hip_buf(), sldns_str2wire_int16_buf(), sldns_str2wire_int16_data_buf(), sldns_str2wire_int32_buf(), sldns_str2wire_int8_buf(), sldns_str2wire_ipseckey_buf(), sldns_str2wire_nsap_buf(), sldns_str2wire_nsec3_salt_buf(), sldns_str2wire_nsec_buf(), sldns_str2wire_period_buf(), sldns_str2wire_str_buf(), sldns_str2wire_tag_buf(), sldns_str2wire_time_buf(), sldns_str2wire_tsigtime_buf(), and sldns_str2wire_wks_buf().

## ◆ RET_ERR_SHIFT

#define RET_ERR_SHIFT | ( |  | e,
|  |  | move )

Value:
RET_ERR(LDNS_WIREPARSE_ERROR(e), LDNS_WIREPARSE_OFFSET(e)+(move));
RET_ERR
#define RET_ERR(e, off)
return an error
Definition str2wire.c:31

Move parse error but keep its ID.

Referenced by rrinternal_get_owner(), rrinternal_parse_rdf(), rrinternal_parse_unknown(), sldns_str2wire_hip_buf(), and sldns_str2wire_ipseckey_buf().

## Function Documentation

## ◆ sldns_str2wire_dname_buf()

int sldns_str2wire_dname_buf | ( | const char * | str,
|  | uint8_t * | buf,
|  | size_t * | len )

Convert text string into dname wireformat, mallocless, with user buffer.

Parameters

  str | the text string with the domain name.
  buf | the result buffer, suggested size LDNS_MAX_DOMAINLEN+1
  len | length of the buffer on input, length of the result on output.

Returns
  0 on success, otherwise an error.

Referenced by auth_zones_find_or_add_zone(), dname_to_buf(), do_cache_lookup(), get_origin(), http_parse_origin(), lz_enter_override(), lz_enter_zone_tag(), parse_arg_name(), q_ans_parse(), rpz_apply_cfg_elements(), sldns_fp2wire_rr_buf(), sldns_str2wire_dname(), sldns_str2wire_ipseckey_buf(), sldns_str2wire_rdf_buf(), xfr_probe_lookup_host(), and xfr_transfer_lookup_host().

## ◆ sldns_str2wire_dname_buf_origin()

int sldns_str2wire_dname_buf_origin | ( | const char * | str,
|  | uint8_t * | buf,
|  | size_t * | len,
|  | uint8_t * | origin,
|  | size_t | origin_len )

Same as sldns_str2wire_dname_buf, but concatenates origin if the domain name is relative (does not end in '.

').

Parameters

  str | the text string with the domain name.
  buf | the result buffer, suggested size LDNS_MAX_DOMAINLEN+1
  len | length of the buffer on input, length of the result on output.
  origin | the origin to append or NULL (nothing is appended).
  origin_len | length of origin.

Returns
  0 on success, otherwise an error.

References LDNS_MAX_DOMAINLEN, and RET_ERR.

Referenced by generate_keytag_query(), rrinternal_get_owner(), and rrinternal_parse_rdf().

## ◆ sldns_str2wire_dname()

uint8_t * sldns_str2wire_dname | ( | const char * | str,
|  | size_t * | len )

Convert text string into dname wireformat.

Parameters

  str | the text string with the domain name.
  len | returned length of wireformat.

Returns
  wireformat dname (malloced) or NULL on failure.

References LDNS_MAX_DOMAINLEN, and sldns_str2wire_dname_buf().

Referenced by ah(), anchor_insert_insecure(), authextstrtodname(), authtest_addzone(), caps_white_apply_cfg(), dns64_insert_ignore_aaaa(), do_infra_rtt(), domain_limit_findcreate(), edns_ede_answer_encode_test(), handle_origin(), make_auth_holes(), make_stub_holes(), parse_dname(), parse_id(), qlist_parse_line(), read_fwds_name(), read_names(), read_stubs_name(), setup_qinfo_edns(), and write_q().

## ◆ sldns_parse_rdf_token()

int sldns_parse_rdf_token | ( | sldns_buffer * | strbuf,
|  | char * | token,
|  | size_t | token_len,
|  | int * | quoted,
|  | int * | parens,
|  | size_t * | pre_data_pos,
|  | const char * | delimiters,
|  | sldns_rdf_type | rdftype,
|  | size_t * | token_strlen )
| static

Parse one rdf token.

Takes care of quotes and parenthesis.

References sldns_buffer_current(), sldns_buffer_position(), sldns_buffer_remaining(), and sldns_buffer_skip().

Referenced by rrinternal_parse_rdata(), and sldns_affix_token().

## ◆ sldns_str2wire_rr_buf()

int sldns_str2wire_rr_buf | ( | const char * | str,
|  | uint8_t * | rr,
|  | size_t * | len,
|  | size_t * | dname_len,
|  | uint32_t | default_ttl,
|  | uint8_t * | origin,
|  | size_t | origin_len,
|  | uint8_t * | prev,
|  | size_t | prev_len )

Convert text RR to wireformat, with user buffer.

Parameters

  str | the RR data in text presentation format.
  rr | the buffer where the result is stored into. This buffer has the wire-dname(uncompressed), type, class, ttl, rdatalen, rdata. These values are probably not aligned, and in network format. Use the sldns_wirerr_get_xxx functions to access them safely. buffer size LDNS_RR_BUF_SIZE is suggested.
  len | on input the length of the buffer, on output the amount of the buffer used for the rr.
  dname_len | if non-NULL, filled with the dname length as result. Because after the dname you find the type, class, ttl, rdatalen, rdata.
  default_ttl | TTL used if no TTL available.
  origin | used for origin dname (if not NULL)
  origin_len | length of origin.
  prev | used for prev_rr dname (if not NULL)
  prev_len | length of prev.

Returns
  0 on success, an error on failure.

Referenced by acl_view_tag_checks(), add_rr(), add_trustanchor_frm_str(), anchor_store_str(), check_data(), check_RR_syntax(), get_rr_nameclass(), http_parse_add_rr(), http_zonefile_syntax_check(), load_rr(), local_data_find_tag_datas(), rr_transform(), rrstr_get_rr_content(), and sldns_fp2wire_rr_buf().

## ◆ sldns_str2wire_rr_question_buf()

int sldns_str2wire_rr_question_buf | ( | const char * | str,
|  | uint8_t * | rr,
|  | size_t * | len,
|  | size_t * | dname_len,
|  | uint8_t * | origin,
|  | size_t | origin_len,
|  | uint8_t * | prev,
|  | size_t | prev_len )

Same as sldns_str2wire_rr_buf, but there is no rdata, it returns an RR with zero rdata and no ttl.

It has name, type, class. You can access those with the sldns_wirerr_get_type and class functions.

Parameters

  str | the RR data in text presentation format.
  rr | the buffer where the result is stored into.
  len | on input the length of the buffer, on output the amount of the buffer used for the rr.
  dname_len | if non-NULL, filled with the dname length as result. Because after the dname you find the type, class, ttl, rdatalen, rdata.
  origin | used for origin dname (if not NULL)
  origin_len | length of origin.
  prev | used for prev_rr dname (if not NULL)
  prev_len | length of prev.

Returns
  0 on success, an error on failure.

Referenced by add_rr(), do_expire_message(), do_flush_message(), load_qinfo(), and q_ans_parse().

## ◆ sldns_wirerr_get_type()

uint16_t sldns_wirerr_get_type | ( | uint8_t * | rr,
|  | size_t | len,
|  | size_t | dname_len )

Get the type of the RR.

Parameters

  rr | the RR in wire format.
  len | rr length.
  dname_len | dname length to skip.

Returns
  type in host byteorder

Referenced by add_trustanchor_frm_str(), anchor_read_file(), anchor_store_new_rr(), assemble_iterate_dnskey(), assemble_iterate_ds(), autr_cleanup_keys(), az_insert_rr(), az_parse_file(), az_remove_rr(), check_data(), do_expire_message(), do_flush_message(), get_rr_nameclass(), init_zsk_to_ksk(), load_qinfo(), load_rr(), local_data_find_tag_datas(), packed_rrset_heap_data(), q_ans_parse(), read_root_hints(), revoke_dnskey(), rrstr_get_rr_content(), sldns_wire2str_rr_comment_buf(), ta_compare(), ta_is_dnskey_sep(), and ub_packed_rrset_heap_key().

## ◆ sldns_wirerr_get_class()

uint16_t sldns_wirerr_get_class | ( | uint8_t * | rr,
|  | size_t | len,
|  | size_t | dname_len )

Get the class of the RR.

Parameters

  rr | the RR in wire format.
  len | rr length.
  dname_len | dname length to skip.

Returns
  class in host byteorder

Referenced by anchor_store_new_rr(), az_insert_rr(), az_remove_rr(), do_expire_message(), do_flush_message(), find_add_tp(), get_rr_nameclass(), http_zonefile_syntax_check(), load_qinfo(), load_rr(), q_ans_parse(), read_root_hints(), rrstr_get_rr_content(), and ub_packed_rrset_heap_key().

## ◆ sldns_wirerr_get_ttl()

uint32_t sldns_wirerr_get_ttl | ( | uint8_t * | rr,
|  | size_t | len,
|  | size_t | dname_len )

Get the ttl of the RR.

Parameters

  rr | the RR in wire format.
  len | rr length.
  dname_len | dname length to skip.

Returns
  ttl in host byteorder

Referenced by az_insert_rr(), load_rr(), local_data_find_tag_datas(), packed_rrset_heap_data(), rrstr_get_rr_content(), and sldns_fp2wire_rr_buf().

## ◆ sldns_wirerr_get_rdatalen()

uint16_t sldns_wirerr_get_rdatalen | ( | uint8_t * | rr,
|  | size_t | len,
|  | size_t | dname_len )

Get the rdata length of the RR.

Parameters

  rr | the RR in wire format.
  len | rr length.
  dname_len | dname length to skip.

Returns
  rdata length in host byteorder If the rdata length is larger than the rr-len allows, it is truncated. So, that it is safe to read the data length returned from this function from the rdata pointer of sldns_wirerr_get_rdata.

Referenced by anchor_store_new_rr(), az_insert_rr(), az_remove_rr(), check_contains_revoked(), load_rr(), local_data_find_tag_datas(), packed_rrset_heap_data(), read_root_hints(), revoke_dnskey(), rrstr_get_rr_content(), ta_compare(), ta_is_dnskey_sep(), and verbose_key().

## ◆ sldns_wirerr_get_rdata()

uint8_t * sldns_wirerr_get_rdata | ( | uint8_t * | rr,
|  | size_t | len,
|  | size_t | dname_len )

Get the rdata pointer of the RR.

Parameters

  rr | the RR in wire format.
  len | rr length.
  dname_len | dname length to skip.

Returns
  rdata pointer

Referenced by check_contains_revoked(), read_root_hints(), revoke_dnskey(), ta_compare(), ta_is_dnskey_sep(), and verbose_key().

## ◆ sldns_wirerr_get_rdatawl()

uint8_t * sldns_wirerr_get_rdatawl | ( | uint8_t * | rr,
|  | size_t | len,
|  | size_t | dname_len )

Get the rdata pointer of the RR.

prefixed with rdata length.

Parameters

  rr | the RR in wire format.
  len | rr length.
  dname_len | dname length to skip.

Returns
  pointer to rdatalength, followed by the rdata.

Referenced by anchor_store_new_rr(), az_insert_rr(), az_remove_rr(), load_rr(), local_data_find_tag_datas(), packed_rrset_heap_data(), and rrstr_get_rr_content().

## ◆ sldns_get_errorstr_parse()

const char * sldns_get_errorstr_parse | ( | int | e | ) |

Get reference to a constant string for the (parse) error.

Parameters

  e | error return value

Returns
  string.

References sldns_wireparse_errors.

Referenced by acl_view_tag_checks(), add_rr(), add_trustanchor_frm_str(), anchor_read_file(), anchor_store_str(), az_parse_file(), check_data(), check_RR_syntax(), dname_to_buf(), do_cache_lookup(), get_origin(), get_rr_nameclass(), http_parse_add_rr(), http_zonefile_syntax_check(), load_qinfo(), load_rr(), parse_arg_name(), q_ans_parse(), read_root_hints(), rr_transform(), and rrstr_get_rr_content().

## ◆ sldns_strip_ws()

char * sldns_strip_ws | ( | char * | line | ) |

Strip whitespace from the start and the end of line.

Parameters

  line | modified with 0 to shorten it.

Returns
  new start with spaces skipped.

Referenced by http_parse_origin(), http_parse_ttl(), and sldns_fp2wire_rr_buf().

## ◆ sldns_fp2wire_rr_buf()

int sldns_fp2wire_rr_buf | ( | FILE * | in,
|  | uint8_t * | rr,
|  | size_t * | len,
|  | size_t * | dname_len,
|  | struct sldns_file_parse_state * | parse_state )

Read one RR from zonefile with buffer for the data.

Parameters

  in | file that is read from (one RR, multiple lines if it spans them).
  rr | this is malloced by the user and the result is stored here, if an RR is read. If no RR is read this is signalled with the return len set to 0 (for ORIGIN, TTL directives). The read line is available in the rr_buf (zero terminated), for $DIRECTIVE style elements.
  len | on input, the length of the rr buffer. on output the rr len. Buffer size of 64k should be enough.
  dname_len | returns the length of the dname initial part of the rr.
  parse_state | pass a pointer to user-allocated struct. Contents are maintained by this function. If you pass NULL then ORIGIN and TTL directives are not honored. You can start out with a particular origin by pre-filling it. otherwise, zero the structure before passing it. lineno is incremented when a newline is passed by the parser, you should initialize it at 1 at the start of the file.

Returns
  0 on success, error on failure.

References sldns_file_parse_state::default_ttl, LDNS_RR_BUF_SIZE, sldns_file_parse_state::lineno, sldns_file_parse_state::origin, sldns_file_parse_state::origin_len, sldns_file_parse_state::prev_rr, sldns_file_parse_state::prev_rr_len, sldns_str2period(), sldns_str2wire_dname_buf(), sldns_str2wire_rr_buf(), sldns_strip_ws(), and sldns_wirerr_get_ttl().

Referenced by anchor_read_file(), az_parse_file(), and read_root_hints().

## ◆ sldns_str2wire_rdf_buf()

int sldns_str2wire_rdf_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len,
|  | sldns_rdf_type | rdftype )

Convert one rdf in rdata to wireformat and parse from string.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.
  rdftype | the type of the rdf.

Returns
  0 on success, error on failure.

References LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_AAAA, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_APL, LDNS_RDF_TYPE_ATMA, LDNS_RDF_TYPE_B32_EXT, LDNS_RDF_TYPE_B64, LDNS_RDF_TYPE_CERT_ALG, LDNS_RDF_TYPE_CLASS, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_EUI48, LDNS_RDF_TYPE_EUI64, LDNS_RDF_TYPE_HEX, LDNS_RDF_TYPE_HIP, LDNS_RDF_TYPE_ILNP64, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16_DATA, LDNS_RDF_TYPE_INT32, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_IPSECKEY, LDNS_RDF_TYPE_LOC, LDNS_RDF_TYPE_LONG_STR, LDNS_RDF_TYPE_NONE, LDNS_RDF_TYPE_NSAP, LDNS_RDF_TYPE_NSEC, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC3_SALT, LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_SERVICE, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_TAG, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TSIGERROR, LDNS_RDF_TYPE_TSIGTIME, LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_UNKNOWN, LDNS_RDF_TYPE_UNQUOTED, LDNS_RDF_TYPE_WKS, sldns_str2wire_a_buf(), sldns_str2wire_aaaa_buf(), sldns_str2wire_alg_buf(), sldns_str2wire_apl_buf(), sldns_str2wire_atma_buf(), sldns_str2wire_b32_ext_buf(), sldns_str2wire_b64_buf(), sldns_str2wire_cert_alg_buf(), sldns_str2wire_class_buf(), sldns_str2wire_dname_buf(), sldns_str2wire_eui48_buf(), sldns_str2wire_eui64_buf(), sldns_str2wire_hex_buf(), sldns_str2wire_hip_buf(), sldns_str2wire_ilnp64_buf(), sldns_str2wire_int16_buf(), sldns_str2wire_int16_data_buf(), sldns_str2wire_int32_buf(), sldns_str2wire_int8_buf(), sldns_str2wire_ipseckey_buf(), sldns_str2wire_loc_buf(), sldns_str2wire_long_str_buf(), sldns_str2wire_nsap_buf(), sldns_str2wire_nsec3_salt_buf(), sldns_str2wire_nsec_buf(), sldns_str2wire_period_buf(), sldns_str2wire_str_buf(), sldns_str2wire_tag_buf(), sldns_str2wire_time_buf(), sldns_str2wire_tsigerror_buf(), sldns_str2wire_tsigtime_buf(), sldns_str2wire_type_buf(), sldns_str2wire_unquoted_buf(), and sldns_str2wire_wks_buf().

Referenced by rrinternal_parse_rdf().

## ◆ sldns_str2wire_int8_buf()

int sldns_str2wire_int8_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_INT8 from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR.

Referenced by sldns_str2wire_alg_buf(), and sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_int16_buf()

int sldns_str2wire_int16_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_INT16 from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR.

Referenced by sldns_str2wire_cert_alg_buf(), sldns_str2wire_rdf_buf(), and sldns_str2wire_tsigerror_buf().

## ◆ sldns_str2wire_int32_buf()

int sldns_str2wire_int32_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_INT32 from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR.

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_a_buf()

int sldns_str2wire_a_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_A from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

Referenced by sldns_str2wire_ipseckey_buf(), and sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_aaaa_buf()

int sldns_str2wire_aaaa_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_AAAA from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

Referenced by sldns_str2wire_ipseckey_buf(), and sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_str_buf()

int sldns_str2wire_str_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_STR from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, and sldns_parse_char().

Referenced by sldns_str2wire_rdf_buf(), and sldns_str2wire_unquoted_buf().

## ◆ sldns_str2wire_apl_buf()

int sldns_str2wire_apl_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_APL from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_b64_buf()

int sldns_str2wire_b64_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_B64 from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_b64_pton_calculate_size().

Referenced by sldns_str2wire_hip_buf(), sldns_str2wire_ipseckey_buf(), and sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_b32_ext_buf()

int sldns_str2wire_b32_ext_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_B32_EXT from string to wireformat.

And also LDNS_RDF_TYPE_NSEC3_NEXT_OWNER.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_b32_pton_calculate_size(), and sldns_b32_pton_extended_hex().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_hex_buf()

int sldns_str2wire_hex_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_HEX from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, sldns_hexdigit_to_int(), and sldns_is_last_of_string().

Referenced by sldns_str2wire_hip_buf(), sldns_str2wire_rdf_buf(), and zonemd_check_test().

## ◆ sldns_str2wire_nsec_buf()

int sldns_str2wire_nsec_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_NSEC from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, sldns_buffer_init_frm_data(), sldns_buffer_position(), sldns_buffer_remaining(), and sldns_get_rr_type_by_name().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_type_buf()

int sldns_str2wire_type_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_TYPE from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_get_rr_type_by_name().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_class_buf()

int sldns_str2wire_class_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_CLASS from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_get_rr_class_by_name().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_cert_alg_buf()

int sldns_str2wire_cert_alg_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_CERT_ALG from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_cert_algorithms, and sldns_str2wire_int16_buf().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_alg_buf()

int sldns_str2wire_alg_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_ALG from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_algorithms, and sldns_str2wire_int8_buf().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_tsigerror_buf()

int sldns_str2wire_tsigerror_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_TSIGERROR from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_str2wire_int16_buf(), and sldns_tsig_errors.

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_time_buf()

int sldns_str2wire_time_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_TIME from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, and sldns_mktime_from_utc().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_tsigtime_buf()

int sldns_str2wire_tsigtime_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_TSIGTIME from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR.

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_period_buf()

int sldns_str2wire_period_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_PERIOD from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, and sldns_str2period().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_loc_buf()

int sldns_str2wire_loc_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_LOC from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References loc_parse_cm().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_wks_buf()

int sldns_str2wire_wks_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_WKS from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, sldns_buffer_init_frm_data(), and sldns_buffer_position().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_nsap_buf()

int sldns_str2wire_nsap_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_NSAP from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, and sldns_hexdigit_to_int().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_atma_buf()

int sldns_str2wire_atma_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_ATMA from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, and sldns_hexdigit_to_int().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_ipseckey_buf()

int sldns_str2wire_ipseckey_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_IPSECKEY from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, RET_ERR_SHIFT, sldns_buffer_current(), sldns_buffer_init_frm_data(), sldns_buffer_position(), sldns_str2wire_a_buf(), sldns_str2wire_aaaa_buf(), sldns_str2wire_b64_buf(), and sldns_str2wire_dname_buf().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_nsec3_salt_buf()

int sldns_str2wire_nsec3_salt_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_NSEC3_SALT from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, and sldns_hexdigit_to_int().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_ilnp64_buf()

int sldns_str2wire_ilnp64_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_ILNP64 from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_eui48_buf()

int sldns_str2wire_eui48_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_EUI48 from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_eui64_buf()

int sldns_str2wire_eui64_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_EUI64 from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_unquoted_buf()

int sldns_str2wire_unquoted_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_UNQUOTED from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_str2wire_str_buf().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_tag_buf()

int sldns_str2wire_tag_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_TAG from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR.

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_long_str_buf()

int sldns_str2wire_long_str_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_LONG_STR from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References sldns_parse_char().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_hip_buf()

int sldns_str2wire_hip_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_HIP from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR, RET_ERR_SHIFT, sldns_str2wire_b64_buf(), and sldns_str2wire_hex_buf().

Referenced by sldns_str2wire_rdf_buf().

## ◆ sldns_str2wire_int16_data_buf()

int sldns_str2wire_int16_data_buf | ( | const char * | str,
|  | uint8_t * | rd,
|  | size_t * | len )

Convert rdf of type LDNS_RDF_TYPE_INT16_DATA from string to wireformat.

Parameters

  str | the text to convert for this rdata element.
  rd | rdata buffer for the wireformat.
  len | length of rd buffer on input, used length on output.

Returns
  0 on success, error on failure.

References RET_ERR.

Referenced by sldns_str2wire_rdf_buf().