[Olsr-cvs] olsrd-current/lib/mini/src olsrd_plugin.c, 1.3, 1.4 olsrd_plugin.h, 1.3, 1.4

Bernd Petrovitsch (spam-protected)
Sun Sep 2 23:37:51 CEST 2007


Update of /cvsroot/olsrd/olsrd-current/lib/mini/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14201/lib/mini/src

Modified Files:
	olsrd_plugin.c olsrd_plugin.h 
Log Message:
* converted it to plugin interface version 5. It doesn't make much sense to leave version 1 there

Index: olsrd_plugin.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/src/olsrd_plugin.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** olsrd_plugin.h	20 Apr 2007 14:18:56 -0000	1.3
--- olsrd_plugin.h	2 Sep 2007 21:37:49 -0000	1.4
***************
*** 47,53 ****
  olsrd_plugin_init(void);
  
- int
- olsrd_plugin_register_param(char *, char *);
- 
  int 
  olsrd_plugin_interface_version(void);
--- 47,50 ----

Index: olsrd_plugin.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/src/olsrd_plugin.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** olsrd_plugin.c	20 Apr 2007 13:46:02 -0000	1.3
--- olsrd_plugin.c	2 Sep 2007 21:37:49 -0000	1.4
***************
*** 41,48 ****
  #include <string.h>
  
  #include "olsrd_plugin.h"
  #include "olsr.h"
  
! #define PLUGIN_INTERFACE_VERSION 1
  
  
--- 41,50 ----
  #include <string.h>
  
+ #include "../../../src/olsrd_plugin.h"
+ 
  #include "olsrd_plugin.h"
  #include "olsr.h"
  
! #define PLUGIN_INTERFACE_VERSION 5
  
  
***************
*** 55,77 ****
   * Used by main olsrd to check plugin interface version
   */
! int 
! olsrd_plugin_interface_version(void)
  {
! 	return PLUGIN_INTERFACE_VERSION;
  }
  
  
  /**
   * Register parameters from config file
   * Called for all plugin parameters
   */
! int
! olsrd_plugin_register_param(char *key, char *value)
  {
! 	if(!strcmp(key, "test")) {
! 		printf("\n*** MINI: parameter test: %s\n", value);
! 		return 1;
! 	}
! 	return 0;
  }
  
--- 57,84 ----
   * Used by main olsrd to check plugin interface version
   */
! int olsrd_plugin_interface_version(void)
  {
!     return PLUGIN_INTERFACE_VERSION;
  }
  
  
+ static int set_plugin_test(const char *value, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
+ {
+     printf("\n*** MINI: parameter test: %s\n", value);
+     return 0;
+ }
+ 
  /**
   * Register parameters from config file
   * Called for all plugin parameters
   */
! static const struct olsrd_plugin_parameters plugin_parameters[] = {
!     { .name = "test",   .set_plugin_parameter = &set_plugin_test,      .data = NULL },
! };
! 
! void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size)
  {
!     *params = plugin_parameters;
!     *size = sizeof(plugin_parameters)/sizeof(*plugin_parameters);
  }
  
***************
*** 99,107 ****
  /* attention: make static to avoid name clashes */
  
! static void __attribute__ ((constructor)) 
! my_init(void);
! 
! static void __attribute__ ((destructor)) 
! my_fini(void);
  
  
--- 106,111 ----
  /* attention: make static to avoid name clashes */
  
! static void my_init(void) __attribute__ ((constructor));
! static void my_fini(void) __attribute__ ((destructor));
  
  
***************
*** 109,116 ****
   * Optional Private Constructor
   */
! static void
! my_init(void)
  {
! 	printf("*** MINI: constructor\n");
  }
  
--- 113,119 ----
   * Optional Private Constructor
   */
! static void my_init(void)
  {
!     printf("*** MINI: constructor\n");
  }
  
***************
*** 119,125 ****
   * Optional Private Destructor
   */
! static void
! my_fini(void)
  {
! 	printf("*** MINI: destructor\n");
  }
--- 122,127 ----
   * Optional Private Destructor
   */
! static void my_fini(void)
  {
!     printf("*** MINI: destructor\n");
  }





More information about the Olsr-cvs mailing list