#pragma once #ifdef __cplusplus extern "C" { #endif #include "plugin_manager.h" #include "stellar/stellar.h" #include "stellar/stellar_mq.h" #include "stellar/stellar_exdata.h" #include "uthash/utarray.h" struct stellar_message; struct per_thread_exdata_array { struct stellar_exdata *exdata_array; }; struct plugin_manager_per_thread_data { struct per_thread_exdata_array per_thread_pkt_exdata_array; struct stellar_message *priority_mq[STELLAR_MQ_PRIORITY_MAX];// message list struct stellar_message *dealth_letter_queue;// dlq list long long pub_packet_msg_cnt; struct session *thread_scratch_session; }; struct plugin_manager_schema { struct stellar *st; UT_array *plugin_load_specs_array; UT_array *stellar_exdata_schema_array; UT_array *stellar_mq_schema_array; UT_array *registered_packet_plugin_array; UT_array *registered_polling_plugin_array; int stellar_mq_topic_num; int mq_topic_subscriber_num; int max_message_dispatch; struct plugin_manager_per_thread_data *per_thread_data; }__attribute__((aligned(sizeof(void*)))); enum plugin_exdata_state { INIT, ACTIVE, EXIT }; struct stellar_exdata { struct plugin_manager_schema *plug_mgr; void *exdata; enum plugin_exdata_state state; }; struct stellar_exdata_schema { char *name; stellar_exdata_free *free_func; void *free_arg; int idx; }__attribute__((aligned(sizeof(void*)))); struct stellar_message { struct stellar *st; struct { int topic_id; enum stellar_mq_priority priority; } header; void *body; struct stellar_message *next, *prev; } __attribute__((aligned(sizeof(void *)))); typedef struct stellar_mq_subscriber { int topic_subscriber_idx; int plugin_idx; on_msg_cb_func *plugin_msg_cb; struct stellar_mq_subscriber *next, *prev; }stellar_mq_subscriber __attribute__((aligned(sizeof(void*)))); struct stellar_mq_topic_schema { char *topic_name; void *free_cb_arg; int topic_id; int subscriber_cnt; int is_destroyed; stellar_msg_free_cb_func *free_cb; struct stellar_mq_subscriber *subscribers; }__attribute__((aligned(sizeof(void*)))); enum packet_stage { PACKET_STAGE_INPUT=0, PACKET_STAGE_OUTPUT, PACKET_STAGE_MAX }; struct registered_packet_plugin_schema { char ip_protocol; plugin_on_packet_func *on_packet[PACKET_STAGE_MAX]; void *plugin_env; UT_array *registed_packet_mq_subscriber_info; }__attribute__((aligned(sizeof(void*)))); struct registered_polling_plugin_schema { plugin_on_polling_func *on_polling; void *plugin_env; }__attribute__((aligned(sizeof(void*)))); struct stellar_mq_subscriber_info { int topic_id; int subscriber_idx; }__attribute__((aligned(sizeof(void*)))); /******************************* * PLUGIN MANAGER INIT & EXIT * *******************************/ #define MAX_MSG_PER_DISPATCH 256 #include struct plugin_specific { char plugin_name[256]; plugin_on_load_func *load_cb; plugin_on_unload_func *unload_cb; void *plugin_ctx; }__attribute__((aligned(sizeof(void*)))); #ifdef __cplusplus } #endif