~ubuntu-branches/ubuntu/vivid/curl/vivid

« back to all changes in this revision

Viewing changes to lib/curl_addrinfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Schuldei
  • Date: 2009-04-02 23:35:45 UTC
  • mto: (1.2.1 upstream) (3.2.3 sid)
  • mto: This revision was merged to the branch mainline in revision 38.
  • Revision ID: james.westby@ubuntu.com-20090402233545-geixkwhe3izccjt7
Tags: upstream-7.19.4
ImportĀ upstreamĀ versionĀ 7.19.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef HEADER_CURL_ADDRINFO_H
 
2
#define HEADER_CURL_ADDRINFO_H
 
3
/***************************************************************************
 
4
 *                                  _   _ ____  _
 
5
 *  Project                     ___| | | |  _ \| |
 
6
 *                             / __| | | | |_) | |
 
7
 *                            | (__| |_| |  _ <| |___
 
8
 *                             \___|\___/|_| \_\_____|
 
9
 *
 
10
 * Copyright (C) 1998 - 2008, 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: curl_addrinfo.h,v 1.3 2008-11-06 17:19:57 yangtse Exp $
 
24
 ***************************************************************************/
 
25
 
 
26
#include "setup.h"
 
27
 
 
28
#ifdef HAVE_SYS_SOCKET_H
 
29
#  include <sys/socket.h>
 
30
#endif
 
31
#ifdef HAVE_NETINET_IN_H
 
32
#  include <netinet/in.h>
 
33
#endif
 
34
#ifdef HAVE_NETDB_H
 
35
#  include <netdb.h>
 
36
#endif
 
37
#ifdef HAVE_ARPA_INET_H
 
38
#  include <arpa/inet.h>
 
39
#endif
 
40
 
 
41
#ifdef  VMS
 
42
#  include <in.h>
 
43
#  include <inet.h>
 
44
#  include <stdlib.h>
 
45
#endif
 
46
 
 
47
 
 
48
/* 
 
49
 * Curl_addrinfo is our internal struct definition that we use to allow
 
50
 * consistent internal handling of this data. We use this even when the
 
51
 * system provides an addrinfo structure definition. And we use this for
 
52
 * all sorts of IPv4 and IPV6 builds.
 
53
 */
 
54
 
 
55
struct Curl_addrinfo {
 
56
  int                   ai_flags;
 
57
  int                   ai_family;
 
58
  int                   ai_socktype;
 
59
  int                   ai_protocol;
 
60
  socklen_t             ai_addrlen;   /* Follow rfc3493 struct addrinfo */
 
61
  char                 *ai_canonname;
 
62
  struct sockaddr      *ai_addr;
 
63
  struct Curl_addrinfo *ai_next;
 
64
};
 
65
typedef struct Curl_addrinfo Curl_addrinfo;
 
66
 
 
67
void
 
68
Curl_freeaddrinfo(Curl_addrinfo *cahead);
 
69
 
 
70
#ifdef HAVE_GETADDRINFO
 
71
int
 
72
Curl_getaddrinfo_ex(const char *nodename,
 
73
                    const char *servname,
 
74
                    const struct addrinfo *hints,
 
75
                    Curl_addrinfo **result);
 
76
#endif
 
77
 
 
78
Curl_addrinfo *
 
79
Curl_he2ai(const struct hostent *he, int port);
 
80
 
 
81
Curl_addrinfo *
 
82
Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port);
 
83
 
 
84
#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO)
 
85
void
 
86
curl_dofreeaddrinfo(struct addrinfo *freethis,
 
87
                    int line, const char *source);
 
88
#endif
 
89
 
 
90
#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO)
 
91
int
 
92
curl_dogetaddrinfo(const char *hostname,
 
93
                   const char *service,
 
94
                   const struct addrinfo *hints,
 
95
                   struct addrinfo **result,
 
96
                   int line, const char *source);
 
97
#endif
 
98
 
 
99
#endif /* HEADER_CURL_ADDRINFO_H */