The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
rlm_sql_unixodbc.c File Reference
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include <sqltypes.h>
#include "rlm_sql.h"
#include "rlm_sql_trunk.h"
#include <sql.h>
#include <sqlext.h>
+ Include dependency graph for rlm_sql_unixodbc.c:

Go to the source code of this file.

Data Structures

struct  rlm_sql_unixodbc_conn_t
 

Macros

#define LOG_PREFIX   "sql - unixodbc"
 

Functions

static void _sql_connection_close (UNUSED fr_event_list_t *el, void *h, UNUSED void *uctx)
 
static connection_state_t _sql_connection_init (void **h, connection_t *conn, void *uctx)
 
static int sql_affected_rows (fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 
static USES_APPLE_DEPRECATED_API sql_rcode_t sql_check_error (SQLRETURN ret, SQLSMALLINT handle_type, SQLHANDLE handle)
 Checks the error code to determine if the connection needs to be re-esttablished.
 
static size_t sql_error (TALLOC_CTX *ctx, sql_log_entry_t out[], NDEBUG_UNUSED size_t outlen, fr_sql_query_t *query_ctx)
 Retrieves any errors associated with the query context.
 
static unlang_action_t sql_fetch_row (rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
 
static sql_rcode_t sql_fields (char const **out[], fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 
static sql_rcode_t sql_finish_query (fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 
static sql_rcode_t sql_free_result (fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 
static void sql_request_cancel (connection_t *conn, void *preq, trunk_cancel_reason_t reason, UNUSED void *uctx)
 
static void sql_request_cancel_mux (UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
 
SQL_QUERY_FAIL static SQL_QUERY_RESUME unlang_action_t sql_select_query_resume (rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
 
static void sql_trunk_connection_init_poll (fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
 
static connection_state_t sql_trunk_connection_init_stmt (rlm_sql_unixodbc_conn_t *c)
 
static void sql_trunk_connection_notify (UNUSED trunk_connection_t *tconn, connection_t *conn, UNUSED fr_event_list_t *el, trunk_connection_event_t notify_on, UNUSED void *uctx)
 
static void sql_trunk_connection_read_poll (fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
 
static void sql_trunk_connection_write_poll (UNUSED fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
 
static SQL_TRUNK_CONNECTION_ALLOC void sql_trunk_request_mux (UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
 

Variables

rlm_sql_driver_t rlm_sql_unixodbc
 

Data Structure Documentation

◆ rlm_sql_unixodbc_conn_t

struct rlm_sql_unixodbc_conn_t

Definition at line 33 of file rlm_sql_unixodbc.c.

+ Collaboration diagram for rlm_sql_unixodbc_conn_t:
Data Fields
SQLUSMALLINT async_mode
SQLSMALLINT colcount
rlm_sql_config_t const * config
connection_t * conn
SQLHDBC dbc
SQLHENV env
SQLLEN * ind
uint poll_count
fr_sql_query_t * query_ctx
uint query_interval
fr_event_timer_t const * read_ev
rlm_sql_row_t row
uint select_interval
SQLHSTMT stmt
fr_event_timer_t const * write_ev

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   "sql - unixodbc"

Definition at line 24 of file rlm_sql_unixodbc.c.

Function Documentation

◆ _sql_connection_close()

static void _sql_connection_close ( UNUSED fr_event_list_t el,
void *  h,
UNUSED void *  uctx 
)
static

Definition at line 113 of file rlm_sql_unixodbc.c.

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

◆ _sql_connection_init()

static connection_state_t _sql_connection_init ( void **  h,
connection_t conn,
void *  uctx 
)
static

Definition at line 200 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_affected_rows()

static int sql_affected_rows ( fr_sql_query_t query_ctx,
UNUSED rlm_sql_config_t const *  config 
)
static

Definition at line 704 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_check_error()

static USES_APPLE_DEPRECATED_API sql_rcode_t sql_check_error ( SQLRETURN  ret,
SQLSMALLINT  handle_type,
SQLHANDLE  handle 
)
static

Checks the error code to determine if the connection needs to be re-esttablished.

Parameters
retReturn code from a failed unixodbc call.
handle_typeType of ODBC handle
handleODBC handle
Returns

Definition at line 66 of file rlm_sql_unixodbc.c.

+ Here is the caller graph for this function:

◆ sql_error()

static size_t sql_error ( TALLOC_CTX *  ctx,
sql_log_entry_t  out[],
NDEBUG_UNUSED size_t  outlen,
fr_sql_query_t query_ctx 
)
static

Retrieves any errors associated with the query context.

Note
Caller will free any memory allocated in ctx.
Parameters
ctxto allocate temporary error buffers in.
outArray of sql_log_entry_t to fill.
outlenLength of out array.
query_ctxQuery context to retrieve error for.
Returns
number of errors written to the sql_log_entry_t array.

Definition at line 653 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_fetch_row()

static unlang_action_t sql_fetch_row ( rlm_rcode_t p_result,
UNUSED int *  priority,
UNUSED request_t request,
void *  uctx 
)
static

Definition at line 561 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_fields()

static sql_rcode_t sql_fields ( char const **  out[],
fr_sql_query_t query_ctx,
UNUSED rlm_sql_config_t const *  config 
)
static

Definition at line 521 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_finish_query()

static sql_rcode_t sql_finish_query ( fr_sql_query_t query_ctx,
UNUSED rlm_sql_config_t const *  config 
)
static

Definition at line 605 of file rlm_sql_unixodbc.c.

◆ sql_free_result()

static sql_rcode_t sql_free_result ( fr_sql_query_t query_ctx,
UNUSED rlm_sql_config_t const *  config 
)
static

Definition at line 594 of file rlm_sql_unixodbc.c.

◆ sql_request_cancel()

static void sql_request_cancel ( connection_t conn,
void *  preq,
trunk_cancel_reason_t  reason,
UNUSED void *  uctx 
)
static

Definition at line 333 of file rlm_sql_unixodbc.c.

◆ sql_request_cancel_mux()

static void sql_request_cancel_mux ( UNUSED fr_event_list_t el,
trunk_connection_t tconn,
connection_t conn,
UNUSED void *  uctx 
)
static

Definition at line 345 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_select_query_resume()

SQL_QUERY_FAIL static SQL_QUERY_RESUME unlang_action_t sql_select_query_resume ( rlm_rcode_t p_result,
UNUSED int *  priority,
UNUSED request_t request,
void *  uctx 
)
static

Definition at line 488 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_trunk_connection_init_poll()

static void sql_trunk_connection_init_poll ( fr_event_list_t el,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Definition at line 172 of file rlm_sql_unixodbc.c.

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

◆ sql_trunk_connection_init_stmt()

static connection_state_t sql_trunk_connection_init_stmt ( rlm_sql_unixodbc_conn_t c)
static

Definition at line 131 of file rlm_sql_unixodbc.c.

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

◆ sql_trunk_connection_notify()

static void sql_trunk_connection_notify ( UNUSED trunk_connection_t tconn,
connection_t conn,
UNUSED fr_event_list_t el,
trunk_connection_event_t  notify_on,
UNUSED void *  uctx 
)
static

Definition at line 452 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

◆ sql_trunk_connection_read_poll()

static void sql_trunk_connection_read_poll ( fr_event_list_t el,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Definition at line 366 of file rlm_sql_unixodbc.c.

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

◆ sql_trunk_connection_write_poll()

static void sql_trunk_connection_write_poll ( UNUSED fr_event_list_t el,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Definition at line 438 of file rlm_sql_unixodbc.c.

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

◆ sql_trunk_request_mux()

static SQL_TRUNK_CONNECTION_ALLOC void sql_trunk_request_mux ( UNUSED fr_event_list_t el,
trunk_connection_t tconn,
connection_t conn,
UNUSED void *  uctx 
)
static

Definition at line 279 of file rlm_sql_unixodbc.c.

+ Here is the call graph for this function:

Variable Documentation

◆ rlm_sql_unixodbc

rlm_sql_driver_t rlm_sql_unixodbc
Initial value:
= {
.common = {
.name = "sql_unixodbc"
},
.sql_query_resume = sql_query_resume,
.sql_select_query_resume = sql_select_query_resume,
.sql_affected_rows = sql_affected_rows,
.sql_fields = sql_fields,
.sql_fetch_row = sql_fetch_row,
.sql_free_result = sql_free_result,
.sql_error = sql_error,
.sql_finish_query = sql_finish_query,
.sql_finish_select_query = sql_finish_query,
.trunk_io_funcs = {
.connection_alloc = sql_trunk_connection_alloc,
.connection_notify = sql_trunk_connection_notify,
.request_mux = sql_trunk_request_mux,
.request_cancel_mux = sql_request_cancel_mux,
.request_cancel = sql_request_cancel,
.request_fail = sql_request_fail,
}
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
#define RLM_SQL_RCODE_FLAGS_ALT_QUERY
Can distinguish between other errors and those resulting from a unique key violation.
Definition rlm_sql.h:167
static void sql_request_fail(request_t *request, void *preq, UNUSED void *rctx, UNUSED trunk_request_state_t state, UNUSED void *uctx)
static sql_rcode_t sql_fields(char const **out[], fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static sql_rcode_t sql_finish_query(fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static SQL_TRUNK_CONNECTION_ALLOC void sql_trunk_request_mux(UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
static size_t sql_error(TALLOC_CTX *ctx, sql_log_entry_t out[], NDEBUG_UNUSED size_t outlen, fr_sql_query_t *query_ctx)
Retrieves any errors associated with the query context.
SQL_QUERY_FAIL static SQL_QUERY_RESUME unlang_action_t sql_select_query_resume(rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
static unlang_action_t sql_fetch_row(rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
static void sql_request_cancel(connection_t *conn, void *preq, trunk_cancel_reason_t reason, UNUSED void *uctx)
static void sql_request_cancel_mux(UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
static sql_rcode_t sql_free_result(fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static int sql_affected_rows(fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static void sql_trunk_connection_notify(UNUSED trunk_connection_t *tconn, connection_t *conn, UNUSED fr_event_list_t *el, trunk_connection_event_t notify_on, UNUSED void *uctx)

Definition at line 719 of file rlm_sql_unixodbc.c.