djbdnscurve6 46
djbdnscurve6
Loading...
Searching...
No Matches
dns.h File Reference
#include "stralloc.h"
#include "iopause.h"
#include "taia.h"
#include "ip.h"
Include dependency graph for dns.h:

Go to the source code of this file.

Data Structures

struct  dns_transmit

Macros

#define DNS_NXD   0 /* NXDOMAIN,␣NODATA␣*/
#define DNS_MEM   -1 /* out of memory; fatal */
#define DNS_ERR   -2 /* parsing errors and others */
#define DNS_COM   -3 /* (socket) communication errors - SERVFAIL */
#define DNS_INT   -4 /* internal errors */
#define DNS_SOFT   -5 /* DNS_ERR␣or␣DNS_COM␣*/$
#define DNS_HARD   -6 /* DNS␣loop␣problem␣*/$
#define MSGSIZE   MTUSIZE - 48 /* DNS Flag Day 2020 recommendation */
#define MINMSGSIZE   512 /* RFC 1035 */
#define MAXMSGSIZE   4096 /* 4069 seen with EDNS0 */
#define MAXSEGMENT   65535 /* Max TCP buffer size */
#define MAX_TTL   655360 /* Default TTL for static DNS objects */
#define QUERY_MAXNS   32 /* 16 IPv4 + 16 IPv6 NS */
#define QUERY_MAXIPLEN   512 /* QUERY_MAXNS * 16 */
#define TCP_BACKLOG   20 /* the number of TCP connections supported simultaneously */
#define FQDN_LEN   255 /* length of FQDN including all labels + dots */
#define EDNS0FLAG   1
#define DNS_C_IN   "\0\1"
#define DNS_C_ANY   "\0\377"
#define DNS_T_A   "\0\1"
#define DNS_T_NS   "\0\2"
#define DNS_T_CNAME   "\0\5"
#define DNS_T_SOA   "\0\6"
#define DNS_T_PTR   "\0\14"
#define DNS_T_HINFO   "\0\15"
#define DNS_T_MX   "\0\17"
#define DNS_T_TXT   "\0\20"
#define DNS_T_RP   "\0\21"
#define DNS_T_SIG   "\0\30"
#define DNS_T_KEY   "\0\31"
#define DNS_T_AAAA   "\0\34"
#define DNS_T_SRV   "\0\41"
#define DNS_T_NAPTR   "\0\43"
#define DNS_T_CERT   "\0\45"
#define DNS_T_OPT   "\0\51"
#define DNS_T_DS   "\0\53"
#define DNS_T_SSHFP   "\0\54"
#define DNS_T_IPSECKEY   "\0\55"
#define DNS_T_RRSIG   "\0\56"
#define DNS_T_NSEC   "\0\57"
#define DNS_T_DNSKEY   "\0\60"
#define DNS_T_NSEC3   "\0\62"
#define DNS_T_NSEC3PARAM   "\0\63"
#define DNS_T_TLSA   "\0\64"
#define DNS_T_HIP   "\0\67"
#define DNS_T_OPENPGPKEY   "\0\75"
#define DNS_T_SPF   "\0\143"
#define DNS_T_AXFR   "\0\374"
#define DNS_T_ANY   "\0\377"
#define DNS_T_CAA   "\1\1"
#define LOCALHOST   "localhost" /* no clear distinction IPv4/IPv6 */
#define IP4_LOOPBACK   "ip4-loopback"
#define IP6_LOOPBACK   "ip6-loopback"
#define DNS_NAME4_DOMAIN   31
#define DNS_NAME6_DOMAIN   (4*16+11)

Functions

