AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Functions | Variables
alexaClientSDK::avsCommon::utils::libcurlUtils Namespace Reference

Classes

class  CallbackData
 
class  CurlEasyHandleWrapper
 
class  CurlEasyHandleWrapperOptionsSettingAdapter
 
class  CurlMultiHandleWrapper
 
class  DefaultSetCurlOptionsCallbackFactory
 
class  HTTPContentFetcherFactory
 
class  HttpGetInterface
 Minimal interface for making HTTP GET requests. More...
 
class  HttpPost
 LIBCURL based implementation of HttpPostInterface. More...
 
class  HttpPostInterface
 Minimal interface for making Http POST requests. More...
 
class  HttpPut
 LIBCURL based implementation of HttpPutInterface. More...
 
class  HttpPutInterface
 Minimal interface for making HTTP PUT requests. More...
 
struct  HTTPResponse
 
class  LibcurlHTTP2Connection
 
class  LibcurlHTTP2ConnectionFactory
 
class  LibcurlHTTP2Request
 
class  LibCurlHttpContentFetcher
 
class  LibcurlSetCurlOptionsCallbackFactoryInterface
 
class  LibcurlSetCurlOptionsCallbackInterface
 

Functions

bool prepareForTLS (CURL *handle)
 
bool prepareForProxy (CURL *handle)
 
static const std::string TAG ("CallbackData")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("CurlEasyHandleWrapper")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("CurlMultiHandleWrapper")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("HTTPContentFetcherFactory")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("HttpPost")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("HttpPut")
 String to identify log entries originating from this file. More...
 
static size_t readCallback (char *dataBuffer, size_t blockSize, size_t numBlocks, void *dataStream)
 
static size_t writeCallback (char *dataBuffer, size_t blockSize, size_t numBlocks, void *dataStream)
 
static const std::string TAG ("LibcurlHTTP2Connection")
 String to identify log entries originating from this file. More...
 
static const std::chrono::milliseconds WAIT_FOR_ACTIVITY_TIMEOUT (50)
 Timeout for curl_multi_wait. More...
 
static const std::chrono::milliseconds WAIT_FOR_ACTIVITY_WHILE_STREAMS_PAUSED_TIMEOUT (10)
 Timeout for curl_multi_wait while all non-intermittent HTTP/2 streams are paused. More...
 
static bool performCurlChecks ()
 
static const std::string TAG ("LibcurlHTTP2ConnectionFactory")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("LibcurlHTTP2Request")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("LibCurlHttpContentFetcher")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("LibcurlUtils")
 String to identify log entries originating from this file. More...
 
template<typename ValueType >
static bool setopt (CURL *handle, CURLoption option, ValueType value, const char *optionName, const char *valueAsString)
 

Variables

static std::string JSON_MIME_TYPE = "application/json"
 MIME Content-Type for JSON data. More...
 
static std::string OCTET_MIME_TYPE = "application/octet-stream"
 MIME Content-Type for octet stream data. More...
 
static const std::string LIBCURLUTILS_CONFIG_KEY = "libcurlUtils"
 Key for looking up the LibCurlUtil ConfigurationNode. More...
 
static const std::string INTERFACE_CONFIG_KEY = "CURLOPT_INTERFACE"
 Key for looking up a configuration value for CURLOPT_INTERFACE. More...
 
static constexpr long INVALID_RESPONSE_CODE = -1L
 
static const std::chrono::milliseconds TIMEOUT_FOR_BLOCKING_WRITE = std::chrono::milliseconds(100)
 
static const std::chrono::milliseconds WAIT_FOR_ACTIVITY_TIMEOUT {100}
 Timeout for polling loops that check activities running on separate threads. More...
 
static const auto TIMEOUT_CONNECTION = std::chrono::seconds(30)
 Timeout for curl connection. More...
 
static const std::chrono::minutes MAX_GET_BODY_WAIT {1}
 Timeout to wait for a call to get body after getContent was called. More...
 
static const std::chrono::minutes MAX_GET_HEADER_WAIT {5}
 Timeout to wait for get header to complete. More...
 
static const std::string LIBCURLUTILS_CONFIG_KEY = "libcurlUtils"
 Key for looking up the LibCurlUtil ConfigurationNode. More...
 
static const std::string CAPATH_CONFIG_KEY = "CURLOPT_CAPATH"
 Key for looking up a configuration value for CURLOPT_CAPATH. More...
 
