Skip to content
Snippets Groups Projects
Commit d91dfd6d authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Continue plugin API definition

parent 6cfa328d
Branches
Tags
No related merge requests found
...@@ -38,7 +38,8 @@ AC_CONFIG_FILES([src/Makefile \ ...@@ -38,7 +38,8 @@ AC_CONFIG_FILES([src/Makefile \
src/config/Makefile \ src/config/Makefile \
src/dbus/Makefile \ src/dbus/Makefile \
src/zeroconf/Makefile \ src/zeroconf/Makefile \
src/plug-in/Makefile]) src/plug-in/Makefile \
src/plug-in/test/Makefile])
dnl Unitary test section dnl Unitary test section
AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([test/Makefile])
......
...@@ -2,7 +2,8 @@ include ../../globals.mak ...@@ -2,7 +2,8 @@ include ../../globals.mak
noinst_LTLIBRARIES = libplugin.la noinst_LTLIBRARIES = libplugin.la
noinst_HEADERS=plugin_api.h
libplugin_la_SOURCES = \ libplugin_la_SOURCES = \
pluginmanager.cpp \ pluginmanager.cpp
plugin.h
#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
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
#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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment