getdns_general(3)
πΈ NAME πΈ
okay so this is getdns_general(3), straight out of the getdns manual, and it's the page for getdns_general and getdns_general_sync β they do a getdns DNS lookup. that's it, that's the whole job, and they ate π
π LIBRARY π
DNS Resolver library (libgetdns, -lgetdns). yes bestie, you gotta link it.
β¨ SYNOPSIS β¨
#include <getdns.h>
getdns_return_t
getdns_general (getdns_context *context,
const char *name,
uint16_t request_type
getdns_dict *extensions,
void *userarg,
getdns_transaction_t *transaction_id,
getdns_callback_t callbackfn)
getdns_return_t
getdns_general_sync (getdns_context *context,
const char *name,
uint16_t request_type
getdns_dict *extensions,
getdns_dict **response)
π DESCRIPTION π
So getdns_general(3) and getdns_general_sync are the public entry points into the getdns API library β they go get you any valid responses to a query from the DNS. and real talk: other namespaces in the context are not used here, so don't come looking for them π«Ά
ngl, most typical use cases for applications are probably already satisfied by just calling getdns_address(3) instead, which would replace getaddrinfo(3). so likeβ¦ check that first if it's giving what you need π
contextβ a pointer to the previously created DNS context you're using for this DNS request. seegetdns_context (3).nameβ the ASCII-based domain name being looked up, as a string. it can <em>also</em> be an IPv4 or IPv6 address for request types that take addresses instead of domain names, likePTR. the values here follow the rules in section 2.1 of RFC 4343, which is what lets non-ASCII octets and special characters exist in labels. iconic of them tbh.request_typeβ specifies the RRtype for the query; the RRtype numbers live in the IANA registry. for example, to get the NS records,request_typewould be2. the API also has defined macros for most of the RRtypes by name, and every one of those definition names starts with"GETDNS_RRTYPE_". so for example, to get the NS records, you can also setrequest_typetoGETDNS_RRTYPE_NS. two roads, same slay β¨extensionsβ extensions for this request,NULLif no extensions. seelibgetnds (3)for a detailed description of extensions.userargβ returned to the callback function untouched, can beNULL. it's just vibing, it does not get processed, no cap.transaction_idβ populated by the API and used to identify the callback (for example togetdns_cancel_callback), can beNULL, and it's set to0if the function fails.callbackfnβ non-NULLpointer to a callback function defined by the application, typically used to process the response. only the asynchronous signature accepts a callback function β the synchronous signature does not include a callback. seelibgetdns (3)for a more detailed discussion of callback functions.responseβ agetdns_dicttype is returned inresponseand it always contains at least three names:replies_full(a list containing the DNS response as binary data),replies_tree(a list containing the parsed DNS response data) andstatus(anint).
β οΈ the storage associated withresponsemust be freed by a call togetdns_free_sync_request_memory (3). do not forget this one bestie, it's giving memory leak and nobody wants that π
π₯ RETURN VALUES π₯
Upon successful completion the functions return GETDNS_RETURN_GOOD. otherwise, these error values come back at you:
GETDNS_RETURN_BAD_CONTEXTβ if the context pointer is invalid, or the context has internal deficiencies.GETDNS_RETURN_BAD_DOMAIN_NAMEβ if the domain name passed to the function is invalid.GETDNS_RETURN_EXTENSION_MISFORMATβ if the data type specified in one or more of the extensions does not match the specifications.GETDNS_RETURN_GENERIC_ERRORβ if some problem was encountered in the function that isn't addressed by one of the more specific return codes. the vague one πGETDNS_RETURN_INVALID PARAMETERβ if one or more parameters has an invalid value.GETDNS_RETURN_MEMORY_ERRORβ if unable to allocate the memory required.GETDNS_RETURN_NO_SUCH_EXTENSIONβ if one or more of the strings specified in the extensions are not valid.
and the values of status that get included in the response parameter are:
GETDNS_RESPSTATUS_GOODβ if at least one response was returned.GETDNS_RESPSTATUS_NO_NAMEβ if queries for the name yielded all negative responses.GETDNS_RESPSTATUS_ALL_TIMEOUTβ if all queries for the name timed out. clocked out, every single one πGETDNS_RESPSTATUS_NO_SECURE_ANSWERSβ if only secure replies are accepted (per context) and at least one response was received, but no DNS responses were secure through DNSSEC.
for a more detailed explanation of the response object, see libgetdns (3).
π¦ REQUEST TYPES π¦
this is the list of the most common request types. a full list of request types in more detail lives at http://www.iana.org/assignments/dns-parameters/dns-parameters.xml β go read it if you want the whole extended universe.
Aβ Host addressAAAAβ IPv6 addressCAAβ Certificate Authority AuthorizationCNAMEβ Canonical name for an aliasDLVβ DNSSEC lookaside validationDNAMEβ DNAMEDSβ Delegation signerHINFOβ Host informationKEYβ Security keyMINFOβ Mailbox or mail list informationMXβ Mail exchangeNSβ Authoritative name serverNSECβ Next secure recordNSEC3β Next secure record (hashed)NSEC3PARAMβ NSEC3PARAMPTRβ Domain name pointerRRSIGβ Signature for a record setSIGβ Security signatureSOAβ Marks the start of a zone of authoritySRVβ Server selectionTAβ DNSSEC trust authoritiesTKEYβ Transaction keyTLSAβ TLSATSIGβ Transaction signatureTXTβ Text strings
π EXAMPLES π
TBD
yes literally. that's what it says. not me waiting for the examples to drop π
π FILES π
/etc/hosts/etc/resolv.conf
π SEE ALSO π
libgetdns(3), getdns_address(3), getdns_context(3), getdns_free_sync_request_memory(3), getdns_hostname(3), getdns_service(3),
and that's the whole page bestie, you're so ready. this was getdns 1.7.3, dated December 2015 β old money, still slaying π periodt.
π¦ where this page comes from
- alpine 3.24: getdns-doc 1.7.3-r0 Β· BSD-3-Clause
- arch rolling: getdns 1.7.3-2 Β· BSD
- epel 10: getdns-devel 1.7.3-9.el10_2 Β· BSD-3-Clause
- epel 9: getdns-devel 1.7.3-1.el9 Β· BSD-3-Clause
- fedora 43: getdns-devel 1.7.3-9.fc43 Β· BSD-3-Clause
- fedora 43: getdns-devel 1.7.3-9.fc43 Β· BSD-3-Clause
- fedora 44: getdns-devel 1.7.3-10.fc44 Β· BSD-3-Clause
- fedora 44: getdns-devel 1.7.3-10.fc44 Β· BSD-3-Clause
- nixpkgs unstable: getdns 1.7.3
- ubuntu resolute: libgetdns-dev 1.7.3-3 Β· BSD-3-Clause
- ubuntu stonking: libgetdns-dev 1.7.3-5build1 Β· BSD-3-Clause
- Copyright (c) 2013, NLnet Labs, Verisign, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms