The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
base.c File Reference

Kafka global structures. More...

#include <freeradius-devel/kafka/base.h>
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/util/value.h>
#include <freeradius-devel/util/sbuff.h>
#include <freeradius-devel/util/size.h>
+ Include dependency graph for base.c:

Go to the source code of this file.

Data Structures

struct  fr_kafka_conf_ctx_t
 
struct  fr_kafka_conf_t
 
struct  fr_kafka_topic_conf_t
 

Macros

#define BASE_CONFIG
 

Functions

static int _kafka_conf_free (fr_kafka_conf_t *kc)
 Destroy a kafka configuration handle. More...
 
static int _kafka_topic_conf_free (fr_kafka_topic_conf_t *ktc)
 Destroy a kafka topic configuration handle. More...
 
static fr_kafka_conf_tkafka_conf_from_cs (CONF_SECTION *cs)
 
static int kafka_config_dflt (CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule)
 Return the default value from the kafka client library. More...
 
static int kafka_config_dflt_single (CONF_PAIR **out, UNUSED void *parent, CONF_SECTION *cs, char const *value, fr_token_t quote, conf_parser_t const *rule)
 Perform any conversions necessary to map kafka defaults to our values. More...
 
static int kafka_config_parse (TALLOC_CTX *ctx, UNUSED void *out, UNUSED void *base, CONF_ITEM *ci, conf_parser_t const *rule)
 Translate config items directly to settings in a kafka config struct. More...
 
static int kafka_config_parse_single (char const **out, CONF_PAIR *cp, conf_parser_t const *rule)
 
static fr_kafka_topic_conf_tkafka_topic_conf_from_cs (CONF_SECTION *cs)
 
static int kafka_topic_config_dflt (CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule)
 Return the default value for a topic from the kafka client library. More...
 
static int kafka_topic_config_parse (UNUSED TALLOC_CTX *ctx, UNUSED void *out, UNUSED void *base, CONF_ITEM *ci, conf_parser_t const *rule)
 Translate config items directly to settings in a kafka topic config struct. More...
 

Variables

conf_parser_t const kafka_base_consumer_config []
 
static conf_parser_t const kafka_base_consumer_topic_config []
 
static conf_parser_t const kafka_base_consumer_topics_config []
 
conf_parser_t const kafka_base_producer_config []
 
static conf_parser_t const kafka_base_producer_topic_config []
 
static conf_parser_t const kafka_base_producer_topics_config []
 
static fr_table_ptr_sorted_t kafka_check_cert_cn_table []
 
static size_t kafka_check_cert_cn_table_len = NUM_ELEMENTS(kafka_check_cert_cn_table)
 
static conf_parser_t const kafka_connection_config []
 
static conf_parser_t const kafka_consumer_group_config []
 
static conf_parser_t const kafka_metadata_config []
 
static conf_parser_t const kafka_sasl_config []
 
static conf_parser_t const kafka_sasl_kerberos_config []
 
static conf_parser_t const kafka_sasl_oauth_config []
 
static conf_parser_t const kafka_tls_config []
 
static conf_parser_t const kafka_version_config []
 

Detailed Description

Kafka global structures.

Id
1c5b31927d4e569cd934a3f2d567d2a70091105c

Definition in file base.c.


Data Structure Documentation

◆ fr_kafka_conf_ctx_t

struct fr_kafka_conf_ctx_t

Definition at line 40 of file base.c.

+ 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.

◆ fr_kafka_conf_t

struct fr_kafka_conf_t

Definition at line 32 of file base.c.

Data Fields
rd_kafka_conf_t * conf

◆ fr_kafka_topic_conf_t

struct fr_kafka_topic_conf_t

Definition at line 36 of file base.c.

Data Fields
rd_kafka_topic_conf_t * conf

Macro Definition Documentation

◆ BASE_CONFIG