void dns_random_init (const char *)
unsigned int dns_random (unsigned int)
void dns_domain_free (char **)
int dns_domain_copy (char **, const char *)
unsigned int dns_domain_length (const char *)
int dns_domain_equal (const char *, const char *)
int dns_domain_suffix (const char *, const char *)
unsigned int dns_domain_suffixpos (const char *, const char *)
int dns_domain_fromdot (char **, const char *, unsigned int)
int dns_domain_todot_cat (stralloc *, const char *)
unsigned int dns_packet_copy (const char *, unsigned int, unsigned int, char *, unsigned int)
unsigned int dns_packet_getname (const char *, unsigned int, unsigned int, char **)
unsigned int dns_packet_skipname (const char *, unsigned int, unsigned int)
int dns_transmit_start (struct dns_transmit *, const char *, int, const char *, const char *, const char *)
void dns_transmit_free (struct dns_transmit *)
void dns_transmit_io (struct dns_transmit *, iopause_fd *, struct taia *)
int dns_transmit_get (struct dns_transmit *, const iopause_fd *, const struct taia *)
int dns_resolvconfip (char *, uint32 *)
int dns_resolvconfrewrite (stralloc *)
int dns_resolve (const char *, const char *)
int dns_name (stralloc *, const char *)
int dns_name_packet (stralloc *, const char *, unsigned int)
int dns_txt_packet (stralloc *, const char *, unsigned int)
int dns_txt (stralloc *, const stralloc *)
int dns_mx_packet (stralloc *, const char *, unsigned int)
int dns_mx (stralloc *, const stralloc *)
int dns_ip_qualify (stralloc *, stralloc *, const stralloc *)
int dns_ip4_packet (stralloc *, const char *, unsigned int)
int dns_ip4 (stralloc *, stralloc *)
void dns_sortip4 (char *, unsigned int)
int dns_ip4_qualify_rules (stralloc *, stralloc *, const stralloc *, const stralloc *)
int dns_ip4_qualify (stralloc *, stralloc *, const stralloc *)
int dns_name4_domain (char *, const char *)
int dns_name4 (stralloc *, const char *)
int dns_ip6_packet (stralloc *, const char *, unsigned int)
int dns_ip6 (stralloc *, stralloc *)
void dns_sortip6 (char *, unsigned int)
int dns_ip6_qualify_rules (stralloc *, stralloc *, const stralloc *, const stralloc *)
int dns_ip6_qualify (stralloc *, stralloc *, const stralloc *)
int dns_name6_domain (char *, const char *)
int dns_name6 (stralloc *, const char *)
int dns_transmit_start6 (struct dns_transmit *, const char *, int, const char *, const char *, const char *, const uint32 *)
unsigned int dns_packet_edns0 (const char *, const char *, const int, unsigned int)
void socketfree (struct dns_transmit *)
void queryfree (struct dns_transmit *)
void packetfree (struct dns_transmit *)
int randombind (struct dns_transmit *)
int randombind4 (struct dns_transmit *)
int serverwantstcp (const char *, unsigned int)
int serverfailed (const char *, unsigned int, char *)
int getscopeid (const struct dns_transmit *, const char *)
int firstudp (struct dns_transmit *)
int nextudp (struct dns_transmit *)
int firsttcp (struct dns_transmit *)
int nexttcp (struct dns_transmit *)

Variables

struct dns_transmit dns_resolve_tx

Macro Definition Documentation

◆ DNS_C_ANY

#define DNS_C_ANY   "\0\377"

Definition at line 54 of file dns.h.

◆ DNS_C_IN

#define DNS_C_IN   "\0\1"

Definition at line 53 of file dns.h.

◆ DNS_COM

#define DNS_COM   -3 /* (socket) communication errors - SERVFAIL */

Definition at line 33 of file dns.h.

◆ DNS_ERR

#define DNS_ERR   -2 /* parsing errors and others */

Definition at line 32 of file dns.h.

◆ DNS_HARD

#define DNS_HARD   -6 /* DNS␣loop␣problem␣*/$

Definition at line 36 of file dns.h.

◆ DNS_INT

#define DNS_INT   -4 /* internal errors */

Definition at line 34 of file dns.h.

◆ DNS_MEM

#define DNS_MEM   -1 /* out of memory; fatal */

Definition at line 31 of file dns.h.

◆ DNS_NAME4_DOMAIN

#define DNS_NAME4_DOMAIN   31

Definition at line 162 of file dns.h.

◆ DNS_NAME6_DOMAIN

#define DNS_NAME6_DOMAIN   (4*16+11)

Definition at line 175 of file dns.h.

◆ DNS_NXD

#define DNS_NXD   0 /* NXDOMAIN,␣NODATA␣*/

Definition at line 30 of file dns.h.

◆ DNS_SOFT

#define DNS_SOFT   -5 /* DNS_ERR␣or␣DNS_COM␣*/$

Definition at line 35 of file dns.h.

◆ DNS_T_A

#define DNS_T_A   "\0\1"

Definition at line 56 of file dns.h.

◆ DNS_T_AAAA

#define DNS_T_AAAA   "\0\34"

Definition at line 67 of file dns.h.

◆ DNS_T_ANY

#define DNS_T_ANY   "\0\377"

Definition at line 85 of file dns.h.

◆ DNS_T_AXFR

#define DNS_T_AXFR   "\0\374"

Definition at line 84 of file dns.h.

◆ DNS_T_CAA

#define DNS_T_CAA   "\1\1"

