✨ feat(plugin manager api): packet plugin register with stage
This commit is contained in:
@@ -202,7 +202,7 @@ TEST(plugin_manager_init, packet_mq_subscribe) {
|
||||
EXPECT_EQ(stellar_packet_mq_subscribe(&st, topic_id, test_mock_on_packet_msg, 10+PACKET_PULGIN_ID_BASE),-1);//illgeal plugin_id
|
||||
EXPECT_EQ(stellar_packet_mq_subscribe(&st, 10, test_mock_on_packet_msg, 10+PACKET_PULGIN_ID_BASE),-1);//illgeal topic_id & plugin_id
|
||||
|
||||
int plugin_id=stellar_packet_plugin_register(&st, 6, NULL, &st);
|
||||
int plugin_id=stellar_packet_plugin_register(&st, 6, NULL, NULL,&st);
|
||||
EXPECT_GE(plugin_id, PACKET_PULGIN_ID_BASE);
|
||||
|
||||
EXPECT_EQ(stellar_packet_mq_subscribe(&st, topic_id, test_mock_on_packet_msg, plugin_id),0);
|
||||
@@ -271,7 +271,7 @@ TEST(plugin_manager, packet_plugin_illegal_exdata) {
|
||||
struct packet_plugin_env env;
|
||||
memset(&env, 0, sizeof(struct packet_plugin_env));
|
||||
env.plug_mgr=plug_mgr;
|
||||
int plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_basic_on_packet, &env);
|
||||
int plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_basic_on_packet, NULL,&env);
|
||||
EXPECT_GE(plugin_id, PACKET_PULGIN_ID_BASE);
|
||||
|
||||
{
|
||||
@@ -314,7 +314,7 @@ TEST(plugin_manager, packet_plugins_with_proto_filter) {
|
||||
int proto_filter_plugin_num=(int)(sizeof(env.proto_filter_plugin_id) / sizeof(env.proto_filter_plugin_id[0]));
|
||||
for (int i = 0; i < proto_filter_plugin_num; i++)
|
||||
{
|
||||
env.proto_filter_plugin_id[i] = stellar_packet_plugin_register(&st, i, test_proto_filter_on_packet, &env);
|
||||
env.proto_filter_plugin_id[i] = stellar_packet_plugin_register(&st, i, test_proto_filter_on_packet, NULL,&env);
|
||||
EXPECT_GE(env.proto_filter_plugin_id[i], PACKET_PULGIN_ID_BASE);
|
||||
|
||||
|
||||
@@ -442,10 +442,10 @@ TEST(plugin_manager, packet_plugins_share_exdata) {
|
||||
EXPECT_EQ(utarray_len(plug_mgr->stellar_exdata_schema_array), exdata_idx_len);
|
||||
}
|
||||
|
||||
int exdata_set_plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_exdata_set_on_packet, &env);
|
||||
int exdata_set_plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_exdata_set_on_packet, NULL,&env);
|
||||
EXPECT_GE(exdata_set_plugin_id, PACKET_PULGIN_ID_BASE);
|
||||
|
||||
int exdata_get_plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_exdata_get_on_packet, &env);
|
||||
int exdata_get_plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_exdata_get_on_packet, NULL,&env);
|
||||
EXPECT_GE(exdata_get_plugin_id, PACKET_PULGIN_ID_BASE);
|
||||
|
||||
{
|
||||
@@ -539,14 +539,14 @@ TEST(plugin_manager, packet_plugins_mq_pub_sub) {
|
||||
EXPECT_EQ(utarray_len(plug_mgr->stellar_mq_schema_array), topic_id_num+STELLAR_INTRINSIC_TOPIC_NUM);
|
||||
}
|
||||
|
||||
int pub_plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_mq_pub_on_packet, &env);
|
||||
int pub_plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_mq_pub_on_packet, NULL,&env);
|
||||
EXPECT_GE(pub_plugin_id, PACKET_PULGIN_ID_BASE);
|
||||
|
||||
int topic_sub_num=(int)(sizeof(env.packet_mq_sub_plugin_id) / sizeof(env.packet_mq_sub_plugin_id[0]));
|
||||
|
||||
for (int i = 0; i < topic_sub_num; i++)
|
||||
{
|
||||
env.packet_mq_sub_plugin_id[i] = stellar_packet_plugin_register(&st, ip_proto, NULL, &env);// empty on_packet is ok
|
||||
env.packet_mq_sub_plugin_id[i] = stellar_packet_plugin_register(&st, ip_proto, NULL, NULL,&env);// empty on_packet is ok
|
||||
EXPECT_GE(env.packet_mq_sub_plugin_id[i], PACKET_PULGIN_ID_BASE);
|
||||
for(int j = 0; j < topic_id_num; j++)
|
||||
{
|
||||
@@ -658,14 +658,14 @@ TEST(plugin_manager, packet_plugins_pub_overlimit) {
|
||||
EXPECT_EQ(utarray_len(plug_mgr->stellar_mq_schema_array), topic_id_num+STELLAR_INTRINSIC_TOPIC_NUM);
|
||||
}
|
||||
|
||||
int pub_plugin_id=stellar_packet_plugin_register(&st, ip_proto, overlimit_pub_on_packet, &env);
|
||||
int pub_plugin_id=stellar_packet_plugin_register(&st, ip_proto, overlimit_pub_on_packet, NULL,&env);
|
||||
EXPECT_GE(pub_plugin_id, PACKET_PULGIN_ID_BASE);
|
||||
|
||||
int topic_sub_num=(int)(sizeof(env.packet_mq_sub_plugin_id) / sizeof(env.packet_mq_sub_plugin_id[0]));
|
||||
|
||||
for (int i = 0; i < topic_sub_num; i++)
|
||||
{
|
||||
env.packet_mq_sub_plugin_id[i] = stellar_packet_plugin_register(&st, ip_proto, NULL, &env);// empty on_packet is ok
|
||||
env.packet_mq_sub_plugin_id[i] = stellar_packet_plugin_register(&st, ip_proto, NULL, NULL, &env);// empty on_packet is ok
|
||||
EXPECT_GE(env.packet_mq_sub_plugin_id[i], PACKET_PULGIN_ID_BASE);
|
||||
for(int j = 0; j < topic_id_num; j++)
|
||||
{
|
||||
@@ -741,7 +741,7 @@ TEST(plugin_manager, packet_plugin_exdata_free_pub_msg) {
|
||||
struct packet_plugin_env env;
|
||||
memset(&env, 0, sizeof(struct packet_plugin_env));
|
||||
env.plug_mgr=plug_mgr;
|
||||
int plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_exdata_free_pub_msg_on_packet, &env);
|
||||
int plugin_id=stellar_packet_plugin_register(&st, ip_proto, test_exdata_free_pub_msg_on_packet, NULL,&env);
|
||||
EXPECT_GE(plugin_id, PACKET_PULGIN_ID_BASE);
|
||||
|
||||
env.packet_exdata_idx[0]=stellar_exdata_new_index(&st, "PACKET_EXDATA", test_exdata_free_pub_msg_exdata_free, &env);
|
||||
|
||||
Reference in New Issue
Block a user