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-351-g2


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-351-g2d24ff7
Date: Thu, 05 Nov 2009 14:56:14 +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  2d24ff71aba154e493eedfe858fd12901a5de95a (commit)
      from  828a911010e1cb1391316cfc2bef87e093a0b6e3 (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 2d24ff71aba154e493eedfe858fd12901a5de95a
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Nov 5 15:56:01 2009 +0100

    Change Protocol interface: rename `registerName' to `getName', it does not 
accept additional parameters.

diff --git a/myserver/include/protocol/control/control_protocol.h 
b/myserver/include/protocol/control/control_protocol.h
index d1f6e83..fe59801 100644
--- a/myserver/include/protocol/control/control_protocol.h
+++ b/myserver/include/protocol/control/control_protocol.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2004, 2005, 2008, 2009 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/>.
+  MyServer
+  Copyright (C) 2004, 2005, 2008, 2009 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/>.
 */
 
 #ifndef CONTROL_PROTOCOL_H
@@ -34,11 +34,11 @@ public:
 
   int sendResponse (char*, int, ConnectionPtr, int, ControlHeader& header, 
File* = 0);
   virtual int loadProtocol ();
-       int controlConnection (ConnectionPtr a, char *b1, char *b2, u_long bs1,
+  int controlConnection (ConnectionPtr a, char *b1, char *b2, u_long bs1,
                          u_long bs2, u_long nbtr, u_long id);
-       virtual char* registerName (char*,int len);
-       ControlProtocol ();
-       virtual ~ControlProtocol ();
+  virtual const char* getName ();
+  ControlProtocol ();
+  virtual ~ControlProtocol ();
 
 protected:
   static char adminLogin[64];
@@ -50,9 +50,9 @@ protected:
   int showDynamicProtocols (ConnectionPtr,File* out, char *b1,int bs1, 
ControlHeader&);
   int killConnection (ConnectionPtr,u_long ID, File* out, char *b1,int bs1, 
ControlHeader&);
   int getFile (ConnectionPtr, char*, File* in, File* out,
-              char *b1,int bs1, ControlHeader&);
+               char *b1,int bs1, ControlHeader&);
   int putFile (ConnectionPtr,char*, File* in, File* out,
-              char *b1,int bs1, ControlHeader&);
+               char *b1,int bs1, ControlHeader&);
   int getVersion (ConnectionPtr,File* out, char *b1,int bs1, ControlHeader&);
   int addToLog (int retCode, ConnectionPtr con, char *b1, int bs1, 
ControlHeader&);
 };
diff --git a/myserver/include/protocol/ftp/ftp.h 
b/myserver/include/protocol/ftp/ftp.h
index fcc1b26..7bf286f 100644
--- a/myserver/include/protocol/ftp/ftp.h
+++ b/myserver/include/protocol/ftp/ftp.h
@@ -135,8 +135,8 @@ public:
   int openDataPassive ();
   int openDataActive ();
 
-  virtual char *registerName (char *out, int len);
-  static char *registerNameImpl (char *out, int len);
+  virtual const char *getName ();
+  static const char *getNameImpl ();
 
   void escapeTelnet (MemBuf & In, MemBuf & Out);
   void user (const std::string & sParam);
@@ -222,9 +222,9 @@ public:
 
   }
 