Definition at line 86 of file dns.h.

◆ DNS_T_CERT

#define DNS_T_CERT   "\0\45"

Definition at line 70 of file dns.h.

◆ DNS_T_CNAME

#define DNS_T_CNAME   "\0\5"

Definition at line 58 of file dns.h.

◆ DNS_T_DNSKEY

#define DNS_T_DNSKEY   "\0\60"

Definition at line 77 of file dns.h.

◆ DNS_T_DS

#define DNS_T_DS   "\0\53"

Definition at line 72 of file dns.h.

◆ DNS_T_HINFO

#define DNS_T_HINFO   "\0\15"

Definition at line 61 of file dns.h.

◆ DNS_T_HIP

#define DNS_T_HIP   "\0\67"

Definition at line 81 of file dns.h.

◆ DNS_T_IPSECKEY

#define DNS_T_IPSECKEY   "\0\55"

Definition at line 74 of file dns.h.

◆ DNS_T_KEY

#define DNS_T_KEY   "\0\31"

Definition at line 66 of file dns.h.

◆ DNS_T_MX

#define DNS_T_MX   "\0\17"

Definition at line 62 of file dns.h.

◆ DNS_T_NAPTR

#define DNS_T_NAPTR   "\0\43"

Definition at line 69 of file dns.h.

◆ DNS_T_NS

#define DNS_T_NS   "\0\2"

Definition at line 57 of file dns.h.

◆ DNS_T_NSEC

#define DNS_T_NSEC   "\0\57"

Definition at line 76 of file dns.h.

◆ DNS_T_NSEC3

#define DNS_T_NSEC3   "\0\62"

Definition at line 78 of file dns.h.

◆ DNS_T_NSEC3PARAM

#define DNS_T_NSEC3PARAM   "\0\63"

Definition at line 79 of file dns.h.

◆ DNS_T_OPENPGPKEY

#define DNS_T_OPENPGPKEY   "\0\75"

Definition at line 82 of file dns.h.

◆ DNS_T_OPT

#define DNS_T_OPT   "\0\51"

Definition at line 71 of file dns.h.

◆ DNS_T_PTR

#define DNS_T_PTR   "\0\14"

Definition at line 60 of file dns.h.

◆ DNS_T_RP

#define DNS_T_RP   "\0\21"

Definition at line 64 of file dns.h.

◆ DNS_T_RRSIG

#define DNS_T_RRSIG   "\0\56"

Definition at line 75 of file dns.h.

◆ DNS_T_SIG

#define DNS_T_SIG   "\0\30"

Definition at line 65 of file dns.h.

◆ DNS_T_SOA

#define DNS_T_SOA   "\0\6"

Definition at line 59 of file dns.h.

◆ DNS_T_SPF

#define DNS_T_SPF   "\0\143"

Definition at line 83 of file dns.h.

◆ DNS_T_SRV

#define DNS_T_SRV   "\0\41"

Definition at line 68 of file dns.h.

◆ DNS_T_SSHFP

#define DNS_T_SSHFP   "\0\54"

Definition at line 73 of file dns.h.

◆ DNS_T_TLSA

#define DNS_T_TLSA   "\0\64"

Definition at line 80 of file dns.h.

◆ DNS_T_TXT

#define DNS_T_TXT   "\0\20"

Definition at line 63 of file dns.h.

◆ EDNS0FLAG

#define EDNS0FLAG   1

Definition at line 49 of file dns.h.

◆ FQDN_LEN

#define FQDN_LEN   255 /* length of FQDN including all labels + dots */

Definition at line 47 of file dns.h.

◆ IP4_LOOPBACK

#define IP4_LOOPBACK   "ip4-loopback"

Definition at line 89 of file dns.h.

◆ IP6_LOOPBACK

#define IP6_LOOPBACK   "ip6-loopback"

Definition at line 90 of file dns.h.

◆ LOCALHOST

#define LOCALHOST   "localhost" /* no clear distinction IPv4/IPv6 */

Definition at line 88 of file dns.h.

◆ MAX_TTL

#define MAX_TTL   655360 /* Default TTL for static DNS objects */

Definition at line 42 of file dns.h.

◆ MAXMSGSIZE

#define MAXMSGSIZE   4096 /* 4069 seen with EDNS0 */

Definition at line 40 of file dns.h.

◆ MAXSEGMENT

#define MAXSEGMENT   65535 /* Max TCP buffer size */

Definition at line 41 of file dns.h.

◆ MINMSGSIZE

#define MINMSGSIZE   512 /* RFC 1035 */

