Home --> Documentations --> PJLIB-UTIL Reference

Data Structures | Macros | Enumerations | Functions
dns.h File Reference

Low level DNS message parsing and packetization. More...

Go to the source code of this file.

Data Structures

struct  pj_dns_hdr
 
struct  pj_dns_parsed_query
 
struct  pj_dns_parsed_rr
 
union  pj_dns_parsed_rr::rdata
 
struct  pj_dns_parsed_rr::rdata::srv
 
struct  pj_dns_parsed_rr::rdata::cname
 
struct  pj_dns_parsed_rr::rdata::ns
 
struct  pj_dns_parsed_rr::rdata::ptr
 
struct  pj_dns_parsed_rr::rdata::a
 
struct  pj_dns_parsed_rr::rdata::aaaa
 
struct  pj_dns_parsed_packet
 

Macros

#define PJ_DNS_SET_RCODE(c)   ((pj_uint16_t)((c) & 0x0F))
 
#define PJ_DNS_SET_RA(on)   ((pj_uint16_t)((on) << 7))
 
#define PJ_DNS_SET_RD(on)   ((pj_uint16_t)((on) << 8))
 
#define PJ_DNS_SET_TC(on)   ((pj_uint16_t)((on) << 9))
 
#define PJ_DNS_SET_AA(on)   ((pj_uint16_t)((on) << 10))
 
#define PJ_DNS_SET_OPCODE(o)   ((pj_uint16_t)((o) << 11))
 
#define PJ_DNS_SET_QR(on)   ((pj_uint16_t)((on) << 15))
 
#define PJ_DNS_GET_RCODE(val)   (((val) & PJ_DNS_SET_RCODE(0x0F)) >> 0)
 
#define PJ_DNS_GET_RA(val)   (((val) & PJ_DNS_SET_RA(1)) >> 7)
 
#define PJ_DNS_GET_RD(val)   (((val) & PJ_DNS_SET_RD(1)) >> 8)
 
#define PJ_DNS_GET_TC(val)   (((val) & PJ_DNS_SET_TC(1)) >> 9)
 
#define PJ_DNS_GET_AA(val)   (((val) & PJ_DNS_SET_AA(1)) >> 10)
 
#define PJ_DNS_GET_OPCODE(val)   (((val) & PJ_DNS_SET_OPCODE(0x0F)) >> 11)
 
#define PJ_DNS_GET_QR(val)   (((val) & PJ_DNS_SET_QR(1)) >> 15)
 

Enumerations

enum  { PJ_DNS_CLASS_IN = 1 }
 
enum  pj_dns_type {
  PJ_DNS_TYPE_A = 1, PJ_DNS_TYPE_NS = 2, PJ_DNS_TYPE_MD = 3, PJ_DNS_TYPE_MF = 4,
  PJ_DNS_TYPE_CNAME = 5, PJ_DNS_TYPE_SOA = 6, PJ_DNS_TYPE_MB = 7, PJ_DNS_TYPE_MG = 8,
  PJ_DNS_TYPE_MR = 9, PJ_DNS_TYPE_NULL = 10, PJ_DNS_TYPE_WKS = 11, PJ_DNS_TYPE_PTR = 12,
  PJ_DNS_TYPE_HINFO = 13, PJ_DNS_TYPE_MINFO = 14, PJ_DNS_TYPE_MX = 15, PJ_DNS_TYPE_TXT = 16,
  PJ_DNS_TYPE_RP = 17, PJ_DNS_TYPE_AFSB = 18, PJ_DNS_TYPE_X25 = 19, PJ_DNS_TYPE_ISDN = 20,
  PJ_DNS_TYPE_RT = 21, PJ_DNS_TYPE_NSAP = 22, PJ_DNS_TYPE_NSAP_PTR = 23, PJ_DNS_TYPE_SIG = 24,
  PJ_DNS_TYPE_KEY = 25, PJ_DNS_TYPE_PX = 26, PJ_DNS_TYPE_GPOS = 27, PJ_DNS_TYPE_AAAA = 28,
  PJ_DNS_TYPE_LOC = 29, PJ_DNS_TYPE_NXT = 30, PJ_DNS_TYPE_EID = 31, PJ_DNS_TYPE_NIMLOC = 32,
  PJ_DNS_TYPE_SRV = 33, PJ_DNS_TYPE_ATMA = 34, PJ_DNS_TYPE_NAPTR = 35, PJ_DNS_TYPE_KX = 36,
  PJ_DNS_TYPE_CERT = 37, PJ_DNS_TYPE_A6 = 38, PJ_DNS_TYPE_DNAME = 39, PJ_DNS_TYPE_OPT = 41,
  PJ_DNS_TYPE_APL = 42, PJ_DNS_TYPE_DS = 43, PJ_DNS_TYPE_SSHFP = 44, PJ_DNS_TYPE_IPSECKEY = 45,
  PJ_DNS_TYPE_RRSIG = 46, PJ_DNS_TYPE_NSEC = 47, PJ_DNS_TYPE_DNSKEY = 48
}
 
enum  pj_dns_rcode {
  PJ_DNS_RCODE_FORMERR = 1, PJ_DNS_RCODE_SERVFAIL = 2, PJ_DNS_RCODE_NXDOMAIN = 3, PJ_DNS_RCODE_NOTIMPL = 4,
  PJ_DNS_RCODE_REFUSED = 5, PJ_DNS_RCODE_YXDOMAIN = 6, PJ_DNS_RCODE_YXRRSET = 7, PJ_DNS_RCODE_NXRRSET = 8,
  PJ_DNS_RCODE_NOTAUTH = 9, PJ_DNS_RCODE_NOTZONE = 10
}
 
enum  pj_dns_dup_options { PJ_DNS_NO_QD = 1, PJ_DNS_NO_ANS = 2, PJ_DNS_NO_NS = 4, PJ_DNS_NO_AR = 8 }
 

Functions

pj_status_t pj_dns_make_query (void *packet, unsigned *size, pj_uint16_t id, int qtype, const pj_str_t *name)
 
pj_status_t pj_dns_parse_packet (pj_pool_t *pool, const void *packet, unsigned size, pj_dns_parsed_packet **p_res)
 
void pj_dns_packet_dup (pj_pool_t *pool, const pj_dns_parsed_packet *p, unsigned options, pj_dns_parsed_packet **p_dst)
 
const char * pj_dns_get_type_name (int type)
 
void pj_dns_init_srv_rr (pj_dns_parsed_rr *rec, const pj_str_t *res_name, unsigned dnsclass, unsigned ttl, unsigned prio, unsigned weight, unsigned port, const pj_str_t *target)
 
void pj_dns_init_cname_rr (pj_dns_parsed_rr *rec, const pj_str_t *res_name, unsigned dnsclass, unsigned ttl, const pj_str_t *name)
 
void pj_dns_init_a_rr (pj_dns_parsed_rr *rec, const pj_str_t *res_name, unsigned dnsclass, unsigned ttl, const pj_in_addr *ip_addr)
 
void pj_dns_init_aaaa_rr (pj_dns_parsed_rr *rec, const pj_str_t *res_name, unsigned dnsclass, unsigned ttl, const pj_in6_addr *ip_addr)
 
void pj_dns_dump_packet (const pj_dns_parsed_packet *res)
 

Detailed Description

Low level DNS message parsing and packetization.

 


PJLIB-UTIL Open Source, small footprint, and portable asynchronous/caching DNS resolver, text scanner, STUN client, and XML library
Copyright (C) 2006-2009 Teluu Inc.