This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/common/include/tfe_kafka_logger.h
fengweihao 88a7a8c5c4 TSG-21787 Proxy初始化kafka topic时增加client.id参数
TSG-21730 Proxy优化Manipulation日志中host和fqdn字段的格式
2024-07-12 11:13:56 +08:00

45 lines
1.1 KiB
C

#ifndef _TFE_KAFKA_LOGGER_H
#define _TFE_KAFKA_LOGGER_H
#ifdef __cpluscplus
extern "C"
{
#endif
#include <tfe_utils.h>
#include <librdkafka/rdkafka.h>
enum kafka_topic_type
{
TOPIC_LOGGER,
TOPIC_BUCKET,
TOPIC_MC_CACHE,
TOPIC_MAX
};
typedef struct tfe_kafka_logger_s
{
int enable;
int t_vsys_id;
unsigned int local_ip_num;
char local_ip_str[TFE_SYMBOL_MAX];
char topic_name[TOPIC_MAX][TFE_STRING_MAX];
char broker_list[TFE_STRING_MAX];
rd_kafka_t *kafka_handle[TOPIC_MAX];
rd_kafka_topic_t *kafka_topic[TOPIC_MAX];
} tfe_kafka_logger_t;
tfe_kafka_logger_t *tfe_kafka_logger_create(int enable, const char *nic_name, const char *brokerlist, void *local_logger);
int tfe_logger_create_kafka_topic(tfe_kafka_logger_t *logger, const char *sasl_username, const char *sasl_passwd, const char *topic_name, int topic_id, void *local_logger);
void tfe_kafka_logger_destroy(tfe_kafka_logger_t *logger);
int tfe_kafka_logger_send(tfe_kafka_logger_t *logger, int topic_id, const char *data, int len);
#ifdef __cpluscplus
}
#endif
#endif