#define BASE_CONFIG
Value:
.uctx = &(fr_kafka_conf_ctx_t){ .property = "metadata.broker.list", .string_sep = "," }}, \
.uctx = &(fr_kafka_conf_ctx_t){ .property = "client.id" }}, \
.uctx = &(fr_kafka_conf_ctx_t){ .property = "client.rack" }}, \
.uctx = &(fr_kafka_conf_ctx_t){ .property = "message.max.bytes" }}, \
{ FR_CONF_FUNC("request_copy_max_size", FR_TYPE_SIZE, 0, kafka_config_parse, kafka_config_dflt), \
.uctx = &(fr_kafka_conf_ctx_t){ .property = "message.copy.max.bytes" }}, \
.uctx = &(fr_kafka_conf_ctx_t){ .property = "receive.message.max.bytes" }}, \
.uctx = &(fr_kafka_conf_ctx_t){ .property = "builtin.features", .string_sep = "," }}, \
.uctx = &(fr_kafka_conf_ctx_t){ .property = "debug", .string_sep = "," }}, \
.uctx = &(fr_kafka_conf_ctx_t){ .property = "plugin.library.paths", .string_sep = ";" }}, \
#define FR_CONF_SUBSECTION_GLOBAL(_name, _flags, _subcs)
conf_parser_t entry which runs conf_parser_t entries for a subsection without any output
Definition: cf_parse.h:374
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:405
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition: cf_parse.h:419
#define FR_CONF_FUNC(_name, _type, _flags, _func, _dflt_func)
conf_parser_t entry which doesn't fill in a pointer or offset, but relies on functions to record valu...
Definition: cf_parse.h:361
static conf_parser_t const kafka_connection_config[]
Definition: base.c:684
static int kafka_config_parse(TALLOC_CTX *ctx, UNUSED void *out, UNUSED void *base, CONF_ITEM *ci, conf_parser_t const *rule)
Translate config items directly to settings in a kafka config struct.
Definition: base.c:429
static conf_parser_t const kafka_version_config[]
Definition: base.c:761
static conf_parser_t const kafka_tls_config[]
Definition: base.c:625
static int kafka_config_dflt(CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule)
Return the default value from the kafka client library.
Definition: base.c:210
static conf_parser_t const kafka_metadata_config[]
Definition: base.c:789
static conf_parser_t const kafka_sasl_config[]
Definition: base.c:591
@ FR_TYPE_STRING
String of printable characters.
Definition: merged_model.c:83
@ FR_TYPE_SIZE
Unsigned integer capable of representing any memory address on the local system.
Definition: merged_model.c:115

Definition at line 829 of file base.c.

Function Documentation

◆ _kafka_conf_free()

static int _kafka_conf_free ( fr_kafka_conf_t kc)
static

Destroy a kafka configuration handle.

Parameters
[in]kcTo destroy.
Returns
0

Definition at line 60 of file base.c.

+ Here is the caller graph for this function:

◆ _kafka_topic_conf_free()

static int _kafka_topic_conf_free ( fr_kafka_topic_conf_t ktc)
static

Destroy a kafka topic configuration handle.

Parameters
[in]ktcTo destroy.
Returns
0

Definition at line 90 of file base.c.

+ Here is the caller graph for this function:

◆ kafka_conf_from_cs()

static fr_kafka_conf_t* kafka_conf_from_cs ( CONF_SECTION cs)
inlinestatic

Definition at line 67 of file base.c.

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

◆ kafka_config_dflt()

static int kafka_config_dflt ( CONF_PAIR **  out,
void *  parent,
CONF_SECTION cs,
fr_token_t  quote,
conf_parser_t const *  rule 
)
static

Return the default value from the kafka client library.

Parameters
[out]outWhere to write the pair.
[in]parentbeing populated.
[in]csto allocate the pair in.
[in]quoteto use when allocing the pair.
[in]ruleUNUSED.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 210 of file base.c.

+ Here is the call graph for this function:

◆ kafka_config_dflt_single()

static int kafka_config_dflt_single ( CONF_PAIR **  out,
UNUSED void *  parent,
CONF_SECTION cs,
char const *  value,
fr_token_t  quote,
conf_parser_t const *  rule 
)
static

Perform any conversions necessary to map kafka defaults to our values.

