21 #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
22 #error "Only <gnunet_util_lib.h> can be included directly."
40 #ifndef GNUNET_DNSPARSER_LIB_H
41 #define GNUNET_DNSPARSER_LIB_H
46 #define GNUNET_DNSPARSER_MAX_LABEL_LENGTH 63
51 #define GNUNET_DNSPARSER_MAX_NAME_LENGTH 253
57 #define GNUNET_DNSPARSER_TYPE_ANY 0
58 #define GNUNET_DNSPARSER_TYPE_A 1
59 #define GNUNET_DNSPARSER_TYPE_NS 2
60 #define GNUNET_DNSPARSER_TYPE_CNAME 5
61 #define GNUNET_DNSPARSER_TYPE_SOA 6
62 #define GNUNET_DNSPARSER_TYPE_PTR 12
63 #define GNUNET_DNSPARSER_TYPE_MX 15
64 #define GNUNET_DNSPARSER_TYPE_TXT 16
65 #define GNUNET_DNSPARSER_TYPE_RP 17
66 #define GNUNET_DNSPARSER_TYPE_AFSDB 18
67 #define GNUNET_DNSPARSER_TYPE_SIG 24
68 #define GNUNET_DNSPARSER_TYPE_KEY 25
69 #define GNUNET_DNSPARSER_TYPE_AAAA 28
70 #define GNUNET_DNSPARSER_TYPE_LOC 29
71 #define GNUNET_DNSPARSER_TYPE_SRV 33
72 #define GNUNET_DNSPARSER_TYPE_NAPTR 35
73 #define GNUNET_DNSPARSER_TYPE_KX 36
74 #define GNUNET_DNSPARSER_TYPE_CERT 37
75 #define GNUNET_DNSPARSER_TYPE_DNAME 39
76 #define GNUNET_DNSPARSER_TYPE_APL 42
77 #define GNUNET_DNSPARSER_TYPE_DS 43
78 #define GNUNET_DNSPARSER_TYPE_SSHFP 44
79 #define GNUNET_DNSPARSER_TYPE_IPSECKEY 45
80 #define GNUNET_DNSPARSER_TYPE_RRSIG 46
81 #define GNUNET_DNSPARSER_TYPE_NSEC 47
82 #define GNUNET_DNSPARSER_TYPE_DNSKEY 48
83 #define GNUNET_DNSPARSER_TYPE_DHCID 49
84 #define GNUNET_DNSPARSER_TYPE_NSEC3 50
85 #define GNUNET_DNSPARSER_TYPE_NSEC3PARAM 51
86 #define GNUNET_DNSPARSER_TYPE_TLSA 52
87 #define GNUNET_DNSPARSER_TYPE_HIP 55
88 #define GNUNET_DNSPARSER_TYPE_CDS 59
89 #define GNUNET_DNSPARSER_TYPE_CDNSKEY 60
90 #define GNUNET_DNSPARSER_TYPE_OPENPGPKEY 61
91 #define GNUNET_DNSPARSER_TYPE_TKEY 249
92 #define GNUNET_DNSPARSER_TYPE_TSIG 250
93 #define GNUNET_DNSPARSER_TYPE_ALL 255
94 #define GNUNET_DNSPARSER_TYPE_URI 256
95 #define GNUNET_DNSPARSER_TYPE_CAA 257
96 #define GNUNET_DNSPARSER_TYPE_TA 32768
597 size_t udp_payload_length);
760 size_t udp_payload_length,
776 size_t udp_payload_length,
792 size_t udp_payload_length,
808 size_t udp_payload_length,
823 size_t udp_payload_length,
838 size_t udp_payload_length,
853 size_t udp_payload_length,
static size_t data_size
Number of bytes in data.
uint32_t data
The data value.
static struct GNUNET_REVOCATION_Query * q
Handle for revocation query.
static struct GNUNET_OS_Process * p
Helper process we started.
GNUNET_DNSPARSER_CertAlgorithm
DNSCERT algorithms as defined in http://www.iana.org/assignments/ dns-sec-alg-numbers/dns-sec-alg-num...
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.
void GNUNET_DNSPARSER_free_packet(struct GNUNET_DNSPARSER_Packet *p)
Free memory taken by a packet.
int GNUNET_DNSPARSER_builder_add_query(char *dst, size_t dst_len, size_t *off, const struct GNUNET_DNSPARSER_Query *query)
Add a DNS query to the UDP packet at the given location.
GNUNET_DNSPARSER_CertType
DNS CERT types as defined in RFC 4398.
struct GNUNET_DNSPARSER_SrvRecord * GNUNET_DNSPARSER_duplicate_srv_record(const struct GNUNET_DNSPARSER_SrvRecord *r)
Duplicate (deep-copy) the given DNS record.
char * GNUNET_DNSPARSER_bin_to_hex(const void *data, size_t data_size)
Convert a block of binary data to HEX.
void GNUNET_DNSPARSER_free_record(struct GNUNET_DNSPARSER_Record *r)
Free the given DNS record.
void GNUNET_DNSPARSER_free_cert(struct GNUNET_DNSPARSER_CertRecord *cert)
Free CERT information record.
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.
struct GNUNET_DNSPARSER_Packet * GNUNET_DNSPARSER_parse(const char *udp_payload, size_t udp_payload_length)
Parse a UDP payload of a DNS packet in to a nice struct for further processing and manipulation.
int GNUNET_DNSPARSER_check_name(const char *name)
Check if a hostname in UTF-8 format can be coded into valid IDNA.
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.
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.
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.
struct GNUNET_DNSPARSER_MxRecord * GNUNET_DNSPARSER_duplicate_mx_record(const struct GNUNET_DNSPARSER_MxRecord *r)
Duplicate (deep-copy) the given DNS record.
int GNUNET_DNSPARSER_parse_query(const char *udp_payload, size_t udp_payload_length, size_t *off, struct GNUNET_DNSPARSER_Query *q)
Parse a DNS query entry.
int GNUNET_DNSPARSER_pack(const struct GNUNET_DNSPARSER_Packet *p, uint16_t max, char **buf, size_t *buf_length)
Given a DNS packet p, generate the corresponding UDP payload.
int GNUNET_DNSPARSER_parse_record(const char *udp_payload, size_t udp_payload_length, size_t *off, struct GNUNET_DNSPARSER_Record *r)
Parse a DNS record entry.
int GNUNET_DNSPARSER_check_label(const char *label)
Check if a label in UTF-8 format can be coded into valid IDNA.
struct GNUNET_DNSPARSER_SoaRecord * GNUNET_DNSPARSER_duplicate_soa_record(const struct GNUNET_DNSPARSER_SoaRecord *r)
Duplicate (deep-copy) the given DNS record.
struct GNUNET_DNSPARSER_Record * GNUNET_DNSPARSER_duplicate_record(const struct GNUNET_DNSPARSER_Record *r)
Duplicate (deep-copy) the given DNS record.
struct GNUNET_DNSPARSER_CertRecord * GNUNET_DNSPARSER_duplicate_cert_record(const struct GNUNET_DNSPARSER_CertRecord *r)
Duplicate (deep-copy) the given DNS record.
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.
@ GNUNET_DNSPARSER_CERTALGO_RSAMD5
RSA/MD5.
@ GNUNET_DNSPARSER_CERTALGO_RSASHA
RSA/SHA1.
@ GNUNET_DNSPARSER_CERTALGO_RSRVD9
Reserved.
@ GNUNET_DNSPARSER_CERTALGO_GOST_R34
GHOST R 34.10-2001.
@ GNUNET_DNSPARSER_CERTALGO_RSASHA256
RSA/SHA256.
@ GNUNET_DNSPARSER_CERTALGO_RSRVD4
Reserved.
@ GNUNET_DNSPARSER_CERTALGO_DSANSEC3
DSA/NSEC3/SHA.
@ GNUNET_DNSPARSER_CERTALGO_ECDSA_P256SHA256
ECDSA Curve P-256/SHA256.
@ GNUNET_DNSPARSER_CERTALGO_RSASHA512
RSA/SHA512.
@ GNUNET_DNSPARSER_CERTALGO_DH
Diffie-Hellman.
@ GNUNET_DNSPARSER_CERTALGO_ECDSA_P384SHA384
ECDSA Curve P-384/SHA384.
@ GNUNET_DNSPARSER_CERTALGO_RSANSEC3
RSA/NSEC3/SHA.
@ GNUNET_DNSPARSER_CERTALGO_DSASHA
DSA/SHA1.
@ GNUNET_DNSPARSER_CERTALGO_UNDEFINED
No defined.
@ GNUNET_DNSPARSER_CERTTYPE_SKPI
A SKPI certificate.
@ GNUNET_DNSPARSER_CERTTYPE_ISKPI
A SKPI cert URL.
@ GNUNET_DNSPARSER_CERTTYPE_IPGP
A PGP cert fingerprint and URL.
@ GNUNET_DNSPARSER_CERTTYPE_IACKPIX
An attribute cert URL.
@ GNUNET_DNSPARSER_CERTTYPE_PGP
A PGP certificate.
@ GNUNET_DNSPARSER_CERTTYPE_ACPKIX
An attribute Certificate.
@ GNUNET_DNSPARSER_CERTTYPE_RESERVED
Reserved value.
@ GNUNET_DNSPARSER_CERTTYPE_PKIX
An x509 PKIX certificate.
@ GNUNET_DNSPARSER_CERTTYPE_IPKIX
An x509 PKIX cert URL.
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).
Easy-to-process, parsed version of a DNS packet.
struct GNUNET_DNSPARSER_Query * queries
Array of all queries in the packet, must contain "num_queries" entries.
unsigned int num_answers
Number of answers in the packet, should be 0 for queries.
struct GNUNET_TUN_DnsFlags flags
Bitfield of DNS flags.
struct GNUNET_DNSPARSER_Record * answers
Array of all answers in the packet, must contain "num_answers" entries.
unsigned int num_additional_records
Number of additional records in the packet, should be 0 for queries.
struct GNUNET_DNSPARSER_Record * additional_records
Array of all additional answers in the packet, must contain "num_additional_records" entries.
struct GNUNET_DNSPARSER_Record * authority_records
Array of all authority records in the packet, must contain "num_authority_records" entries.
unsigned int num_authority_records
Number of authoritative answers in the packet, should be 0 for queries.
unsigned int num_queries
Number of queries in the packet.
uint16_t id
DNS ID (to match replies to requests).
uint16_t dns_traffic_class
See GNUNET_TUN_DNS_CLASS_*.
uint16_t type
See GNUNET_DNSPARSER_TYPE_*.
char * name
Name of the record that the query is for (0-terminated).
Binary record information (unparsed).
void * data
Binary record data.
size_t data_len
Number of bytes in data.
uint16_t dns_traffic_class
See GNUNET_TUN_DNS_CLASS_*.
struct GNUNET_DNSPARSER_SoaRecord * soa
SOA data for SOA records.
struct GNUNET_DNSPARSER_SrvRecord * srv
SRV data for SRV records.
struct GNUNET_DNSPARSER_MxRecord * mx
MX data for MX records.
char * hostname
For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
struct GNUNET_DNSPARSER_CertRecord * cert
CERT data for CERT records.
uint16_t type
See GNUNET_DNSPARSER_TYPE_*.
struct GNUNET_TIME_Absolute expiration_time
When does the record expire?
union GNUNET_DNSPARSER_Record::@24 data
Payload of the record (which one of these is valid depends on the 'type').
char * name
Name of the record that the query is for (0-terminated).
struct GNUNET_DNSPARSER_RawRecord raw
Raw data for all other types.
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.
Time for absolute times used by GNUnet, in microseconds.
DNS flags (largely RFC 1035 / RFC 2136).