hostsyn.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 1998 - 2007, 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. #ifdef NEED_MALLOC_H
  26. #include <malloc.h>
  27. #endif
  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. #ifdef HAVE_STDLIB_H
  41. #include <stdlib.h> /* required for free() prototypes */
  42. #endif
  43. #ifdef HAVE_UNISTD_H
  44. #include <unistd.h> /* for the close() proto */
  45. #endif
  46. #ifdef VMS
  47. #include <in.h>
  48. #include <inet.h>
  49. #include <stdlib.h>
  50. #endif
  51. #ifdef HAVE_SETJMP_H
  52. #include <setjmp.h>
  53. #endif
  54. #ifdef HAVE_PROCESS_H
  55. #include <process.h>
  56. #endif
  57. #include "urldata.h"
  58. #include "sendf.h"
  59. #include "hostip.h"
  60. #include "hash.h"
  61. #include "share.h"
  62. #include "strerror.h"
  63. #include "url.h"
  64. #define _MPRINTF_REPLACE /* use our functions only */
  65. #include <curl/mprintf.h>
  66. #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
  67. #include "inet_ntoa_r.h"
  68. #endif
  69. #include "memory.h"
  70. /* The last #include file should be: */
  71. #include "memdebug.h"
  72. /***********************************************************************
  73. * Only for builds using synchronous name resolves
  74. **********************************************************************/
  75. #ifdef CURLRES_SYNCH
  76. /*
  77. * Curl_wait_for_resolv() for synch-builds. Curl_resolv() can never return
  78. * wait==TRUE, so this function will never be called. If it still gets called,
  79. * we return failure at once.
  80. *
  81. * We provide this function only to allow multi.c to remain unaware if we are
  82. * doing asynch resolves or not.
  83. */
  84. CURLcode Curl_wait_for_resolv(struct connectdata *conn,
  85. struct Curl_dns_entry **entry)
  86. {
  87. (void)conn;
  88. *entry=NULL;
  89. return CURLE_COULDNT_RESOLVE_HOST;
  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. return CURLE_COULDNT_RESOLVE_HOST;
  104. }
  105. /*
  106. * We just return OK, this function is never actually used for synch builds.
  107. * It is present here to keep #ifdefs out from multi.c
  108. */
  109. int Curl_resolv_getsock(struct connectdata *conn,
  110. curl_socket_t *sock,
  111. int numsocks)
  112. {
  113. (void)conn;
  114. (void)sock;
  115. (void)numsocks;
  116. return 0; /* no bits since we don't use any socks */
  117. }
  118. #endif /* truly sync */