Parameters
[out]outWhere to write the pair.
[in]parentbeing populated.
[in]csto allocate the pair in.
[in]valueto convert.
[in]quoteto use when allocing the pair.
[in]ruleUNUSED.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 127 of file base.c.

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

◆ kafka_config_parse()

static int kafka_config_parse ( TALLOC_CTX *  ctx,
UNUSED void *  out,
UNUSED void *  base,
CONF_ITEM ci,
conf_parser_t const *  rule 
)
static

Translate config items directly to settings in a kafka config struct.

Parameters
[in]ctxto allocate fr_kafka_conf_t in.
[out]outUnused.
[in]baseUnused.
[in]ciTo parse.
[in]ruledescribing how to parse the item.
Returns
  • 0 on success.
  • -1 on failure

Definition at line 429 of file base.c.

+ Here is the call graph for this function:

◆ kafka_config_parse_single()

static int kafka_config_parse_single ( char const **  out,
CONF_PAIR cp,
conf_parser_t const *  rule 
)
static

Definition at line 330 of file base.c.

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

◆ kafka_topic_conf_from_cs()

static fr_kafka_topic_conf_t* kafka_topic_conf_from_cs ( CONF_SECTION cs)
inlinestatic

Definition at line 97 of file base.c.

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

◆ kafka_topic_config_dflt()

static int kafka_topic_config_dflt ( CONF_PAIR **  out,
void *  parent,
CONF_SECTION cs,
fr_token_t  quote,
conf_parser_t const *  rule 
)
static

Return the default value for a topic from the kafka client library.

Parameters
[out]outWhere to write the pair.
[in]parentbeing populated.
[in]csto allocate the pair in.
[in]quoteto use when allocing the pair.
[in]ruleUNUSED.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 292 of file base.c.

+ Here is the call graph for this function:

◆ kafka_topic_config_parse()

static int kafka_topic_config_parse ( UNUSED TALLOC_CTX *  ctx,
UNUSED void *  out,
UNUSED void *  base,
CONF_ITEM ci,
conf_parser_t const *  rule 
)
static

Translate config items directly to settings in a kafka topic config struct.

Parameters
[in]ctxto allocate fr_kafka_conf_t in.
[out]outUnused.
[in]baseUnused.
[in]ciTo parse.
[in]ruledescribing how to parse the item.
Returns
  • 0 on success.
  • -1 on failure

Definition at line 501 of file base.c.

+ Here is the call graph for this function:

Variable Documentation

◆ kafka_base_consumer_config

conf_parser_t const kafka_base_consumer_config[]

Definition at line 930 of file base.c.

◆ kafka_base_consumer_topic_config

conf_parser_t const kafka_base_consumer_topic_config[]
static
Initial value:
= {
.uctx = &(fr_kafka_conf_ctx_t){ .property = "consume.callback.max.messages" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "auto.offset.reset" }},
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99

Definition at line 895 of file base.c.

◆ kafka_base_consumer_topics_config

conf_parser_t const kafka_base_consumer_topics_config[]
static
Initial value:
= {
}
#define CF_IDENT_ANY
Definition: cf_util.h:78
static conf_parser_t const kafka_base_consumer_topic_config[]
Definition: base.c:895

Definition at line 924 of file base.c.

◆ kafka_base_producer_config

conf_parser_t const kafka_base_producer_config[]

Definition at line 1092 of file base.c.

◆ kafka_base_producer_topic_config

conf_parser_t const kafka_base_producer_topic_config[]
static
Initial value:
= {
.uctx = &(fr_kafka_conf_ctx_t){ .property = "request.required.acks" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "request.timeout.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "message.timeout.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "partitioner" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "compression.type" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "compression.level" }},
}
static int kafka_topic_config_dflt(CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule)
Return the default value for a topic from the kafka client library.
Definition: base.c:292
static int kafka_topic_config_parse(UNUSED TALLOC_CTX *ctx, UNUSED void *out, UNUSED void *base, CONF_ITEM *ci, conf_parser_t const *rule)
Translate config items directly to settings in a kafka topic config struct.
Definition: base.c:501
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
Definition: merged_model.c:113
@ FR_TYPE_INT8
8 Bit signed integer.
Definition: merged_model.c:103
@ FR_TYPE_INT16
16 Bit signed integer.
Definition: merged_model.c:104

