Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis Developer Reference
restincurl.h File Reference
#include <algorithm>
#include <atomic>
#include <deque>
#include <exception>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <thread>
#include <vector>
#include <assert.h>
#include <curl/curl.h>
#include <curl/easy.h>
#include <fcntl.h>
#include <string.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

Go to the source code of this file.

Classes

struct  restincurl::Result
 
class  restincurl::Exception
 
class  restincurl::SystemException
 
class  restincurl::CurlException
 
class  restincurl::EasyHandle
 
class  restincurl::Options
 
struct  restincurl::DataHandlerBase
 
struct  restincurl::InDataHandler< T >
 
struct  restincurl::OutDataHandler< T >
 
class  restincurl::Request
 
class  restincurl::Signaler
 
class  restincurl::TlsLocker
 
class  restincurl::Worker
 
class  restincurl::RequestBuilder
 
class  restincurl::Client
 

Namespaces

namespace  restincurl
 

Macros

#define RESTINCURL_MAX_CONNECTIONS   32L
 Max concurrent connections.
 
#define RESTINCURL_ENABLE_ASYNC   1
 Enables or disables asynchronous mode.
 
#define RESTINCURL_IDLE_TIMEOUT_SEC   60
 How long to wait for the next request before the idle worker-thread is stopped.
 
#define RESTINCURL_LOG_VERBOSE_ENABLE   0
 Enable very verbose logging.
 
#define RESTINCURL_ENABLE_DEFAULT_LOGGER   0
 Enables a simple built-in logger.
 
#define RESTINCURL_LOG(msg)
 Macro to log debug messages.
 
#define RESTINCURL_LOG_TRACE(msg)
 Macro to log debug messages.
 

Typedefs

using restincurl::lock_t = std::lock_guard<std::mutex>
 
using restincurl::completion_fn_t = std::function<void (const Result& result)>
 

Enumerations

enum class  restincurl::RequestType {
  restincurl::GET , restincurl::PUT , restincurl::POST , restincurl::HEAD ,
  restincurl::DELETE , restincurl::PATCH , restincurl::OPTIONS , restincurl::POST_MIME ,
  restincurl::INVALID
}
 

Macro Definition Documentation

◆ RESTINCURL_ENABLE_ASYNC

#define RESTINCURL_ENABLE_ASYNC   1

Enables or disables asynchronous mode.

In asynchronous mode, many requests can be served simultaneously using a worker-thread. In synchronous mode, you use the current thread to serve only one request at the time.

Default is 1 (asynchronous mode enabled).

Referenced by restincurl::Client::Build(), and restincurl::RequestBuilder::RequestBuilder().

◆ RESTINCURL_ENABLE_DEFAULT_LOGGER

#define RESTINCURL_ENABLE_DEFAULT_LOGGER   0

Enables a simple built-in logger.

RESTinCurl has a very simple built in logger.

It writes to either std::clog, the Unix syslog or Androids log facility.

  • Define RESTINCURL_USE_SYSLOG to use syslog
  • Define RESTINCURL_USE_ANDROID_NDK_LOG to use the Android NDK logger.

By default, it will write to std::clog.

Default value is 0 (disabled)

◆ RESTINCURL_IDLE_TIMEOUT_SEC

#define RESTINCURL_IDLE_TIMEOUT_SEC   60

How long to wait for the next request before the idle worker-thread is stopped.

This will delete curl's connection-cache and cause a new thread to be created and new connections to be made if there are new requests at at later time.

Note that this option is only relevant in asynchronous mode.

Default is 60 seconds.

◆ RESTINCURL_LOG

#define RESTINCURL_LOG ( msg)

Macro to log debug messages.

If you want to log messages from the library to your own log facility, you may define this macro to do so.

Note that the logging statements in the library expect the log msg to be std::ostream compliant. The macro must be able to deal with statement such as:

  • RESTINCURL_LOG("test");
  • RESTINCURL_LOG("test " << 1 << " and " << 2);

If you manually define this macro, you should not define RESTINCURL_ENABLE_DEFAULT_LOGGER.

Referenced by restincurl::RequestBuilder::Build(), restincurl::Client::Client(), restincurl::EasyHandle::Close(), restincurl::EasyHandle::EasyHandle(), restincurl::Worker::PrepareThread(), and restincurl::Client::~Client().

◆ RESTINCURL_LOG_TRACE

#define RESTINCURL_LOG_TRACE ( msg)

Macro to log debug messages.

If you want to log trace-messages from the library to your own log facility, you may define this macro to do so.

Note that the logging statements in the library expect the log msg to be std::ostream compliant. The macro must be able to deal with statement such as:

  • RESTINCURL_LOG_TRACE("test");
  • RESTINCURL_LOG_TRACE("test " << 1 << " and " << 2);

If you manually define this macro, you should not define RESTINCURL_ENABLE_DEFAULT_LOGGER.

This macro is only called if RESTINCURL_LOG_VERBOSE_ENABLE is defined and not 0.

Referenced by restincurl::Worker::Enqueue(), restincurl::InDataHandler< T >::InDataHandler(), restincurl::OutDataHandler< T >::read_callback(), restincurl::Signaler::Signal(), and restincurl::Signaler::WasSignalled().

◆ RESTINCURL_LOG_VERBOSE_ENABLE

#define RESTINCURL_LOG_VERBOSE_ENABLE   0

Enable very verbose logging.

This option enabled very verbose logging, suitable to pinpoint problems during development / porting of the library itself.

Default is 0 (disabled).

◆ RESTINCURL_MAX_CONNECTIONS

#define RESTINCURL_MAX_CONNECTIONS   32L

Max concurrent connections.

This option restrains the maximum number of concurrent connections that will be used at any time. It sets libcurl's CURLMOPT_MAXCONNECTS option, and also puts any new requests in a waiting queue. As soon as some active request finish, the oldest waiting request will be served (FIFO queue).

The default value is 32