The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
rlm_sql_oracle.c File Reference
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include <sys/stat.h>
#include <oci.h>
#include "rlm_sql.h"
#include "rlm_sql_trunk.h"
+ Include dependency graph for rlm_sql_oracle.c:

Go to the source code of this file.

Data Structures

struct  rlm_sql_oracle_conn_t
 
struct  rlm_sql_oracle_t
 

Macros

#define LOG_PREFIX   "sql - oracle"
 
#define MAX_DATASTR_LEN   64
 
#define ORACLE_ERROR(_message)
 

Functions

static void _sql_connection_close (UNUSED fr_event_list_t *el, void *h, UNUSED void *uctx)
 
 CC_NO_UBSAN (function)
 
static int mod_detach (module_detach_ctx_t const *mctx)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static sql_rcode_t sql_check_reconnect (rlm_sql_oracle_conn_t *conn)
 
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. More...
 
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_finish_select_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 int sql_num_rows (fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
 
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 int sql_snprint_error (char *out, size_t outlen, rlm_sql_oracle_conn_t *conn)
 Write the last Oracle error out to a buffer. More...
 
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)
 

Variables

static const conf_parser_t driver_config []
 
rlm_sql_driver_t rlm_sql_oracle
 

Data Structure Documentation

◆ rlm_sql_oracle_conn_t

struct rlm_sql_oracle_conn_t

Definition at line 57 of file rlm_sql_oracle.c.

+ Collaboration diagram for rlm_sql_oracle_conn_t:
Data Fields
int col_count Number of columns associated with the result set.
rlm_sql_config_t const * config SQL instance configuration.
connection_t * conn Generic connection structure for this connection.
OCISvcCtx * ctx Service handle.
OCIError * error Error handle.
sb2 * ind Indicators regarding contents of the results row.
uint poll_count How many polls have been done for the current query.
OCIStmt * query Query handle.
fr_sql_query_t * query_ctx Current request running on the connection.
uint query_interval How frequently this connection gets polled for other queries.
fr_event_timer_t const * read_ev Timer event for polling reading this connection.
rlm_sql_row_t row Results row.
uint select_interval How frequently this connection gets polled for select queries.
OCISession * sess Session handle.
OCIServer * srv Server handle.
fr_event_timer_t const * write_ev Timer event for polling writing this connection.

◆ rlm_sql_oracle_t

struct rlm_sql_oracle_t

Definition at line 52 of file rlm_sql_oracle.c.

Data Fields
OCIEnv * env Environment handle.
uint32_t stmt_cache_size Statement cache size.

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   "sql - oracle"

Definition at line 25 of file rlm_sql_oracle.c.

◆ MAX_DATASTR_LEN

#define MAX_DATASTR_LEN   64

Definition at line 81 of file rlm_sql_oracle.c.

◆ ORACLE_ERROR

#define ORACLE_ERROR (   _message)
Value:
sql_snprint_error(errbuff, sizeof(errbuff), c); \
ERROR(_message ": %s", errbuff); \
@ CONNECTION_STATE_FAILED
Connection has failed.
Definition: connection.h:54
static int sql_snprint_error(char *out, size_t outlen, rlm_sql_oracle_conn_t *conn)
Write the last Oracle error out to a buffer.

Definition at line 192 of file rlm_sql_oracle.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 174 of file rlm_sql_oracle.c.

+ Here is the call graph for this function:

◆ CC_NO_UBSAN()

CC_NO_UBSAN ( function  )

Definition at line 197 of file rlm_sql_oracle.c.

+ Here is the call graph for this function:

◆ mod_detach()

static int mod_detach ( module_detach_ctx_t const *  mctx)
static

Definition at line 136 of file rlm_sql_oracle.c.

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 145 of file rlm_sql_oracle.c.

◆ sql_check_reconnect()

static sql_rcode_t sql_check_reconnect ( rlm_sql_oracle_conn_t conn)
static

Definition at line 160 of file rlm_sql_oracle.c.

+ Here is the call graph for this function:
+ 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_entrys to fill.
outlenLength of out array.
query_ctxQuery context to retrieve error for.
configrlm_sql config.
Returns
number of errors written to the sql_log_entry_t array.

Definition at line 118 of file rlm_sql_oracle.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 731 of file rlm_sql_oracle.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 678 of file rlm_sql_oracle.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 794 of file rlm_sql_oracle.c.

◆ sql_finish_select_query()

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

Definition at line 808 of file rlm_sql_oracle.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 771 of file rlm_sql_oracle.c.

◆ sql_num_rows()

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

Definition at line 720 of file rlm_sql_oracle.c.

◆ 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 575 of file rlm_sql_oracle.c.

+ Here is the call graph for this function:

◆ sql_snprint_error()

static int sql_snprint_error ( char *  out,
size_t  outlen,
rlm_sql_oracle_conn_t conn 
)
static

Write the last Oracle error out to a buffer.

Parameters
outWhere to write the error (should be at least 512 bytes).
outlenThe length of the error buffer.
connOracle connection.
Returns
  • Oracle error code on success.
  • -1 if there was no error.

Definition at line 92 of file rlm_sql_oracle.c.

+ Here is the call graph for this function:
+ Here is the caller 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 436 of file rlm_sql_oracle.c.

+ Here is the call 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 525 of file rlm_sql_oracle.c.

+ Here is the call graph for this function:

Variable Documentation

◆ driver_config

const conf_parser_t driver_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("stmt_cache_size", rlm_sql_oracle_t, stmt_cache_size), .dflt = "32" },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268

Definition at line 76 of file rlm_sql_oracle.c.

◆ rlm_sql_oracle

rlm_sql_driver_t rlm_sql_oracle
Initial value:
= {
.common = {
.name = "sql_oracle",
.inst_size = sizeof(rlm_sql_oracle_t),
.detach = mod_detach
},
.sql_query_resume = sql_query_resume,
.sql_select_query_resume = sql_select_query_resume,
.sql_num_rows = sql_num_rows,
.sql_affected_rows = sql_num_rows,
.sql_fetch_row = sql_fetch_row,
.sql_fields = sql_fields,
.sql_free_result = sql_free_result,
.sql_error = sql_error,
.sql_finish_query = sql_finish_query,
.sql_finish_select_query = sql_finish_select_query,
.uses_trunks = true,
.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
static const conf_parser_t config[]
Definition: base.c:183
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1302
#define RLM_SQL_RCODE_FLAGS_ALT_QUERY
Can distinguish between other errors and those.
Definition: rlm_sql.h:172
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
static int mod_detach(module_detach_ctx_t const *mctx)
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 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 sql_rcode_t sql_finish_select_query(fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static unlang_action_t sql_fetch_row(rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, void *uctx)
static int sql_num_rows(fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static const conf_parser_t driver_config[]
static sql_rcode_t sql_free_result(fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config)
static int mod_instantiate(module_inst_ctx_t const *mctx)

Definition at line 827 of file rlm_sql_oracle.c.