示例#1
0
/*******************************************************
  * Get the full host name from the cache using either 
  * the host name or the address depending on what is 
  * supplied.
  *****************************************************/
char *get_cached_fullhostname(const char *hostname,const struct sockaddr_in *sai)
  {
  struct addrinfo *pAddrInfo = NULL;

  if (hostname != NULL) 
    pAddrInfo = cache.getFromCache(hostname);

  if ((pAddrInfo == NULL) &&
      (sai != NULL))
    pAddrInfo = cache.getFromCache(sai->sin_addr.s_addr);

  if (pAddrInfo == NULL)
    return(NULL);

  return(pAddrInfo->ai_canonname);
  } /* END get_cached_fullhostname() */
示例#2
0
/*************************************************************
  * Get the full addrinfo structure returned by getaddrinfo
  * from the cache.
  ************************************************************/
struct addrinfo *get_cached_addrinfo_full(const char *hostname)
  {
  struct addrinfo *pAddrInfo = NULL;

  if(hostname != NULL) pAddrInfo = cache.getFromCache(hostname);
  if(pAddrInfo == NULL) return NULL;
  return pAddrInfo;
  } /* END get_cached_addrinfo() */
示例#3
0
/*************************************************************
  * Get the address from the host name.
  ***********************************************************/
struct sockaddr_in *get_cached_addrinfo(const char *hostname)
  {
  struct addrinfo *pAddrInfo = NULL;
  
  if(hostname != NULL) pAddrInfo = cache.getFromCache(hostname);
  if(pAddrInfo == NULL) return NULL;
  return (struct sockaddr_in *)pAddrInfo->ai_addr;
  } /* END get_cached_addrinfo() */