myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-46-g


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-46-g01bfeea
Date: Wed, 24 Feb 2010 16:57:25 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  01bfeea1ba67b0fb12599c7a8006416c3e8b8858 (commit)
       via  66ea79c469ec99d751ceddcdaa31992b4b55e544 (commit)
       via  bf996fa6a7272272c36a4d1b00c1ffc33c80c5de (commit)
       via  00b0c5fe2065a63172ac1105f93076c6e9f8d1c6 (commit)
       via  9c95db4929b7f577ad91d9e49ab85584ecd03795 (commit)
       via  f7c3602b68c03c219a63689f73f43207a9633f1d (commit)
      from  26881c43ea7825c70b4d4fc63fe52bcdd1d7c20a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 01bfeea1ba67b0fb12599c7a8006416c3e8b8858
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 17:55:06 2010 +0100

    Add plugin `guile_conf'.

diff --git a/plugins/src/guile/guile.cpp b/plugins/src/guile/guile.cpp
index 4d3d707..a2b03ea 100644
--- a/plugins/src/guile/guile.cpp
+++ b/plugins/src/guile/guile.cpp
@@ -22,16 +22,14 @@
 
 PLUGIN_NAME ("guile");
 
-EXPORTABLE(int) eval (char *const string)
+EXPORTABLE(SCM) eval (char *const string)
 {
-  scm_c_eval_string (string);
-  return 0;
+  return scm_c_eval_string (string);
 }
 
-EXPORTABLE(int) eval_file (char *const file)
+EXPORTABLE(SCM) eval_file (char *const file)
 {
-  gh_eval_file (file);
-  return 0;
+  return gh_eval_file (file);
 }
 
 EXPORTABLE(int) load (void* server)
diff --git a/plugins/src/guile_conf/README b/plugins/src/guile_conf/README
new file mode 100644
index 0000000..7c93035
--- /dev/null
+++ b/plugins/src/guile_conf/README
@@ -0,0 +1,20 @@
+This plugin enables to use a configuration file written in scheme.
+
+The plugin MUST be specified on the command line, before any
+configuration file is loaded:
+
+$ ./myserver  \
+  --plugins=guile_conf:../../plugins/bin/guile_conf/guile_conf.so 
+
+
+It looks for the `configuration' symbol in the `myserver.sch' file.
+The configuration looks like:
+
+A node can have an arbitrary number of attributes, and they are
+specified as a list of cons cells, the remaining non-cons cells
+contain the children of the node or the value.
+
+  (define configuration 
+    '(((name . "foo") (bar . "baz")
+       ("value1" "value2" "value3" "value4"))
+      ((name . "foo") "10")))
diff --git a/plugins/src/guile_conf/SConscript 
b/plugins/src/guile_conf/SConscript
new file mode 100644
index 0000000..4cb9227
--- /dev/null
+++ b/plugins/src/guile_conf/SConscript
@@ -0,0 +1,29 @@
+#-*- mode: python -*-
+Import('dest_dir','listinc')
+
+local_listinc=[
+      GetLaunchDir(),
+      '../../../',
+      '/usr/local/include',
+      '/usr/include/',
+      '/usr/include/guile',
+      '/usr/local/include/guile',
+      '/usr/local/include/libxml2',
+      '/usr/include/libxml2',
+      '.'
+      ]
+
+local_listinc.extend(listinc)
+
+env = Environment(CPPPATH=local_listinc)
+
+conf = Configure(env, config_h="config.h")
+
+if conf.CheckHeader("libguile.h") and conf.CheckLib("guile"):
+    conf.Define('GUILE', 1)
+
+env = conf.Finish()
+
+env.SharedLibrary(GetLaunchDir() + "/" + dest_dir + "/guile_conf", 
["guile_conf.cpp" ], SHLIBPREFIX="")
+
+
diff --git a/plugins/src/guile_conf/guile_conf.cpp 
b/plugins/src/guile_conf/guile_conf.cpp
new file mode 100644
index 0000000..52befbd
--- /dev/null
+++ b/plugins/src/guile_conf/guile_conf.cpp
@@ -0,0 +1,150 @@
+/*
+  MyServer
+  Copyright (C) 2009, 2010 The Free Software Foundation Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <myserver.h>
+
+#include <libguile.h>
+#include <guile/gh.h>
+#include <include/plugin/plugin.h>
+#include <include/conf/main/main_configuration.h>
+#include <include/server/server.h>
+
+#include <string.h>
+
+#define CONF_FILE_NAME "myserver.sch"
+
+PLUGIN_NAME ("guile_conf");
+
+/*! Define the interface to read from the main configuration file.  */
+class GuileConfiguration : public MainConfiguration
+{
+public:
+  virtual const char *getValue (const char* field);
+  virtual void readData (list<NodeTree<string>*> *hashedDataTrees,
+                         HashMap<string, NodeTree<string>*> *hashedData);
+};
+
+
+static MainConfiguration *genGuileMainConf (Server *server, const char *arg)
+{
+  return new GuileConfiguration ();
+}
+
+
+extern MainConfiguration* (*genMainConf) (Server *server, const char *arg);
+
+const char *
+GuileConfiguration::getValue (const char* field)
+{
+  /* TODO.  */
+  return NULL;
+}
+
+
+static NodeTree<string>*
+traverse (SCM node, HashMap<string, NodeTree<string>*> *hashedData)
+{
+  NodeTree<string> *newNode = new NodeTree<string> ();
+  if (gh_list_p (node))
+    {
+      while (gh_pair_p (gh_car (node)) && gh_symbol_p (gh_car (gh_car (node))))
+        {
+          size_t len;
+          char* attr = gh_symbol2newstr (gh_car (gh_car (node)), &len);
+          char* value = gh_scm2newstr (gh_cdr (gh_car (node)), &len);
+
+          string attrStr (attr);
+          string valueStr (value);
+
+          if (! strcmp (attr, "name"))
+            hashedData->put (valueStr, newNode);
+
+          newNode->addAttr (attrStr, valueStr);
+          node = gh_cdr (node);
+          free (attr);
+          free (value);
+        }
+
+      if (gh_string_p (gh_car (node)))
+        {
+          size_t len;
+          char *str = gh_scm2newstr (gh_car (node), &len);
+          newNode->setValue (new string (str));
+          free (str);
+        }
+      else
+        {
+          while (! gh_null_p (node))
+            {
+              NodeTree<string>* child = traverse (gh_car (node), hashedData);
+              newNode->addChild (child);
+              node = gh_cdr (node);
+            }
+        }
+    }
+
+  return newNode;
+}
+
+static Server *serverInstance;
+
+void
+GuileConfiguration::readData (list<NodeTree<string>*> *hashedDataTrees,
+                              HashMap<string, NodeTree<string>*> *hashedData)
+{
+  gh_eval_file (CONF_FILE_NAME);
+  SCM list = gh_lookup ("configuration");
+
+  if (gh_null_p (list))
+    {
+      serverInstance->log (MYSERVER_LOG_MSG_ERROR,
+                   _("GuileConf: cannot find symbol: %s"), "`configuration'");
+      return;
+    }
+
+  while (! gh_null_p (list))
+    {
+      hashedDataTrees->push_back (traverse (gh_car (list), hashedData));
+      list = gh_cdr (list);
+    }
+}
+
+EXPORTABLE(int) load (void* server)
+{
+  /* TODO: This plugin can be loaded only with --plugins.  Fail otherwise.  */
+  scm_init_guile ();
+  serverInstance = static_cast<Server *> (server);
+
+  if (! FilesUtility::nodeExists (CONF_FILE_NAME))
+    {
+      serverInstance->log (MYSERVER_LOG_MSG_ERROR,
+                           _("GuileConf: cannot find file %s"), 
CONF_FILE_NAME);
+      return 1;
+    }
+
+  genMainConf = &genGuileMainConf;
+  return 0;
+}
+
+EXPORTABLE(int) postLoad (void* server)
+{
+  return 0;
+}
+
+EXPORTABLE(int) unLoad ()
+{
+  return 0;
+}
diff --git a/plugins/src/guile_conf/myserver.sch 
b/plugins/src/guile_conf/myserver.sch
new file mode 100644
index 0000000..ffdd78e
--- /dev/null
+++ b/plugins/src/guile_conf/myserver.sch
@@ -0,0 +1,4 @@
+(define configuration 
+  '(((name . "foo") (bar . "baz")
+     ("value1" "value2" "value3" "value4"))
+    ((name . "foo") "10")))
diff --git a/plugins/src/guile_conf/plugin.xml 
b/plugins/src/guile_conf/plugin.xml
new file mode 100644
index 0000000..9a4185d
--- /dev/null
+++ b/plugins/src/guile_conf/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<PLUGIN min-version="0.9" max-version="0.10">
+  <NAME>guile_conf</NAME>
+  <VERSION>0.1</VERSION>
+  <AUTHOR>The Free Software Foundation Inc.</AUTHOR>
+  <MAINTAINER>The Free Software Foundation Inc.</MAINTAINER>
+  <DESCRIPTION>Handle the configuration file written in guile</DESCRIPTION>
+</PLUGIN>



