GNUnet 0.22.2
gnunet_dnsparser_lib.h File Reference

API for helper library to parse DNS packets. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_DNSPARSER_Query
 A DNS query. More...
 
struct  GNUNET_DNSPARSER_MxRecord
 Information from MX records (RFC 1035). More...
 
struct  GNUNET_DNSPARSER_SrvRecord
 Information from SRV records (RFC 2782). More...
 
struct  GNUNET_DNSPARSER_UriRecord
 Information from URI records (RFC 7553). More...
 
struct  GNUNET_DNSPARSER_CertRecord
 Information from CERT records (RFC 4034). More...
 
struct  GNUNET_DNSPARSER_SoaRecord
 Information from SOA records (RFC 1035). More...
 
struct  GNUNET_DNSPARSER_CaaRecord
 Information from CAA records (RFC 6844). More...
 
struct  GNUNET_DNSPARSER_RawRecord
 Binary record information (unparsed). More...
 
struct  GNUNET_DNSPARSER_Record
 A DNS response record. More...
 
struct  GNUNET_DNSPARSER_Packet
 Easy-to-process, parsed version of a DNS packet. More...
 

Macros

#define GNUNET_DNSPARSER_MAX_LABEL_LENGTH   63
 Maximum length of a label in DNS. More...
 
#define GNUNET_DNSPARSER_MAX_NAME_LENGTH   253
 Maximum length of a name in DNS. More...
 
#define GNUNET_DNSPARSER_TYPE_ANY   0
 A few common DNS types. More...
 
#define GNUNET_DNSPARSER_TYPE_A   1
 
#define GNUNET_DNSPARSER_TYPE_NS   2
 
#define GNUNET_DNSPARSER_TYPE_CNAME   5
 
#define GNUNET_DNSPARSER_TYPE_SOA   6
 
#define GNUNET_DNSPARSER_TYPE_PTR   12
 
#define GNUNET_DNSPARSER_TYPE_MX   15
 
#define GNUNET_DNSPARSER_TYPE_TXT   16
 
#define GNUNET_DNSPARSER_TYPE_RP   17
 
#define GNUNET_DNSPARSER_TYPE_AFSDB   18
 
#define GNUNET_DNSPARSER_TYPE_SIG   24
 
#define GNUNET_DNSPARSER_TYPE_KEY   25
 
#define GNUNET_DNSPARSER_TYPE_AAAA   28
 
#define GNUNET_DNSPARSER_TYPE_LOC   29
 
#define GNUNET_DNSPARSER_TYPE_SRV   33
 
#define GNUNET_DNSPARSER_TYPE_NAPTR   35
 
#define GNUNET_DNSPARSER_TYPE_KX   36
 
#define GNUNET_DNSPARSER_TYPE_CERT   37
 
#define GNUNET_DNSPARSER_TYPE_DNAME   39
 
#define GNUNET_DNSPARSER_TYPE_APL   42
 
#define GNUNET_DNSPARSER_TYPE_DS   43
 
#define GNUNET_DNSPARSER_TYPE_SSHFP   44
 
#define GNUNET_DNSPARSER_TYPE_IPSECKEY   45
 
#define GNUNET_DNSPARSER_TYPE_RRSIG   46
 
#define GNUNET_DNSPARSER_TYPE_NSEC   47
 
#define GNUNET_DNSPARSER_TYPE_DNSKEY   48
 
#define GNUNET_DNSPARSER_TYPE_DHCID   49
 
#define GNUNET_DNSPARSER_TYPE_NSEC3   50
 
#define GNUNET_DNSPARSER_TYPE_NSEC3PARAM   51
 
#define GNUNET_DNSPARSER_TYPE_TLSA   52
 
#define GNUNET_DNSPARSER_TYPE_SMIMEA   53
 
#define GNUNET_DNSPARSER_TYPE_HIP   55
 
#define GNUNET_DNSPARSER_TYPE_CDS   59
 
#define GNUNET_DNSPARSER_TYPE_CDNSKEY   60
 
#define GNUNET_DNSPARSER_TYPE_OPENPGPKEY   61
 
#define GNUNET_DNSPARSER_TYPE_TKEY   249
 
#define GNUNET_DNSPARSER_TYPE_TSIG   250
 
#define GNUNET_DNSPARSER_TYPE_ALL   255
 
#define GNUNET_DNSPARSER_TYPE_URI   256
 
#define GNUNET_DNSPARSER_TYPE_CAA   257
 
#define GNUNET_DNSPARSER_TYPE_TA   32768
 

Enumerations

enum  GNUNET_DNSPARSER_CertType {
  GNUNET_DNSPARSER_CERTTYPE_RESERVED = 0 , GNUNET_DNSPARSER_CERTTYPE_PKIX = 1 , GNUNET_DNSPARSER_CERTTYPE_SKPI = 2 , GNUNET_DNSPARSER_CERTTYPE_PGP = 3 ,
  GNUNET_DNSPARSER_CERTTYPE_IPKIX = 4 , GNUNET_DNSPARSER_CERTTYPE_ISKPI = 5 , GNUNET_DNSPARSER_CERTTYPE_IPGP = 6 , GNUNET_DNSPARSER_CERTTYPE_ACPKIX = 7 ,
  GNUNET_DNSPARSER_CERTTYPE_IACKPIX = 8
}
 DNS CERT types as defined in RFC 4398. More...
 
