diff options
Diffstat (limited to 'lib/hostip.c')
-rw-r--r-- | lib/hostip.c | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/hostip.c b/lib/hostip.c index f2e394665..b4eb3583a 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -724,88 +724,3 @@ Curl_addrinfo *Curl_addrinfo_copy(const void *org, int port) return Curl_he2ai(orig, port); } #endif /* CURLRES_ADDRINFO_COPY */ - -/*********************************************************************** - * Only for plain-ipv4 and c-ares builds (NOTE: c-ares builds can be IPv6 - * enabled) - **********************************************************************/ - -#if defined(CURLRES_IPV4) || defined(CURLRES_ARES) - -struct namebuf4 { - struct hostent hostentry; - struct in_addr addrentry; - char *h_addr_list[2]; -}; - -/* - * Curl_ip2addr() takes a 32bit ipv4 internet address as input parameter - * together with a pointer to the string version of the address, and it - * returns a Curl_addrinfo chain filled in correctly with information for this - * address/host. - * - * The input parameters ARE NOT checked for validity but they are expected - * to have been checked already when this is called. - */ -Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port) -{ - Curl_addrinfo *ai; - -#if defined(VMS) && \ - defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) -#pragma pointer_size save -#pragma pointer_size short -#pragma message disable PTRMISMATCH -#endif - - struct hostent *h; - struct in_addr *addrentry; - struct namebuf4 *buf; - char *hoststr; - - DEBUGASSERT(hostname); - - buf = malloc(sizeof(struct namebuf4)); - if(!buf) - return NULL; - - hoststr = strdup(hostname); - if(!hoststr) { - free(buf); - return NULL; - } - - addrentry = &buf->addrentry; -#ifdef _CRAYC - /* On UNICOS, s_addr is a bit field and for some reason assigning to it - * doesn't work. There must be a better fix than this ugly hack. - */ - memcpy(addrentry, &num, SIZEOF_in_addr); -#else - addrentry->s_addr = num; -#endif - - h = &buf->hostentry; - h->h_name = hoststr; - h->h_aliases = NULL; - h->h_addrtype = AF_INET; - h->h_length = sizeof(struct in_addr); - h->h_addr_list = &buf->h_addr_list[0]; - h->h_addr_list[0] = (char*)addrentry; - h->h_addr_list[1] = NULL; /* terminate list of entries */ - -#if defined(VMS) && \ - defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) -#pragma pointer_size restore -#pragma message enable PTRMISMATCH -#endif - - ai = Curl_he2ai(h, port); - - free(hoststr); - free(buf); - - return ai; -} - -#endif /* CURLRES_IPV4 || CURLRES_ARES */ |