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.
curl_tools.h File Reference
#include <stdio.h>
#include <curl/curl.h>
#include "jansson.h"
#include "typedefs.h"
#include "network_library.h"
#include "byte_buffer.h"
Include dependency graph for curl_tools.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TemporaryFile
 
struct  CurlTool
 A tool for making http(s) requests and responses. More...
 

Enumerations

enum  CurlMode { CM_MEMORY, CM_FILE, CM_NUM_MODES }
 An enum specifying where any resultant data from running a CurlTool will be stored. More...
 

Functions

bool CallSecureUrl (const char *url_s, const char *header_data_s, const char *ca_cert_name_s, const char *const cert_name_s, const char *key_name_s, const bool verify_certs, ByteBuffer *buffer_p)
 Call a secure web address. More...
 
CurlToolAllocateFileCurlTool (const char *const filename_s)
 
CurlToolAllocateMemoryCurlTool (const size_t buffer_size)
 
char * GetWebData (const char *url_s)
 
void SetCurlToolTimeout (CurlTool *tool_p, const long timeout)
 
void ClearCurlToolData (CurlTool *tool_p)
 

Function Documentation

◆ CallSecureUrl()

bool CallSecureUrl ( const char *  url_s,
const char *  header_data_s,
const char *  ca_cert_name_s,
const char *const  cert_name_s,
const char *  key_name_s,
const bool  verify_certs,
ByteBuffer buffer_p 
)

Call a secure web address.

Parameters
url_sThe address to get the data from.
header_data_sThe value to use for CURLOPT_CAINFO. See the Curl documentation.
ca_cert_name_sThe value to use for CURLOPT_CAINFO. See the Curl documentation.
cert_name_sThe value to use for CURLOPT_SSLCERT. See the Curl documentation.
key_name_sThe value to use for CURLOPT_SSLKEY. See the Curl documentation.
verify_certsIf this is true then CURLOPT_SSL_VERIFYPEER will be set. See the Curl documentation.
buffer_pWhere the data from the address will be written to
Returns
true if the call was successful, false otherwise.

◆ AllocateFileCurlTool()

CurlTool* AllocateFileCurlTool ( const char *const  filename_s)

◆ AllocateMemoryCurlTool()

CurlTool* AllocateMemoryCurlTool ( const size_t  buffer_size)

◆ GetWebData()

char* GetWebData ( const char *  url_s)

◆ SetCurlToolTimeout()

void SetCurlToolTimeout ( CurlTool tool_p,
const long  timeout 
)

◆ ClearCurlToolData()

void ClearCurlToolData ( CurlTool tool_p)