enum  GNUNET_DNSPARSER_CertAlgorithm {
  GNUNET_DNSPARSER_CERTALGO_UNDEFINED = 0 , GNUNET_DNSPARSER_CERTALGO_RSAMD5 = 1 , GNUNET_DNSPARSER_CERTALGO_DH = 2 , GNUNET_DNSPARSER_CERTALGO_DSASHA = 3 ,
  GNUNET_DNSPARSER_CERTALGO_RSRVD4 = 4 , GNUNET_DNSPARSER_CERTALGO_RSASHA = 5 , GNUNET_DNSPARSER_CERTALGO_DSANSEC3 = 6 , GNUNET_DNSPARSER_CERTALGO_RSANSEC3 = 7 ,
  GNUNET_DNSPARSER_CERTALGO_RSASHA256 = 8 , GNUNET_DNSPARSER_CERTALGO_RSRVD9 = 9 , GNUNET_DNSPARSER_CERTALGO_RSASHA512 = 10 , GNUNET_DNSPARSER_CERTALGO_GOST_R34 = 12 ,
  GNUNET_DNSPARSER_CERTALGO_ECDSA_P256SHA256 = 13 , GNUNET_DNSPARSER_CERTALGO_ECDSA_P384SHA384 = 14
}
 DNSCERT algorithms as defined in http://www.iana.org/assignments/ dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml, under dns-sec-alg-numbers-1. More...
 

Functions

int GNUNET_DNSPARSER_check_label (const char *label)
 Check if a label in UTF-8 format can be coded into valid IDNA. More...
 
int GNUNET_DNSPARSER_check_name (const char *name)
 Check if a hostname in UTF-8 format can be coded into valid IDNA. More...
 
struct GNUNET_DNSPARSER_PacketGNUNET_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. More...
 
void GNUNET_DNSPARSER_free_packet (struct GNUNET_DNSPARSER_Packet *p)
 Free memory taken by a packet. More...
 
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. More...
 
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 necessary. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int GNUNET_DNSPARSER_builder_add_uri (char *dst, size_t dst_len, size_t *off, const struct GNUNET_DNSPARSER_UriRecord *uri)
 Add an URI record to the UDP packet at the given location. More...
 
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. More...
 
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. More...
 
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. More...
 
struct GNUNET_DNSPARSER_SoaRecordGNUNET_DNSPARSER_parse_soa (const char *udp_payload, size_t udp_payload_length, size_t *off)
 Parse a DNS SOA record. More...
 
struct GNUNET_DNSPARSER_CertRecordGNUNET_DNSPARSER_parse_cert (const char *udp_payload, size_t udp_payload_length, size_t *off)
 Parse a DNS CERT record. More...
 
struct GNUNET_DNSPARSER_MxRecordGNUNET_DNSPARSER_parse_mx (const char *udp_payload, size_t udp_payload_length, size_t *off)
 Parse a DNS MX record. More...
 
struct GNUNET_DNSPARSER_SrvRecordGNUNET_DNSPARSER_parse_srv (const char *udp_payload, size_t udp_payload_length, size_t *off)
 Parse a DNS SRV record. More...
 
struct GNUNET_DNSPARSER_UriRecordGNUNET_DNSPARSER_parse_uri (const char *udp_payload, size_t udp_payload_length, size_t *off)
 Parse a DNS URI record. More...
 
struct GNUNET_DNSPARSER_RecordGNUNET_DNSPARSER_duplicate_record (const struct GNUNET_DNSPARSER_Record *r)
 Duplicate (deep-copy) the given DNS record. More...
 
struct GNUNET_DNSPARSER_SoaRecordGNUNET_DNSPARSER_duplicate_soa_record (const struct GNUNET_DNSPARSER_SoaRecord *r)
 Duplicate (deep-copy) the given DNS record. More...
 
struct GNUNET_DNSPARSER_CertRecordGNUNET_DNSPARSER_duplicate_cert_record (const struct GNUNET_DNSPARSER_CertRecord *r)
 Duplicate (deep-copy) the given DNS record. More...
 
struct GNUNET_DNSPARSER_MxRecordGNUNET_DNSPARSER_duplicate_mx_record (const struct GNUNET_DNSPARSER_MxRecord *r)
 Duplicate (deep-copy) the given DNS record. More...
 
struct GNUNET_DNSPARSER_SrvRecordGNUNET_DNSPARSER_duplicate_srv_record (const struct GNUNET_DNSPARSER_SrvRecord *r)
 Duplicate (deep-copy) the given DNS record. More...
 
struct GNUNET_DNSPARSER_UriRecordGNUNET_DNSPARSER_duplicate_uri_record (const struct GNUNET_DNSPARSER_UriRecord *r)
 Duplicate (deep-copy) the given DNS record. More...
 
void GNUNET_DNSPARSER_free_record (struct GNUNET_DNSPARSER_Record *r)
 Free the given DNS record. More...
 
void GNUNET_DNSPARSER_free_mx (struct GNUNET_DNSPARSER_MxRecord *mx)
 Free MX information record. More...
 
void GNUNET_DNSPARSER_free_srv (struct GNUNET_DNSPARSER_SrvRecord *srv)
 Free SRV information record. More...
 
void GNUNET_DNSPARSER_free_uri (struct GNUNET_DNSPARSER_UriRecord *uri)
 Free URI information record. More...
 
void GNUNET_DNSPARSER_free_soa (struct GNUNET_DNSPARSER_SoaRecord *soa)
 Free SOA information record. More...
 
void GNUNET_DNSPARSER_free_cert (struct GNUNET_DNSPARSER_CertRecord *cert)
 Free CERT information record. More...
 
char * GNUNET_DNSPARSER_bin_to_hex (const void *data, size_t data_size)
 Convert a block of binary data to HEX. More...
 
size_t GNUNET_DNSPARSER_hex_to_bin (const char *hex, void *data)
 Convert a HEX string to block of binary data. More...
 

Detailed Description

API for helper library to parse DNS packets.

Definition in file gnunet_dnsparser_lib.h.