The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
base.h File Reference

Main include file for our libcurl extension API. More...

#include <curl/curl.h>
#include <freeradius-devel/server/global_lib.h>
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/request.h>
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/util/slab.h>
#include <freeradius-devel/unlang/xlat.h>
+ Include dependency graph for base.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fr_curl_conn_config_t
 
struct  fr_curl_handle_t
 Uctx data for timer and I/O functions. More...
 
struct  fr_curl_io_request_t
 Structure representing an individual request being passed to curl for processing. More...
 
struct  fr_curl_tls_t
 

Macros

#define CURL_AT_LEAST_VERSION(x, y, z)   (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
 
#define CURL_NO_OLDIES   1
 
#define CURL_VERSION_BITS(x, y, z)   ((x) << 16 | (y) << 8 | (z))
 
#define FR_CURL_REQUEST_SET_OPTION(_x, _y)
 
#define FR_CURL_ROPTIONAL_SET_OPTION(_x, _y)
 
#define FR_CURL_SET_OPTION(_x, _y)
 

Functions

int fr_curl_easy_tls_init (fr_curl_io_request_t *randle, fr_curl_tls_t const *conf)
 
fr_curl_handle_tfr_curl_io_init (TALLOC_CTX *ctx, fr_event_list_t *el, bool multiplex)
 
fr_curl_io_request_tfr_curl_io_request_alloc (TALLOC_CTX *ctx)
 Allocate a new curl easy request and wrapper struct. More...
 
int fr_curl_io_request_enqueue (fr_curl_handle_t *mhandle, request_t *request, fr_curl_io_request_t *creq)
 Sends a request using libcurl. More...
 
int fr_curl_response_certinfo (request_t *request, fr_curl_io_request_t *randle)
 
CURL * fr_curl_tmp_handle (void)
 Return a thread local curl easy handle. More...
 

Variables

global_lib_autoinst_t fr_curl_autoinst
 
conf_parser_t fr_curl_conn_config []
 
conf_parser_t fr_curl_tls_config []
 

Detailed Description

Main include file for our libcurl extension API.

Definition in file base.h.


Data Structure Documentation

◆ fr_curl_conn_config_t

struct fr_curl_conn_config_t

Definition at line 125 of file base.h.

+ Collaboration diagram for fr_curl_conn_config_t:
Data Fields
fr_time_delta_t connect_timeout
fr_slab_config_t reuse

◆ fr_curl_handle_t

struct fr_curl_handle_t

Uctx data for timer and I/O functions.

Seems like overkill for a single field, but I'm sure we'll need to pass around other things later.

Definition at line 91 of file base.h.

+ Collaboration diagram for fr_curl_handle_t:
Data Fields
fr_event_list_t * el Event list servicing I/O events.
fr_event_timer_t const * ev Multi-Handle timer.
CURLM * mandle The multi handle.
uint64_t transfers How many transfers are current in progress.

◆ fr_curl_io_request_t

struct fr_curl_io_request_t

Structure representing an individual request being passed to curl for processing.

Definition at line 101 of file base.h.

+ Collaboration diagram for fr_curl_io_request_t:
Data Fields
CURL * candle Request specific handle.
request_t * request Current request.
CURLcode result Result of executing the request.
void * uctx Private data for the module using the API.

◆ fr_curl_tls_t

struct fr_curl_tls_t

Definition at line 108 of file base.h.

Data Fields
char const * ca_file
char const * ca_issuer_file
char const * ca_path
char const * certificate_file
bool check_cert
bool check_cert_cn
bool extract_cert_attrs
char const * keylog_file Where to log SSL keying material like the pre-master secret.

The log file can then be used to decrypt the SSL session with Wireshark.

char const * private_key_file
char const * private_key_password
char const * random_file
long * require_cert

Macro Definition Documentation

◆ CURL_AT_LEAST_VERSION

#define CURL_AT_LEAST_VERSION (   x,
  y,
 
)    (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))

Definition at line 83 of file base.h.

◆ CURL_NO_OLDIES

#define CURL_NO_OLDIES   1

Definition at line 32 of file base.h.

