Plugin management support pm_session_dettach_me and pm_session_dettach_others

Add test cases for pm_session_dettach_me and pm_session_dettach_others
This commit is contained in:
luwenpeng
2022-08-03 19:46:43 +08:00
parent 50111e7cd0
commit 5c790085eb
26 changed files with 1348 additions and 382 deletions

View File

@@ -2,4 +2,5 @@
#include "session.h"
void http_decoder(const struct stellar_session *s, enum session_event_type event, struct stellar_packet *p, const char *payload, uint16_t len, void **pme);
void http_decoder(const struct stellar_session *s, enum session_event_type event, struct stellar_packet *p, const char *payload, uint16_t len, void **pme);
void http_error_cb(const struct stellar_session *s, enum error_event_type event, void **pme);

View File

@@ -1,15 +1,25 @@
#pragma once
#ifndef _PLUGIN_H
#define _PLUGIN_H
#ifdef __cpluscplus
extern "C"
{
#endif
#include "session.h"
typedef int plugin_init_callback(void);
typedef void plugin_exit_callback(void);
void plugin_remove_from_session_event(struct stellar_event *ev, struct stellar_session *s);
/******************************************************************************
* Public API: between plugin and plugin_manager
* Public API For Plugin
******************************************************************************/
// TODO
// TODO
void pm_session_dettach_me(const struct stellar_session *session);
void pm_session_dettach_others(const struct stellar_session *session);
#ifdef __cpluscplus
}
#endif
#endif

View File

@@ -1,4 +1,10 @@
#pragma once
#ifndef _SESSION_H
#define _SESSION_H
#ifdef __cpluscplus
extern "C"
{
#endif
#include "packet.h"
#include "event.h"
@@ -34,9 +40,23 @@ enum session_event_type
SESSION_EVENT_ALL = (0x01 << 1 | 0x01 << 2 | 0x01 << 3 | 0x01 << 4 | 0x01 << 5),
};
enum error_event_type
{
ERROR_EVENT_DETTACH = (0x1 << 10),
};
struct stellar_session_event_extras;
typedef void(fn_session_error_callback)(const struct stellar_session *s, enum error_event_type event, void **pme);
typedef void(fn_session_event_callback)(const struct stellar_session *s, enum session_event_type event, struct stellar_packet *p, const char *payload, uint16_t len, void **pme);
void session_manager_trigger_event(struct stellar_session *s, enum session_event_type type, struct stellar_session_event_extras *info);
struct stellar_session *session_manager_session_derive(const struct stellar_session *this_session, const char *session_name);
struct stellar_session *session_manager_session_derive(const struct stellar_session *this_session, const char *session_name);
const char *stellar_session_get_name(const struct stellar_session *session);
#ifdef __cpluscplus
}
#endif
#endif