#include "session.h" #include "packet.h" #include "plugin.h" struct custom_session_event *_event = nullptr; void *custom_decode(const char *payload, uint32_t len, void **pme) { return nullptr; } int custom_plugin_entry(const struct stellar_session *s, int what, struct stellar_packet *p, const char *payload, uint32_t len, void **pme) { 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_A"); session_manager_trigger_event(new_session, SESSION_EVENT_OPENING, info); session_manager_trigger_event(new_session, SESSION_EVENT_META, info); return 0; } int custom_event_plugin_entry(const struct stellar_session *s, int what, struct stellar_packet *p, const char *payload, uint32_t len, void **pme) { return 0; } int custom_plugin_init() { plugin_session_event_register("TCP", custom_plugin_entry, nullptr); plugin_session_event_register("CUSTOM_A", custom_event_plugin_entry, nullptr); return 0; } void custom_plugin_destroy() { return ; }