2
0

hostsyn.c 3.3 KB

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