58 lines
1.9 KiB
C
58 lines
1.9 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
struct stellar;
|
|
|
|
//return plugin_env
|
|
typedef void *plugin_on_load_func(struct stellar *st);
|
|
typedef void plugin_on_unload_func(void *plugin_env);
|
|
|
|
struct tcp_segment;
|
|
const char *tcp_segment_get_data(const struct tcp_segment *seg);
|
|
uint16_t tcp_segment_get_len(const struct tcp_segment *seg);
|
|
|
|
#define TOPIC_TCP_STREAM "TCP_STREAM" //topic message: tcp_segment
|
|
#define TOPIC_CONTROL_PACKET "CONTROL_PACKET" //topic message: packet
|
|
|
|
#define TOPIC_TCP "TCP" //topic message: session
|
|
#define TOPIC_UDP "UDP" //topic message: session
|
|
|
|
|
|
struct packet;
|
|
typedef void plugin_on_packet_func(struct packet *pkt, unsigned char ip_protocol, void *plugin_env);
|
|
|
|
//return plugin_id
|
|
int stellar_plugin_register(struct stellar *st, unsigned char ip_protocol, plugin_on_packet_func on_packet_input, plugin_on_packet_func on_packet_output, void *plugin_env);
|
|
|
|
|
|
//return polling work result, 0: no work, 1: work
|
|
typedef int plugin_on_polling_func(void *plugin_env);
|
|
|
|
//return polling plugin_id
|
|
int stellar_polling_plugin_register(struct stellar *st, plugin_on_polling_func on_polling, void *plugin_env);
|
|
|
|
void stellar_emit_datapath_telemetry(struct packet *pkt, const char * module, const char *str);
|
|
|
|
int stellar_get_worker_thread_num(struct stellar *st);
|
|
uint16_t stellar_get_current_thread_index();
|
|
// only send user build packet, can't send packet which come from network
|
|
void stellar_send_build_packet(struct stellar *st, struct packet *pkt);
|
|
|
|
struct stellar;
|
|
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);
|
|
void stellar_reload_log_level(struct stellar *st);
|
|
struct logger *stellar_get_logger(struct stellar *st);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|