Git init
[external/curl.git] / lib / hostsyn.c
1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
9  *
10  * This software is licensed as described in the file COPYING, which
11  * you should have received as part of this distribution. The terms
12  * are also available at http://curl.haxx.se/docs/copyright.html.
13  *
14  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15  * copies of the Software, and permit persons to whom the Software is
16  * furnished to do so, under the terms of the COPYING file.
17  *
18  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19  * KIND, either express or implied.
20  *
21  ***************************************************************************/
22
23 #include "setup.h"
24
25 #include <string.h>
26
27 #ifdef HAVE_SYS_SOCKET_H
28 #include <sys/socket.h>
29 #endif
30 #ifdef HAVE_NETINET_IN_H
31 #include <netinet/in.h>
32 #endif
33 #ifdef HAVE_NETDB_H
34 #include <netdb.h>
35 #endif
36 #ifdef HAVE_ARPA_INET_H
37 #include <arpa/inet.h>
38 #endif
39 #ifdef HAVE_STDLIB_H
40 #include <stdlib.h>     /* required for free() prototypes */
41 #endif
42 #ifdef HAVE_UNISTD_H
43 #include <unistd.h>     /* for the close() proto */
44 #endif
45 #ifdef __VMS
46 #include <in.h>
47 #include <inet.h>
48 #include <stdlib.h>
49 #endif
50
51 #ifdef HAVE_PROCESS_H
52 #include <process.h>
53 #endif
54
55 #include "urldata.h"
56 #include "sendf.h"
57 #include "hostip.h"
58 #include "hash.h"
59 #include "share.h"
60 #include "strerror.h"
61 #include "url.h"
62
63 #define _MPRINTF_REPLACE /* use our functions only */
64 #include <curl/mprintf.h>
65
66 #include "curl_memory.h"
67 /* The last #include file should be: */
68 #include "memdebug.h"
69
70 /***********************************************************************
71  * Only for builds using synchronous name resolves
72  **********************************************************************/
73 #ifdef CURLRES_SYNCH
74
75 /*
76  * Curl_wait_for_resolv() for synch-builds.  Curl_resolv() can never return
77  * wait==TRUE, so this function will never be called. If it still gets called,
78  * we return failure at once.
79  *
80  * We provide this function only to allow multi.c to remain unaware if we are
81  * doing asynch resolves or not.
82  */
83 CURLcode Curl_wait_for_resolv(struct connectdata *conn,
84                               struct Curl_dns_entry **entry)
85 {
86   (void)conn;
87   *entry=NULL;
88   return CURLE_COULDNT_RESOLVE_HOST;
89 }
90
91 /*
92  * This function will never be called when synch-built. If it still gets
93  * called, we return failure at once.
94  *
95  * We provide this function only to allow multi.c to remain unaware if we are
96  * doing asynch resolves or not.
97  */
98 CURLcode Curl_is_resolved(struct connectdata *conn,
99                           struct Curl_dns_entry **dns)
100 {
101   (void)conn;
102   *dns = NULL;
103
104   return CURLE_COULDNT_RESOLVE_HOST;
105 }
106
107 /*
108  * We just return OK, this function is never actually used for synch builds.
109  * It is present here to keep #ifdefs out from multi.c
110  */
111
112 int Curl_resolv_getsock(struct connectdata *conn,
113                         curl_socket_t *sock,
114                         int numsocks)
115 {
116   (void)conn;
117   (void)sock;
118   (void)numsocks;
119
120   return 0; /* no bits since we don't use any socks */
121 }
122
123 #endif /* truly sync */