Refactor(plug_mgr API): remove session_ctx, provide stellar_mq
This commit is contained in:
@@ -11,7 +11,6 @@ extern "C"
|
||||
#include "stellar/stellar_mq.h"
|
||||
#include "stellar/stellar_exdata.h"
|
||||
|
||||
#include "bitmap/bitmap.h"
|
||||
#include "uthash/utarray.h"
|
||||
|
||||
|
||||
@@ -38,18 +37,10 @@ struct plugin_manager_schema
|
||||
UT_array *plugin_load_specs_array;
|
||||
UT_array *stellar_exdata_schema_array;
|
||||
UT_array *stellar_mq_schema_array;
|
||||
UT_array *registered_session_plugin_array;
|
||||
UT_array *registered_packet_plugin_array;
|
||||
UT_array *registered_polling_plugin_array;
|
||||
int stellar_mq_topic_num;
|
||||
int packet_topic_subscriber_num;
|
||||
int session_topic_subscriber_num;
|
||||
int tcp_input_topic_id;
|
||||
int tcp_output_topic_id;
|
||||
int tcp_stream_topic_id;
|
||||
int udp_input_topic_id;
|
||||
int udp_output_topic_id;
|
||||
int control_packet_topic_id;
|
||||
int mq_topic_subscriber_num;
|
||||
int max_message_dispatch;
|
||||
struct plugin_manager_per_thread_data *per_thread_data;
|
||||
}__attribute__((aligned(sizeof(void*))));
|
||||
@@ -59,12 +50,11 @@ enum plugin_exdata_state
|
||||
|
||||
struct stellar_exdata
|
||||
{
|
||||
struct plugin_manager_schema *plug_mgr;
|
||||
void *exdata;
|
||||
enum plugin_exdata_state state;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct stellar_exdata_schema
|
||||
{
|
||||
char *name;
|
||||
@@ -75,18 +65,12 @@ struct stellar_exdata_schema
|
||||
}__attribute__((aligned(sizeof(void*))));
|
||||
|
||||
|
||||
enum stellar_topic_type
|
||||
{
|
||||
ON_SESSION_TOPIC,
|
||||
ON_PACKET_TOPIC,
|
||||
};
|
||||
|
||||
struct stellar_message
|
||||
{
|
||||
struct stellar *st;
|
||||
struct
|
||||
{
|
||||
int topic_id;
|
||||
enum stellar_topic_type type;
|
||||
enum stellar_mq_priority priority;
|
||||
} header;
|
||||
void *body;
|
||||
@@ -97,12 +81,7 @@ typedef struct stellar_mq_subscriber
|
||||
{
|
||||
int topic_subscriber_idx;
|
||||
int plugin_idx;
|
||||
union
|
||||
{
|
||||
on_session_msg_cb_func *sess_msg_cb;
|
||||
on_packet_msg_cb_func *pkt_msg_cb;
|
||||
void *msg_cb;
|
||||
};
|
||||
on_msg_cb_func *plugin_msg_cb;
|
||||
struct stellar_mq_subscriber *next, *prev;
|
||||
}stellar_mq_subscriber __attribute__((aligned(sizeof(void*))));
|
||||
|
||||
@@ -119,28 +98,6 @@ struct stellar_mq_topic_schema
|
||||
}__attribute__((aligned(sizeof(void*))));
|
||||
|
||||
|
||||
|
||||
struct session_plugin_ctx_runtime
|
||||
{
|
||||
enum plugin_exdata_state state;
|
||||
int session_plugin_id;
|
||||
void *plugin_ctx;
|
||||
}__attribute__((aligned(sizeof(void*))));
|
||||
|
||||
|
||||
|
||||
struct plugin_manager_runtime
|
||||
{
|
||||
struct plugin_manager_schema *plug_mgr;
|
||||
struct session *sess;
|
||||
struct bitmap *session_mq_status; //N * M bits, N topic, M subscriber
|
||||
struct bitmap *session_topic_status; //N bits, N topic
|
||||
struct stellar_exdata *sess_exdata_array;
|
||||
struct session_plugin_ctx_runtime *plugin_ctx_array;//N plugins TODO: call alloc and free
|
||||
int current_session_plugin_id;
|
||||
int pub_session_msg_cnt;
|
||||
}__attribute__((aligned(sizeof(void*))));
|
||||
|
||||
enum packet_stage
|
||||
{
|
||||
PACKET_STAGE_INPUT=0,
|
||||
@@ -168,19 +125,6 @@ struct stellar_mq_subscriber_info
|
||||
int subscriber_idx;
|
||||
}__attribute__((aligned(sizeof(void*))));
|
||||
|
||||
struct registered_session_plugin_schema
|
||||
{
|
||||
session_ctx_new_func *on_ctx_new;
|
||||
session_ctx_free_func *on_ctx_free;
|
||||
on_session_new_func *on_session_new;
|
||||
on_session_free_func *on_session_free;
|
||||
void *plugin_env;
|
||||
UT_array *registed_session_mq_subscriber_info;
|
||||
}__attribute__((aligned(sizeof(void*))));
|
||||
|
||||
#define SESSION_PULGIN_ID_BASE 0x00000
|
||||
#define PACKET_PULGIN_ID_BASE 0x10000
|
||||
#define POLLING_PULGIN_ID_BASE 0x20000
|
||||
|
||||
/*******************************
|
||||
* PLUGIN MANAGER INIT & EXIT *
|
||||
|
||||
Reference in New Issue
Block a user