[Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_plugin.c,1.2,1.3
Bernd Petrovitsch
(spam-protected)
Sun Jul 15 19:41:35 CEST 2007
Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27139/lib/txtinfo/src
Modified Files:
olsrd_plugin.c
Log Message:
* use the correct plugin interface version number
Index: olsrd_plugin.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_plugin.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** olsrd_plugin.c 20 Apr 2007 13:46:04 -0000 1.2
--- olsrd_plugin.c 15 Jul 2007 17:41:33 -0000 1.3
***************
*** 54,57 ****
--- 54,58 ----
#include "olsrd_plugin.h"
#include "olsrd_txtinfo.h"
+ #include "defs.h"
***************
*** 60,142 ****
#define PLUGIN_AUTHOR "Lorenz Schori"
#define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR
! #define PLUGIN_INTERFACE_VERSION 4
! struct in_addr ipc_accept_ip;
int ipc_port;
int nompr;
!
! static void __attribute__ ((constructor))
! my_init(void);
!
! static void __attribute__ ((destructor))
! my_fini(void);
!
/**
*Constructor
*/
! static void
! my_init(void)
{
! /* Print plugin info to stdout */
! printf("%s\n", MOD_DESC);
! /* defaults for parameters */
! ipc_port = 2006;
! ipc_accept_ip.s_addr = htonl(INADDR_LOOPBACK);
! /* highlite neighbours by default */
! nompr = 0;
}
-
/**
*Destructor
*/
! static void
! my_fini(void)
{
! /* Calls the destruction function
! * olsr_plugin_exit()
! * This function should be present in your
! * sourcefile and all data destruction
! * should happen there - NOT HERE!
! */
! olsr_plugin_exit();
}
! int
! olsrd_plugin_interface_version(void)
{
! return PLUGIN_INTERFACE_VERSION;
}
! int
! olsrd_plugin_register_param(char *key, char *value)
{
! if(!strcmp(key, "port"))
! {
! ipc_port = atoi(value);
! printf("(TXTINFO) listening on port: %d\n", ipc_port);
! }
- if(!strcmp(key, "accept"))
- {
- inet_aton(value, &ipc_accept_ip);
- printf("(TXTINFO) accept only: %s\n", inet_ntoa(ipc_accept_ip));
- }
/*
! if(!strcmp(key, "hilitemprneighbours"))
! {
! if(!strcmp(value, "false") || !strcmp(value, "0"))
! {
! nompr=1;
! }
! }
! */
! return 1;
! }
--- 61,131 ----
#define PLUGIN_AUTHOR "Lorenz Schori"
#define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR
! #define PLUGIN_INTERFACE_VERSION 5
! union olsr_ip_addr ipc_accept_ip;
int ipc_port;
int nompr;
! static void my_init(void) __attribute__ ((constructor));
! static void my_fini(void) __attribute__ ((destructor));
/**
*Constructor
*/
! static void my_init(void)
{
! /* Print plugin info to stdout */
! printf("%s\n", MOD_DESC);
! /* defaults for parameters */
! ipc_port = 2006;
! if (olsr_cnf->ip_version == AF_INET) {
! ipc_accept_ip.v4 = htonl(INADDR_LOOPBACK);
! } else {
! ipc_accept_ip.v6 = in6addr_loopback;
! }
! /* highlite neighbours by default */
! nompr = 0;
}
/**
*Destructor
*/
! static void my_fini(void)
{
! /* Calls the destruction function
! * olsr_plugin_exit()
! * This function should be present in your
! * sourcefile and all data destruction
! * should happen there - NOT HERE!
! */
! olsr_plugin_exit();
}
! int olsrd_plugin_interface_version(void)
{
! return PLUGIN_INTERFACE_VERSION;
}
+ static const struct olsrd_plugin_parameters plugin_parameters[] = {
+ { .name = "port", .set_plugin_parameter = &set_plugin_port, .data = &ipc_port },
+ { .name = "accept", .set_plugin_parameter = &set_plugin_ipaddress, .data = &ipc_accept_ip },
+ };
! void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size)
{
! *params = plugin_parameters;
! *size = sizeof(plugin_parameters)/sizeof(*plugin_parameters);
! }
/*
! * Local Variables:
! * mode: c
! * style: linux
! * c-basic-offset: 4
! * indent-tabs-mode: nil
! * End:
! */
More information about the Olsr-cvs
mailing list