◆ CURL_VERSION_BITS

#define CURL_VERSION_BITS (   x,
  y,
 
)    ((x) << 16 | (y) << 8 | (z))

Definition at line 82 of file base.h.

◆ FR_CURL_REQUEST_SET_OPTION

#define FR_CURL_REQUEST_SET_OPTION (   _x,
  _y 
)
Value:
do {\
int _ret;\
if ((_ret = curl_easy_setopt(randle->candle, _x, _y)) != CURLE_OK) {\
char const *_option;\
_option = STRINGIFY(_x);\
RERROR("Failed setting curl option %s: %s (%i)", _option, curl_easy_strerror(_ret), _ret);\
goto error;\
}\
} while (0)
#define STRINGIFY(x)
Definition: build.h:195

Definition at line 67 of file base.h.

◆ FR_CURL_ROPTIONAL_SET_OPTION

#define FR_CURL_ROPTIONAL_SET_OPTION (   _x,
  _y 
)
Value:
do {\
int _ret;\
if ((_ret = curl_easy_setopt(randle->candle, _x, _y)) != CURLE_OK) {\
char const *_option;\
_option = STRINGIFY(_x);\
ROPTIONAL(RERROR, ERROR, "Failed setting curl option %s: %s (%i)", _option, curl_easy_strerror(_ret), _ret);\
goto error;\
}\
} while (0)
#define ERROR(fmt,...)
Definition: dhcpclient.c:41
#define RERROR(fmt,...)
Definition: log.h:298

Definition at line 56 of file base.h.

◆ FR_CURL_SET_OPTION

#define FR_CURL_SET_OPTION (   _x,
  _y 
)
Value:
do {\
int _ret;\
if ((_ret = curl_easy_setopt(randle->candle, _x, _y)) != CURLE_OK) {\
char const *_option;\
_option = STRINGIFY(_x);\
ERROR("Failed setting curl option %s: %s (%i)", _option, curl_easy_strerror(_ret), _ret);\
goto error;\
}\
} while (0)

Definition at line 45 of file base.h.

Function Documentation

◆ fr_curl_easy_tls_init()

int fr_curl_easy_tls_init ( fr_curl_io_request_t randle,
fr_curl_tls_t const *  conf 
)

Definition at line 141 of file base.c.

+ Here is the caller graph for this function:

◆ fr_curl_io_init()

fr_curl_handle_t* fr_curl_io_init ( TALLOC_CTX *  ctx,
fr_event_list_t el,
bool  multiplex 
)
+ Here is the caller graph for this function:

◆ fr_curl_io_request_alloc()

fr_curl_io_request_t* fr_curl_io_request_alloc ( TALLOC_CTX *  ctx)

Allocate a new curl easy request and wrapper struct.

Definition at line 546 of file io.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_curl_io_request_enqueue()

int fr_curl_io_request_enqueue ( fr_curl_handle_t mhandle,
request_t request,
fr_curl_io_request_t randle 
)

Sends a request using libcurl.

Send the actual curl request to the server. The response will be handled by the numerous callbacks configured for the easy handle.

Parameters
[in]mhandleThread-specific mhandle wrapper.
[in]requestCurrent request.
[in]randlerepresenting the request.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 482 of file io.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_curl_response_certinfo()

int fr_curl_response_certinfo ( request_t request,
fr_curl_io_request_t randle 
)

Definition at line 172 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_curl_tmp_handle()

CURL* fr_curl_tmp_handle ( void  )

Return a thread local curl easy handle.

This should only be used for calls into libcurl functions which don't operate on an active request, like the escape/unescape functions.

Returns
  • A thread local curl easy handle.
  • NULL on failure.

Definition at line 280 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ fr_curl_autoinst

global_lib_autoinst_t fr_curl_autoinst
extern

Definition at line 400 of file base.c.

◆ fr_curl_conn_config

conf_parser_t fr_curl_conn_config[]
extern

Definition at line 99 of file base.c.

◆ fr_curl_tls_config

conf_parser_t fr_curl_tls_config[]
extern

Definition at line 68 of file base.c.