hostsyn.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 1998 - 2004, Daniel Stenberg, <[email protected]>, 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. #include <errno.h>
  26. #define _REENTRANT
  27. #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
  28. #include <malloc.h>
  29. #else
  30. #ifdef HAVE_SYS_TYPES_H
  31. #include <sys/types.h>
  32. #endif
  33. #ifdef HAVE_SYS_SOCKET_H
  34. #include <sys/socket.h>
  35. #endif
  36. #ifdef HAVE_NETINET_IN_H
  37. #include <netinet/in.h>
  38. #endif
  39. #ifdef HAVE_NETDB_H
  40. #include <netdb.h>
  41. #endif
  42. #ifdef HAVE_ARPA_INET_H
  43. #include <arpa/inet.h>
  44. #endif
  45. #ifdef HAVE_STDLIB_H
  46. #include <stdlib.h> /* required for free() prototypes */
  47. #endif
  48. #ifdef HAVE_UNISTD_H
  49. #include <unistd.h> /* for the close() proto */
  50. #endif
  51. #ifdef VMS
  52. #include <in.h>
  53. #include <inet.h>
  54. #include <stdlib.h>
  55. #endif
  56. #endif
  57. #ifdef HAVE_SETJMP_H
  58. #include <setjmp.h>
  59. #endif
  60. #ifdef WIN32
  61. #include <process.h>
  62. #endif
  63. #if (defined(NETWARE) && defined(__NOVELL_LIBC__))
  64. #undef in_addr_t
  65. #define in_addr_t unsigned long
  66. #endif
  67. #include "urldata.h"
  68. #include "sendf.h"
  69. #include "hostip.h"
  70. #include "hash.h"
  71. #include "share.h"
  72. #include "strerror.h"
  73. #include "url.h"
  74. #define _MPRINTF_REPLACE /* use our functions only */
  75. #include <curl/mprintf.h>
  76. #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
  77. #include "inet_ntoa_r.h"
  78. #endif
  79. #include "curl_memory.h"
  80. /* The last #include file should be: */
  81. #include "memdebug.h"
  82. /***********************************************************************
  83. * Only for builds using synchronous name resolves
  84. **********************************************************************/
  85. #ifdef CURLRES_SYNCH
  86. /*
  87. * Curl_wait_for_resolv() for synch-builds. Curl_resolv() can never return
  88. * wait==TRUE, so this function will never be called. If it still gets called,
  89. * we return failure at once.
  90. *
  91. * We provide this function only to allow multi.c to remain unaware if we are
  92. * doing asynch resolves or not.
  93. */
  94. CURLcode Curl_wait_for_resolv(struct connectdata *conn,
  95. struct Curl_dns_entry **entry)
  96. {
  97. (void)conn;
  98. *entry=NULL;
  99. return CURLE_COULDNT_RESOLVE_HOST;
  100. }
  101. /*
  102. * This function will never be called when synch-built. If it still gets
  103. * called, we return failure at once.
  104. *
  105. * We provide this function only to allow multi.c to remain unaware if we are
  106. * doing asynch resolves or not.
  107. */
  108. CURLcode Curl_is_resolved(struct connectdata *conn,
  109. struct Curl_dns_entry **dns)
  110. {
  111. (void)conn;
  112. *dns = NULL;
  113. return CURLE_COULDNT_RESOLVE_HOST;
  114. }
  115. /*
  116. * We just return OK, this function is never actually used for synch builds.
  117. * It is present here to keep #ifdefs out from multi.c
  118. */
  119. CURLcode Curl_fdset(struct connectdata *conn,
  120. fd_set *read_fd_set,
  121. fd_set *write_fd_set,
  122. int *max_fdp)
  123. {
  124. (void)conn;
  125. (void)read_fd_set;
  126. (void)write_fd_set;
  127. (void)max_fdp;
  128. return CURLE_OK;
  129. }
  130. #endif /* truly sync */