easy.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef __CURL_EASY_H
  2. #define __CURL_EASY_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2008, Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at http://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. ***************************************************************************/
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. CURL_EXTERN CURL *curl_easy_init(void);
  28. CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
  29. CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
  30. CURL_EXTERN void curl_easy_cleanup(CURL *curl);
  31. /*
  32. * NAME curl_easy_getinfo()
  33. *
  34. * DESCRIPTION
  35. *
  36. * Request internal information from the curl session with this function. The
  37. * third argument MUST be a pointer to a long, a pointer to a char * or a
  38. * pointer to a double (as the documentation describes elsewhere). The data
  39. * pointed to will be filled in accordingly and can be relied upon only if the
  40. * function returns CURLE_OK. This function is intended to get used *AFTER* a
  41. * performed transfer, all results from this function are undefined until the
  42. * transfer is completed.
  43. */
  44. CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
  45. /*
  46. * NAME curl_easy_duphandle()
  47. *
  48. * DESCRIPTION
  49. *
  50. * Creates a new curl session handle with the same options set for the handle
  51. * passed in. Duplicating a handle could only be a matter of cloning data and
  52. * options, internal state info and things like persistent connections cannot
  53. * be transferred. It is useful in multithreaded applications when you can run
  54. * curl_easy_duphandle() for each new thread to avoid a series of identical
  55. * curl_easy_setopt() invokes in every thread.
  56. */
  57. CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);
  58. /*
  59. * NAME curl_easy_reset()
  60. *
  61. * DESCRIPTION
  62. *
  63. * Re-initializes a CURL handle to the default values. This puts back the
  64. * handle to the same state as it was in when it was just created.
  65. *
  66. * It does keep: live connections, the Session ID cache, the DNS cache and the
  67. * cookies.
  68. */
  69. CURL_EXTERN void curl_easy_reset(CURL *curl);
  70. /*
  71. * NAME curl_easy_recv()
  72. *
  73. * DESCRIPTION
  74. *
  75. * Receives data from the connected socket. Use after successful
  76. * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
  77. */
  78. CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
  79. size_t *n);
  80. /*
  81. * NAME curl_easy_send()
  82. *
  83. * DESCRIPTION
  84. *
  85. * Sends data over the connected socket. Use after successful
  86. * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
  87. */
  88. CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
  89. size_t buflen, size_t *n);
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif