1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2007, 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  * $Id: hostsyn.c,v 1.14 2008-09-29 21:44:50 danf Exp $
22  ***************************************************************************/
23 
24 #include "setup.h"
25 
26 #include <string.h>
27 
28 #ifdef NEED_MALLOC_H
29 #include <malloc.h>
30 #endif
31 #ifdef HAVE_SYS_SOCKET_H
32 #include <sys/socket.h>
33 #endif
34 #ifdef HAVE_NETINET_IN_H
35 #include <netinet/in.h>
36 #endif
37 #ifdef HAVE_NETDB_H
38 #include <netdb.h>
39 #endif
40 #ifdef HAVE_ARPA_INET_H
41 #include <arpa/inet.h>
42 #endif
43 #ifdef HAVE_STDLIB_H
44 #include <stdlib.h>     /* required for free() prototypes */
45 #endif
46 #ifdef HAVE_UNISTD_H
47 #include <unistd.h>     /* for the close() proto */
48 #endif
49 #ifdef  VMS
50 #include <in.h>
51 #include <inet.h>
52 #include <stdlib.h>
53 #endif
54 
55 #ifdef HAVE_PROCESS_H
56 #include <process.h>
57 #endif
58 
59 #include "urldata.h"
60 #include "sendf.h"
61 #include "hostip.h"
62 #include "hash.h"
63 #include "share.h"
64 #include "strerror.h"
65 #include "url.h"
66 
67 #define _MPRINTF_REPLACE /* use our functions only */
68 #include <curl/mprintf.h>
69 
70 #include "memory.h"
71 /* The last #include file should be: */
72 #include "memdebug.h"
73 
74 /***********************************************************************
75  * Only for builds using synchronous name resolves
76  **********************************************************************/
77 #ifdef CURLRES_SYNCH
78 
79 /*
80  * Curl_wait_for_resolv() for synch-builds.  Curl_resolv() can never return
81  * wait==TRUE, so this function will never be called. If it still gets called,
82  * we return failure at once.
83  *
84  * We provide this function only to allow multi.c to remain unaware if we are
85  * doing asynch resolves or not.
86  */
Curl_wait_for_resolv(struct connectdata * conn,struct Curl_dns_entry ** entry)87 CURLcode Curl_wait_for_resolv(struct connectdata *conn,
88                               struct Curl_dns_entry **entry)
89 {
90   (void)conn;
91   *entry=NULL;
92   return CURLE_COULDNT_RESOLVE_HOST;
93 }
94 
95 /*
96  * This function will never be called when synch-built. If it still gets
97  * called, we return failure at once.
98  *
99  * We provide this function only to allow multi.c to remain unaware if we are
100  * doing asynch resolves or not.
101  */
Curl_is_resolved(struct connectdata * conn,struct Curl_dns_entry ** dns)102 CURLcode Curl_is_resolved(struct connectdata *conn,
103                           struct Curl_dns_entry **dns)
104 {
105   (void)conn;
106   *dns = NULL;
107 
108   return CURLE_COULDNT_RESOLVE_HOST;
109 }
110 
111 /*
112  * We just return OK, this function is never actually used for synch builds.
113  * It is present here to keep #ifdefs out from multi.c
114  */
115 
Curl_resolv_getsock(struct connectdata * conn,curl_socket_t * sock,int numsocks)116 int Curl_resolv_getsock(struct connectdata *conn,
117                         curl_socket_t *sock,
118                         int numsocks)
119 {
120   (void)conn;
121   (void)sock;
122   (void)numsocks;
123 
124   return 0; /* no bits since we don't use any socks */
125 }
126 
127 #endif /* truly sync */
128