~ubuntu-branches/ubuntu/jaunty/cmake/jaunty-security

« back to all changes in this revision

Viewing changes to Source/CTest/Curl/hostip.h

  • Committer: Bazaar Package Importer
  • Author(s): A. Maitland Bottoms
  • Date: 2005-03-02 09:22:44 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050302092244-y6o9j8wr27vqcqvx
Tags: 2.0.5-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __HOSTIP_H
 
2
#define __HOSTIP_H
 
3
/***************************************************************************
 
4
 *                                  _   _ ____  _     
 
5
 *  Project                     ___| | | |  _ \| |    
 
6
 *                             / __| | | | |_) | |    
 
7
 *                            | (__| |_| |  _ <| |___ 
 
8
 *                             \___|\___/|_| \_\_____|
 
9
 *
 
10
 * Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
 
11
 *
 
12
 * This software is licensed as described in the file COPYING, which
 
13
 * you should have received as part of this distribution. The terms
 
14
 * are also available at http://curl.haxx.se/docs/copyright.html.
 
15
 * 
 
16
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
 
17
 * copies of the Software, and permit persons to whom the Software is
 
18
 * furnished to do so, under the terms of the COPYING file.
 
19
 *
 
20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 
21
 * KIND, either express or implied.
 
22
 *
 
23
 * $Id: hostip.h,v 1.4 2003/08/07 21:47:53 andy Exp $
 
24
 ***************************************************************************/
 
25
 
 
26
#include "setup.h"
 
27
#include "hash.h"
 
28
 
 
29
struct addrinfo;
 
30
struct SessionHandle;
 
31
 
 
32
void Curl_global_host_cache_init(void);
 
33
void Curl_global_host_cache_dtor(void);
 
34
curl_hash *Curl_global_host_cache_get(void);
 
35
 
 
36
#define Curl_global_host_cache_use(__p) ((__p)->set.global_dns_cache)
 
37
 
 
38
struct Curl_dns_entry {
 
39
  Curl_addrinfo *addr;
 
40
  time_t timestamp;
 
41
  long inuse;      /* use-counter, make very sure you decrease this
 
42
                      when you're done using the address you received */
 
43
#ifdef MALLOCDEBUG
 
44
  char *entry_id;
 
45
#endif
 
46
};
 
47
 
 
48
/*
 
49
 * Curl_resolv() returns an entry with the info for the specified host
 
50
 * and port.
 
51
 *
 
52
 * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after
 
53
 * use, or we'll leak memory!
 
54
 */
 
55
 
 
56
struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data,
 
57
                                   char *hostname,
 
58
                                   int port);
 
59
 
 
60
/* unlock a previously resolved dns entry */
 
61
#define Curl_resolv_unlock(dns) dns->inuse--
 
62
 
 
63
/* for debugging purposes only: */
 
64
void Curl_scan_cache_used(void *user, void *ptr);
 
65
 
 
66
/* free name info */
 
67
void Curl_freeaddrinfo(Curl_addrinfo *freeaddr);
 
68
 
 
69
/* free cached name info */
 
70
void Curl_freednsinfo(void *freethis);
 
71
 
 
72
#ifdef MALLOCDEBUG
 
73
void curl_freeaddrinfo(struct addrinfo *freethis,
 
74
                       int line, const char *source);
 
75
int curl_getaddrinfo(char *hostname, char *service,
 
76
                     struct addrinfo *hints,
 
77
                     struct addrinfo **result,
 
78
                     int line, const char *source);
 
79
#endif
 
80
 
 
81
#endif