Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
|
A tool for making http(s) requests and responses. More...
#include <curl_tools.h>
Public Member Functions | |
void | FreeCurlTool (CurlTool *curl_p) |
Free a CurlTool. More... | |
bool | SetSSLEngine (CurlTool *curl_p, const char *cryptograph_engine_name_s) |
Set the cryptographic engine to use. More... | |
bool | AddCurlCallback (CurlTool *curl_tool_p, curl_write_callback callback_fn, void *callback_data_p) |
Add a callback to write the HTTP response for this CURL object to the given buffer. More... | |
bool | SetUriForCurlTool (CurlTool *tool_p, const char *const uri_s) |
Set the URI that the CurlTool will try to get the html data from. More... | |
CURLcode | RunCurlTool (CurlTool *tool_p) |
Run a CurlTool. More... | |
bool | SetCurlToolForJSONPost (CurlTool *tool_p) |
Set up a CurlTool to do a JSON post when it is run. More... | |
const char * | GetCurlToolData (CurlTool *const tool_p) |
Get the downloaded data from a CurlTool. More... | |
size_t | GetCurlToolDataSize (CurlTool *const tool_p) |
Get the size in bytes of the downloaded data from a CurlTool. More... | |
bool | MakeRemoteJSONCallFromCurlTool (CurlTool *tool_p, const json_t *req_p) |
Send a JSON request using a CurlTool. More... | |
bool | SetCurlToolHeader (CurlTool *tool_p, const char *key_s, const char *value_s) |
Add a key value pair to the request header that a CurlTool will send when it is run. More... | |
bool | SetCurlToolAuth (CurlTool *tool_p, const char *username_s, const char *password_s) |
void | ClearCurlToolAuth (CurlTool *tool_p) |
char * | GetURLEscapedString (CurlTool *tool_p, const char *src_s) |
Get the URL encoded version of a string. More... | |
void | FreeURLEscapedString (char *value_s) |
Free a previously allocated string created by GetURLEscapedString. More... | |
A tool for making http(s) requests and responses.
A datatype that uses CURL to perform http(s) requests and responses.
bool SetSSLEngine | ( | CurlTool * | curl_p, |
const char * | cryptograph_engine_name_s | ||
) |
Set the cryptographic engine to use.
curl_p | The CurlTool instance to set the SSL engine for. |
cryptograph_engine_name_s | The name of the cryptographic engine to use. For the valid names see the CURL documentation. |
true
if the SSL engine name was set successfully, false
otherwise. bool AddCurlCallback | ( | CurlTool * | curl_tool_p, |
curl_write_callback | callback_fn, | ||
void * | callback_data_p | ||
) |
Add a callback to write the HTTP response for this CURL object to the given buffer.
buffer_p | The ByteBuffer which will store the CURL object's response. * |
curl_p | The CurlTool object to add the callback for. |
true
if the CurlTool was updated successfully, false
otherwise. bool SetUriForCurlTool | ( | CurlTool * | tool_p, |
const char *const | uri_s | ||
) |
CURLcode RunCurlTool | ( | CurlTool * | tool_p | ) |
bool SetCurlToolForJSONPost | ( | CurlTool * | tool_p | ) |
const char * GetCurlToolData | ( | CurlTool *const | tool_p | ) |
Get the downloaded data from a CurlTool.
If the CurlTool has been run successfully, this will get a read-only version of the downloaded data. RunCurlTool() must have been run prior to this.
tool_p | The CurlTool to get the data from. |
NULL
upon error. size_t GetCurlToolDataSize | ( | CurlTool *const | tool_p | ) |
Get the size in bytes of the downloaded data from a CurlTool.
If the CurlTool has been run successfully, this will get the length of the downloaded data. RunCurlTool() must have been run prior to this.
tool_p | The CurlTool to get the length from. |
bool MakeRemoteJSONCallFromCurlTool | ( | CurlTool * | tool_p, |
const json_t * | req_p | ||
) |
Send a JSON request using a CurlTool.
tool_p | The CurlTool to use. |
req_p | The json data to send. |
true
if the CurlTool made the request and received a response successfully. The resultant data can be retrieved using GetCurlToolData
. If the call was unsuccessful, then false
will be returned. bool SetCurlToolHeader | ( | CurlTool * | tool_p, |
const char * | key_s, | ||
const char * | value_s | ||
) |
Add a key value pair to the request header that a CurlTool will send when it is run.
tool_p | The CurlTool to add the header to |
key_s | The key to add. This will be copied so this value does not need to stay in scope. |
value_s | The value to add. This will be copied so this value does not need to stay in scope. |
true
if the header values were set successfully, false
otherwise. bool SetCurlToolAuth | ( | CurlTool * | tool_p, |
const char * | username_s, | ||
const char * | password_s | ||
) |
void ClearCurlToolAuth | ( | CurlTool * | tool_p | ) |
char * GetURLEscapedString | ( | CurlTool * | tool_p, |
const char * | src_s | ||
) |
Get the URL encoded version of a string.
tool_p | The CurlTool to use to generate the URL encoded string. |
src_s | The string to encode. |
void FreeURLEscapedString | ( | char * | value_s | ) |
Free a previously allocated string created by GetURLEscapedString.
value_s | The string to free. This must have been created by GetURLEscapedString. |