mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
Continue plugin API definition
This commit is contained in:
@ -38,7 +38,8 @@ AC_CONFIG_FILES([src/Makefile \
|
||||
src/config/Makefile \
|
||||
src/dbus/Makefile \
|
||||
src/zeroconf/Makefile \
|
||||
src/plug-in/Makefile])
|
||||
src/plug-in/Makefile \
|
||||
src/plug-in/test/Makefile])
|
||||
|
||||
dnl Unitary test section
|
||||
AC_CONFIG_FILES([test/Makefile])
|
||||
|
@ -2,7 +2,8 @@ include ../../globals.mak
|
||||
|
||||
noinst_LTLIBRARIES = libplugin.la
|
||||
|
||||
libplugin_la_SOURCES = \
|
||||
pluginmanager.cpp \
|
||||
plugin.h
|
||||
noinst_HEADERS=plugin_api.h
|
||||
|
||||
libplugin_la_SOURCES = \
|
||||
pluginmanager.cpp
|
||||
|
||||
|
65
src/plug-in/plugin_api.h
Normal file
65
src/plug-in/plugin_api.h
Normal file
@ -0,0 +1,65 @@
|
||||
#ifndef PLUGIN_API_H
|
||||
#define PLUGIN_API_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/*
|
||||
* @file plugin_api.h
|
||||
* @brief Define a plugin object
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
namespace sflphone {
|
||||
|
||||
class PluginManager;
|
||||
|
||||
typedef struct PluginApi_Version{
|
||||
int version;
|
||||
int revision;
|
||||
}
|
||||
|
||||
typedef struct Register_Params{
|
||||
PluginApi_Version plugin_version;
|
||||
create_t create_func;
|
||||
destroy_t destroy_func;
|
||||
}Register_Params;
|
||||
|
||||
class PluginApi {
|
||||
|
||||
public:
|
||||
PluginApi( const std::string &name );
|
||||
//Plugin( const Plugin &plugin );
|
||||
virtual ~PluginApi() {}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Return the minimal core version required so that the plugin could work
|
||||
* @return int The version required
|
||||
*/
|
||||
virtual int getCoreVersion() const = 0;
|
||||
|
||||
/**
|
||||
* Register the plugin to the plugin manager
|
||||
*/
|
||||
virtual void registerPlugin( PluginManager & ) = 0;
|
||||
|
||||
private:
|
||||
PluginApi &operator =(const PluginApi &plugin);
|
||||
|
||||
};
|
||||
|
||||
typedef Plugin* create_t( void* );
|
||||
typedef int destroy_t( Plugin* );
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //PLUGIN_API_H
|
||||
|
21
src/plug-in/test/Makefile.am
Normal file
21
src/plug-in/test/Makefile.am
Normal file
@ -0,0 +1,21 @@
|
||||
include $(top_srcdir)/globals.mak
|
||||
|
||||
PLUGIN_LIB = libplugintest.so
|
||||
libplugintest_so_SOURCES = pluginTest.cpp
|
||||
libplugintest_so_CXXFLAGS = -fPIC -g -Wall
|
||||
libplugintest_so_LDFLAGS = --shared -lc
|
||||
INSTALL_PLUGIN_RULE = install-libplugintest_so
|
||||
|
||||
noinst_PROGRAMS = libplugintest.so
|
||||
|
||||
noinst_HEADERS = plugin_api.h
|
||||
|
||||
install-exec-local: install-libplugintest_so
|
||||
uninstall-local: uninstall-libplugintest_so
|
||||
|
||||
install-libplugintest_so: libplugintest.so
|
||||
mkdir -p $(sflpluginsdir)
|
||||
$(INSTALL_PROGRAM) libplugintest.so $(sflpluginsdir)
|
||||
|
||||
uninstall-libplugintest_so:
|
||||
rm -f $(sflpluginsdir)/libplugintest.so
|
15
src/plug-in/test/pluginTest.cpp
Normal file
15
src/plug-in/test/pluginTest.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "../plugin_api.h"
|
||||
|
||||
class PluginTest : public Plugin {
|
||||
public:
|
||||
PluginTest():Plugin(){
|
||||
}
|
||||
};
|
||||
|
||||
extern "C" Plugin* create_t( void * ){
|
||||
return new PluginTest();
|
||||
}
|
||||
|
||||
extern "C" void* destroy_t( Plugin *p ){
|
||||
delete p;
|
||||
}
|
Reference in New Issue
Block a user