From 0ce97f77e02acd2de15970270834a7011ce6cb38 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 30 Oct 2008 13:45:25 +0000 Subject: Use our Curl_addrinfo definition even when an addrinfo struct is available. Use a wrapper function to call system's getaddrinfo(). --- lib/curl_addrinfo.h | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 lib/curl_addrinfo.h (limited to 'lib/curl_addrinfo.h') diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h new file mode 100644 index 000000000..583f3d082 --- /dev/null +++ b/lib/curl_addrinfo.h @@ -0,0 +1,81 @@ +#ifndef HEADER_CURL_ADDRINFO_H +#define HEADER_CURL_ADDRINFO_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef VMS +# include +# include +# include +#endif + + +/* + * Curl_addrinfo is our internal struct definition that we use to allow + * consistent internal handling of this data. We use this even when the + * system provides an addrinfo structure definition. And we use this for + * all sorts of IPv4 and IPV6 builds. + */ + +struct Curl_addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ + char *ai_canonname; + struct sockaddr *ai_addr; + struct Curl_addrinfo *ai_next; +}; +typedef struct Curl_addrinfo Curl_addrinfo; + +void +Curl_freeaddrinfo(Curl_addrinfo *cahead); + +#ifdef HAVE_GETADDRINFO +int +Curl_getaddrinfo_ex(const char *nodename, + const char *servname, + const struct addrinfo *hints, + Curl_addrinfo **result); +#endif + +Curl_addrinfo * +Curl_he2ai(const struct hostent *he, int port); + +#endif /* HEADER_CURL_ADDRINFO_H */ -- cgit v1.2.1 From c2c800d8639b1f34a89548e6c26e6d805036dfdc Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 30 Oct 2008 19:02:23 +0000 Subject: Move curl_dofreeaddrinfo() and curl_dofreeaddrinfo() implementation from lib/hostip6.c to lib/curl_addrinfo.c and prototypes from lib/hostip.h to lib/curl_addrinfo.h --- lib/curl_addrinfo.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/curl_addrinfo.h') diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h index 583f3d082..f6456f965 100644 --- a/lib/curl_addrinfo.h +++ b/lib/curl_addrinfo.h @@ -78,4 +78,20 @@ Curl_getaddrinfo_ex(const char *nodename, Curl_addrinfo * Curl_he2ai(const struct hostent *he, int port); + +#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) +void +curl_dofreeaddrinfo(struct addrinfo *freethis, + int line, const char *source); +#endif + +#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) +int +curl_dogetaddrinfo(const char *hostname, + const char *service, + const struct addrinfo *hints, + struct addrinfo **result, + int line, const char *source); +#endif + #endif /* HEADER_CURL_ADDRINFO_H */ -- cgit v1.2.1 From a0ef686c542bee30be0b20cd4d3243bec6b4f059 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 6 Nov 2008 17:19:56 +0000 Subject: Merged existing IPv4 and IPv6 Curl_ip2addr functions into a single one which now also takes a protocol address family argument. --- lib/curl_addrinfo.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/curl_addrinfo.h') diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h index f6456f965..50480fa09 100644 --- a/lib/curl_addrinfo.h +++ b/lib/curl_addrinfo.h @@ -78,6 +78,8 @@ Curl_getaddrinfo_ex(const char *nodename, Curl_addrinfo * Curl_he2ai(const struct hostent *he, int port); +Curl_addrinfo * +Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port); #if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) void -- cgit v1.2.1 From 9137e717b04644592b9b527839470337fdd9f44d Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 2 May 2009 02:37:32 +0000 Subject: Use build-time configured curl_socklen_t instead of socklen_t --- lib/curl_addrinfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/curl_addrinfo.h') diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h index 50480fa09..2fbb47a68 100644 --- a/lib/curl_addrinfo.h +++ b/lib/curl_addrinfo.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -57,7 +57,7 @@ struct Curl_addrinfo { int ai_family; int ai_socktype; int ai_protocol; - socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ + curl_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ char *ai_canonname; struct sockaddr *ai_addr; struct Curl_addrinfo *ai_next; -- cgit v1.2.1 From 3184a91ec86b2f35f16a8e11e2daa03fac8e91b6 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 30 Dec 2009 17:59:56 +0000 Subject: VMS specific preprocessor symbol checking adjustments --- lib/curl_addrinfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/curl_addrinfo.h') diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h index 2fbb47a68..a7235039f 100644 --- a/lib/curl_addrinfo.h +++ b/lib/curl_addrinfo.h @@ -38,7 +38,7 @@ # include #endif -#ifdef VMS +#ifdef __VMS # include # include # include -- cgit v1.2.1 From a07bc79117971b96ebf3188c0a34a73ee0a3609b Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 14 Feb 2010 19:40:18 +0000 Subject: removed trailing whitespace --- lib/curl_addrinfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/curl_addrinfo.h') diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h index a7235039f..cf7470370 100644 --- a/lib/curl_addrinfo.h +++ b/lib/curl_addrinfo.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -45,7 +45,7 @@ #endif -/* +/* * Curl_addrinfo is our internal struct definition that we use to allow * consistent internal handling of this data. We use this even when the * system provides an addrinfo structure definition. And we use this for -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/curl_addrinfo.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/curl_addrinfo.h') diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h index cf7470370..63159cc4a 100644 --- a/lib/curl_addrinfo.h +++ b/lib/curl_addrinfo.h @@ -20,7 +20,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ #include "setup.h" -- cgit v1.2.1 From 1b24b89cca3c06e36b69969af8edeeaca659515b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 5 Nov 2010 22:31:40 +0100 Subject: CURLOPT_RESOLVE: added CURLOPT_RESOLVE is a new option that sends along a curl_slist with name:port:address sets that will populate the DNS cache with entries so that request can be "fooled" to use another host than what otherwise would've been used. Previously we've encouraged the use of Host: for that when dealing with HTTP, but this new feature has the added bonus that it allows the name from the URL to be used for TLS SNI and server certificate name checks as well. This is a first change. Surely more will follow to make it decent. --- lib/curl_addrinfo.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/curl_addrinfo.h') diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h index 63159cc4a..11c339474 100644 --- a/lib/curl_addrinfo.h +++ b/lib/curl_addrinfo.h @@ -80,6 +80,8 @@ Curl_he2ai(const struct hostent *he, int port); Curl_addrinfo * Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port); +Curl_addrinfo *Curl_str2addr(char *dotted, int port); + #if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) void curl_dofreeaddrinfo(struct addrinfo *freethis, -- cgit v1.2.1