47 char tmp[INET6_ADDRSTRLEN];
54 if (NULL == inet_ntop (AF_INET,
data, tmp,
sizeof(tmp)))
79 if ((NULL == cname) || (off !=
data_size))
102 "%s %s ( %u %u %u %u %u )",
137 if ((NULL == cert) || (off !=
data_size))
182 if (
data_size !=
sizeof(
struct in6_addr))
184 if (NULL == inet_ntop (AF_INET6,
data, tmp,
sizeof(tmp)))
225 (
unsigned int) tlsa->
usage,
248 memset (tag, 0,
sizeof(tag));
250 memcpy (tag, &caa[1], caa->
tag_len);
252 (
char *) &caa[1] + caa->
tag_len,
256 (
unsigned int) caa->
flags,
283 const char *mnemonic;
285 }
table[] = { {
"PKIX", 1 },
298 for (i = 0; NULL !=
table[i].mnemonic; i++)
299 if (0 == strcasecmp (mnemonic,
table[i].mnemonic))
316 const char *mnemonic;
318 }
table[] = { {
"RSAMD5", 1 },
324 {
"PRIVATEDNS", 253 },
325 {
"PRIVATEOID", 254 },
329 for (i = 0; NULL !=
table[i].mnemonic; i++)
330 if (0 == strcasecmp (mnemonic,
table[i].mnemonic))
354 struct in_addr value_a;
355 struct in6_addr value_aaaa;
363 if (1 != inet_pton (AF_INET, s, &value_a))
366 _ (
"Unable to parse IPv4 address `%s'\n"),
384 _ (
"Failed to serialize NS record with value `%s'\n"),
405 _ (
"Failed to serialize CNAME record with value `%s'\n"),
429 typep = strtok (sdup,
" ");
430 if ((NULL == typep) ||
432 ((1 != sscanf (typep,
"%u", &
type)) || (
type > UINT16_MAX))))
437 keyp = strtok (NULL,
" ");
438 if ((NULL == keyp) || (1 != sscanf (keyp,
"%u", &
key)) ||
445 algp = strtok (NULL,
" ");
446 if ((NULL == algp) ||
448 ((1 != sscanf (algp,
"%u", &alg)) || (alg > UINT8_MAX))))
453 certp = strtok (NULL,
" ");
454 if ((NULL == certp) || (0 == strlen (certp)))
461 (
void **) &cert_data);
479 _ (
"Failed to serialize CERT record with %u bytes\n"),
480 (
unsigned int) cert_size);
495 char soa_rname[253 + 1];
496 char soa_mname[253 + 1];
497 unsigned int soa_serial;
498 unsigned int soa_refresh;
499 unsigned int soa_retry;
500 unsigned int soa_expire;
501 unsigned int soa_min;
505 "%253s %253s ( %u %u %u %u %u )",
515 _ (
"Unable to parse SOA record `%s'\n"),
519 soa.
mname = soa_mname;
520 soa.
rname = soa_rname;
521 soa.
serial = (uint32_t) soa_serial;
522 soa.
refresh = (uint32_t) soa_refresh;
523 soa.
retry = (uint32_t) soa_retry;
524 soa.
expire = (uint32_t) soa_expire;
532 _ (
"Failed to serialize SOA record with mname `%s' and rname `%s'\n"),
552 _ (
"Failed to serialize PTR record with value `%s'\n"),
566 unsigned int mx_pref;
569 if (2 != sscanf (s,
"%u %253s", &mx_pref,
mxhost))
572 _ (
"Unable to parse MX record `%s'\n"),
584 _ (
"Failed to serialize MX record with hostname `%s'\n"),
597 char srvtarget[253 + 1];
607 _ (
"Unable to parse SRV record `%s'\n"),
620 _ (
"Failed to serialize SRV record with target `%s'\n"),
636 if (1 != inet_pton (AF_INET6, s, &value_aaaa))
639 _ (
"Unable to parse IPv6 address `%s'\n"),
650 unsigned int selector;
651 unsigned int matching_type;
652 size_t slen = strlen (s) + 1;
655 if (4 != sscanf (s,
"%u %u %u %s", &
usage, &selector, &matching_type,
659 _ (
"Unable to parse TLSA record string `%s'\n"),
673 _ (
"Unable to parse TLSA record string `%s'\n"),
687 char value[strlen (s) + 1];
689 if (3 != sscanf (s,
"%u %s %[^\n]", &
flags, tag,
value))
692 _ (
"Unable to parse CAA record string `%s'\n"),
701 memcpy (&caa[1], tag, strlen (tag));
733 { NULL, UINT32_MAX } };
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
static size_t data_size
Number of bytes in data.
static uint16_t port
Port number.
struct GNUNET_HashCode key
The key used in the DHT.
uint32_t data
The data value.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
static char * value
Value of the record to add/remove.
static int result
Global testing status.
Plugin API for GNS record types.
int GNUNET_DNSPARSER_builder_add_name(char *dst, size_t dst_len, size_t *off, const char *name)
Add a DNS name to the UDP packet at the given location, converting the name to IDNA notation as neces...
int GNUNET_DNSPARSER_builder_add_cert(char *dst, size_t dst_len, size_t *off, const struct GNUNET_DNSPARSER_CertRecord *cert)
Add CERT record to the UDP packet at the given location.
struct GNUNET_DNSPARSER_SoaRecord * GNUNET_DNSPARSER_parse_soa(const char *udp_payload, size_t udp_payload_length, size_t *off)
Parse a DNS SOA record.
#define GNUNET_DNSPARSER_TYPE_TLSA
#define GNUNET_DNSPARSER_TYPE_CAA
char * GNUNET_DNSPARSER_bin_to_hex(const void *data, size_t data_size)
Convert a block of binary data to HEX.
#define GNUNET_DNSPARSER_TYPE_SRV
#define GNUNET_DNSPARSER_TYPE_SOA
void GNUNET_DNSPARSER_free_cert(struct GNUNET_DNSPARSER_CertRecord *cert)
Free CERT information record.
#define GNUNET_DNSPARSER_TYPE_CERT
#define GNUNET_DNSPARSER_TYPE_A
size_t GNUNET_DNSPARSER_hex_to_bin(const char *hex, void *data)
Convert a HEX string to block of binary data.
void GNUNET_DNSPARSER_free_srv(struct GNUNET_DNSPARSER_SrvRecord *srv)
Free SRV information record.
#define GNUNET_DNSPARSER_TYPE_PTR
struct GNUNET_DNSPARSER_MxRecord * GNUNET_DNSPARSER_parse_mx(const char *udp_payload, size_t udp_payload_length, size_t *off)
Parse a DNS MX record.
#define GNUNET_DNSPARSER_TYPE_NS
int GNUNET_DNSPARSER_builder_add_soa(char *dst, size_t dst_len, size_t *off, const struct GNUNET_DNSPARSER_SoaRecord *soa)
Add an SOA record to the UDP packet at the given location.
#define GNUNET_DNSPARSER_TYPE_CNAME
int GNUNET_DNSPARSER_builder_add_mx(char *dst, size_t dst_len, size_t *off, const struct GNUNET_DNSPARSER_MxRecord *mx)
Add an MX record to the UDP packet at the given location.
void GNUNET_DNSPARSER_free_soa(struct GNUNET_DNSPARSER_SoaRecord *soa)
Free SOA information record.
int GNUNET_DNSPARSER_builder_add_srv(char *dst, size_t dst_len, size_t *off, const struct GNUNET_DNSPARSER_SrvRecord *srv)
Add an SRV record to the UDP packet at the given location.
struct GNUNET_DNSPARSER_SrvRecord * GNUNET_DNSPARSER_parse_srv(const char *udp_payload, size_t udp_payload_length, size_t *off)
Parse a DNS SRV record.
void GNUNET_DNSPARSER_free_mx(struct GNUNET_DNSPARSER_MxRecord *mx)
Free MX information record.
struct GNUNET_DNSPARSER_CertRecord * GNUNET_DNSPARSER_parse_cert(const char *udp_payload, size_t udp_payload_length, size_t *off)
Parse a DNS CERT record.
#define GNUNET_DNSPARSER_TYPE_AAAA
#define GNUNET_DNSPARSER_TYPE_MX
#define GNUNET_DNSPARSER_TYPE_TXT
char * GNUNET_DNSPARSER_parse_name(const char *udp_payload, size_t udp_payload_length, size_t *off)
Parse name inside of a DNS query or record.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
@ GNUNET_ERROR_TYPE_ERROR
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
size_t GNUNET_STRINGS_base64_decode(const char *data, size_t len, void **output)
Decode from Base64.
size_t GNUNET_STRINGS_base64_encode(const void *in, size_t len, char **output)
Encode into Base64.
static struct PeerEntry ** table
Table with our interned peer IDs.
static const char * dns_number_to_typename(void *cls, uint32_t type)
Convert a type number to the corresponding type string (e.g.
static struct @23 name_map[]
Mapping of record type numbers to human-readable record type names.
static enum GNUNET_GenericReturnValue dns_is_critical(void *cls, uint32_t type)
static int dns_string_to_value(void *cls, uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'value' of a record to the binary representation.
void * libgnunet_plugin_gnsrecord_dns_done(void *cls)
Exit point from the plugin.
static char * dns_value_to_string(void *cls, uint32_t type, const void *data, size_t data_size)
Convert the 'value' of a record to a string.
static unsigned int rfc4398_mnemonic_to_value(const char *mnemonic)
Convert RFC 4394 Mnemonics to the corresponding integer values.
void * libgnunet_plugin_gnsrecord_dns_init(void *cls)
Entry point for the plugin.
static uint32_t dns_typename_to_number(void *cls, const char *dns_typename)
Convert a type name (e.g.
static unsigned int rfc4034_mnemonic_to_value(const char *mnemonic)
Convert RFC 4034 algorithm types to the corresponding integer values.
Information from CAA records (RFC 6844).
uint8_t flags
The flags of the CAA record.
uint8_t tag_len
The length of the tag.
Information from CERT records (RFC 4034).
enum GNUNET_DNSPARSER_CertType cert_type
Certificate type.
char * certificate_data
Data of the certificate.
enum GNUNET_DNSPARSER_CertAlgorithm algorithm
Algorithm.
size_t certificate_size
Number of bytes in certificate_data.
uint16_t cert_tag
Certificate KeyTag.
Information from MX records (RFC 1035).
char * mxhost
Name of the mail server.
uint16_t preference
Preference for this entry (lower value is higher preference).
Information from SOA records (RFC 1035).
uint32_t retry
Time interval that should elapse before a failed refresh should be retried.
char * mname
The domainname of the name server that was the original or primary source of data for this zone.
uint32_t refresh
Time interval before the zone should be refreshed.
uint32_t minimum_ttl
The bit minimum TTL field that should be exported with any RR from this zone.
char * rname
A domainname which specifies the mailbox of the person responsible for this zone.
uint32_t expire
Time value that specifies the upper limit on the time interval that can elapse before the zone is no ...
uint32_t serial
The version number of the original copy of the zone.
Information from SRV records (RFC 2782).
uint16_t port
TCP or UDP port of the service.
uint16_t weight
Relative weight for records with the same priority.
uint16_t priority
Preference for this entry (lower value is higher preference).
char * target
Hostname offering the service.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
GNUNET_GNSRECORD_IsCriticalFunction is_critical
Is critical.
GNUNET_GNSRECORD_TypenameToNumberFunction typename_to_number
Typename to number.
GNUNET_GNSRECORD_NumberToTypenameFunction number_to_typename
Number to typename.
GNUNET_GNSRECORD_ValueToStringFunction value_to_string
Conversion to string.
void * cls
Closure for all of the callbacks.
GNUNET_GNSRECORD_StringToValueFunction string_to_value
Conversion to binary.
Payload of DNS CERT record.
Payload of DNSSEC TLSA record.
uint8_t selector
Selector What part will be matched against the cert presented by server 0: Full cert (in binary) 1: F...
uint8_t matching_type
Matching type (of selected content) 0: exact match 1: SHA-256 hash 2: SHA-512 hash.
uint8_t usage
Certificate usage 0: CA cert 1: Entity cert 2: Trust anchor 3: domain-issued cert.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model