Definition at line 1035 of file base.c.

◆ kafka_base_producer_topics_config

conf_parser_t const kafka_base_producer_topics_config[]
static
Initial value:
= {
}
static conf_parser_t const kafka_base_producer_topic_config[]
Definition: base.c:1035

Definition at line 1086 of file base.c.

◆ kafka_check_cert_cn_table

fr_table_ptr_sorted_t kafka_check_cert_cn_table[]
static
Initial value:
= {
{ L("false"), "none" },
{ L("no"), "none" },
{ L("true"), "https" },
{ L("yes"), "https" }
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition: build.h:207

Definition at line 617 of file base.c.

◆ kafka_check_cert_cn_table_len

size_t kafka_check_cert_cn_table_len = NUM_ELEMENTS(kafka_check_cert_cn_table)
static

Definition at line 623 of file base.c.

◆ kafka_connection_config

conf_parser_t const kafka_connection_config[]
static

Definition at line 684 of file base.c.

◆ kafka_consumer_group_config

conf_parser_t const kafka_consumer_group_config[]
static
Initial value:
= {
.uctx = &(fr_kafka_conf_ctx_t){ .property = "group.id" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "group.instance.id" }},
{ FR_CONF_FUNC("partition_assignment_strategy", FR_TYPE_STRING, 0, kafka_config_parse, kafka_config_dflt),
.uctx = &(fr_kafka_conf_ctx_t){ .property = "partition.assignment.strategy" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "session.timeout.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "heartbeat.interval.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "coordinator.query.interval.ms" }},
}

Definition at line 854 of file base.c.

◆ kafka_metadata_config

conf_parser_t const kafka_metadata_config[]
static
Initial value:
= {
.uctx = &(fr_kafka_conf_ctx_t){ .property = "topic.metadata.refresh.interval.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "metadata.max.age.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "topic.metadata.refresh.fast.interval.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "topic.metadata.propagation.max.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "topic.metadata.refresh.sparse" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "topic.blacklist", .string_sep = ",", .empty_default = true }},
}
@ FR_TYPE_BOOL
A truth value.
Definition: merged_model.c:95

Definition at line 789 of file base.c.

◆ kafka_sasl_config

conf_parser_t const kafka_sasl_config[]
static
Initial value:
= {
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.mechanism" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.username", .empty_default = true }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.password", .empty_default = true }},
}
@ CONF_FLAG_SECRET
Only print value if debug level >= 3.
Definition: cf_parse.h:409
static conf_parser_t const kafka_sasl_oauth_config[]
Definition: base.c:547
static conf_parser_t const kafka_sasl_kerberos_config[]
Definition: base.c:557

Definition at line 591 of file base.c.

◆ kafka_sasl_kerberos_config

conf_parser_t const kafka_sasl_kerberos_config[]
static
Initial value:
= {
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.kerberos.service.name" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.kerberos.principal" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.kerberos.kinit.cmd" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.kerberos.kinit.keytab", .empty_default = true }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.kerberos.min.time.before.relogin" }},
}
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition: cf_parse.h:411

Definition at line 557 of file base.c.

◆ kafka_sasl_oauth_config

conf_parser_t const kafka_sasl_oauth_config[]
static
Initial value:
= {
.uctx = &(fr_kafka_conf_ctx_t){ .property = "sasl.oauthbearer.config", .empty_default = true }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "enable.sasl.oauthbearer.unsecure.jwt" }},
}

Definition at line 547 of file base.c.

◆ kafka_tls_config

conf_parser_t const kafka_tls_config[]
static

Definition at line 625 of file base.c.

◆ kafka_version_config

conf_parser_t const kafka_version_config[]
static
Initial value:
= {
.uctx = &(fr_kafka_conf_ctx_t){ .property = "api.version.request" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "api.version.request.timeout.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "api.version.fallback.ms" }},
.uctx = &(fr_kafka_conf_ctx_t){ .property = "broker.version.fallback" }},
}

Definition at line 761 of file base.c.