tfNgDnsGetNextMailHost

Jump to: navigation, search

Table of Contents >> Application Reference >> DNS Resolver


#include <trsocket.h>


int tfNgDnsGetNextMailHost (
const char * hostnameStr,
struct addrinfo * lastIpAddrPtr,
unsigned short lastPref,
const struct addrinfo * hintsPtr,
struct addrinfo ** resPtrPtr
);


Function Description

This function returns the IP address of any additional mail server for this hostname. If operating in non-blocking mode, tfNgDnsGetNextMailHost() should be called repeatedly for the same request until it returns any value other than TM_EWOULDBLOCK. If this function returns TM_ENOERROR, the user is responsible for freeing the returned addrinfo structure by calling freeaddrinfo().


Parameters

  • hostnameStr
    Hostname to resolve.
  • lastIpAddrPtr
    The IP address of the last retrieved mail host for this host.
  • lastPref
    The preference of the last retrieved mail host for this host.
  • hintsPtr
    A pointer to a structure indicating which types of addresses the caller is interested in.
  • resPtrPtr
    A pointer to the address of an addrinfo structure to store the address information of the retrieved mail host.



Returns

  • TM_ENOERROR
    Success. The IP address is stored in *resPtrPtr. The MX preference value is stored in (*resPtrPtr)->ai_mxpref.
  • TM_EINVAL
    Invalid host name string or IP address pointer.
  • EAI_FAMILY
    Invalid address family specified with hintsPtr.
  • TM_EPERM
    tfDnsInit() has not yet been called.
  • TM_EWOULDBLOCK
    DNS lookup in progress. The user should continue to call tfNgDnsGetMailHost() with the same parameters until it returns a value other than TM_EWOULDBLOCK.
  • TM_EFILE
    Treck was unable to successfully allocate a socket for the DNS request. This could indicate Treck did not have the resources to allocate another socket. It could also be due to Treck hitting the limit of sockets set by TM_DNS_MAX_SOCKETS_ALLOWED or the tfDnsSetOption() option: TM_DNS_OPTION_MAX_SOCKETS_ALLOWED.


Table of Contents >> Application Reference >> DNS Resolver