static const std::string CAINFO_CONFIG_KEY = "CURLOPT_CAINFO"
 Key for looking up a configuration value for CURLOPT_CAINFO. More...
 
static const std::string PROXY_CONFIG_KEY = "CURLOPT_PROXY"
 Key for looking up a configuration value for CURLOPT_PROXY. More...
 
static const std::string VERIFY_HOSTS_AND_PEERS_CONFIG_KEY = "verifyHostsAndPeers"
 Key for looking up a configuration value for verifying hosts and peers. More...
 

Function Documentation

◆ performCurlChecks()

static bool alexaClientSDK::avsCommon::utils::libcurlUtils::performCurlChecks ( )
static

This function logs a warning if the version of curl is not recent enough for use with the ACL.

Returns
true if check passes, false if it fails

◆ prepareForProxy()

bool alexaClientSDK::avsCommon::utils::libcurlUtils::prepareForProxy ( CURL *  handle)

Prepare a CURL handle to set the proxy to use for the upcoming request.

The 'libCurlUtils' sub-component of the global configuration supports the following options:

  • CURLOPT_PROXY If present, specifies a value for the libcurl property CURLOPT_PROXY.

Here is an example configuration:

{
"libcurlUtils" : {
"CURLOPT_PROXY" : "http://proxy:1080"
}
// Other configuration nodes
}
Parameters
handleThe libcurl handle to prepare.
Returns
Whether the operation was successful.

◆ prepareForTLS()

bool alexaClientSDK::avsCommon::utils::libcurlUtils::prepareForTLS ( CURL *  handle)

Prepare a CURL handle to require TLS based upon global configuration settings.

The 'libCurlUtils' sub-component of the global configuration supports the following options:

  • CURLOPT_CAPATH If present, specifies a value for the libcurl property CURLOPT_CAPATH.

Here is an example configuration:

{
"libcurlUtils" : {
"CURLOPT_CAPATH" : "/path/to/directory/with/ca/certificates"
}
// Other configuration nodes
}
Parameters
handleThe libcurl handle to prepare.
Returns
Whether the operation was successful.

◆ readCallback()

size_t alexaClientSDK::avsCommon::utils::libcurlUtils::readCallback ( char *  dataBuffer,
size_t  blockSize,
size_t  numBlocks,
void *  dataStream 
)
static

Read callback function used for CURLOPT_READFUNCTION option in libcurl

◆ setopt()

template<typename ValueType >
static bool alexaClientSDK::avsCommon::utils::libcurlUtils::setopt ( CURL *  handle,
CURLoption  option,
ValueType  value,
const char *  optionName,
const char *  valueAsString 
)
static

Set an option on a libcurl handle to value.

Template Parameters
ValueTypeThe type of value being set
Parameters
handleThe CURL handle to set the option on.
optionThe option to set.
valueThe new value for the specified option.
optionNameThe name of the option being set.
valueAsStringString representation of the value being set.
Returns
Whether the option was set.

◆ TAG() [1/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "CurlMultiHandleWrapper"  )
static

String to identify log entries originating from this file.

◆ TAG() [2/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "HTTPContentFetcherFactory"  )
static

String to identify log entries originating from this file.

◆ TAG() [3/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "LibcurlHTTP2ConnectionFactory"  )
static

String to identify log entries originating from this file.

◆ TAG() [4/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "LibcurlUtils"  )
static

String to identify log entries originating from this file.

◆ TAG() [5/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "LibcurlHTTP2Request"  )
static

String to identify log entries originating from this file.

◆ TAG() [6/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "HttpPost"  )
static

String to identify log entries originating from this file.

◆ TAG() [7/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "LibcurlHTTP2Connection"  )
static

String to identify log entries originating from this file.

◆ TAG() [8/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "CallbackData"  )
static

String to identify log entries originating from this file.

◆ TAG() [9/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "HttpPut"  )
static

String to identify log entries originating from this file.

◆ TAG() [10/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "LibCurlHttpContentFetcher"  )
static

String to identify log entries originating from this file.

◆ TAG() [11/11]

static const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::TAG ( "CurlEasyHandleWrapper"  )
static

String to identify log entries originating from this file.

◆ WAIT_FOR_ACTIVITY_TIMEOUT()

