Data Structures | Typedefs | Enumerations | Functions
extDns Message: API functions to handle and produce DNS requsts and replies

Data Structures

struct  _extDnsCacheStats
 Object used by ext_dns_cache_stats to report current cache stats on a particular context. More...
 
struct  _extDnsHeader
 Header information for each DNS message. More...
 
struct  _extDnsMessage
 Data type that represents a single DNS message. More...
 
struct  _extDnsQuestion
 Represents a question inside the question section. More...
 
struct  _extDnsResourceRecord
 Public structure that defines a single resource record. More...
 

Typedefs

typedef struct _extDnsAsyncQueue extDnsAsyncQueue
 Message queue implementation that allows to communicate several threads in a safe manner. More...
 
typedef struct _extDnsCacheStats extDnsCacheStats
 Object used by ext_dns_cache_stats to report current cache stats on a particular context. More...
 
typedef __OS_COND_TYPE__ extDnsCond
 Conditional variable mutex, encapsulating the underlaying operating system implementation for conditional variables inside critical sections. More...
 
typedef struct _extDnsCtx extDnsCtx
 A single library context where all state is stored. More...
 
typedef struct _extDnsHeader extDnsHeader
 Header information for each DNS message. More...
 
typedef struct _extDnsMessage extDnsMessage
 Data type that represents a single DNS message. More...
 
typedef __OS_MUTEX_TYPE__ extDnsMutex
 Mutex definition that encapsulates the underlaying mutex API. More...
 
typedef struct _extDnsQuestion extDnsQuestion
 Represents a question inside the question section. More...
 
typedef struct
_extDnsResourceRecord 
extDnsResourceRecord
 Public structure that defines a single resource record. More...
 
typedef struct _extDnsSession extDnsSession
 Structure that represents a single session server (name server) or client session (resolver) More...
 
typedef __OS_THREAD_TYPE__ extDnsThread
 Thread definition, which encapsulates the os thread API, allowing to provide a unified type for all threading interface. More...
 
typedef axlPointer(* extDnsThreadFunc )(axlPointer user_data)
 Handle definition for the family of function that is able to accept the function ext_dns_thread_create. More...
 

Enumerations

enum  extDnsClass {
  extDnsClassIN = 1, extDnsClassCS = 2, extDnsClassCH = 3, extDnsClassHS = 4,
  extDnsClassANY = 255
}
 CLASS values. More...
 
enum  extDnsIoWaitingFor { READ_OPERATIONS = 1 << 0, WRITE_OPERATIONS = 1 << 1 }
 Allows to specify which type of operation should be implemented while calling to extDns Library internal IO blocking abstraction. More...
 
enum  extDnsIoWaitingType { EXT_DNS_IO_WAIT_SELECT = 1, EXT_DNS_IO_WAIT_POLL = 2, EXT_DNS_IO_WAIT_EPOLL = 3 }
 Enumeration type that allows to use the waiting mechanism to be used by the core library to perform wait on changes on sockets handled. More...
 
enum  extDnsPeerRole { extDnsRoleUnknown, extDnsRoleResolver, extDnsRoleListener, extDnsRoleMasterListener }
 Allows to classify the role of the connection. More...
 
enum  extDnsQueryType { extDnsUnknownQueryType = -1, extDnsStandardQuery = 0, extDnsInverseQuery = 1, extDnsSeverStatusQuery = 2 }
 Type of DNS message supported (RFC). More...
 
enum  extDnsResponseType {
  extDnsResponseNoError = 0, extDnsResponseFormarError = 1, extDnsResponseServerFailure = 2, extDnsResponseNameError = 3,
  extDnsResponseNoImplementedError = 4, extDnsResponseRefused = 5
}
 Type of responses we can receive or send via DNS message. More...
 
enum  extDnsSessionType { extDnsTcpSession = 1, extDnsUdpSession = 2 }
 Allows to signal which type of session is running a extDnsSession object. More...
 
enum  extDnsStatus {
  extDnsError = 1, extDnsOk = 2, extDnsBindError = 3, extDnsWrongReference = 4,
  extDnsNameResolvFailure = 5, extDnsSocketCreationError = 6, extDnsSocketSanityError = 7, extDnsSessionError = 8,
  extDnsSessionTimeoutError = 9, extDnsSessionCloseCalled = 10, extDnsSessionForcedClose = 11, extDnsProtocolError = 12,
  extDnsSessionFiltered = 13, extDnsMemoryFail = 14, extDnsUnnotifiedSessionClose = 15
}
 extDns Operation Status. More...
 
