~ubuntu-branches/ubuntu/lucid/curl/lucid-security

« back to all changes in this revision

Viewing changes to lib/hostip.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2009-04-29 11:10:29 UTC
  • mfrom: (3.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090429111029-2j5eiyokfw2bw049
Tags: 7.19.4-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop build dependencies: stunnel, libdb4.6-dev, libssh2-1-dev
  - Add build-dependency on openssh-server
  - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.
  - Call automake-1.9 with --add-missing --copy --force
* drop debian/patches/security_CVE-2009-0037.patch 
  - this patch is part of 7.19.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
21
 * KIND, either express or implied.
22
22
 *
23
 
 * $Id: hostip.h,v 1.61 2008-01-15 22:44:12 bagder Exp $
 
23
 * $Id: hostip.h,v 1.69 2008-11-06 17:19:57 yangtse Exp $
24
24
 ***************************************************************************/
25
25
 
26
26
#include "setup.h"
27
27
#include "hash.h"
 
28
#include "curl_addrinfo.h"
 
29
 
 
30
#ifdef HAVE_SETJMP_H
 
31
#include <setjmp.h>
 
32
#endif
28
33
 
29
34
#ifdef NETWARE
30
35
#undef in_addr_t
99
104
#define ares_destroy(x) do {} while(0)
100
105
#endif
101
106
 
102
 
/*
103
 
 * Curl_addrinfo MUST be used for all name resolved info.
104
 
 */
105
 
#ifdef CURLRES_IPV6
106
 
typedef struct addrinfo Curl_addrinfo;
107
 
#else
108
 
/* OK, so some ipv4-only include tree probably have the addrinfo struct, but
109
 
   to work even on those that don't, we provide our own look-alike! */
110
 
struct Curl_addrinfo {
111
 
  int                   ai_flags;
112
 
  int                   ai_family;
113
 
  int                   ai_socktype;
114
 
  int                   ai_protocol;
115
 
  socklen_t             ai_addrlen;   /* Follow rfc3493 struct addrinfo */
116
 
  char                 *ai_canonname;
117
 
  struct sockaddr      *ai_addr;
118
 
  struct Curl_addrinfo *ai_next;
119
 
};
120
 
typedef struct Curl_addrinfo Curl_addrinfo;
121
 
#endif
122
 
 
123
107
struct addrinfo;
124
108
struct hostent;
125
109
struct SessionHandle;
150
134
 * use, or we'll leak memory!
151
135
 */
152
136
/* return codes */
 
137
#define CURLRESOLV_TIMEDOUT -2
153
138
#define CURLRESOLV_ERROR    -1
154
139
#define CURLRESOLV_RESOLVED  0
155
140
#define CURLRESOLV_PENDING   1
156
141
int Curl_resolv(struct connectdata *conn, const char *hostname,
157
142
                int port, struct Curl_dns_entry **dnsentry);
 
143
int Curl_resolv_timeout(struct connectdata *conn, const char *hostname,
 
144
                        int port, struct Curl_dns_entry **dnsentry,
 
145
                        long timeoutms);
158
146
 
159
147
/*
160
148
 * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've
195
183
/* for debugging purposes only: */
196
184
void Curl_scan_cache_used(void *user, void *ptr);
197
185
 
198
 
/* free name info */
199
 
void Curl_freeaddrinfo(Curl_addrinfo *freeaddr);
200
 
 
201
186
/* make a new dns cache and return the handle */
202
187
struct curl_hash *Curl_mk_dnscache(void);
203
188
 
207
192
/* Return # of adresses in a Curl_addrinfo struct */
208
193
int Curl_num_addresses (const Curl_addrinfo *addr);
209
194
 
210
 
#ifdef CURLDEBUG
211
 
void curl_dofreeaddrinfo(struct addrinfo *freethis,
212
 
                         int line, const char *source);
213
 
int curl_dogetaddrinfo(const char *hostname, const char *service,
214
 
                       struct addrinfo *hints,
215
 
                       struct addrinfo **result,
216
 
                       int line, const char *source);
217
 
#ifdef HAVE_GETNAMEINFO
 
195
#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)
218
196
int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,
219
197
                       GETNAMEINFO_TYPE_ARG2 salen,
220
198
                       char *host, GETNAMEINFO_TYPE_ARG46 hostlen,
222
200
                       GETNAMEINFO_TYPE_ARG7 flags,
223
201
                       int line, const char *source);
224
202
#endif
225
 
#endif
226
203
 
227
204
/* This is the callback function that is used when we build with asynch
228
205
   resolve, ipv4 */
239
216
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
240
217
                                 int timeouts,
241
218
#endif
242
 
                                 struct addrinfo *ai);
243
 
 
244
 
 
245
 
/* [ipv4/ares only] Creates a Curl_addrinfo struct from a numerical-only IP
246
 
   address */
247
 
Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port);
248
 
 
249
 
/* [ipv4/ares only] Curl_he2ai() converts a struct hostent to a Curl_addrinfo chain
250
 
   and returns it */
251
 
Curl_addrinfo *Curl_he2ai(const struct hostent *, int port);
 
219
                                 Curl_addrinfo *ai);
 
220
 
252
221
 
253
222
/* Clone a Curl_addrinfo struct, works protocol independently */
254
223
Curl_addrinfo *Curl_addrinfo_copy(const void *orig, int port);
283
252
#define CURL_INADDR_NONE INADDR_NONE
284
253
#endif
285
254
 
286
 
 
287
 
 
 
255
#ifdef HAVE_SIGSETJMP
 
256
/* Forward-declaration of variable defined in hostip.c. Beware this
 
257
 * is a global and unique instance. This is used to store the return
 
258
 * address that we can jump back to from inside a signal handler.
 
259
 * This is not thread-safe stuff.
 
260
 */
 
261
extern sigjmp_buf curl_jmpenv;
 
262
#endif
288
263
 
289
264
#endif