jpayne@69: #ifndef CURLINC_EASY_H jpayne@69: #define CURLINC_EASY_H jpayne@69: /*************************************************************************** jpayne@69: * _ _ ____ _ jpayne@69: * Project ___| | | | _ \| | jpayne@69: * / __| | | | |_) | | jpayne@69: * | (__| |_| | _ <| |___ jpayne@69: * \___|\___/|_| \_\_____| jpayne@69: * jpayne@69: * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. jpayne@69: * jpayne@69: * This software is licensed as described in the file COPYING, which jpayne@69: * you should have received as part of this distribution. The terms jpayne@69: * are also available at https://curl.se/docs/copyright.html. jpayne@69: * jpayne@69: * You may opt to use, copy, modify, merge, publish, distribute and/or sell jpayne@69: * copies of the Software, and permit persons to whom the Software is jpayne@69: * furnished to do so, under the terms of the COPYING file. jpayne@69: * jpayne@69: * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY jpayne@69: * KIND, either express or implied. jpayne@69: * jpayne@69: * SPDX-License-Identifier: curl jpayne@69: * jpayne@69: ***************************************************************************/ jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: /* Flag bits in the curl_blob struct: */ jpayne@69: #define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */ jpayne@69: #define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */ jpayne@69: jpayne@69: struct curl_blob { jpayne@69: void *data; jpayne@69: size_t len; jpayne@69: unsigned int flags; /* bit 0 is defined, the rest are reserved and should be jpayne@69: left zeroes */ jpayne@69: }; jpayne@69: jpayne@69: CURL_EXTERN CURL *curl_easy_init(void); jpayne@69: CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); jpayne@69: CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); jpayne@69: CURL_EXTERN void curl_easy_cleanup(CURL *curl); jpayne@69: jpayne@69: /* jpayne@69: * NAME curl_easy_getinfo() jpayne@69: * jpayne@69: * DESCRIPTION jpayne@69: * jpayne@69: * Request internal information from the curl session with this function. The jpayne@69: * third argument MUST be a pointer to a long, a pointer to a char * or a jpayne@69: * pointer to a double (as the documentation describes elsewhere). The data jpayne@69: * pointed to will be filled in accordingly and can be relied upon only if the jpayne@69: * function returns CURLE_OK. This function is intended to get used *AFTER* a jpayne@69: * performed transfer, all results from this function are undefined until the jpayne@69: * transfer is completed. jpayne@69: */ jpayne@69: CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); jpayne@69: jpayne@69: jpayne@69: /* jpayne@69: * NAME curl_easy_duphandle() jpayne@69: * jpayne@69: * DESCRIPTION jpayne@69: * jpayne@69: * Creates a new curl session handle with the same options set for the handle jpayne@69: * passed in. Duplicating a handle could only be a matter of cloning data and jpayne@69: * options, internal state info and things like persistent connections cannot jpayne@69: * be transferred. It is useful in multithreaded applications when you can run jpayne@69: * curl_easy_duphandle() for each new thread to avoid a series of identical jpayne@69: * curl_easy_setopt() invokes in every thread. jpayne@69: */ jpayne@69: CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); jpayne@69: jpayne@69: /* jpayne@69: * NAME curl_easy_reset() jpayne@69: * jpayne@69: * DESCRIPTION jpayne@69: * jpayne@69: * Re-initializes a CURL handle to the default values. This puts back the jpayne@69: * handle to the same state as it was in when it was just created. jpayne@69: * jpayne@69: * It does keep: live connections, the Session ID cache, the DNS cache and the jpayne@69: * cookies. jpayne@69: */ jpayne@69: CURL_EXTERN void curl_easy_reset(CURL *curl); jpayne@69: jpayne@69: /* jpayne@69: * NAME curl_easy_recv() jpayne@69: * jpayne@69: * DESCRIPTION jpayne@69: * jpayne@69: * Receives data from the connected socket. Use after successful jpayne@69: * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. jpayne@69: */ jpayne@69: CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, jpayne@69: size_t *n); jpayne@69: jpayne@69: /* jpayne@69: * NAME curl_easy_send() jpayne@69: * jpayne@69: * DESCRIPTION jpayne@69: * jpayne@69: * Sends data over the connected socket. Use after successful jpayne@69: * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. jpayne@69: */ jpayne@69: CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, jpayne@69: size_t buflen, size_t *n); jpayne@69: jpayne@69: jpayne@69: /* jpayne@69: * NAME curl_easy_upkeep() jpayne@69: * jpayne@69: * DESCRIPTION jpayne@69: * jpayne@69: * Performs connection upkeep for the given session handle. jpayne@69: */ jpayne@69: CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } /* end of extern "C" */ jpayne@69: #endif jpayne@69: jpayne@69: #endif