tfNgDnsGetMailHost

Jump to: navigation, search

Table of Contents >> Application Reference >> DNS Resolver


#include <trsocket.h>


int tfNgDnsGetMailHost (
const char * hostnameStr,
const struct addrinfo * hintsPtr,
struct addrinfo ** resPtrPtr
);


Function Description

This function returns the IP address of the primary mail server for the given hostname. If operating in non-blocking mode, tfNgDnsGetMailHost() should be called repeatedly for the same request until it returns any value other than TM_EWOULDBLOCK.


Parameters

  • hostnameStr
    Hostname to resolve.
  • 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