commit 66ea79c469ec99d751ceddcdaa31992b4b55e544
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 17:45:52 2010 +0100

    Link against libguile

diff --git a/plugins/src/guile/SConscript b/plugins/src/guile/SConscript
index b9b76f2..f8ea846 100644
--- a/plugins/src/guile/SConscript
+++ b/plugins/src/guile/SConscript
@@ -19,7 +19,7 @@ env = Environment(CPPPATH=local_listinc)
 
 conf = Configure(env, config_h="config.h")
 
-if conf.CheckHeader("libguile.h"):
+if conf.CheckHeader("libguile.h") and conf.CheckLib("guile"):
     conf.Define('GUILE', 1)
 
 env = conf.Finish()



commit bf996fa6a7272272c36a4d1b00c1ffc33c80c5de
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 15:22:03 2010 +0100

    add `eval_file' to the guile plugin.

diff --git a/plugins/src/guile/guile.cpp b/plugins/src/guile/guile.cpp
index 836bf31..4d3d707 100644
--- a/plugins/src/guile/guile.cpp
+++ b/plugins/src/guile/guile.cpp
@@ -28,6 +28,12 @@ EXPORTABLE(int) eval (char *const string)
   return 0;
 }
 
+EXPORTABLE(int) eval_file (char *const file)
+{
+  gh_eval_file (file);
+  return 0;
+}
+
 EXPORTABLE(int) load (void* server)
 {
   scm_init_guile ();



commit 00b0c5fe2065a63172ac1105f93076c6e9f8d1c6
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 15:15:05 2010 +0100

    Remove unused arguments.

diff --git a/plugins/src/guile/guile.cpp b/plugins/src/guile/guile.cpp
index 71eb8b0..836bf31 100644
--- a/plugins/src/guile/guile.cpp
+++ b/plugins/src/guile/guile.cpp
@@ -28,13 +28,13 @@ EXPORTABLE(int) eval (char *const string)
   return 0;
 }
 
-EXPORTABLE(int) load (void* server, void* parser)
+EXPORTABLE(int) load (void* server)
 {
   scm_init_guile ();
   return 0;
 }
 
-EXPORTABLE(int) postLoad (void* server, void* parser)
+EXPORTABLE(int) postLoad (void* server)
 {
   return 0;
 }
diff --git a/plugins/src/hello/hello.cpp b/plugins/src/hello/hello.cpp
index 702bcf4..a5ea40f 100644
--- a/plugins/src/hello/hello.cpp
+++ b/plugins/src/hello/hello.cpp
@@ -20,13 +20,13 @@
 
 PLUGIN_NAME ("hello");
 
-EXPORTABLE(int) load (void* server, void* parser)
+EXPORTABLE(int) load (void* server)
 {
   printf ("load: hello world!\n");
   return 0;
 }
 
-EXPORTABLE(int) postLoad (void* server, void* parser)
+EXPORTABLE(int) postLoad (void* server)
 {
   printf ("postLoad: hello world!\n");
   return 0;
diff --git a/plugins/src/http_checker/http_checker.cpp 
b/plugins/src/http_checker/http_checker.cpp
index b3d1710..5e0cc99 100644
--- a/plugins/src/http_checker/http_checker.cpp
+++ b/plugins/src/http_checker/http_checker.cpp
@@ -29,6 +29,7 @@
 typedef int (*executePROC)(char*, u_long);
 typedef int (*executeFromFilePROC)(char*);
 
+PLUGIN_NAME ("http_checker");
 
 struct ThreadData
 {
@@ -217,15 +218,7 @@ private:
 
 static HttpObserver observer;
 
-EXPORTABLE(char*) name(char* name, u_long len)
-{
-  char* str = (char*)"http_checker";
-  if (name)
-    strncpy(name, str, len);
-  return str;
-}
-
-EXPORTABLE(int) load(void* server,void* parser)
+EXPORTABLE(int) load(void* server)
 {
   Server* serverInstance = (Server*)server;
   string msg("new-http-request");
@@ -297,7 +290,7 @@ EXPORTABLE(int) load(void* server,void* parser)
 
   return 0;
 }
-EXPORTABLE(int) postLoad (void* server,void* parser)
+EXPORTABLE(int) postLoad (void* server)
 {
   return 0;
 }
diff --git a/plugins/src/php/php.h b/plugins/src/php/php.h
index 07e2b0e..1faaf2b 100644
--- a/plugins/src/php/php.h
+++ b/plugins/src/php/php.h
@@ -31,9 +31,9 @@
 EXPORTABLE(char*) name(char* name, u_long len);
 
 
-EXPORTABLE(int) load(void* server, void* parser);
+EXPORTABLE(int) load(void* server);
 
-EXPORTABLE(int) postLoad(void* server,void* parser)
+EXPORTABLE(int) postLoad(void* server);
 
 EXPORTABLE(int) unLoad();
 
diff --git a/plugins/src/python/python.h b/plugins/src/python/python.h
index 2b7237b..2267c72 100644
--- a/plugins/src/python/python.h
+++ b/plugins/src/python/python.h
@@ -36,7 +36,7 @@ struct PythonData
 
 extern HashMap<ThreadID, PythonData*> pythonThreadData;
 
-EXPORTABLE(int) load (void* server,void* parser);
+EXPORTABLE(int) load (void* server);
 EXPORTABLE(int) unLoad ();
 
 



commit 9c95db4929b7f577ad91d9e49ab85584ecd03795
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 15:07:37 2010 +0100

    Initialize guile

diff --git a/plugins/src/guile/guile.cpp b/plugins/src/guile/guile.cpp
index 74a5789..71eb8b0 100644
--- a/plugins/src/guile/guile.cpp
+++ b/plugins/src/guile/guile.cpp
@@ -30,6 +30,7 @@ EXPORTABLE(int) eval (char *const string)
 
 EXPORTABLE(int) load (void* server, void* parser)
 {
+  scm_init_guile ();
   return 0;
 }
 



commit f7c3602b68c03c219a63689f73f43207a9633f1d
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 12:26:35 2010 +0100

    Fix typo.

diff --git a/myserver/binaries/myserver.default.xml 
b/myserver/binaries/myserver.default.xml
index d6804be..9ef7099 100755
--- a/myserver/binaries/myserver.default.xml
+++ b/myserver/binaries/myserver.default.xml
@@ -16,15 +16,12 @@
       CREATE-->
   <DEFINE name="server.max_threads" value="200" />
 
-  <!--DIMENSION OF EVERY BUFFER IN BYTES IF ON THE MACHINE THERE IS A
-      LOT OF RAM       THIS VALUES CAN BE INCREASED TO MAKE MYSERVER
-      FASTER. NORMALLY THE MEMORY USED BY BUFFERS IS EQUAL TO
-      BUFFER_SIZE * 2 * NUM_OF_THREADS-->
+  <!-- BUFFER SIZE AVAILABLE TO EVERY THREAD.  -->
   <DEFINE name="server.buffer_size" value="102400" />
 
   <!--DEFAULT FILENAME TO SEND IN A DIRECTORY
       IF THE FILE ISN'T IN THE PATH THEN THE DIRECTORY
-      CONTENT IS SENT  -->
+      CONTENT IS SENT. -->
   <DEFINE name="http.default_file">
     <DEFINE value="default.html"/>
     <DEFINE value="default.htm"/>
@@ -36,11 +33,11 @@
       IF THE CLIENT DOESN'T REQUEST ANYTHING FOR N
       SECONDS THE CONNECTION WITH THE CLIENT IS
       CLOSED. SET THIS TO 0 IF YOU DON'T WANT USE
-      KEEP-ALIVE CONNECTIONS   -->
+      KEEP-ALIVE CONNECTIONS. -->
   <DEFINE name="connection.timeout" value="180" />
 
   <!--SET THIS TO YES FOR USE PERSONALIZED PAGES TO SEND MESSAGE,
-      PERSONALIZED PAGES ARE IN THE SYSTEM DIRECTORY   -->
+      PERSONALIZED PAGES ARE IN THE SYSTEM DIRECTORY.  -->
   <DEFINE name="http.use_error_file" value="YES" />
 
   <!--DEFINE THE MAX NUMBER OF CONNECTIONS TO ALLOW TO THE SERVER. IF
@@ -60,7 +57,7 @@
   <DEFINE name="log_color.error_fg" value="red" />
   <DEFINE name="log_color.error_bg" value="black" />
 
-  <!--MAX SIZE OF THE LOG FILE IN BYTES        -->
+  <!--MAX SIZE OF THE LOG FILE IN BYTES.  -->
   <DEFINE name="server.max_log_size" value="1048576" />
 
   <!--DEFINE THE FOLDER BROWSING STYLE-->

-----------------------------------------------------------------------

Summary of changes:
 myserver/binaries/myserver.default.xml       |   13 +--
 plugins/src/guile/SConscript                 |    2 +-
 plugins/src/guile/guile.cpp                  |   15 ++-
 plugins/src/guile_conf/README                |   20 ++++
 plugins/src/{guile => guile_conf}/SConscript |    4 +-
 plugins/src/guile_conf/guile_conf.cpp        |  150 ++++++++++++++++++++++++++
 plugins/src/guile_conf/myserver.sch          |    4 +
 plugins/src/{guile => guile_conf}/plugin.xml |    4 +-
 plugins/src/hello/hello.cpp                  |    4 +-
 plugins/src/http_checker/http_checker.cpp    |   13 +--
 plugins/src/php/php.h                        |    4 +-
 plugins/src/python/python.h                  |    2 +-
 12 files changed, 202 insertions(+), 33 deletions(-)
 create mode 100644 plugins/src/guile_conf/README
 copy plugins/src/{guile => guile_conf}/SConscript (74%)
 create mode 100644 plugins/src/guile_conf/guile_conf.cpp
 create mode 100644 plugins/src/guile_conf/myserver.sch
 copy plugins/src/{guile => guile_conf}/plugin.xml (68%)


hooks/post-receive
-- 
GNU MyServer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]