Home

Traffic Server Software Developers Kit

Host Lookup Functions

INKHostLookup

Instructs Traffic Server to do a DNS lookup on a host name.

Prototype

INKAction INKHostLookupResult (INKCont contp, char *hostname, int namelen)

Arguments

INKCont contp is the continuation Traffic Server calls back when the DNS lookup occurs.

char *hostname is the name to look up. Null-terminated.

int namelen is the length of hostname +1 (add one to account for null termination).

Description

Initiates a DNS lookup of hostname. When the lookup occurs, Traffic Server sends contp INK_EVENT_DNS_LOOKUP. If the lookup is successful (IP address resolved), then the void * data passed to the handler of the continuation contp is a data of type INKHostLookupResult. You can then use INKHostLookupResultIPGet to convert this information to an unsigned int representing the IP address.

If the lookup fails (IP address not resolved), then the void * data passed to the handler of continuation contp is a null pointer.

You have the option to cancel the action returned by INKHostLookup by using INKActionCancel.

[Note] Note

Reentrant calls are possible; i.e., the cache can call back the user (contp) in the same call.

Returns

An INKAction object if successful.

INK_ERROR_PTR if an argument is incorrect or if the API fails.