enum  extDnsThreadConf { EXT_DNS_THREAD_CONF_END = 0, EXT_DNS_THREAD_CONF_JOINABLE = 1, EXT_DNS_THREAD_CONF_DETACHED = 2 }
 Thread configuration its to modify default behaviour provided by the thread creation API. More...
 
enum  extDnsType {
  extDnsTypeA = 1, extDnsTypeNS = 2, extDnsTypeMD = 3, extDnsTypeMF = 4,
  extDnsTypeCNAME = 5, extDnsTypeSOA = 6, extDnsTypeMB = 7, extDnsTypeMG = 8,
  extDnsTypeMR = 9, extDnsTypeNULL = 10, extDnsTypeWKS = 11, extDnsTypePTR = 12,
  extDnsTypeHINFO = 13, extDnsTypeMINFO = 14, extDnsTypeMX = 15, extDnsTypeTXT = 16,
  extDnsTypeAAAA = 28, extDnsTypeSRV = 33, extDnsTypeSPF = 99, extDnsTypeAXFR = 252,
  extDnsTypeMAILB = 253, extDnsTypeMAILA = 254, extDnsTypeANY = 255
}
 TYPE fields are used in resource records. More...
 

Functions

axl_bool ext_dns_message_add_answer (extDnsCtx *ctx, extDnsMessage *message, extDnsType type, extDnsClass class, const char *name, int ttl, const char *content)
 Allows to add an additional answer record to the provided message. More...
 
axl_bool ext_dns_message_add_answer_from_msg (extDnsCtx *ctx, extDnsMessage *message, extDnsMessage *extension)
 Allows to add all answers inside extension message into the first message (second argument). More...
 
axl_bool ext_dns_message_add_cname_reply (extDnsCtx *ctx, extDnsMessage *reply, const char *name, int ttl)
 Allows to add a cname reply on the provided reply already created. More...
 
axl_bool ext_dns_message_add_ipv4_reply (extDnsCtx *ctx, extDnsMessage *reply, const char *ip, int ttl)
 Given a created reply, this function allows to add an additional A reply to the query replied. More...
 
axl_bool ext_dns_message_add_mx_reply (extDnsCtx *ctx, extDnsMessage *reply, const char *mailer, int preference, int ttl)
 Allows to add a MX reply on the provided reply already created. More...
 
axl_bool ext_dns_message_add_ns_reply (extDnsCtx *ctx, extDnsMessage *reply, const char *dns_server, int ttl)
 Allows to add a cname reply on the provided reply already created. More...
 
axl_bool ext_dns_message_add_soa_reply (extDnsCtx *ctx, extDnsMessage *reply, const char *primary_server, const char *mail_contact, int serial, int refresh, int retry, int expire, int minimum, int ttl)
 Allows to add a NS reply on the provided reply already created. More...
 
extDnsMessageext_dns_message_build_cname_reply (extDnsCtx *ctx, extDnsMessage *message, const char *name, int ttl)
 Allows to build a message reply to the provided message, using as reply to the question the name provided. More...
 
extDnsMessageext_dns_message_build_ipv4_reply (extDnsCtx *ctx, extDnsMessage *message, const char *ip, int ttl)
 Allows to build a message reply to the provided message, using as reply to the question the IP provided. More...
 
extDnsMessageext_dns_message_build_mx_reply (extDnsCtx *ctx, extDnsMessage *message, const char *mailer, int preference, int ttl)
 Allows to build a message reply to the provided message, using as reply to the question the name provided. More...
 
extDnsMessageext_dns_message_build_ns_reply (extDnsCtx *ctx, extDnsMessage *message, const char *dns_server, int ttl)
 Allows to build a message reply to the provided message, using as reply to the question the name provided. More...
 
int ext_dns_message_build_query (extDnsCtx *ctx, const char *qname, extDnsType qtype, extDnsClass qclass, char *buffer, extDnsHeader **header)
 Allows to build the provided query on the buffer reference. More...
 
extDnsMessageext_dns_message_build_reject_reply (extDnsCtx *ctx, extDnsMessage *message)
 Allows to build a DNS refuse (policy refuse) reply message, taking the id to reply to from the provided message. More...
 
