[Olsr-cvs] olsrd-current/lib/tas/src http.c, 1.5, 1.6 http.h, 1.1, 1.2 plugin.c, 1.8, 1.9

Bernd Petrovitsch (spam-protected)
Mon Sep 3 00:17:03 CEST 2007


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

Modified Files:
	http.c http.h plugin.c 
Log Message:
* converted TAS plugin interface to version 5. Untested since I have not test cases. But it looks pretty obvious

Index: http.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** http.h	12 Apr 2005 17:17:26 -0000	1.1
--- http.h	2 Sep 2007 22:17:00 -0000	1.2
***************
*** 118,133 ****
  extern void httpInit(void);
  
! extern int httpSetAddress(const char *addrStr);
! extern int httpSetPort(const char *portStr);
! extern int httpSetRootDir(const char *rootDir);
! extern int httpSetWorkDir(const char *workDir);
! extern void httpSetIndexFile(const char *indexFile);
! extern void httpSetUser(const char *user);
! extern void httpSetPassword(const char *password);
! extern int httpSetSessTime(const char *timeStr);
! extern void httpSetPubDir(const char *pref);
! extern int httpSetQuantum(const char *quantumStr);
! extern int httpSetMessTime(const char *timeStr);
! extern int httpSetMessLimit(const char *limitStr);
  
  extern int httpSetup(void);
--- 118,133 ----
  extern void httpInit(void);
  
! extern int httpSetAddress(const char *addrStr, void *data, unsigned int addon);
! extern int httpSetPort(const char *portStr, void *data, unsigned int addon);
! extern int httpSetRootDir(const char *rootDir, void *data, unsigned int addon);
! extern int httpSetWorkDir(const char *workDir, void *data, unsigned int addon);
! extern int httpSetIndexFile(const char *indexFile, void *data, unsigned int addon);
! extern int httpSetUser(const char *user, void *data, unsigned int addon);
! extern int httpSetPassword(const char *password, void *data, unsigned int addon);
! extern int httpSetSessTime(const char *timeStr, void *data, unsigned int addon);
! extern int httpSetPubDir(const char *pref, void *data, unsigned int addon);
! extern int httpSetQuantum(const char *quantumStr, void *data, unsigned int addon);
! extern int httpSetMessTime(const char *timeStr, void *data, unsigned int addon);
! extern int httpSetMessLimit(const char *limitStr, void *data, unsigned int addon);
  
  extern int httpSetup(void);

Index: plugin.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/plugin.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** plugin.c	20 Apr 2007 13:46:03 -0000	1.8
--- plugin.c	2 Sep 2007 22:17:00 -0000	1.9
***************
*** 51,54 ****
--- 51,55 ----
  #include "glua.h"
  #include "glua_ext.h"
+ #include "olsrd_plugin.h"
  
  #include <defs.h>
***************
*** 68,71 ****
--- 69,74 ----
  #include <duplicate_set.h>
  
+ #define PLUGIN_INTERFACE_VERSION 5
+ 
  #define MESSAGE_TYPE 129
  
***************
*** 463,467 ****
  int olsrd_plugin_interface_version(void)
  {
!   return 4;
  }
  
--- 466,470 ----
  int olsrd_plugin_interface_version(void)
  {
!   return PLUGIN_INTERFACE_VERSION;
  }
  
***************
*** 487,580 ****
  }
  
! int olsrd_plugin_register_param(char *name, char *value)
! {
!   if (strcmp(name, "address") == 0)
!   {
!     if (httpSetAddress(value) < 0)
!       return 0;
! 
!     return 1;
!   }
! 
!   if (strcmp(name, "port") == 0)
!   {
!     if (httpSetPort(value) < 0)
!       return 0;
! 
!     return 1;
!   }
! 
!   if (strcmp(name, "rootdir") == 0)
!   {
!     if (httpSetRootDir(value) < 0)
!       return 0;
! 
!     return 1;
!   }
! 
!   if (strcmp(name, "workdir") == 0)
!   {
!     if (httpSetWorkDir(value) < 0)
!       return 0;
! 
!     return 1;
!   }
! 
!   if (strcmp(name, "indexfile") == 0)
!   {
!     httpSetIndexFile(value);
!     return 1;
!   }
! 
!   if (strcmp(name, "user") == 0)
!   {
!     httpSetUser(value);
!     return 1;
!   }
! 
!   if (strcmp(name, "password") == 0)
!   {
!     httpSetPassword(value);
!     return 1;
!   }
! 
!   if (strcmp(name, "sesstime") == 0)
!   {
!     if (httpSetSessTime(value) < 0)
!       return 0;
! 
!     return 1;
!   }
! 
!   if (strcmp(name, "pubdir") == 0)
!   {
!     httpSetPubDir(value);
!     return 1;
!   }
! 
!   if (strcmp(name, "quantum") == 0)
!   {
!     if (httpSetQuantum(value) < 0)
!       return 0;
! 
!     return 1;
!   }
! 
!   if (strcmp(name, "messtime") == 0)
!   {
!     if (httpSetMessTime(value) < 0)
!       return 0;
! 
!     return 1;
!   }
! 
!   if (strcmp(name, "messlimit") == 0)
!   {
!     if (httpSetMessLimit(value) < 0)
!       return 0;
! 
!     return 1;
!   }
  
!   return 0;
  }