Definition at line 39 of file dns.h.

◆ MSGSIZE

#define MSGSIZE   MTUSIZE - 48 /* DNS Flag Day 2020 recommendation */

Definition at line 38 of file dns.h.

◆ QUERY_MAXIPLEN

#define QUERY_MAXIPLEN   512 /* QUERY_MAXNS * 16 */

Definition at line 45 of file dns.h.

◆ QUERY_MAXNS

#define QUERY_MAXNS   32 /* 16 IPv4 + 16 IPv6 NS */

Definition at line 44 of file dns.h.

◆ TCP_BACKLOG

#define TCP_BACKLOG   20 /* the number of TCP connections supported simultaneously */

Definition at line 46 of file dns.h.

Function Documentation

◆ dns_domain_copy()

int dns_domain_copy ( char ** out,
const char * in )
extern

Definition at line 25 of file dns_domain.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_domain_equal()

int dns_domain_equal ( const char * dn1,
const char * dn2 )
extern

Definition at line 39 of file dns_domain.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_domain_free()

void dns_domain_free ( char ** out)
extern

Definition at line 17 of file dns_domain.c.

Here is the caller graph for this function:

◆ dns_domain_fromdot()

int dns_domain_fromdot ( char ** out,
const char * buf,
unsigned int n )
extern

Definition at line 6 of file dns_dfd.c.

Here is the caller graph for this function:

◆ dns_domain_length()

unsigned int dns_domain_length ( const char * dn)
extern

Definition at line 6 of file dns_domain.c.

Here is the caller graph for this function:

◆ dns_domain_suffix()

int dns_domain_suffix ( const char * big,
const char * little )
extern

Definition at line 50 of file dns_domain.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_domain_suffixpos()

unsigned int dns_domain_suffixpos ( const char * big,
const char * little )
extern

Definition at line 62 of file dns_domain.c.

Here is the call graph for this function:

◆ dns_domain_todot_cat()

int dns_domain_todot_cat ( stralloc * out,
const char * d )
extern

Definition at line 11 of file dns_dtda.c.

Here is the caller graph for this function:

◆ dns_ip4()

int dns_ip4 ( stralloc * out,
stralloc * fqdn )
extern

Definition at line 42 of file dns_ip.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_ip4_packet()

int dns_ip4_packet ( stralloc * out,
const char * buf,
unsigned int len )
extern

Definition at line 9 of file dns_ip.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_ip4_qualify()

int dns_ip4_qualify ( stralloc * ipout,
stralloc * fqdn,
const stralloc * in )
extern

Definition at line 109 of file dns_ipq.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_ip4_qualify_rules()

int dns_ip4_qualify_rules ( stralloc * ipout,
stralloc * fqdn,
const stralloc * in,
const stralloc * rules )
extern

Definition at line 47 of file dns_ipq.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_ip6()

int dns_ip6 ( stralloc * out,
stralloc * fqdn )
extern

Definition at line 133 of file dns_ip.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_ip6_packet()

int dns_ip6_packet ( stralloc * out,
const char * buf,
unsigned int len )
extern

Definition at line 93 of file dns_ip.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_ip6_qualify()

int dns_ip6_qualify ( stralloc * ipout,
stralloc * fqdn,
const stralloc * in )
extern

Definition at line 157 of file dns_ipq.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_ip6_qualify_rules()

int dns_ip6_qualify_rules ( stralloc * ipout,
stralloc * fqdn,
const stralloc * in,
const stralloc * rules )
extern

Definition at line 121 of file dns_ipq.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_ip_qualify()

int dns_ip_qualify ( stralloc * ipout,
stralloc * fqdn,
const stralloc * in )
extern

Definition at line 228 of file dns_ipq.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_mx()

int dns_mx ( stralloc * out,
const stralloc * fqdn )
extern

Definition at line 43 of file dns_mx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_mx_packet()

int dns_mx_packet ( stralloc * out,
const char * buf,
unsigned int len )
extern

Definition at line 8 of file dns_mx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_name()

int dns_name ( stralloc * ,
const char *  )
extern

◆ dns_name4()

int dns_name4 ( stralloc * ,
const char *  )
extern

◆ dns_name4_domain()

int dns_name4_domain ( char * ,
const char *  )
extern

◆ dns_name6()

int dns_name6 ( stralloc * ,
const char *  )
extern

◆ dns_name6_domain()

int dns_name6_domain ( char * ,
const char *  )
extern

◆ dns_name_packet()

int dns_name_packet ( stralloc * out,
const char * buf,
unsigned int len )
extern

