The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
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.
 

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, \
UNUSED trunk_request_state_t state, UNUSED void *uctx) \
{ \
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:315
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
sql_rcode_t rcode
Result code.
Definition rlm_sql.h:139
trunk_request_t * treq
Trunk request for this query.
Definition rlm_sql.h:135
static void sql_request_fail(request_t *request, void *preq, UNUSED void *rctx, UNUSED trunk_request_state_t state, UNUSED void *uctx)
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; \
}
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition action.h:35
#define RETURN_MODULE_OK
Definition rcode.h:57
#define RETURN_MODULE_FAIL
Definition rcode.h:56
rlm_rcode_t
Return codes indicating the result of the module call.
Definition rcode.h:40

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, \
}, \
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:426
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
rlm_sql_t const * inst
Module instance data.
Definition rlm_sql.h:109
static connection_state_t _sql_connection_init(void **h, connection_t *conn, void *uctx)
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.
Associates request queues with a connection.
Definition trunk.c:134
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.