Scheduling asynchronous requests

Typedefs

typedef void(* getdns_callback_t) (getdns_context *context, getdns_callback_type_t callback_type, getdns_dict *response, void *userarg, getdns_transaction_t transaction_id)
 

Functions

getdns_return_t getdns_general (getdns_context *context, const char *name, uint16_t request_type, const getdns_dict *extensions, void *userarg, getdns_transaction_t *transaction_id, getdns_callback_t callbackfn)
 
getdns_return_t getdns_address (getdns_context *context, const char *name, const getdns_dict *extensions, void *userarg, getdns_transaction_t *transaction_id, getdns_callback_t callbackfn)
 
getdns_return_t getdns_hostname (getdns_context *context, const getdns_dict *address, const getdns_dict *extensions, void *userarg, getdns_transaction_t *transaction_id, getdns_callback_t callbackfn)
 
getdns_return_t getdns_service (getdns_context *context, const char *name, const getdns_dict *extensions, void *userarg, getdns_transaction_t *transaction_id, getdns_callback_t callbackfn)
 
getdns_return_t getdns_cancel_callback (getdns_context *context, getdns_transaction_t transaction_id)
 

Detailed Description

Typedef Documentation

◆ getdns_callback_t

typedef void(* getdns_callback_t) (getdns_context *context, getdns_callback_type_t callback_type, getdns_dict *response, void *userarg, getdns_transaction_t transaction_id)

The type of the callback function that must be registered when scheduling asynchronous requests. The registered function will be called from the eventloop with the following parameters.

See also
Callback types and texts
Parameters
contextThe DNS context that was used in the calling function
callback_typeSupplies the reason for the callback. This will be one of:
  • GETDNS_CALLBACK_COMPLETE The response has the requested data in it
  • GETDNS_CALLBACK_CANCEL The calling program cancelled the callback; response is NULL
  • GETDNS_CALLBACK_TIMEOUT The requested action timed out; response is filled in with empty structures or will contain additional information about the timeout when used in combination with the return_call_reporting extension.
  • GETDNS_CALLBACK_ERROR The requested action had an error; response is NULL.
responseA response object with the response data. The application is responsible for cleaning up the response object with getdns_dict_destroy.
userargIdentical to the userarg passed to the calling function.
transaction_idThe transaction identifier that was assigned by the calling function.

Definition at line 1014 of file getdns.h.

Function Documentation

◆ getdns_general()

getdns_return_t getdns_general ( getdns_context context,
const char *  name,
uint16_t  request_type,
const getdns_dict extensions,
void *  userarg,
getdns_transaction_t transaction_id,
getdns_callback_t  callbackfn 
)

retrieve general DNS data

See also
RR Types
getdns_general_sync
Parameters
contextpointer to a previously created context to be used for this call
namethe ASCII based domain name to lookup
request_typeRR type for the query, e.g. GETDNS_RR_TYPE_NS
extensionsdict data structures, NULL to use no extensions
userargvoid* returned to the callback untouched
[out]transaction_idid used to identify the callback, NULL is ignored
callbackfncallback function defined by the application
Returns
GETDNS_RETURN_GOOD on success

◆ getdns_address()

getdns_return_t getdns_address ( getdns_context context,
const char *  name,
const getdns_dict extensions,
void *  userarg,
getdns_transaction_t transaction_id,
getdns_callback_t  callbackfn 
)

retrieve address assigned to a DNS name

See also
getdns_address_sync
Parameters
contextpointer to a previously created context to be used for this call
namethe ASCII based domain name to lookup
extensionsdict data structures, NULL to use no extensions
userargvoid* returned to the callback untouched
[out]transaction_idid used to identify the callback, NULL is ignored
callbackfncallback function defined by the application
Returns
GETDNS_RETURN_GOOD on success

◆ getdns_hostname()

getdns_return_t getdns_hostname ( getdns_context context,
const getdns_dict address,
const getdns_dict extensions,
void *  userarg,
getdns_transaction_t transaction_id,
getdns_callback_t  callbackfn 
)

retrieve hostname assigned to an IP address

See also
getdns_hostname_sync
Parameters
contextpointer to a previously created context to be used for this call
addressthe address to look up
extensionsdict data structures, NULL to use no extensions
userargvoid* returned to the callback untouched
[out]transaction_idid used to identify the callback, NULL is ignored
callbackfncallback function defined by the application
Returns
GETDNS_RETURN_GOOD on success

◆ getdns_service()

getdns_return_t getdns_service ( getdns_context context,
const char *  name,
const getdns_dict extensions,
void *  userarg,
getdns_transaction_t transaction_id,
getdns_callback_t  callbackfn 
)

retrieve a service assigned to a DNS name

See also
getdns_service_sync
Parameters
contextpointer to a previously created context to be used for this call
namethe ASCII based domain name to lookup
extensionsdict data structures, NULL to use no extensions
userargvoid* returned to the callback untouched
[out]transaction_idid used to identify the callback, NULL is ignored
callbackfncallback function defined by the application
Returns
GETDNS_RETURN_GOOD on success

◆ getdns_cancel_callback()

getdns_return_t getdns_cancel_callback ( getdns_context context,
getdns_transaction_t  transaction_id 
)

Cancel an outstanding asynchronous request. The callback registered with the request will be called with the getdns_callback_type_t set to GETDNS_CALLBACK_CANCEL and the response set to NULL.