The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
This is free and unencumbered software released into the public domain. More...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include <cassandra.h>
#include "rlm_sql.h"
#include "rlm_sql_trunk.h"
Go to the source code of this file.
Data Structures | |
struct | cassandra_query_ctx_t |
Driver specific data to attach to the query ctx. More... | |
struct | cassandra_query_t |
Structure for tracking outstanding queries. More... | |
struct | rlm_sql_cassandra_conn_t |
Cassandra cluster connection. More... | |
struct | rlm_sql_cassandra_t |
Cassandra driver instance. More... | |
Macros | |
#define | DO_CASS_OPTION(_opt, _x) |
#define | LOG_PREFIX "sql - cassandra" |
#define | RLM_CASS_ERR_DATA_RETRIVE(_t) |
Functions | |
static void | _rlm_sql_cassandra_log (CassLogMessage const *message, UNUSED void *data) |
Log callback for libcassandra. More... | |
static void | _sql_connection_close (UNUSED fr_event_list_t *el, void *h, UNUSED void *uctx) |
CC_NO_UBSAN (function) | |
DIAG_OFF (strict-prototypes) typedef struct | |
static int | mod_detach (module_detach_ctx_t const *mctx) |
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
static int | mod_load (void) |
static int | sql_affected_rows (UNUSED fr_sql_query_t *query_ctx, UNUSED rlm_sql_config_t const *config) |
static size_t | sql_error (UNUSED TALLOC_CTX *ctx, sql_log_entry_t out[], size_t outlen, fr_sql_query_t *query_ctx) |
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, 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) |
static void | sql_set_query_error (TALLOC_CTX *ctx, cassandra_query_ctx_t *cass_query_ctx, char const *message, size_t len) |
Store the last error associated with a query. More... | |
static void | sql_set_query_error_printf (TALLOC_CTX *ctx, cassandra_query_ctx_t *cass_query_ctx, char const *fmt,...)) |
Store the last error associated with a query, using a format string. More... | |
static void | sql_trunk_connection_read_poll (UNUSED 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 fr_table_num_sorted_t const | consistency_levels [] |
static size_t | consistency_levels_len = NUM_ELEMENTS(consistency_levels) |
static const conf_parser_t | driver_config [] |
static conf_parser_t | latency_aware_routing_config [] |
static conf_parser_t | load_balance_dc_aware_config [] |
rlm_sql_driver_t | rlm_sql_cassandra |
rlm_sql_cassandra_mutable_t | |
static conf_parser_t | tls_config [] |
static fr_table_num_sorted_t const | verify_cert_table [] |
static size_t | verify_cert_table_len = NUM_ELEMENTS(verify_cert_table) |
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http://unlicense.org
Cassandra SQL driver
Definition in file rlm_sql_cassandra.c.
struct cassandra_query_ctx_t |
Driver specific data to attach to the query ctx.
Definition at line 162 of file rlm_sql_cassandra.c.
Data Fields | ||
---|---|---|
sql_log_entry_t | error | Most recent Cassandra error message for this query. |
CassResult const * | result | Cassandra result handle. |
struct cassandra_query_t |
Structure for tracking outstanding queries.
Definition at line 153 of file rlm_sql_cassandra.c.
Data Fields | ||
---|---|---|
fr_dlist_t | entry | Entry in list of outstanding queries. |
CassFuture * | future | Future produced when submitting query. |
fr_sql_query_t * | query_ctx | SQL query ctx. |
struct rlm_sql_cassandra_conn_t |
Cassandra cluster connection.
Definition at line 135 of file rlm_sql_cassandra.c.
Data Fields | ||
---|---|---|
rlm_sql_config_t const * | config | SQL instance config. |
connection_t * | conn | Generic connection structure for managing this handle. |
rlm_sql_cassandra_t const * | inst | Module instance for this connection. |
CassIterator * | iterator | Row set iterator. |
TALLOC_CTX * | log_ctx | Prevent unneeded memory allocation by keeping a permanent pool, to store log entries. |
uint | poll_count | How many consecutive polls had no available results. |
uint | poll_interval | Interval between read polling. |
fr_dlist_head_t | queries | Outstanding queries on this connection. |
fr_event_timer_t const * | read_ev | Polling event for reading query results. |
fr_event_timer_t const * | write_ev | Polling event for sending queries. |
struct rlm_sql_cassandra_t |
Cassandra driver instance.
Definition at line 63 of file rlm_sql_cassandra.c.
Data Fields | ||
---|---|---|
CassCluster * | cluster | Configuration of the cassandra cluster connection. |
uint32_t | connections_per_host | Number of connections to each server in each IO thread. |
CassConsistency | consistency | Level of consistency converted to a constant. |
char const * | consistency_str | Level of consistency required. |
uint32_t | event_queue_size | Sets the size of the the fixed size queue that stores events. |
uint32_t | io_queue_size | Size of the the fixed size queue that stores pending requests. |
uint32_t | io_threads | Number of IO threads. |
double | lar_exclusion_threshold |
How much worse the latency me be, compared to the average latency of the best performing node before it's penalized. This gets mangled to a double. |
uint64_t | lar_min_measured | The minimum number of measurements per-host required to be considered by the policy. |
fr_time_delta_t | lar_retry_period | The amount of time a node is penalized by the policy before being given a second chance when the current average latency exceeds the calculated threshold (exclusion_threshold * best_average_latency). |
fr_time_delta_t | lar_scale |
Weight given to older latencies when calculating the average latency of a node. A bigger scale will give more weight to older latency measurements. |
fr_time_delta_t | lar_update_rate | The rate at which the best average latency is recomputed. |
bool | lbdc_allow_remote_dcs_for_local_cl |
Allows remote hosts to be used if no local. dc hosts are available and the consistency level is LOCAL_ONE or LOCAL_QUORUM. |
uint32_t | lbdc_hosts_per_remote_dc | The number of host used in each remote DC if no hosts are available in the local dc. |
char const * | lbdc_local_dc | The primary data center to try first. |
bool | load_balance_round_robin | Enable round robin load balancing. |
rlm_sql_cassandra_mutable_t * | mutable | Instance data which needs to change post instantiation. |
uint32_t | protocol_version | The protocol version. |
CassSession * | session | Cluster's connection pool. |
CassSsl * | ssl | Connection's SSL context. |
uint32_t | tcp_keepalive | How often to send TCP keepalives. |
bool | tcp_nodelay | Disable TCP naggle algorithm. |
char const * | tls_ca_file | Path to the CA used to validate the server's certificate. |
char const * | tls_certificate_file | Public certificate we present to the server. |
char const * | tls_private_key_file | Private key for the certificate we present to the server. |
char const * | tls_private_key_password | String to decrypt private key. |
char const * | tls_verify_cert_str | Whether we validate the cert provided by the server. |
bool | token_aware_routing | Whether to use token aware routing. |
#define DO_CASS_OPTION | ( | _opt, | |
_x | |||
) |
#define LOG_PREFIX "sql - cassandra" |
Definition at line 36 of file rlm_sql_cassandra.c.
#define RLM_CASS_ERR_DATA_RETRIVE | ( | _t | ) |
|
static |
Log callback for libcassandra.
libcassandra seems to use this to log global events in the library, other messages like query errors are not logged here, and should be retrieved with functions like cass_future_error_message();
Messages here do not need to be made available via sql_error.
message | Contains the log message and information about its source. |
data | user data (not used). |
Definition at line 249 of file rlm_sql_cassandra.c.
|
static |
CC_NO_UBSAN | ( | function | ) |
DIAG_OFF | ( | strict- | prototypes | ) |
< Whether we've connected to a keyspace.
< Mutex to prevent multiple connections attempting to connect to a keyspace concurrently.
Definition at line 44 of file rlm_sql_cassandra.c.
|
static |
|
static |
|
static |
|
static |
Definition at line 845 of file rlm_sql_cassandra.c.
|
static |
Definition at line 814 of file rlm_sql_cassandra.c.
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 620 of file rlm_sql_cassandra.c.
|
static |
Store the last error associated with a query.
ctx | to allocate message in |
cass_query_ctx | cassandra query context to write error message into. |
message | from libcassandra. |
len | of message. |
Definition at line 302 of file rlm_sql_cassandra.c.
|
static |
Store the last error associated with a query, using a format string.
ctx | to allocate messate in. |
cass_query_ctx | to replace log message in. |
fmt | of message. |
... | args. |
Definition at line 319 of file rlm_sql_cassandra.c.
|
static |
|
static |
|
static |
Definition at line 167 of file rlm_sql_cassandra.c.
|
static |
Definition at line 178 of file rlm_sql_cassandra.c.
|
static |
Definition at line 213 of file rlm_sql_cassandra.c.
|
static |
Definition at line 194 of file rlm_sql_cassandra.c.
|
static |
Definition at line 187 of file rlm_sql_cassandra.c.
rlm_sql_driver_t rlm_sql_cassandra |
Definition at line 1040 of file rlm_sql_cassandra.c.
rlm_sql_cassandra_mutable_t |
Definition at line 58 of file rlm_sql_cassandra.c.
|
static |
Definition at line 203 of file rlm_sql_cassandra.c.
|
static |
Definition at line 180 of file rlm_sql_cassandra.c.
|
static |
Definition at line 185 of file rlm_sql_cassandra.c.