The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros
rlm_sql_trunk.h File Reference

Macros to reduce boilerplate in trunk SQL drivers. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SQL_QUERY_FAIL
 
#define SQL_QUERY_RESUME
 
#define SQL_TRUNK_CONNECTION_ALLOC
 Allocate an SQL trunk connection. More...
 

Detailed Description

Macros to reduce boilerplate in trunk SQL drivers.

Id
bcd9c641a4a128de27aa5f2a207089c730ec63c8

Definition in file rlm_sql_trunk.h.

Macro Definition Documentation

◆ SQL_QUERY_FAIL

#define SQL_QUERY_FAIL
Value:
static void sql_request_fail(request_t *request, void *preq, UNUSED void *rctx, \
{ \
fr_sql_query_t *query_ctx = talloc_get_type_abort(preq, fr_sql_query_t); \
query_ctx->treq = NULL; \
if (query_ctx->rcode == RLM_SQL_OK) query_ctx->rcode = RLM_SQL_ERROR; \
if (request) unlang_interpret_mark_runnable(request); \
}
#define UNUSED
Definition: build.h:313
fr_dcursor_eval_t void const * uctx
Definition: dcursor.h:546
void unlang_interpret_mark_runnable(request_t *request)
Mark a request as resumable.
Definition: interpret.c:1359
@ RLM_SQL_ERROR
General connection/server error.
Definition: rlm_sql.h:46
@ RLM_SQL_OK
Success.
Definition: rlm_sql.h:47
static void sql_request_fail(request_t *request, void *preq, UNUSED void *rctx, UNUSED trunk_request_state_t state, UNUSED void *uctx)
Definition: rlm_sql_db2.c:301
trunk_request_state_t
Used for sanity checks and to simplify freeing.
Definition: trunk.h:161

Definition at line 64 of file rlm_sql_trunk.h.

◆ SQL_QUERY_RESUME

#define SQL_QUERY_RESUME
Value:
static unlang_action_t sql_query_resume(rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx) \
{ \
fr_sql_query_t *query_ctx = talloc_get_type_abort(uctx, fr_sql_query_t); \
if (query_ctx->rcode != RLM_SQL_OK) RETURN_MODULE_FAIL; \
RETURN_MODULE_OK; \
}
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
RETURN_MODULE_FAIL

Definition at line 56 of file rlm_sql_trunk.h.

◆ SQL_TRUNK_CONNECTION_ALLOC

#define SQL_TRUNK_CONNECTION_ALLOC
Value:
CC_NO_UBSAN(function) /* UBSAN: false positive - public vs private connection_t trips --fsanitize=function */ \
static connection_t *sql_trunk_connection_alloc(trunk_connection_t *tconn, fr_event_list_t *el, \
connection_conf_t const *conn_conf, \
char const *log_prefix, void *uctx) \
{ \
connection_t *conn; \
rlm_sql_thread_t *thread = talloc_get_type_abort(uctx, rlm_sql_thread_t); \
conn = connection_alloc(tconn, el, \
.init = _sql_connection_init, \
}, \
conn_conf, log_prefix, thread->inst); \
if (!conn) { \
PERROR("Failed allocating state handler for new SQL connection"); \
return NULL; \
} \
return conn; \
}
#define CC_NO_UBSAN(_sanitize)
Definition: build.h:424
Holds a complete set of functions for a connection.
Definition: connection.h:186
Stores all information relating to an event list.
Definition: event.c:411
static void _sql_connection_close(UNUSED fr_event_list_t *el, void *h, UNUSED void *uctx)
connection_t * connection_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, connection_funcs_t const *funcs, connection_conf_t const *conf, char const *log_prefix, void const *uctx)
Allocate a new connection.
Definition: connection.c:1512
Associates request queues with a connection.
Definition: trunk.c:131
static fr_event_list_t * el

Allocate an SQL trunk connection.

Parameters
[in]tconnTrunk handle.
[in]elEvent list which will be used for I/O and timer events.
[in]conn_confConfiguration of the connection.
[in]log_prefixWhat to prefix log messages with.
[in]uctxUser context passed to trunk_alloc.

Definition at line 35 of file rlm_sql_trunk.h.