--- 490,511 ----
  }
  
! static const struct olsrd_plugin_parameters plugin_parameters[] = {
!     { .name = "address",   .set_plugin_parameter = &httpSetAddress,   .data = NULL },
!     { .name = "port",      .set_plugin_parameter = &httpSetPort,      .data = NULL },
!     { .name = "rootdir",   .set_plugin_parameter = &httpSetRootDir,   .data = NULL },
!     { .name = "workdir",   .set_plugin_parameter = &httpSetWorkDir,   .data = NULL },
!     { .name = "indexfile", .set_plugin_parameter = &httpSetIndexFile, .data = NULL },
!     { .name = "user",      .set_plugin_parameter = &httpSetUser,      .data = NULL },
!     { .name = "password",  .set_plugin_parameter = &httpSetPassword,  .data = NULL },
!     { .name = "sesstime",  .set_plugin_parameter = &httpSetSessTime,  .data = NULL },
!     { .name = "pubdir",    .set_plugin_parameter = &httpSetPubDir,    .data = NULL },
!     { .name = "quantum",   .set_plugin_parameter = &httpSetQuantum,   .data = NULL },
!     { .name = "messtime",  .set_plugin_parameter = &httpSetMessTime,  .data = NULL },
!     { .name = "messlimit", .set_plugin_parameter = &httpSetMessLimit, .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);
  }

Index: http.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** http.c	10 Nov 2005 19:50:42 -0000	1.5
--- http.c	2 Sep 2007 22:17:00 -0000	1.6
***************
*** 448,452 ****
  }
  
! int httpSetAddress(const char *addrStr)
  {
    if (parseIpAddr(&confAddr, addrStr) < 0)
--- 448,452 ----
  }
  
! int httpSetAddress(const char *addrStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    if (parseIpAddr(&confAddr, addrStr) < 0)
***************
*** 459,463 ****
  }
  
! int httpSetPort(const char *portStr)
  {
    unsigned int port;
--- 459,463 ----
  }
  
! int httpSetPort(const char *portStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    unsigned int port;
***************
*** 480,484 ****
  }
  
! int httpSetRootDir(const char *rootDir)
  {
    if (checkAbsPath(rootDir) < 0)
--- 480,484 ----
  }
  
! int httpSetRootDir(const char *rootDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    if (checkAbsPath(rootDir) < 0)
***************
*** 492,496 ****
  }
  
! int httpSetWorkDir(const char *workDir)
  {
    if (checkAbsPath(workDir) < 0)
--- 492,496 ----
  }
  
! int httpSetWorkDir(const char *workDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    if (checkAbsPath(workDir) < 0)
***************
*** 504,523 ****
  }
  
! void httpSetIndexFile(const char *indexFile)
  {
    confIndexFile = myStrdup(indexFile);
  }
  
! void httpSetUser(const char *user)
  {
    confUser = myStrdup(user);
  }
  
! void httpSetPassword(const char *password)
  {
    confPassword = myStrdup(password);
  }
  
! int httpSetSessTime(const char *timeStr)
  {
    unsigned int time;
--- 504,526 ----
  }
  
! int httpSetIndexFile(const char *indexFile, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    confIndexFile = myStrdup(indexFile);
+   return 0;
  }
  
! int httpSetUser(const char *user, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    confUser = myStrdup(user);
+   return 0;
  }
  
! int httpSetPassword(const char *password, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    confPassword = myStrdup(password);
+   return 0;
  }
  
! int httpSetSessTime(const char *timeStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    unsigned int time;
***************
*** 540,549 ****
  }
  
! void httpSetPubDir(const char *pubDir)
  {
    confPubDir = myStrdup(pubDir);
  }
  
! int httpSetQuantum(const char *quantumStr)
  {
    unsigned int quantum;
--- 543,553 ----
  }
  
! int httpSetPubDir(const char *pubDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    confPubDir = myStrdup(pubDir);
+   return 0;
  }
  
! int httpSetQuantum(const char *quantumStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    unsigned int quantum;
***************
*** 566,570 ****
  }
  
! int httpSetMessTime(const char *timeStr)
  {
    unsigned int time;
--- 570,574 ----
  }
  
! int httpSetMessTime(const char *timeStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    unsigned int time;
***************
*** 587,591 ****
  }
  
! int httpSetMessLimit(const char *limitStr)
  {
    unsigned int limit;
--- 591,595 ----
  }
  
! int httpSetMessLimit(const char *limitStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused)))
  {
    unsigned int limit;





More information about the Olsr-cvs mailing list