-  virtual char *registerName (char *out, int len)
+  virtual const char *getName ()
   {
-    return Ftp::registerNameImpl (out, len);
+    return Ftp::getNameImpl ();
   }
 
   virtual int controlConnection (ConnectionPtr con, char *request,
diff --git a/myserver/include/protocol/gopher/gopher.h 
b/myserver/include/protocol/gopher/gopher.h
index 4fa566a..e9905f0 100644
--- a/myserver/include/protocol/gopher/gopher.h
+++ b/myserver/include/protocol/gopher/gopher.h
@@ -33,12 +33,12 @@ public:
   Gopher ();
   virtual ~Gopher ();
 
-  virtual char* registerName (char* out,int len)
+  virtual const char* getName ()
   {
-    return registerNameImpl (out, len);
+    return getNameImpl ();
   }
 
-  static char* registerNameImpl (char*, int len);
+  static const char* getNameImpl ();
 
   int controlConnection (ConnectionPtr a,
                          char *b1,
@@ -72,20 +72,19 @@ public:
   virtual ~GopherProtocol ()
   {}
 
-  virtual char* registerName (char* out, int len)
+  virtual const char* getName ()
   {
-    return Gopher::registerNameImpl (out, len);
+    return Gopher::getNameImpl ();
   }
 
-  virtual int controlConnection (ConnectionPtr a, char *b1, char *b2,
-                                 u_long bs1, u_long bs2, u_long nbtr, u_long 
id)
+  virtual int controlConnection (ConnectionPtr con, char *request,
+                                 char *auxBuf, u_long reqBufLen,
+                                 u_long auxBufLen, u_long reqLen,
+                                 u_long tid)
   {
-    Gopher Gopher;
-    int ret = 0;
-
-    ret = Gopher.controlConnection (a, b1, b2, bs1, bs2, nbtr, id);
-
-    return ret;
+    Gopher gopher;
+    return gopher.controlConnection (con, request, auxBuf, reqBufLen, 
auxBufLen,
+                                     reqLen, tid);
   }
 
   virtual int loadProtocol ()
diff --git a/myserver/include/protocol/http/http.h 
b/myserver/include/protocol/http/http.h
index 054f656..d50ec75 100644
--- a/myserver/include/protocol/http/http.h
+++ b/myserver/include/protocol/http/http.h
@@ -162,9 +162,9 @@ public:
   int sendHTTPNonModified ();
   Http ();
   virtual ~Http ();
-  virtual char* registerName (char* out,int len){return registerNameImpl (out, 
len);}
+  virtual const char* getName (){return getNameImpl ();}
 
-  static char* registerNameImpl (char*, int len);
+  static const char* getNameImpl ();
   int controlConnection (ConnectionPtr con, char *request, char *auxBuf,
                          u_long reqBufLen, u_long auxBufLen, u_long reqLen,
                          u_long tid);
@@ -209,9 +209,9 @@ public:
   {
   }
 
-  virtual char* registerName (char* out, int len)
+  virtual const char* getName ()
   {
-    return Http::registerNameImpl (out, len);
+    return Http::getNameImpl ();
   }
 
   virtual int controlConnection (ConnectionPtr con, char *request,
diff --git a/myserver/include/protocol/https/https.h 
b/myserver/include/protocol/https/https.h
index 9fcc5ab..a777252 100644
--- a/myserver/include/protocol/https/https.h
+++ b/myserver/include/protocol/https/https.h
@@ -1,20 +1,20 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2008, 2009 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/>.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2008, 2009 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/>.
 */
 
 #ifndef HTTPS_H
@@ -25,18 +25,18 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 class Https : public Http
 {
 public:
-  static char* registerNameImpl (char* out, int len);
-       virtual char* registerName (char*,int len);
-       Https ();
-       virtual ~Https ();
+  static const char* getNameImpl ();
+  virtual const char* getName ();
+  Https ();
+  virtual ~Https ();
 
   static int loadProtocolStatic (XmlParser* lang)
   {
-        return 1;
+    return 1;
   }
   static int unLoadProtocolStatic (XmlParser* lang)
   {
-        return 1;
+    return 1;
   }
 
 };
@@ -47,7 +47,7 @@ public:
 class HttpsProtocol : public Protocol
 {
 public:
-       HttpsProtocol ()
+  HttpsProtocol ()
   {
     protocolOptions = PROTOCOL_USES_SSL;
   }
@@ -57,20 +57,19 @@ public:
 
   }
 
-  virtual char* registerName (char* out, int len)
+  virtual const char* getName ()
   {
-    return Https::registerNameImpl (out, len);
+    return Https::getNameImpl ();
   }
 
-       virtual int controlConnection (ConnectionPtr a, char *b1, char *b2,
-                                u_long bs1, u_long bs2, u_long nbtr, u_long id)
+  virtual int controlConnection (ConnectionPtr con, char *request,
+                                 char *auxBuf, u_long reqBufLen,
+                                 u_long auxBufLen, u_long reqLen,
+                                 u_long tid)
   {
-    int ret = 0;
     Https https;
-
-    ret = https.controlConnection (a, b1, b2, bs1, bs2, nbtr, id);
-
-    return ret;
+    return https.controlConnection (con, request, auxBuf, reqBufLen, auxBufLen,
+                                    reqLen, tid);
   }
 
   virtual int loadProtocol (XmlParser* parser)
@@ -78,7 +77,7 @@ public:
     return Https::loadProtocolStatic (parser);
   }
 
-       virtual int unLoadProtocol (XmlParser* parser)
+  virtual int unLoadProtocol (XmlParser* parser)
   {
     return Https::unLoadProtocolStatic (parser);
   }
diff --git a/myserver/include/protocol/protocol.h 
b/myserver/include/protocol/protocol.h
index 6f2cceb..75720a4 100644
--- a/myserver/include/protocol/protocol.h
+++ b/myserver/include/protocol/protocol.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2008, 2009 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/>.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2008, 2009 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/>.
 */
 
 #ifndef PROTOCOL_H
@@ -32,23 +32,23 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 class Protocol
 {
 public:
-       Protocol ();
+  Protocol ();
   virtual ~Protocol ();
-       virtual char* registerName (char*,int len);
+  virtual const char* getName ();
 
-       virtual int controlConnection (ConnectionPtr con, char *request,
+  virtual int controlConnection (ConnectionPtr con, char *request,
                                  char *auxBuf, u_long reqBufLen,
                                  u_long auxBufLen, u_long reqLen,
                                  u_long tid);
 
-       virtual int loadProtocol ();
-       virtual int unLoadProtocol ();
+  virtual int loadProtocol ();
+  virtual int unLoadProtocol ();
 
   virtual int getProtocolOptions (){return protocolOptions;}
 
   virtual string &getProtocolPrefix (){return protocolPrefix;}
 protected:
   string protocolPrefix;
-       int protocolOptions;
+  int protocolOptions;
 };
 #endif
diff --git a/myserver/include/protocol/protocols_manager.h 
b/myserver/include/protocol/protocols_manager.h
index 0253039..44f0f46 100644
--- a/myserver/include/protocol/protocols_manager.h
+++ b/myserver/include/protocol/protocols_manager.h
@@ -1,20 +1,20 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009 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/>.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009 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/>.
 */
 
 #ifndef PROTOCOLS_MANAGER_H
@@ -34,14 +34,14 @@ using namespace std;
 class ProtocolsManager
 {
 public:
-       ProtocolsManager ();
-       ~ProtocolsManager ();
+  ProtocolsManager ();
+  ~ProtocolsManager ();
 
-  Protocol* getProtocol (string& name);
+  Protocol* getProtocol (string &name);
 
-  void addProtocol (string& name, Protocol* protocol);
+  void addProtocol (string &name, Protocol *protocol);
 
-  void addProtocol (char* name, Protocol* protocol)
+  void addProtocol (const char *name, Protocol *protocol)
   {
     string strName (name);
     addProtocol (strName, protocol);
diff --git a/myserver/src/protocol/control/control_protocol.cpp 
b/myserver/src/protocol/control/control_protocol.cpp
index 3df69c8..0ff8f60 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -67,12 +67,9 @@ struct ControlProtocolVisitorArg
  *Returns the name of the protocol. If an out buffer is defined
  *fullfill it with the name too.
  */
-char* ControlProtocol::registerName (char* out,int len)
+const char* ControlProtocol::getName ()
 {
-  if (out)
-    strncpy (out, "CONTROL", len);
-
-  return (char*)"CONTROL";
+  return "CONTROL";
 }
 
 /*!
diff --git a/myserver/src/protocol/ftp/ftp.cpp 
b/myserver/src/protocol/ftp/ftp.cpp
index c094ad4..96b8ee9 100644
--- a/myserver/src/protocol/ftp/ftp.cpp
+++ b/myserver/src/protocol/ftp/ftp.cpp
@@ -358,18 +358,14 @@ int Ftp::controlConnection (ConnectionPtr pConnection, 
char *request,
 }
 
 
-char * Ftp::registerName (char *out, int len)
+const char * Ftp::getName ()
 {
-  return registerNameImpl (out, len);
+  return getNameImpl ();
 }
 
-char * Ftp::registerNameImpl (char *out, int len)
+const char * Ftp::getNameImpl ()
 {
-  if (out)
-    {
-      myserver_strlcpy (out, "FTP", len);
-    }
-  return (char *) "FTP";
+  return "FTP";
 }
 
 
diff --git a/myserver/src/protocol/gopher/gopher.cpp 
b/myserver/src/protocol/gopher/gopher.cpp
index ee4ded4..46f1b00 100644
--- a/myserver/src/protocol/gopher/gopher.cpp
+++ b/myserver/src/protocol/gopher/gopher.cpp
@@ -47,12 +47,9 @@ Gopher::~Gopher ()
  * Service method
  */
 
-char *Gopher::registerNameImpl (char* out, int len)
+const char *Gopher::getNameImpl ()
 {
-  if (out)
-    myserver_strlcpy (out, "GOPHER", len);
-
-  return (char*) "GOPHER";
+  return "GOPHER";
 }
 
 /*!
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index fdafbdb..161cce0 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1808,13 +1808,9 @@ int Http::unLoadProtocolStatic ()
  * Returns the name of the protocol. If an out buffer
  * is defined fullfill it with the name too.
  */
-char* Http::registerNameImpl (char* out, int len)
+const char* Http::getNameImpl ()
 {
-  if (out)
-    {
-      myserver_strlcpy (out, "HTTP", len);
-    }
-  return (char*) "HTTP";
+  return "HTTP";
 }
 
 /*!
diff --git a/myserver/src/protocol/https/https.cpp 
b/myserver/src/protocol/https/https.cpp
index c7f0b5a..ddf0bb2 100644
--- a/myserver/src/protocol/https/https.cpp
+++ b/myserver/src/protocol/https/https.cpp
@@ -35,18 +35,14 @@ extern "C"
  *Returns the name of the protocol. If an out buffer is defined
  *fullfill it with the name too.
  */
-char* Https::registerNameImpl (char* out, int len)
+const char* Https::getNameImpl ()
 {
-  if (out)
-  {
-    strncpy (out, "HTTPS", len);
-  }
-  return (char*)"HTTPS";
+  return "HTTPS";
 }
 
-char* Https::registerName (char* out, int len)
+const char* Https::getName ()
 {
-  return registerNameImpl (out, len);
+  return getNameImpl ();
 }
 
 /*!
diff --git a/myserver/src/protocol/protocol.cpp 
b/myserver/src/protocol/protocol.cpp
index c211c4d..f03ec3b 100644
--- a/myserver/src/protocol/protocol.cpp
+++ b/myserver/src/protocol/protocol.cpp
@@ -64,9 +64,9 @@ int Protocol::controlConnection (ConnectionPtr con, char 
*request,
  * Returns the name of the protocol. If an out buffer is
  * defined fullfill it with the name too.
  */
-char* Protocol::registerName (char* /*out*/,int /*len*/)
+const char* Protocol::getName ()
 {
-  return 0;
+  return "";
 }
 
 /*!
diff --git a/myserver/src/protocol/protocols_manager.cpp 
b/myserver/src/protocol/protocols_manager.cpp
index 1ae14ee..7d698d0 100644
--- a/myserver/src/protocol/protocols_manager.cpp
+++ b/myserver/src/protocol/protocols_manager.cpp
@@ -40,7 +40,7 @@ ProtocolsManager::~ProtocolsManager ()
 /*!
  * Return a protocol by its name.
  */
-Protocol* ProtocolsManager::getProtocol (string& name)
+Protocol* ProtocolsManager::getProtocol (string &name)
 {
   return staticProtocols.get (name);
 }
@@ -48,7 +48,7 @@ Protocol* ProtocolsManager::getProtocol (string& name)
 /*!
  * Add a static protocol to the list.
  */
-void ProtocolsManager::addProtocol (string& name, Protocol* protocol)
+void ProtocolsManager::addProtocol (string &name, Protocol *protocol)
 {
   std::transform (name.begin (), name.end (), name.begin (),
                   static_cast < int (*)(int) > (tolower));
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index da88639..a998b79 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -368,10 +368,9 @@ void Server::loadPlugins ()
 
   for (int j = 0; protocolsSet[j]; j++)
     {
-      char protocolName[32];
       Protocol *protocol = protocolsSet[j];
       protocol->loadProtocol ();
-      protocol->registerName (protocolName, 32);
+      const char *protocolName = protocol->getName ();
       getProtocolsManager ()->addProtocol (protocolName, protocol);
     }
 

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

Summary of changes:
 .../include/protocol/control/control_protocol.h    |   40 ++++++------
 myserver/include/protocol/ftp/ftp.h                |    8 +-
 myserver/include/protocol/gopher/gopher.h          |   25 ++++----
 myserver/include/protocol/http/http.h              |    8 +-
 myserver/include/protocol/https/https.h            |   63 ++++++++++----------
 myserver/include/protocol/protocol.h               |   40 ++++++------
 myserver/include/protocol/protocols_manager.h      |   40 ++++++------
 myserver/src/protocol/control/control_protocol.cpp |    7 +--
 myserver/src/protocol/ftp/ftp.cpp                  |   12 +---
 myserver/src/protocol/gopher/gopher.cpp            |    7 +--
 myserver/src/protocol/http/http.cpp                |    8 +--
 myserver/src/protocol/https/https.cpp              |   12 +---
 myserver/src/protocol/protocol.cpp                 |    4 +-
 myserver/src/protocol/protocols_manager.cpp        |    4 +-
 myserver/src/server/server.cpp                     |    3 +-
 15 files changed, 130 insertions(+), 151 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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