2024-06-19 15:06:14 +08:00
|
|
|
#pragma once
|
2024-04-22 20:01:15 +08:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2024-09-10 10:18:05 +08:00
|
|
|
#include "stellar/mq.h"
|
|
|
|
|
#include "stellar/log.h"
|
|
|
|
|
#include "stellar/packet.h"
|
2024-05-17 16:55:46 +08:00
|
|
|
|
2024-09-10 10:18:05 +08:00
|
|
|
struct stellar;
|
2024-09-06 13:22:02 +08:00
|
|
|
|
2024-05-17 16:55:46 +08:00
|
|
|
//return plugin_env
|
|
|
|
|
typedef void *plugin_on_load_func(struct stellar *st);
|
|
|
|
|
typedef void plugin_on_unload_func(void *plugin_env);
|
|
|
|
|
|
2024-09-09 14:14:59 +08:00
|
|
|
typedef void plugin_on_packet_func(struct packet *pkt, void *on_packet_cb_arg);
|
2024-09-10 10:18:05 +08:00
|
|
|
//return 0 if success, otherwise return -1.
|
|
|
|
|
int stellar_raw_packet_subscribe(struct stellar *st, plugin_on_packet_func *on_packet_cb, void *on_packet_cb_arg);
|
2024-05-17 16:55:46 +08:00
|
|
|
|
2024-09-10 10:18:05 +08:00
|
|
|
//return on_polling state, 0: idle, 1: working
|
2024-09-09 14:14:59 +08:00
|
|
|
typedef int plugin_on_polling_func(void *polling_arg);
|
2024-09-10 10:18:05 +08:00
|
|
|
//return 0 if success, otherwise return -1.
|
|
|
|
|
int stellar_polling_subscribe(struct stellar *st, plugin_on_polling_func on_polling, void *polling_arg);
|
2024-09-06 13:22:02 +08:00
|
|
|
|
2024-08-06 20:37:59 +08:00
|
|
|
void stellar_emit_datapath_telemetry(struct packet *pkt, const char * module, const char *str);
|
|
|
|
|
|
|
|
|
|
int stellar_get_worker_thread_num(struct stellar *st);
|
2024-04-25 16:48:50 +08:00
|
|
|
uint16_t stellar_get_current_thread_index();
|
2024-09-02 16:53:02 +08:00
|
|
|
// only send user build packet, can't send packet which come from network
|
2024-08-16 14:15:03 +08:00
|
|
|
void stellar_send_build_packet(struct stellar *st, struct packet *pkt);
|
2024-08-19 17:28:45 +08:00
|
|
|
|
|
|
|
|
struct stellar *stellar_new(const char *stellar_cfg_file, const char *plugin_cfg_file, const char *log_cfg_file);
|
|
|
|
|
void stellar_run(struct stellar *st);
|
|
|
|
|
void stellar_free(struct stellar *st);
|
|
|
|
|
void stellar_loopbreak(struct stellar *st);
|
2024-08-28 14:52:26 +08:00
|
|
|
void stellar_reload_log_level(struct stellar *st);
|
2024-08-28 19:00:32 +08:00
|
|
|
struct logger *stellar_get_logger(struct stellar *st);
|
2024-08-28 14:52:26 +08:00
|
|
|
|
2024-09-10 10:18:05 +08:00
|
|
|
struct mq_schema *stellar_get_mq_schema(struct stellar *st);
|
|
|
|
|
struct mq_runtime *stellar_get_mq_runtime(struct stellar *st);
|
|
|
|
|
|
2024-04-22 20:01:15 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|