static const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::libcurlUtils::WAIT_FOR_ACTIVITY_TIMEOUT ( 50  )
static

Timeout for curl_multi_wait.

◆ WAIT_FOR_ACTIVITY_WHILE_STREAMS_PAUSED_TIMEOUT()

static const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::libcurlUtils::WAIT_FOR_ACTIVITY_WHILE_STREAMS_PAUSED_TIMEOUT ( 10  )
static

Timeout for curl_multi_wait while all non-intermittent HTTP/2 streams are paused.

◆ writeCallback()

size_t alexaClientSDK::avsCommon::utils::libcurlUtils::writeCallback ( char *  dataBuffer,
size_t  blockSize,
size_t  numBlocks,
void *  dataStream 
)
static

Write callback function used for CURLOPT_WRITEFUNCTION option in libcurl

Variable Documentation

◆ CAINFO_CONFIG_KEY

const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::CAINFO_CONFIG_KEY = "CURLOPT_CAINFO"
static

Key for looking up a configuration value for CURLOPT_CAINFO.

◆ CAPATH_CONFIG_KEY

const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::CAPATH_CONFIG_KEY = "CURLOPT_CAPATH"
static

Key for looking up a configuration value for CURLOPT_CAPATH.

◆ INTERFACE_CONFIG_KEY

const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::INTERFACE_CONFIG_KEY = "CURLOPT_INTERFACE"
static

Key for looking up a configuration value for CURLOPT_INTERFACE.

◆ INVALID_RESPONSE_CODE

constexpr long alexaClientSDK::avsCommon::utils::libcurlUtils::INVALID_RESPONSE_CODE = -1L
static

◆ JSON_MIME_TYPE

std::string alexaClientSDK::avsCommon::utils::libcurlUtils::JSON_MIME_TYPE = "application/json"
static

MIME Content-Type for JSON data.

◆ LIBCURLUTILS_CONFIG_KEY [1/2]

const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::LIBCURLUTILS_CONFIG_KEY = "libcurlUtils"
static

Key for looking up the LibCurlUtil ConfigurationNode.

◆ LIBCURLUTILS_CONFIG_KEY [2/2]

const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::LIBCURLUTILS_CONFIG_KEY = "libcurlUtils"
static

Key for looking up the LibCurlUtil ConfigurationNode.

◆ MAX_GET_BODY_WAIT

const std::chrono::minutes alexaClientSDK::avsCommon::utils::libcurlUtils::MAX_GET_BODY_WAIT {1}
static

Timeout to wait for a call to get body after getContent was called.

◆ MAX_GET_HEADER_WAIT

const std::chrono::minutes alexaClientSDK::avsCommon::utils::libcurlUtils::MAX_GET_HEADER_WAIT {5}
static

Timeout to wait for get header to complete.

◆ OCTET_MIME_TYPE

std::string alexaClientSDK::avsCommon::utils::libcurlUtils::OCTET_MIME_TYPE = "application/octet-stream"
static

MIME Content-Type for octet stream data.

◆ PROXY_CONFIG_KEY

const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::PROXY_CONFIG_KEY = "CURLOPT_PROXY"
static

Key for looking up a configuration value for CURLOPT_PROXY.

◆ TIMEOUT_CONNECTION

const auto alexaClientSDK::avsCommon::utils::libcurlUtils::TIMEOUT_CONNECTION = std::chrono::seconds(30)
static

Timeout for curl connection.

◆ TIMEOUT_FOR_BLOCKING_WRITE

const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::libcurlUtils::TIMEOUT_FOR_BLOCKING_WRITE = std::chrono::milliseconds(100)
static

The timeout for a blocking write call to an AttachmentWriter. This value may be increased to decrease wakeups but may also increase latency.

◆ VERIFY_HOSTS_AND_PEERS_CONFIG_KEY

const std::string alexaClientSDK::avsCommon::utils::libcurlUtils::VERIFY_HOSTS_AND_PEERS_CONFIG_KEY = "verifyHostsAndPeers"
static

Key for looking up a configuration value for verifying hosts and peers.

◆ WAIT_FOR_ACTIVITY_TIMEOUT

const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::libcurlUtils::WAIT_FOR_ACTIVITY_TIMEOUT {100}
static

Timeout for polling loops that check activities running on separate threads.

AlexaClientSDK 1.25.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0