add deps directory
update inner include headers
This commit is contained in:
35
sdk/example/custom_event_plugin.cpp
Normal file
35
sdk/example/custom_event_plugin.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#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 session *s, int what, struct packet *p, const char *payload, uint32_t len, void **pme)
|
||||
{
|
||||
void *info= custom_decode(payload, len, pme);
|
||||
struct session *new_session=session_manager_custom_session_derive(s, _event);
|
||||
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 session *s, int what, struct packet *p, const char *payload, uint32_t len, void **pme)
|
||||
{
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int custom_plugin_init()
|
||||
{
|
||||
_event = session_manager_custom_session_event_register("SESSION_TYPE_CUSTOM", (int)(SESSION_EVENT_OPENING|SESSION_EVENT_RAW_PKT|SESSION_EVENT_META|SESSION_EVENT_CLOSING));
|
||||
plugin_session_event_register(SESSION_TYPE_TCP, custom_plugin_entry, nullptr);
|
||||
|
||||
plugin_custom_session_event_register("SESSION_TYPE_CUSTOM", custom_event_plugin_entry, nullptr);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user