Definition at line 9 of file dns_name.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_packet_copy()

unsigned int dns_packet_copy ( const char * buf,
unsigned int len,
unsigned int pos,
char * out,
unsigned int outlen )
extern

Definition at line 8 of file dns_packet.c.

Here is the caller graph for this function:

◆ dns_packet_edns0()

unsigned int dns_packet_edns0 ( const char * ,
const char * ,
const int ,
unsigned int  )
extern

◆ dns_packet_getname()

unsigned int dns_packet_getname ( const char * buf,
unsigned int len,
unsigned int pos,
char ** d )
extern

Definition at line 35 of file dns_packet.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_packet_skipname()

unsigned int dns_packet_skipname ( const char * buf,
unsigned int len,
unsigned int pos )
extern

Definition at line 18 of file dns_packet.c.

Here is the caller graph for this function:

◆ dns_random()

unsigned int dns_random ( unsigned int n)
extern

Definition at line 56 of file dns_random.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_random_init()

void dns_random_init ( const char * )
extern

◆ dns_resolvconfip()

int dns_resolvconfip ( char * ,
uint32 *  )
extern

◆ dns_resolvconfrewrite()

int dns_resolvconfrewrite ( stralloc * out)
extern

Definition at line 115 of file dns_rcrw.c.

Here is the caller graph for this function:

◆ dns_resolve()

int dns_resolve ( const char * ,
const char *  )
extern

◆ dns_sortip4()

void dns_sortip4 ( char * s,
unsigned int n )
extern

Definition at line 10 of file dns_sortip.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_sortip6()

void dns_sortip6 ( char * s,
unsigned int n )
extern

Definition at line 25 of file dns_sortip.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_transmit_free()

void dns_transmit_free ( struct dns_transmit * d)
extern

Definition at line 95 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_transmit_get()

int dns_transmit_get ( struct dns_transmit * d,
const iopause_fd * x,
const struct taia * when )
extern

Definition at line 296 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_transmit_io()

void dns_transmit_io ( struct dns_transmit * d,
iopause_fd * x,
struct taia * deadline )
extern

Definition at line 279 of file dns_transmit.c.

Here is the caller graph for this function:

◆ dns_transmit_start()

int dns_transmit_start ( struct dns_transmit * ,
const char * ,
int ,
const char * ,
const char * ,
const char *  )
extern

◆ dns_transmit_start6()

int dns_transmit_start6 ( struct dns_transmit * ,
const char * ,
int ,
const char * ,
const char * ,
const char * ,
const uint32 *  )
extern

◆ dns_txt()

int dns_txt ( stralloc * out,
const stralloc * fqdn )
extern

Definition at line 53 of file dns_txt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_txt_packet()

int dns_txt_packet ( stralloc * out,
const char * buf,
unsigned int len )
extern

Definition at line 6 of file dns_txt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ firsttcp()

int firsttcp ( struct dns_transmit * d)
extern

Definition at line 250 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ firstudp()

int firstudp ( struct dns_transmit * d)
extern

Definition at line 193 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getscopeid()

int getscopeid ( const struct dns_transmit * d,
const char * ip )
extern

Definition at line 18 of file dns_transmit.c.

Here is the caller graph for this function:

◆ nexttcp()

int nexttcp ( struct dns_transmit * d)
extern

Definition at line 256 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nextudp()

int nextudp ( struct dns_transmit * d)
extern

Definition at line 200 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ packetfree()

void packetfree ( struct dns_transmit * d)
extern

Definition at line 74 of file dns_transmit.c.

Here is the caller graph for this function:

◆ queryfree()

void queryfree ( struct dns_transmit * d)
extern

Definition at line 81 of file dns_transmit.c.

Here is the caller graph for this function:

◆ randombind()

int randombind ( struct dns_transmit * d)
extern

Definition at line 102 of file dns_transmit.c.

Here is the call graph for this function:

◆ randombind4()

int randombind4 ( struct dns_transmit * d)
extern

Definition at line 132 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ serverfailed()

int serverfailed ( const char * buf,
unsigned int len,
char * server )
extern

Definition at line 38 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ serverwantstcp()

int serverwantstcp ( const char * buf,
unsigned int len )
extern

Definition at line 29 of file dns_transmit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ socketfree()

void socketfree ( struct dns_transmit * d)
extern

Definition at line 88 of file dns_transmit.c.

Here is the caller graph for this function:

Variable Documentation

◆ dns_resolve_tx

struct dns_transmit dns_resolve_tx
extern

Definition at line 7 of file dns_resolve.c.