1 #ifndef CURLINC_EASY_H 2 #define CURLINC_EASY_H 3 /*************************************************************************** 4 * _ _ ____ _ 5 * Project ___| | | | _ \| | 6 * / __| | | | |_) | | 7 * | (__| |_| | _ <| |___ 8 * \___|\___/|_| \_\_____| 9 * 10 * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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 https://curl.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 28 /* Flag bits in the curl_blob struct: */ 29 #define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */ 30 #define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */ 31 32 struct curl_blob { 33 void *data; 34 size_t len; 35 unsigned int flags; /* bit 0 is defined, the rest are reserved and should be 36 left zeroes */ 37 }; 38 39 CURL_EXTERN CURL *curl_easy_init(void); 40 CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 41 CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 42 CURL_EXTERN void curl_easy_cleanup(CURL *curl); 43 44 /* 45 * NAME curl_easy_getinfo() 46 * 47 * DESCRIPTION 48 * 49 * Request internal information from the curl session with this function. The 50 * third argument MUST be a pointer to a long, a pointer to a char * or a 51 * pointer to a double (as the documentation describes elsewhere). The data 52 * pointed to will be filled in accordingly and can be relied upon only if the 53 * function returns CURLE_OK. This function is intended to get used *AFTER* a 54 * performed transfer, all results from this function are undefined until the 55 * transfer is completed. 56 */ 57 CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 58 59 60 /* 61 * NAME curl_easy_duphandle() 62 * 63 * DESCRIPTION 64 * 65 * Creates a new curl session handle with the same options set for the handle 66 * passed in. Duplicating a handle could only be a matter of cloning data and 67 * options, internal state info and things like persistent connections cannot 68 * be transferred. It is useful in multithreaded applications when you can run 69 * curl_easy_duphandle() for each new thread to avoid a series of identical 70 * curl_easy_setopt() invokes in every thread. 71 */ 72 CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); 73 74 /* 75 * NAME curl_easy_reset() 76 * 77 * DESCRIPTION 78 * 79 * Re-initializes a CURL handle to the default values. This puts back the 80 * handle to the same state as it was in when it was just created. 81 * 82 * It does keep: live connections, the Session ID cache, the DNS cache and the 83 * cookies. 84 */ 85 CURL_EXTERN void curl_easy_reset(CURL *curl); 86 87 /* 88 * NAME curl_easy_recv() 89 * 90 * DESCRIPTION 91 * 92 * Receives data from the connected socket. Use after successful 93 * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 94 */ 95 CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 96 size_t *n); 97 98 /* 99 * NAME curl_easy_send() 100 * 101 * DESCRIPTION 102 * 103 * Sends data over the connected socket. Use after successful 104 * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 105 */ 106 CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 107 size_t buflen, size_t *n); 108 109 110 /* 111 * NAME curl_easy_upkeep() 112 * 113 * DESCRIPTION 114 * 115 * Performs connection upkeep for the given session handle. 116 */ 117 CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); 118 119 #ifdef __cplusplus 120 } 121 #endif 122 123 #endif 124