![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Common functions for interacting with kafk. More...
#include <librdkafka/rdkafka.h>#include <freeradius-devel/server/cf_parse.h>#include <freeradius-devel/util/rb.h>
Include dependency graph for base.h:Go to the source code of this file.
Data Structures | |
| struct | fr_kafka_conf_ctx_t |
uctx attached to each entry in KAFKA_BASE_PRODUCER_CONFIG More... | |
| struct | fr_kafka_conf_t |
| struct | fr_kafka_topic_conf_t |
| struct | fr_kafka_topic_s |
Declared topic record - one per topic { <name> { ... } } subsection. More... | |
Macros | |
| #define | KAFKA_BASE_CONFIG |
| Config entries common to producer and consumer clients. | |
| #define | KAFKA_CONSUMER_CONFIG |
| Consumer-only delta: consumer-group membership, fetch/queue tuning, declared subscription topics. | |
| #define | KAFKA_PRODUCER_CONFIG |
| Producer-only delta: librdkafka producer tuning + declared topics. | |
Typedefs | |
| typedef struct fr_kafka_topic_s | fr_kafka_topic_t |
Functions | |
| void | fr_kafka_free (void) |
| Release one reference to librdkafka's global state. | |
| int | fr_kafka_init (void) |
| Initialise librdkafka's global state (SSL / SASL / internal ref-count) | |
| int | kafka_config_dflt (CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule) |
| Default-generator counterpart to kafka_config_parse - reads the librdkafka default for the property and materialises it as a CONF_PAIR. | |
| int | kafka_config_parse (TALLOC_CTX *ctx, void *out, void *base, CONF_ITEM *ci, conf_parser_t const *rule) |
Generic librdkafka-property parser used by KAFKA_BASE_PRODUCER_CONFIG entries. | |
| int | kafka_config_raw_parse (TALLOC_CTX *ctx, void *out, void *base, CONF_ITEM *ci, conf_parser_t const *rule) |
Untyped passthrough parser used by KAFKA_RAW_CONFIG | |
| fr_kafka_topic_t * | kafka_topic_conf_find (fr_kafka_conf_t const *kc, char const *name) |
Look up a declared topic by name on an fr_kafka_conf_t | |
| int | kafka_topic_config_raw_parse (TALLOC_CTX *ctx, void *out, void *base, CONF_ITEM *ci, conf_parser_t const *rule) |
| Topic-level raw passthrough. | |
| int | kafka_topic_subsection_parse (TALLOC_CTX *ctx, void *out, void *base, CONF_ITEM *ci, conf_parser_t const *rule) |
| Per-topic subsection hook used by KAFKA_PRODUCER_CONFIG / KAFKA_CONSUMER_CONFIG. | |
Nested config arrays referenced by <tt>KAFKA_BASE_PRODUCER_CONFIG</tt> | |
Extern so the macro's FR_CONF_SUBSECTION_GLOBAL entries can name them from any TU. Not part of the stable API - treat as implementation detail of the macro. | |
| conf_parser_t const | kafka_base_consumer_topics_config [] |
| conf_parser_t const | kafka_base_producer_topics_config [] |
| conf_parser_t const | kafka_base_properties_config [] |
properties { ... } escape-hatch contents | |
| conf_parser_t const | kafka_base_topic_properties_config [] |
Per-topic properties { ... } escape-hatch contents. | |
| conf_parser_t const | kafka_connection_config [] |
| conf_parser_t const | kafka_consumer_group_config [] |
| conf_parser_t const | kafka_metadata_config [] |
| conf_parser_t const | kafka_sasl_config [] |
| conf_parser_t const | kafka_tls_config [] |
| conf_parser_t const | kafka_version_config [] |
Common functions for interacting with kafk.
Definition in file base.h.
| struct fr_kafka_conf_ctx_t |
uctx attached to each entry in KAFKA_BASE_PRODUCER_CONFIG
Public so the config macro's struct literals resolve in caller TUs. You only touch this directly if you're extending the library's producer config with additional librdkafka pass-through properties.
Collaboration diagram for fr_kafka_conf_ctx_t:| Data Fields | ||
|---|---|---|
| bool | empty_default | Don't produce messages saying the default is missing. |
| fr_table_ptr_sorted_t * | mapping | Mapping table between string constant. |
| size_t * | mapping_len | Length of the mapping tables. |
| char const * | property | Kafka configuration property. |
| size_t | size_scale | Divide/multiply FR_TYPE_SIZE by this amount. |
| char const * | string_sep |
Used for multi-value configuration items. Kafka uses ', ' or ';' seemingly at random. |
| struct fr_kafka_conf_t |
Collaboration diagram for fr_kafka_conf_t:| Data Fields | ||
|---|---|---|
| rd_kafka_conf_t * | conf | |
| fr_rb_tree_t * | topics |
Declared topics, keyed by name. Populated during config parsing by the per-topic hook on the |
| struct fr_kafka_topic_conf_t |
| struct fr_kafka_topic_s |
Declared topic record - one per topic { <name> { ... } } subsection.
Built by the library's per-topic parse hook, indexed on the parent fr_kafka_conf_t.topics tree. Callers typically retrieve via kafka_topic_conf_find rather than poking this struct directly.
Collaboration diagram for fr_kafka_topic_s:| Data Fields | ||
|---|---|---|
| fr_kafka_topic_conf_t * | conf | parsed per-topic librdkafka conf |
| CONF_SECTION * | cs |
topic's CONF_SECTION (for call_env lookups of per-topic pairs like value / key) |
| char const * | name | as it appeared in config |
| fr_rb_node_t | node | |
| #define KAFKA_BASE_CONFIG |
Config entries common to producer and consumer clients.
Broker list, client identity, TLS / SASL, metadata / version / connection tuning, debug / plugin knobs. Usually composed with a role-specific macro (KAFKA_PRODUCER_CONFIG, or a future consumer equivalent).
| #define KAFKA_CONSUMER_CONFIG |
Consumer-only delta: consumer-group membership, fetch/queue tuning, declared subscription topics.
Compose with KAFKA_BASE_CONFIG. Same embedding contract as the producer macro (see KAFKA_PRODUCER_CONFIG).
| #define KAFKA_PRODUCER_CONFIG |
Producer-only delta: librdkafka producer tuning + declared topics.
Compose with KAFKA_BASE_CONFIG. Callers must embed fr_kafka_conf_t as the first member of their instance struct so FR_CONF_OFFSET resolves against it.
| typedef struct fr_kafka_topic_s fr_kafka_topic_t |
| void fr_kafka_free | ( | void | ) |
Release one reference to librdkafka's global state.
Call from a module's .unload to pair fr_kafka_init(). The last release is a no-op; librdkafka internally ref-counts its own globals and tears down when the last rd_kafka_t goes.
Release one reference to librdkafka's global state.
librdkafka refcounts its own globals internally; our counter just pairs fr_kafka_init() calls so re-entrant module load/unload in test harnesses does the right thing.
Definition at line 1238 of file base.c.
Here is the caller graph for this function:| int fr_kafka_init | ( | void | ) |
Initialise librdkafka's global state (SSL / SASL / internal ref-count)
Ref-counted: every call must be paired with fr_kafka_free(). The first call lazily kicks librdkafka's one-time init paths by creating and destroying a throwaway producer; subsequent calls just bump the refcount. Call this from a kafka-using module's .onload so the library's internal globals are set up deterministically at startup rather than racing the first real rd_kafka_new() in a worker thread.
Initialise librdkafka's global state (SSL / SASL / internal ref-count)
First call creates and immediately destroys a throwaway producer, which walks all of librdkafka's one-shot init paths (SSL lock callbacks on OpenSSL 1.0.2, SASL global init if compiled in, etc.). Subsequent calls just bump the refcount so multiple kafka-using modules can share the init.
Definition at line 1207 of file base.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int kafka_config_dflt | ( | CONF_PAIR ** | out, |
| void * | parent, | ||
| CONF_SECTION * | cs, | ||
| fr_token_t | quote, | ||
| conf_parser_t const * | rule | ||
| ) |
Default-generator counterpart to kafka_config_parse - reads the librdkafka default for the property and materialises it as a CONF_PAIR.
Default-generator counterpart to kafka_config_parse - reads the librdkafka default for the property and materialises it as a CONF_PAIR.
| [out] | out | Where to write the pair. |
| [in] | parent | being populated. |
| [in] | cs | to allocate the pair in. |
| [in] | quote | to use when allocing the pair. |
| [in] | rule | UNUSED. |
Definition at line 367 of file base.c.
Here is the call graph for this function:| int kafka_config_parse | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| void * | base, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
Generic librdkafka-property parser used by KAFKA_BASE_PRODUCER_CONFIG entries.
Exposed so the macro's FR_CONF_PAIR_GLOBAL entries can reference it from any TU.
| int kafka_config_raw_parse | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| void * | base, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
Untyped passthrough parser used by KAFKA_RAW_CONFIG
Hands the CONF_PAIR's attribute/value straight to rd_kafka_conf_set. No type dispatch - user is responsible for librdkafka-native units.
| fr_kafka_topic_t * kafka_topic_conf_find | ( | fr_kafka_conf_t const * | kc, |
| char const * | name | ||
| ) |
Look up a declared topic by name on an fr_kafka_conf_t
fr_kafka_topic_t, or NULL if no topic of that name was declared (or if no topics have been parsed yet). Definition at line 623 of file base.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int kafka_topic_config_raw_parse | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| void * | base, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
Topic-level raw passthrough.
Counterpart to kafka_config_raw_parse for use inside a declared topic's subsection, dispatching to rd_kafka_topic_conf_set.
| int kafka_topic_subsection_parse | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| void * | base, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
Per-topic subsection hook used by KAFKA_PRODUCER_CONFIG / KAFKA_CONSUMER_CONFIG.
Runs the inner rules against each topic { <name> { ... } } block then inserts an fr_kafka_topic_t into the parent fr_kafka_conf_t.topics tree so callers can look topics up by name without re-walking CONF_SECTIONs.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
1.9.8