Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions | Variables
dns.cpp File Reference
#include <seeder/dns.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <strings.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <util/time.h>
#include <cctype>
#include <cstdbool>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
Include dependency graph for dns.cpp:

Go to the source code of this file.

Classes

union  control_data
 

Macros

#define BUFLEN   512
 

Enumerations

enum  dns_class { CLASS_IN = 1 , QCLASS_ANY = 255 }
 
enum  dns_type {
  TYPE_A = 1 , TYPE_NS = 2 , TYPE_CNAME = 5 , TYPE_SOA = 6 ,
  TYPE_MX = 15 , TYPE_AAAA = 28 , TYPE_SRV = 33 , QTYPE_ANY = 255
}
 
enum class  DNSResponseCode : uint8_t {
  OK = 0 , FORMAT_ERROR = 1 , SERVER_FAILURE = 2 , NAME_ERROR = 3 ,
  NOT_IMPLEMENTED = 4 , REFUSED = 5
}
 

Functions

ParseNameStatus parse_name (const uint8_t **inpos, const uint8_t *inend, const uint8_t *inbuf, char *buf, size_t bufsize)
 
int write_name (uint8_t **outpos, const uint8_t *outend, const char *name, int offset)
 
static int write_record (uint8_t **outpos, const uint8_t *outend, const char *name, int offset, dns_type typ, dns_class cls, int ttl)
 
static int write_record_a (uint8_t **outpos, const uint8_t *outend, const char *name, int offset, dns_class cls, int ttl, const addr_t *ip)
 
static int write_record_aaaa (uint8_t **outpos, const uint8_t *outend, const char *name, int offset, dns_class cls, int ttl, const addr_t *ip)
 
static int write_record_ns (uint8_t **outpos, const uint8_t *outend, const char *name, int offset, dns_class cls, int ttl, const char *ns)
 
static int write_record_soa (uint8_t **outpos, const uint8_t *outend, const char *name, int offset, dns_class cls, int ttl, const char *mname, const char *rname, uint32_t serial, uint32_t refresh, uint32_t retry, uint32_t expire, uint32_t minimum)
 
static ssize_t dnshandle (dns_opt_t *opt, const uint8_t *inbuf, size_t insize, uint8_t *outbuf)
 
int dnsserver (dns_opt_t *opt)
 

Variables

static int listenSocket = -1
 

Macro Definition Documentation

◆ BUFLEN

#define BUFLEN   512

Definition at line 22 of file dns.cpp.

Enumeration Type Documentation

◆ dns_class

Enumerator
CLASS_IN 
QCLASS_ANY 

Definition at line 41 of file dns.cpp.

◆ dns_type

Enumerator
TYPE_A 
TYPE_NS 
TYPE_CNAME 
TYPE_SOA 
TYPE_MX 
TYPE_AAAA 
TYPE_SRV 
QTYPE_ANY 

Definition at line 46 of file dns.cpp.

◆ DNSResponseCode

Enumerator
OK 
FORMAT_ERROR 
SERVER_FAILURE 
NAME_ERROR 
NOT_IMPLEMENTED 
REFUSED 

Definition at line 57 of file dns.cpp.

Function Documentation

◆ dnshandle()

static ssize_t dnshandle ( dns_opt_t opt,
const uint8_t inbuf,
size_t  insize,
uint8_t outbuf 
)
static

Definition at line 366 of file dns.cpp.

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

◆ dnsserver()

int dnsserver ( dns_opt_t opt)

Definition at line 596 of file dns.cpp.

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

◆ parse_name()

ParseNameStatus parse_name ( const uint8_t **  inpos,
const uint8_t inend,
const uint8_t inbuf,
char buf,
size_t  bufsize 
)

Definition at line 66 of file dns.cpp.

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

◆ write_name()

int write_name ( uint8_t **  outpos,
const uint8_t outend,
const char name,
int  offset 
)

Definition at line 132 of file dns.cpp.

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

◆ write_record()

static int write_record ( uint8_t **  outpos,
const uint8_t outend,
const char name,
int  offset,
dns_type  typ,
dns_class  cls,
int  ttl 
)
static

Definition at line 173 of file dns.cpp.

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

◆ write_record_a()

static int write_record_a ( uint8_t **  outpos,
const uint8_t outend,
const char name,
int  offset,
dns_class  cls,
int  ttl,
const addr_t ip 
)
static

Definition at line 205 of file dns.cpp.

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

◆ write_record_aaaa()

static int write_record_aaaa ( uint8_t **  outpos,
const uint8_t outend,
const char name,
int  offset,
dns_class  cls,
int  ttl,
const addr_t ip 
)
static

Definition at line 234 of file dns.cpp.

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

◆ write_record_ns()

static int write_record_ns ( uint8_t **  outpos,
const uint8_t outend,
const char name,
int  offset,
dns_class  cls,
int  ttl,
const char ns 
)
static

Definition at line 263 of file dns.cpp.

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

◆ write_record_soa()

static int write_record_soa ( uint8_t **  outpos,
const uint8_t outend,
const char name,
int  offset,
dns_class  cls,
int  ttl,
const char mname,
const char rname,
uint32_t  serial,
uint32_t  refresh,
uint32_t  retry,
uint32_t  expire,
uint32_t  minimum 
)
static

Definition at line 298 of file dns.cpp.

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

Variable Documentation

◆ listenSocket

int listenSocket = -1
static

Definition at line 594 of file dns.cpp.