#include "session.h" #include "packet.h" #include "plugin.h" #include #include #include static char *g_handler = NULL; static void *custom_decode(const char *payload, uint16_t len, void **pme) { return NULL; } extern "C" void custom_plugin_tcp_entry(const struct stellar_session *s, enum session_event_type event, struct stellar_packet *p, const char *payload, uint16_t len, void **pme) { char **per_session_pme = (char **)pme; printf("RUN custom_plugin_tcp_entry, event: %d\n", event); struct stellar_session_event_extras *info = (struct stellar_session_event_extras *)custom_decode(payload, len, pme); struct stellar_session *new_session = session_manager_session_derive(s, "CUSTOM"); session_manager_trigger_event(new_session, SESSION_EVENT_OPENING, info); session_manager_trigger_event(new_session, SESSION_EVENT_META, info); } extern "C" void custom_plugin_custom_entry(const struct stellar_session *s, enum session_event_type event, struct stellar_packet *p, const char *payload, uint16_t len, void **pme) { char **per_session_pme = (char **)pme; printf("RUN custom_plugin_custom_entry, event: %d\n", event); } extern "C" int custom_plugin_init(void) { printf("RUN custom_plugin_init\n"); if (g_handler == NULL) { g_handler = (char *)malloc(1024); snprintf(g_handler, 1024, "222222"); } return 0; } extern "C" void custom_plugin_exit(void) { printf("RUN custom_plugin_exit\n"); if (g_handler) { free(g_handler); g_handler = NULL; } }