This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar-2022/sdk/include/plugin.h
luwenpeng 9df6bf07af Modify the implementation of the plugin manager take over
A plugin that is taken over, if the plugin was called before being taken over
    and has a registered SESSION_EVENT_CLOSING event,
    it will be called again when the SESSION_EVENT_CLOSING event comes.
    Otherwise, the plugin will not be called.
2022-08-10 10:19:22 +08:00

44 lines
1.6 KiB
C

#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);
/******************************************************************************
* Public API For Plugin
******************************************************************************/
/*
* The pm_session_dettach_me just sets the flag to disable this plugin and no longer call this event callback.
* Before calling pm_session_dettach_me, the current plugin must release related resources for the current session.
*/
void pm_session_dettach_me(const struct stellar_session *session);
/*
* The current plugin(cb2) takes over the current session, the pm_session_take_over setting flag disables other plugins,
* and the current session does not call other plugins except for the SESSION_EVENT_CLOSING event.
*
* +-----+ +-----+ +-----+ +-----+
* Plugin runtime callback list: | cb1 |-->| cb2 |-->| cb3 |-->| cb4 |
* +-----+ +-----+ +-----+ +-----+
* /|\
* |
* plugin cb2 run pm_session_take_over
*
* A plugin(cb1/cb3/cb4) that is taken over, if the plugin was called before being taken over and has a registered SESSION_EVENT_CLOSING event,
* it will be called again when the SESSION_EVENT_CLOSING event comes. Otherwise, the plugin will not be called.
*/
void pm_session_take_over(const struct stellar_session *session);
#ifdef __cpluscplus
}
#endif
#endif