diff options
author | Gisle Vanem <gvanem@broadpark.no> | 2006-07-25 10:31:31 +0000 |
---|---|---|
committer | Gisle Vanem <gvanem@broadpark.no> | 2006-07-25 10:31:31 +0000 |
commit | e4d6ade4b318c2694937695aeaf2b1e542d394f6 (patch) | |
tree | 9e1f338ed22df1334c2830370f34f187d3592a44 /lib/hostip4.c | |
parent | c82e880f5b944b220d8d1592bda32fd35e0f5259 (diff) | |
download | curl-e4d6ade4b318c2694937695aeaf2b1e542d394f6.tar.gz |
Moved functions common to IPv4 and C-ares to hostip.c;
Curl_freeaddrinfo() and Curl_ip2addr().
Diffstat (limited to 'lib/hostip4.c')
-rw-r--r-- | lib/hostip4.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/lib/hostip4.c b/lib/hostip4.c index c56f08a4e..936e436dc 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -93,23 +93,6 @@ * Only for plain-ipv4 builds **********************************************************************/ #ifdef CURLRES_IPV4 /* plain ipv4 code coming up */ - -/* - * This is a function for freeing name information in a protocol independent - * way. - */ -void Curl_freeaddrinfo(Curl_addrinfo *ai) -{ - Curl_addrinfo *next; - - /* walk over the list and free all entries */ - while(ai) { - next = ai->ai_next; - free(ai); - ai = next; - } -} - /* * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've * been set and returns TRUE if they are OK. @@ -123,49 +106,6 @@ bool Curl_ipvalid(struct SessionHandle *data) return TRUE; /* OK, proceed */ } -struct namebuf { - struct hostent hostentry; - char *h_addr_list[2]; - struct in_addr addrentry; - char h_name[16]; /* 123.123.123.123 = 15 letters is maximum */ -}; - -/* - * 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; - struct hostent *h; - struct in_addr *addrentry; - struct namebuf buffer; - struct namebuf *buf = &buffer; - - h = &buf->hostentry; - h->h_addr_list = &buf->h_addr_list[0]; - addrentry = &buf->addrentry; - addrentry->s_addr = num; - h->h_addr_list[0] = (char*)addrentry; - h->h_addr_list[1] = NULL; - h->h_addrtype = AF_INET; - h->h_length = sizeof(*addrentry); - h->h_name = &buf->h_name[0]; - h->h_aliases = NULL; - - /* Now store the dotted version of the address */ - snprintf((char *)h->h_name, 16, "%s", hostname); - - ai = Curl_he2ai(h, port); - - return ai; -} - #ifdef CURLRES_SYNCH /* the functions below are for synchronous resolves */ /* |