extDnsMessageext_dns_message_build_soa_reply (extDnsCtx *ctx, extDnsMessage *message, const char *primary_server, const char *mail_contact, int serial, int refresh, int retry, int expire, int minimum, int ttl)
 Allows to build a message reply to the provided message, using as reply to the question the name provided. More...
 
extDnsMessageext_dns_message_build_unknown_reply (extDnsCtx *ctx, extDnsMessage *message)
 Allows to build a DNS unknown reply message, taking the id to reply to from the provided message. More...
 
extDnsClass ext_dns_message_get_qclass (extDnsCtx *ctx, const char *qclass)
 Allows to get the extDnsClass code from the qclass string. More...
 
const char * ext_dns_message_get_qclass_to_str (extDnsCtx *ctx, extDnsClass class)
 Allows to get the a user printable string from extDnsClass code. More...
 
extDnsType ext_dns_message_get_qtype (extDnsCtx *ctx, const char *qtype)
 Allows to get the extDnsType code from the qtype string. More...
 
const char * ext_dns_message_get_qtype_to_str (extDnsCtx *ctx, extDnsType type)
 Allows to get a printable type representation from extDnsType code. More...
 
axl_bool ext_dns_message_is_answer_valid (extDnsCtx *ctx, extDnsMessage *message)
 Allows to check if the message is valid, that is, it represents a reply and has a valid response with a current ttl. More...
 
axl_bool ext_dns_message_is_name_error (extDnsMessage *message)
 Allows to check if the provided message represents a name resolution error. More...
 
axl_bool ext_dns_message_is_query (extDnsMessage *message)
 Allows to check if the provided extDnsMessage is query (QR == 0). More...
 
axl_bool ext_dns_message_is_reject (extDnsMessage *message)
 Allows to check if the provided message represents a reject reply. More...
 
axl_bool ext_dns_message_query (extDnsCtx *ctx, const char *type, const char *class, const char *name, const char *server, int server_port, extDnsOnMessageReceived on_message, axlPointer data)
 Allows to run a query to the provided server, getting the reply on the provided handler. More...
 
axl_bool ext_dns_message_query_and_forward_from_msg (extDnsCtx *ctx, extDnsMessage *message, const char *server, int server_port, const char *reply_to_address, int reply_to_port, extDnsSession *reply_from, axl_bool cache_reply)
 Convenient function that allows doing a query and forward the reply received. More...
 
const char * ext_dns_message_query_class (extDnsCtx *ctx, extDnsMessage *message)
 Convenient function to get the query class being asked in the message (no matter if it is a query or reply). More...
 
axl_bool ext_dns_message_query_from_msg (extDnsCtx *ctx, extDnsMessage *message, const char *server, int server_port, extDnsOnMessageReceived on_message, axlPointer data)
 Allows to run a query to the provided server, using the provided message as the query to be done, getting the reply on the provided handler. More...
 
axl_bool ext_dns_message_query_int (extDnsCtx *ctx, extDnsType _type, extDnsClass _class, const char *name, const char *server, int server_port, extDnsOnMessageReceived on_message, axlPointer data)
 Allows to run a query to the provided server, getting the reply on the provided handler. More...
 
const char * ext_dns_message_query_name (extDnsCtx *ctx, extDnsMessage *message)
 Convenient function to get the query name being asked in the message (no matter if it is a query or reply). More...
 
const char * ext_dns_message_query_type (extDnsCtx *ctx, extDnsMessage *message)
 Convenient function to get the query type being asked in the message (no matter if it is a query or reply). More...
 
axl_bool ext_dns_message_ref (extDnsMessage *message)
 Increases the reference to the provided message. More...
 
int ext_dns_message_ref_count (extDnsMessage *message)
 Allows to get current ref counting (for debugging purposes). More...
 
axl_bool ext_dns_message_send_udp_s (extDnsCtx *ctx, extDnsSession *session, extDnsMessage *message, const char *address, int port)
 Allows to send a DNS message represented by message to the defined destination. More...
 
int ext_dns_message_to_buffer (extDnsCtx *ctx, extDnsMessage *message, char *buffer, int buffer_size)
 Allows to translate a DNS message represented by an extDnsMessage into its corresponding DNS message following the protocol ready to be sent. More...
 
void ext_dns_message_unref (extDnsMessage *message)
 Releases a reference to the provided DNS message. More...
 
void ext_dns_message_write_header_id (extDnsMessage *message, char *buffer)
 Assuming the provided buffer has a valid DNS message to be send, this function updates that buffer to use the ID from the message's header provided. More...
 

Detailed Description