From e276c279135a758bbc482d103f11b87a06a35d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Wed, 16 Jan 2008 02:01:52 +0000 Subject: [PATCH] Utilisation de sll au lieu de classe local --- sls/trunk/Makefile.am | 32 ++++++++------ sls/trunk/configure.ac | 2 +- sls/trunk/src/client.hh | 2 +- sls/trunk/src/client_console.cc | 5 ++- sls/trunk/src/client_daemon.cc | 4 +- sls/trunk/src/database.cc | 1 - sls/trunk/src/server.cc | 2 - sls/trunk/src/server.hh | 2 +- sls/trunk/src/{ => sll}/connection.cc | 10 ++--- sls/trunk/src/{ => sll}/connection.hh | 0 sls/trunk/src/{ => sll}/connection.hxx | 8 ++-- sls/trunk/src/{ => sll}/error.cc | 8 ++-- sls/trunk/src/{ => sll}/error.hh | 16 +++---- sls/trunk/src/sll/slm.hh | 60 ++++++++++++++++++++++++++ sls/trunk/src/sls.cc | 1 - sls/trunk/src/sls.hh | 40 ++--------------- 16 files changed, 108 insertions(+), 85 deletions(-) rename sls/trunk/src/{ => sll}/connection.cc (98%) rename sls/trunk/src/{ => sll}/connection.hh (100%) rename sls/trunk/src/{ => sll}/connection.hxx (86%) rename sls/trunk/src/{ => sll}/error.cc (91%) rename sls/trunk/src/{ => sll}/error.hh (75%) create mode 100644 sls/trunk/src/sll/slm.hh diff --git a/sls/trunk/Makefile.am b/sls/trunk/Makefile.am index 666f69b..23cbee3 100644 --- a/sls/trunk/Makefile.am +++ b/sls/trunk/Makefile.am @@ -16,29 +16,33 @@ bin_PROGRAMS= sls -sls_SOURCES= src/sls.hh \ - src/sls.cc \ +sls_SOURCES= src/sls.cc \ + src/option.cc \ + src/database.cc \ + src/cron.cc \ + src/server.cc \ + src/client.cc \ + src/client_console.cc \ + src/client_daemon.cc \ + src/sll/error.cc \ + src/sll/connection.cc + +noinst_HEADERS= src/sls.hh \ src/error.hh \ - src/error.cc \ src/option.hh \ - src/option.cc \ src/database.hh \ - src/database.cc \ src/cron.hh \ - src/cron.cc \ src/server.hh \ - src/server.cc \ - src/connection.hh \ - src/connection.hxx \ - src/connection.cc \ src/client.hh \ - src/client.cc \ src/client_console.hh \ - src/client_console.cc \ src/client_daemon.hh \ - src/client_daemon.cc + src/sll/slm.hh \ + src/sll/error.hh \ + src/sll/connection.hh \ + src/sll/connection.hxx + -CLEANFILES= *~ '\#*' +CLEANFILES= '*~' '#*#' '*.swp' EXTRA_DIST= COPYING README diff --git a/sls/trunk/configure.ac b/sls/trunk/configure.ac index 17101a9..d06b861 100644 --- a/sls/trunk/configure.ac +++ b/sls/trunk/configure.ac @@ -24,7 +24,7 @@ AC_INIT([sls],[1.0],[contact@seblu.net],[sls]) AC_CONFIG_AUX_DIR([build]) # Auto Make init -AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip]) +AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip subdir-objects]) # Check platform AC_CANONICAL_HOST diff --git a/sls/trunk/src/client.hh b/sls/trunk/src/client.hh index 6124846..1265b19 100644 --- a/sls/trunk/src/client.hh +++ b/sls/trunk/src/client.hh @@ -19,7 +19,7 @@ #ifndef CLIENT_HH # define CLIENT_HH -# include "connection.hh" +# include "sll/connection.hh" /** * Client diff --git a/sls/trunk/src/client_console.cc b/sls/trunk/src/client_console.cc index 423c23e..782b8ae 100644 --- a/sls/trunk/src/client_console.cc +++ b/sls/trunk/src/client_console.cc @@ -17,7 +17,6 @@ */ #include "sls.hh" -#include "error.hh" #include "option.hh" #include "client_console.hh" @@ -75,13 +74,15 @@ bool Console::trust(const char *login, const char *pass) { assert(pass); // check login and password in DB - c_.sendln("User always trusted !!"); // store username login_ = login; // register as logged in DB + // send validation + c_.sendln("OK"); + return true; } diff --git a/sls/trunk/src/client_daemon.cc b/sls/trunk/src/client_daemon.cc index 1257ed4..c529987 100644 --- a/sls/trunk/src/client_daemon.cc +++ b/sls/trunk/src/client_daemon.cc @@ -57,12 +57,14 @@ bool Daemon::trust(const char *login, const char *pass) { assert(pass); // check login and password in DB - c_.sendln("Daemon always untrusted !!"); // store username login_ = login; // register as logged in DB + // Send + c_.sendln("KO"); + return false; } diff --git a/sls/trunk/src/database.cc b/sls/trunk/src/database.cc index cf41527..3de66fd 100644 --- a/sls/trunk/src/database.cc +++ b/sls/trunk/src/database.cc @@ -18,7 +18,6 @@ #include "sls.hh" #include "database.hh" -#include "error.hh" // ***************************************************************************** // Public Method diff --git a/sls/trunk/src/server.cc b/sls/trunk/src/server.cc index 884dff9..7c548df 100644 --- a/sls/trunk/src/server.cc +++ b/sls/trunk/src/server.cc @@ -18,8 +18,6 @@ #include "sls.hh" #include "server.hh" -#include "error.hh" -#include "connection.hh" #include "client.hh" #include diff --git a/sls/trunk/src/server.hh b/sls/trunk/src/server.hh index 4077fc6..cbe45ba 100644 --- a/sls/trunk/src/server.hh +++ b/sls/trunk/src/server.hh @@ -19,7 +19,7 @@ #ifndef SERVER_HH # define SERVER_HH -# include "connection.hh" +# include "sll/connection.hh" # include # include diff --git a/sls/trunk/src/connection.cc b/sls/trunk/src/sll/connection.cc similarity index 98% rename from sls/trunk/src/connection.cc rename to sls/trunk/src/sll/connection.cc index aa25541..a3ee8ca 100644 --- a/sls/trunk/src/connection.cc +++ b/sls/trunk/src/sll/connection.cc @@ -1,22 +1,22 @@ /* - This file is part of SLS. + This file is part of SLL. Copyright (C) 2008 Sebastien LUTTRINGER - SLS is free software; you can redistribute it and/or modify + SLL 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; version 2 of the License. - SLS is distributed in the hope that it will be useful, + SLL 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 SLS; if not, write to the Free Software + along with SLL; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "sls.hh" +#include "slm.hh" #include "connection.hh" #include "error.hh" diff --git a/sls/trunk/src/connection.hh b/sls/trunk/src/sll/connection.hh similarity index 100% rename from sls/trunk/src/connection.hh rename to sls/trunk/src/sll/connection.hh diff --git a/sls/trunk/src/connection.hxx b/sls/trunk/src/sll/connection.hxx similarity index 86% rename from sls/trunk/src/connection.hxx rename to sls/trunk/src/sll/connection.hxx index 92b5bf7..937ae30 100644 --- a/sls/trunk/src/connection.hxx +++ b/sls/trunk/src/sll/connection.hxx @@ -1,18 +1,18 @@ /* - This file is part of SLS. + This file is part of SLL. Copyright (C) 2008 Sebastien LUTTRINGER - SLS is free software; you can redistribute it and/or modify + SLL 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; version 2 of the License. - SLS is distributed in the hope that it will be useful, + SLL 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 SLS; if not, write to the Free Software + along with SLLo; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/sls/trunk/src/error.cc b/sls/trunk/src/sll/error.cc similarity index 91% rename from sls/trunk/src/error.cc rename to sls/trunk/src/sll/error.cc index 385d6af..429335f 100644 --- a/sls/trunk/src/error.cc +++ b/sls/trunk/src/sll/error.cc @@ -1,18 +1,18 @@ /* - This file is part of SLS. + This file is part of SLL. Copyright (C) 2008 Sebastien LUTTRINGER - SLS is free software; you can redistribute it and/or modify + SLL 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; version 2 of the License. - SLS is distributed in the hope that it will be useful, + SLL 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 SLS; if not, write to the Free Software + along with SLL; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/sls/trunk/src/error.hh b/sls/trunk/src/sll/error.hh similarity index 75% rename from sls/trunk/src/error.hh rename to sls/trunk/src/sll/error.hh index b91555b..52374d5 100644 --- a/sls/trunk/src/error.hh +++ b/sls/trunk/src/sll/error.hh @@ -1,31 +1,25 @@ /* - This file is part of SLS. + This file is part of SLL. Copyright (C) 2008 Sebastien LUTTRINGER - SLS is free software; you can redistribute it and/or modify + SLL 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; version 2 of the License. - SLS is distributed in the hope that it will be useful, + SLL 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 SLS; if not, write to the Free Software + along with SLL; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef ERROR_HH # define ERROR_HH -# include -# include -# include - -typedef std::string string; -typedef std::stringstream sstream; -typedef std::ostream ostream; +# include "slm.hh" class Error { diff --git a/sls/trunk/src/sll/slm.hh b/sls/trunk/src/sll/slm.hh new file mode 100644 index 0000000..37587ff --- /dev/null +++ b/sls/trunk/src/sll/slm.hh @@ -0,0 +1,60 @@ +/* + This file is part of SLL. + Copyright (C) 2008 Sebastien LUTTRINGER + + SLL 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; version 2 of the License. + + SLL 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 SLL; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef SLM_HH +# define SLM_HH + +# define _REENTRANT + +# include +# include +# include +# include +# include + +typedef std::string string; +typedef std::stringstream sstream; +typedef std::ostream ostream; +typedef std::ifstream ifstream; +typedef std::ofstream ofstream; + +enum { + ERR_NO = 0, + ERR_USAGE = 1, + ERR_BADPARAM = 2, + ERR_FILE = 3, + ERR_NET = 4, + ERR_PROTO = 5, + ERR_AUTH = 6, + ERR_DB = 7, + ERR_SRV = 8, + ERR_THREAD = 9, + ERR_PARSE = 10, + ERR_NOMEM = 41, + ERR_UNKNOWN = 42 +}; + +// ----------------------------------------------------------------------------- +// Gonstant +// ----------------------------------------------------------------------------- + +static const string VERSION = (string) "testing.\nCompiled: " + __DATE__ + " " + __TIME__ + "."; +//static const string VERSION = "1.0"; +static const int MAX_LINE_SIZE = 512; + +#endif diff --git a/sls/trunk/src/sls.cc b/sls/trunk/src/sls.cc index 1665946..e383332 100644 --- a/sls/trunk/src/sls.cc +++ b/sls/trunk/src/sls.cc @@ -21,7 +21,6 @@ #include "database.hh" #include "cron.hh" #include "server.hh" -#include "error.hh" #include #include diff --git a/sls/trunk/src/sls.hh b/sls/trunk/src/sls.hh index 51a060c..d33dba7 100644 --- a/sls/trunk/src/sls.hh +++ b/sls/trunk/src/sls.hh @@ -19,47 +19,13 @@ #ifndef SLS_HH # define SLS_HH -# define _REENTRANT - -# include -# include -# include -# include -# include - -typedef std::string string; -typedef std::stringstream sstream; -typedef std::ostream ostream; -typedef std::ifstream ifstream; -typedef std::ofstream ofstream; - -enum { - ERR_NO = 0, - ERR_USAGE = 1, - ERR_BADPARAM = 2, - ERR_FILE = 3, - ERR_NET = 4, - ERR_PROTO = 5, - ERR_AUTH = 6, - ERR_DB = 7, - ERR_SRV = 8, - ERR_THREAD = 9, - ERR_PARSE = 10, - ERR_NOMEM = 41, - ERR_UNKNOWN = 42 -}; - -// ----------------------------------------------------------------------------- -// Gonstant -// ----------------------------------------------------------------------------- - -static const string VERSION = (string) "testing.\nBuild: " + __DATE__ + " " + __TIME__ + "."; -//static const string VERSION = "1.0"; -static const int MAX_LINE_SIZE = 512; +# include "sll/slm.hh" +# include "sll/error.hh" // ----------------------------------------------------------------------------- // global variables // ----------------------------------------------------------------------------- + class Option; extern Option O; -- GitLab