tfAddHost

Jump to: navigation, search

Table of Contents >> Application Reference >> DNS Resolver


#include <trsocket.h>


int tfAddHost (
const char TM_FAR * hostnameStr,
const struct sockaddr_storage TM_FAR * addressPtr
);


Function Description

Add a hostname, IP address pair to the Hosts Table or update an existing entry if the hostname already exists. IPv4 and IPv6 addresses are supported.



Parameters

  • hostnameStr
    Name to associate with host address
  • addressPtr
    IPv4 or IPv6 address in binary form



Returns

  • TM_ENOERROR
    Success.
  • TM_EPERM
    Call tfDnsInit() first.
  • TM_EINVAL
    hostnameStr or addressPtr is NULL or hostnameStr is zero length
  • TM_EAFNOSUPPORT
    addressPtr or addressFamily is not AF_INET or AF_INET6
  • TM_ENOMEM
    Memory allocation failed



Table of Contents >> Application Reference >> DNS Resolver