]> git.stg.codes - stg.git/commitdiff
Remove 'stg' prefixes from headers and add it to libraries
authorMaxim Mamontov <faust@gts.dp.ua>
Fri, 8 Apr 2011 12:44:11 +0000 (15:44 +0300)
committerMaxim Mamontov <faust@gts.dp.ua>
Fri, 8 Apr 2011 12:44:11 +0000 (15:44 +0300)
124 files changed:
include/stg/auth.h
include/stg/const.h [new file with mode: 0644]
include/stg/message.h [new file with mode: 0644]
include/stg/raw_ip_packet.h
include/stg/stg_const.h [deleted file]
include/stg/stg_message.h [deleted file]
include/stg/store.h
include/stg/tariff_conf.h
include/stg/user.h
include/stg/user_conf.h
include/stg/user_property.h
include/stg/user_traff.h
projects/convertor/Makefile
projects/convertor/build
projects/convertor/main.cpp
projects/make_tarball/mt.sh
projects/rlm_stg/Makefile
projects/rscriptd/Makefile
projects/rscriptd/build
projects/rscriptd/listener.cpp
projects/rscriptd/listener.h
projects/rscriptd/main.cpp
projects/sgauth/Makefile
projects/sgauth/build
projects/sgauth/main.cpp
projects/sgauth/web.h
projects/sgconf/Makefile
projects/sgconf/request.h
projects/sgconf_xml/Makefile
projects/sgconf_xml/request.h
projects/stargazer/Makefile
projects/stargazer/actions.inl.h
projects/stargazer/admin_impl.h
projects/stargazer/admins_impl.h
projects/stargazer/build
projects/stargazer/eventloop.cpp
projects/stargazer/main.cpp
projects/stargazer/plugins/authorization/ao/Makefile
projects/stargazer/plugins/authorization/inetaccess/Makefile
projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp
projects/stargazer/plugins/authorization/inetaccess/inetaccess.h
projects/stargazer/plugins/capture/cap_debug/Makefile
projects/stargazer/plugins/capture/cap_nf/Makefile
projects/stargazer/plugins/capture/divert_freebsd/Makefile
projects/stargazer/plugins/capture/ether_freebsd/Makefile
projects/stargazer/plugins/capture/ether_linux/Makefile
projects/stargazer/plugins/capture/ipq_linux/Makefile
projects/stargazer/plugins/configuration/rpcconfig/Makefile
projects/stargazer/plugins/configuration/rpcconfig/messages_methods.cpp
projects/stargazer/plugins/configuration/sgconfig-ng/Makefile
projects/stargazer/plugins/configuration/sgconfig/Makefile
projects/stargazer/plugins/configuration/sgconfig/configproto.h
projects/stargazer/plugins/configuration/sgconfig/parser.h
projects/stargazer/plugins/configuration/sgconfig2/Makefile
projects/stargazer/plugins/configuration/sgconfig2/configproto.h
projects/stargazer/plugins/configuration/sgconfig2/parser.h
projects/stargazer/plugins/other/ping/Makefile
projects/stargazer/plugins/other/ping/ping.cpp
projects/stargazer/plugins/other/radius/Makefile
projects/stargazer/plugins/other/rscript/Makefile
projects/stargazer/plugins/other/rscript/rscript.cpp
projects/stargazer/plugins/other/userstat/Makefile
projects/stargazer/plugins/store/files/Makefile
projects/stargazer/plugins/store/files/file_store.cpp
projects/stargazer/plugins/store/firebird/Makefile
projects/stargazer/plugins/store/firebird/firebird_store.h
projects/stargazer/plugins/store/firebird/firebird_store_users.cpp
projects/stargazer/plugins/store/mysql/Makefile
projects/stargazer/plugins/store/postgresql/Makefile
projects/stargazer/plugins/store/postgresql/postgresql_store_admins.cpp
projects/stargazer/plugins/store/postgresql/postgresql_store_corporations.cpp
projects/stargazer/plugins/store/postgresql/postgresql_store_messages.cpp
projects/stargazer/plugins/store/postgresql/postgresql_store_services.cpp
projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp
projects/stargazer/plugins/store/postgresql/postgresql_store_users.cpp
projects/stargazer/settings_impl.cpp
projects/stargazer/settings_impl.h
projects/stargazer/tariffs_impl.cpp
projects/stargazer/traffcounter_impl.cpp
projects/stargazer/traffcounter_impl.h
projects/stargazer/user_impl.h
projects/stargazer/users_impl.h
stglibs/common.lib/Makefile
stglibs/common.lib/common.h
stglibs/common.lib/stg_strptime.cpp [deleted file]
stglibs/common.lib/strptime.cpp [new file with mode: 0644]
stglibs/conffiles.lib/Makefile
stglibs/crypto.lib/Makefile
stglibs/crypto.lib/blowfish.cpp
stglibs/ia.lib/Makefile [new file with mode: 0644]
stglibs/ia.lib/ia.bpf [new file with mode: 0644]
stglibs/ia.lib/ia.bpr [new file with mode: 0644]
stglibs/ia.lib/ia.cpp [new file with mode: 0644]
stglibs/ia.lib/ia.h [new file with mode: 0644]
stglibs/ia_auth_c.lib/Makefile [deleted file]
stglibs/ia_auth_c.lib/ia_auth_c.bpf [deleted file]
stglibs/ia_auth_c.lib/ia_auth_c.bpr [deleted file]
stglibs/ia_auth_c.lib/ia_auth_c.cpp [deleted file]
stglibs/ia_auth_c.lib/ia_auth_c.h [deleted file]
stglibs/locker.lib/Makefile [new file with mode: 0644]
stglibs/locker.lib/locker.cpp [new file with mode: 0644]
stglibs/locker.lib/locker.h [new file with mode: 0644]
stglibs/logger.lib/Makefile [new file with mode: 0644]
stglibs/logger.lib/logger.cpp [new file with mode: 0644]
stglibs/logger.lib/logger.h [new file with mode: 0644]
stglibs/pinger.lib/Makefile
stglibs/pinger.lib/pinger.cpp
stglibs/script_executer.lib/Makefile [deleted file]
stglibs/script_executer.lib/script_executer.cpp [deleted file]
stglibs/script_executer.lib/script_executer.h [deleted file]
stglibs/scriptexecuter.lib/Makefile [new file with mode: 0644]
stglibs/scriptexecuter.lib/scriptexecuter.cpp [new file with mode: 0644]
stglibs/scriptexecuter.lib/scriptexecuter.h [new file with mode: 0644]
stglibs/srvconf.lib/Makefile
stglibs/srvconf.lib/parser.cpp
stglibs/srvconf.lib/servconf.h
stglibs/stg_locker.lib/Makefile [deleted file]
stglibs/stg_locker.lib/stg_locker.cpp [deleted file]
stglibs/stg_locker.lib/stg_locker.h [deleted file]
stglibs/stg_logger.lib/Makefile [deleted file]
stglibs/stg_logger.lib/stg_logger.cpp [deleted file]
stglibs/stg_logger.lib/stg_logger.h [deleted file]
tests/Makefile
tests/raw_ip_packet_old.h

index 8cdc3f2d53855ffcaae1b8714d03d6570a7c9056..f597f6d1203985821c714f56652229c4dd3989db 100644 (file)
@@ -27,7 +27,7 @@
 #define AUTH_H
 
 #include "plugin.h"
 #define AUTH_H
 
 #include "plugin.h"
-#include "stg_message.h"
+#include "message.h"
 #include "noncopyable.h"
 
 class AUTH : public PLUGIN {
 #include "noncopyable.h"
 
 class AUTH : public PLUGIN {
diff --git a/include/stg/const.h b/include/stg/const.h
new file mode 100644 (file)
index 0000000..e882200
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ *    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 2 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, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *    Author : Boris Mikhailenko <stg34@ua.fm>
+ */
+
+ /*
+ $Author: nobunaga $
+ $Revision: 1.10 $
+ $Date: 2008/01/11 17:33:50 $
+ */
+
+
+#ifndef STG_CONST_H
+#define STG_CONST_H
+
+#define DIR_NUM         (10)
+#define SYS_IFACE_LEN   (9)
+#define IFACE_LEN       (255)
+#define MAX_IP          (5)
+#define USERDATA_NUM    (10)
+
+#define LOGIN_LEN       (32)
+#define PASSWD_LEN      (32)
+#define ADDR_LEN        (255)
+#define NOTE_LEN        (255)
+#define REALNM_LEN      (255)
+#define GROUP_LEN       (255)
+#define PHONE_LEN       (255)
+#define EMAIL_LEN       (255)
+#define USR_IFACE_LEN   (255)
+#define USER_DATA_LEN   (255)
+#define IP_STRING_LEN   (255)
+
+#define ADM_LOGIN_LEN   (32)
+#define ADM_PASSWD_LEN  (32)
+#define TARIFF_NAME_LEN (32)
+#define SERVER_NAME_LEN (255)
+
+#define DIR_NAME_LEN    (16)
+
+#define MAX_MSG_LEN     (235)
+#define MAX_MSG_LEN_8   (1030)
+
+#define LOGCASH         (1)
+#define NOLOGCASH       (0)
+
+#define USERNOCASH      (0)
+#define USERDISCONNECT  (1)
+
+#define LOGEVENT_CONNECT            (0)
+#define LOGEVENT_DISCONNECT         (1)
+#define LOGEVENT_NEW_MONTH          (2)
+#define LOGEVENT_NO_CASH            (3)
+#define LOGEVENT_CONNECT_NO_CASH    (4)
+#define LOGEVENT_USER_DOWN          (5)
+#define LOGEVENT_DELETED            (6)
+
+#define SET_TARIFF_NOW     (0)
+#define SET_TARIFF_DELAYED (1)
+#define SET_TARIFF_RECALC  (2)
+
+#define CASH_SET    (0)
+#define CASH_ADD    (1)
+
+#define NO_TARIFF_NAME  "*_NO_TARIFF_*"
+#define NO_CORP_NAME    "*_NO_CORP_*"
+
+#define mega (1024 * 1024)
+
+#define MONITOR_TIME_DELAY_SEC  (60)
+
+#endif
diff --git a/include/stg/message.h b/include/stg/message.h
new file mode 100644 (file)
index 0000000..16fe566
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef STG_MESSAGES_H
+#define STG_MESSAGES_H
+
+/*
+ *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ */
+
+ /*
+ $Revision: 1.3 $
+ $Date: 2010/03/04 11:49:52 $
+ */
+
+#include <ctime>
+#include <string>
+
+#include "os_int.h"
+
+//-----------------------------------------------------------------------------
+struct STG_MSG_HDR
+{
+STG_MSG_HDR()
+    : id(0),
+      ver(0),
+      type(0),
+      lastSendTime(0),
+      creationTime(0),
+      showTime(0),
+      repeat(0),
+      repeatPeriod(0)
+{};
+
+uint64_t    id;
+unsigned    ver;
+unsigned    type;
+unsigned    lastSendTime;
+unsigned    creationTime;
+unsigned    showTime;
+int         repeat;
+unsigned    repeatPeriod;
+};
+//-----------------------------------------------------------------------------
+struct STG_MSG
+{
+STG_MSG() {};
+
+time_t GetNextSendTime() const
+{
+return header.lastSendTime + header.repeat * 60;
+};
+
+STG_MSG_HDR header;
+std::string text;
+};
+//-----------------------------------------------------------------------------
+
+#endif
index a1bdda7170205d76cc3fbc1eef6ac114ad26134b..bf8bc577adb42646fd103747980e72f6379a2f6c 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <cstring>
 
 
 #include <cstring>
 
-#include "stg_const.h"
+#include "const.h"
 #include "common.h"
 
 #define IPv4 (2)
 #include "common.h"
 
 #define IPv4 (2)
diff --git a/include/stg/stg_const.h b/include/stg/stg_const.h
deleted file mode 100644 (file)
index e882200..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *    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 2 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, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *    Author : Boris Mikhailenko <stg34@ua.fm>
- */
-
- /*
- $Author: nobunaga $
- $Revision: 1.10 $
- $Date: 2008/01/11 17:33:50 $
- */
-
-
-#ifndef STG_CONST_H
-#define STG_CONST_H
-
-#define DIR_NUM         (10)
-#define SYS_IFACE_LEN   (9)
-#define IFACE_LEN       (255)
-#define MAX_IP          (5)
-#define USERDATA_NUM    (10)
-
-#define LOGIN_LEN       (32)
-#define PASSWD_LEN      (32)
-#define ADDR_LEN        (255)
-#define NOTE_LEN        (255)
-#define REALNM_LEN      (255)
-#define GROUP_LEN       (255)
-#define PHONE_LEN       (255)
-#define EMAIL_LEN       (255)
-#define USR_IFACE_LEN   (255)
-#define USER_DATA_LEN   (255)
-#define IP_STRING_LEN   (255)
-
-#define ADM_LOGIN_LEN   (32)
-#define ADM_PASSWD_LEN  (32)
-#define TARIFF_NAME_LEN (32)
-#define SERVER_NAME_LEN (255)
-
-#define DIR_NAME_LEN    (16)
-
-#define MAX_MSG_LEN     (235)
-#define MAX_MSG_LEN_8   (1030)
-
-#define LOGCASH         (1)
-#define NOLOGCASH       (0)
-
-#define USERNOCASH      (0)
-#define USERDISCONNECT  (1)
-
-#define LOGEVENT_CONNECT            (0)
-#define LOGEVENT_DISCONNECT         (1)
-#define LOGEVENT_NEW_MONTH          (2)
-#define LOGEVENT_NO_CASH            (3)
-#define LOGEVENT_CONNECT_NO_CASH    (4)
-#define LOGEVENT_USER_DOWN          (5)
-#define LOGEVENT_DELETED            (6)
-
-#define SET_TARIFF_NOW     (0)
-#define SET_TARIFF_DELAYED (1)
-#define SET_TARIFF_RECALC  (2)
-
-#define CASH_SET    (0)
-#define CASH_ADD    (1)
-
-#define NO_TARIFF_NAME  "*_NO_TARIFF_*"
-#define NO_CORP_NAME    "*_NO_CORP_*"
-
-#define mega (1024 * 1024)
-
-#define MONITOR_TIME_DELAY_SEC  (60)
-
-#endif
diff --git a/include/stg/stg_message.h b/include/stg/stg_message.h
deleted file mode 100644 (file)
index 16fe566..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef STG_MESSAGES_H
-#define STG_MESSAGES_H
-
-/*
- *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- */
-
- /*
- $Revision: 1.3 $
- $Date: 2010/03/04 11:49:52 $
- */
-
-#include <ctime>
-#include <string>
-
-#include "os_int.h"
-
-//-----------------------------------------------------------------------------
-struct STG_MSG_HDR
-{
-STG_MSG_HDR()
-    : id(0),
-      ver(0),
-      type(0),
-      lastSendTime(0),
-      creationTime(0),
-      showTime(0),
-      repeat(0),
-      repeatPeriod(0)
-{};
-
-uint64_t    id;
-unsigned    ver;
-unsigned    type;
-unsigned    lastSendTime;
-unsigned    creationTime;
-unsigned    showTime;
-int         repeat;
-unsigned    repeatPeriod;
-};
-//-----------------------------------------------------------------------------
-struct STG_MSG
-{
-STG_MSG() {};
-
-time_t GetNextSendTime() const
-{
-return header.lastSendTime + header.repeat * 60;
-};
-
-STG_MSG_HDR header;
-std::string text;
-};
-//-----------------------------------------------------------------------------
-
-#endif
index f33a06539134a7589b7171a577f3797f5848322c..0eaf6c3e308b12b15f02f6504274021a8a2a3262 100644 (file)
@@ -38,7 +38,7 @@
 #include "admin_conf.h"
 #include "tariff_conf.h"
 #include "module_settings.h"
 #include "admin_conf.h"
 #include "tariff_conf.h"
 #include "module_settings.h"
-#include "stg_message.h"
+#include "message.h"
 
 //-----------------------------------------------------------------------------
 class STORE {
 
 //-----------------------------------------------------------------------------
 class STORE {
index 30f1981593392091457a771676058d2b5945bf94..31df4ec9146bd24af41642c4c4712744615c20ad 100644 (file)
@@ -31,7 +31,7 @@
 #include <vector>
 
 #include "resetable.h"
 #include <vector>
 
 #include "resetable.h"
-#include "stg_const.h"
+#include "const.h"
 
 //-----------------------------------------------------------------------------
 enum
 
 //-----------------------------------------------------------------------------
 enum
index adf140de0cac0cef36bf26a17f6d18bbeeedbd0c..51e8a76df281ff693146439ef713a48bbe612f14 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "os_int.h"
 #include "notifer.h"
 
 #include "os_int.h"
 #include "notifer.h"
-#include "stg_message.h"
+#include "message.h"
 #include "tariff.h"
 #include "user_traff.h"
 
 #include "tariff.h"
 #include "user_traff.h"
 
index 9a6efb23dc5d8ce4271be5af043434b3049c9d7e..70cb4fa7f5f2fd0d76e01f9abb02ef1b78dd0f55 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string>
 #include <vector>
 
 #include <string>
 #include <vector>
-#include "stg_const.h"
+#include "const.h"
 #include "user_ips.h"
 #include "resetable.h"
 #include "os_int.h"
 #include "user_ips.h"
 #include "resetable.h"
 #include "os_int.h"
index 78e5675a5f9adc453ae5ac13f8c8e06922630477..8b9341672f1480849b2b1a71d128a0646da01f1c 100644 (file)
@@ -18,8 +18,8 @@ $Author: faust $
 #include "store.h"
 #include "admin.h"
 #include "notifer.h"
 #include "store.h"
 #include "admin.h"
 #include "notifer.h"
-#include "stg_logger.h"
-#include "stg_locker.h"
+#include "logger.h"
+#include "locker.h"
 #include "script_executer.h"
 #include "noncopyable.h"
 
 #include "script_executer.h"
 #include "noncopyable.h"
 
index fdefee0fe26b7f54e7ca885884a65da1a33f433b..fa4cc7fd49274b5dec88104073bb428202f3b79c 100644 (file)
@@ -30,7 +30,7 @@
 #include <iostream>
 #include <vector>
 
 #include <iostream>
 #include <vector>
 
-#include "stg_const.h"
+#include "const.h"
 #include "os_int.h"
 
 enum TRAFF_DIRECTION {TRAFF_UPLOAD, TRAFF_DOWNLOAD};
 #include "os_int.h"
 
 enum TRAFF_DIRECTION {TRAFF_UPLOAD, TRAFF_DOWNLOAD};
index a143687cd66397cd44b5ea6b7c4ad663ec6025f0..569917d2138c6d656b561457566b521cd38610e2 100644 (file)
@@ -9,10 +9,10 @@ PROG = convertor
 SRCS = ./main.cpp \
        ./settings_impl.cpp
 
 SRCS = ./main.cpp \
        ./settings_impl.cpp
 
-STGLIBS =  -lstg_logger \
-           -lstg_common \
+STGLIBS =  -lstglogger \
+           -lstgcommon \
            -ldotconfpp \
            -ldotconfpp \
-          -lstg_crypto
+          -lstgcrypto
 
 LIBS += $(LIB_THREAD)
 
 
 LIBS += $(LIB_THREAD)
 
index 0ffb2b8bf216e107ecc8015d5029cacb5b7e7b6b..07fb1e2fbc3994d593cd0809252e87d37ade4949 100755 (executable)
@@ -52,8 +52,8 @@ echo "##########################################################################
 echo "       Building convertor for $sys $release"
 echo "#############################################################################"
 
 echo "       Building convertor for $sys $release"
 echo "#############################################################################"
 
-STG_LIBS="stg_logger.lib 
-          stg_locker.lib
+STG_LIBS="logger.lib 
+          locker.lib
          crypto.lib 
          common.lib 
          conffiles.lib
          crypto.lib 
          common.lib 
          conffiles.lib
index f6491c7bca0c38c035e30f0ed056df261b95e1ac..e0679d070fbf360fd11f1df31996fdba503849b5 100644 (file)
@@ -43,7 +43,7 @@
 #include "stg/admin_conf.h"
 #include "stg/tariff_conf.h"
 #include "stg/settings.h"
 #include "stg/admin_conf.h"
 #include "stg/tariff_conf.h"
 #include "stg/settings.h"
-#include "stg/stg_message.h"
+#include "stg/message.h"
 
 #include "settings_impl.h"
 
 
 #include "settings_impl.h"
 
index 0ad2e6b15fe48d0103b0c3f7b9d801f87ad1327c..bbfa45a16706e8e37930461ad3cb9187e03456f1 100755 (executable)
@@ -19,8 +19,8 @@ arc_name=$src_dir.tar.gz
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/common_settings.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/conffiles.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/crypto.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/common_settings.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/conffiles.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/crypto.lib $src_dir
-./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/stg_logger.lib $src_dir
-./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/stg_locker.lib $src_dir
+./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/logger.lib $src_dir
+./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/locker.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/hostallow.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/pinger.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/dotconfpp.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/hostallow.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/pinger.lib $src_dir
 ./get_from_cvs $cvs_user $cvs_pass $cvs_host /cvsroot/stglibs stglibs/dotconfpp.lib $src_dir
index 20530c5288567758285cffa29c41b0dd2e4344ff..da1a57681cd6de3c768ac26f068eaaf231695d87 100644 (file)
@@ -11,8 +11,8 @@ PROG = $(LIB_NAME).so
 SRCS = ./rlm_stg.cpp \
        ./stg_client.cpp
 
 SRCS = ./rlm_stg.cpp \
        ./stg_client.cpp
 
-STGLIBS = -lstg_common \
-          -lstg_crypto
+STGLIBS = -lstgcommon \
+          -lstgcrypto
 
 LIBS += $(LIB_THREAD)
 
 
 LIBS += $(LIB_THREAD)
 
index ff08de0dc08932104a26868b1a446725c6527d0a..2b6cbc1c4c6f2a778bd720dc93fa720a973876e5 100644 (file)
@@ -10,11 +10,11 @@ SRCS = ./main.cpp \
        ./listener.cpp \
        ./pidfile.cpp
 
        ./listener.cpp \
        ./pidfile.cpp
 
-STGLIBS =  -lstg_logger \
-           -lstg_common \
-          -lstg_crypto \
-           -lscript_executer \
-           -lconffiles
+STGLIBS =  -lstglogger \
+           -lstgcommon \
+          -lstgcrypto \
+           -lstgscriptexecuter \
+           -lstgconffiles
 
 LIBS += $(LIB_THREAD)
 
 
 LIBS += $(LIB_THREAD)
 
index 173e3afc82188c40cb88f08f245fb23fd7e99e16..a91d70c805cbbf843f054daf158bee788817288d 100755 (executable)
@@ -65,11 +65,11 @@ echo "##########################################################################
 echo "       Building rscriptd for $sys $release"
 echo "#############################################################################"
 
 echo "       Building rscriptd for $sys $release"
 echo "#############################################################################"
 
-STG_LIBS="stg_logger.lib 
-          stg_locker.lib
+STG_LIBS="logger.lib 
+          locker.lib
          crypto.lib 
          common.lib 
          crypto.lib 
          common.lib 
-         script_executer.lib 
+         scriptexecuter.lib 
          conffiles.lib"
 
 if [ "$OS" = "linux" ]
          conffiles.lib"
 
 if [ "$OS" = "linux" ]
index e6bd4d77788c0362f5db0fe8a8173721589f5ab1..47adc93b82aed9c29491f5f7532a077c415b9d45 100644 (file)
@@ -34,7 +34,7 @@
 #include <algorithm>
 
 #include "stg/script_executer.h"
 #include <algorithm>
 
 #include "stg/script_executer.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "stg/common.h"
 #include "listener.h"
 
 #include "stg/common.h"
 #include "listener.h"
 
index 16c492190a5853eef55f66d6cff634215488b311..1c88149a2016ef4b6de3c82be22a0ba98b60aff1 100644 (file)
@@ -29,7 +29,7 @@
 #include "stg/os_int.h"
 #include "stg/blowfish.h"
 #include "stg/rs_packets.h"
 #include "stg/os_int.h"
 #include "stg/blowfish.h"
 #include "stg/rs_packets.h"
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 
 struct UserData
 {
 
 struct UserData
 {
index 2f5f0baa5a642e29c7d59b5b80a9b8725e737e6b..714da32038aa5c7876b81f871223287f67f49c52 100644 (file)
@@ -39,8 +39,8 @@
 #include <set>
 
 #include "stg/common.h"
 #include <set>
 
 #include "stg/common.h"
-#include "stg/stg_logger.h"
-#include "stg/script_executer.h"
+#include "stg/logger.h"
+#include "stg/scriptexecuter.h"
 #include "stg/conffiles.h"
 #include "stg/version.h"
 #include "listener.h"
 #include "stg/conffiles.h"
 #include "stg/version.h"
 #include "listener.h"
index e586695bb0bfe86d1944be85b055abf9c369fcd6..338e35008f7be03b250236fc9dbdb1bed24e1255 100644 (file)
@@ -10,10 +10,10 @@ SRCS = ./main.cpp \
        ./settings_impl.cpp \
        ./web.cpp
 
        ./settings_impl.cpp \
        ./web.cpp
 
-STGLIBS =  -lconffiles \
-           -lstg_crypto \
-           -lstg_common \
-           -lia_auth_c
+STGLIBS =  -lstgconffiles \
+           -lstgcrypto \
+           -lstgcommon \
+           -lstgia
 
 LIBS += $(LIB_THREAD)
 
 
 LIBS += $(LIB_THREAD)
 
index 29109a3718a4bc7db19de2b01287b1d66f4bab16..7155188b6aa5da5d204f846c1b63fb34fae7fe82 100755 (executable)
@@ -68,7 +68,7 @@ echo "##########################################################################
 STG_LIBS="crypto.lib 
          common.lib 
          conffiles.lib
 STG_LIBS="crypto.lib 
          common.lib 
          conffiles.lib
-         ia_auth_c.lib"
+         ia.lib"
 
 if [ "$OS" = "linux" ]
 then
 
 if [ "$OS" = "linux" ]
 then
index c78f18edcc7e330ad52149e2690e50c9454bcce5..96c58203ec78c5d5463cae2a52eada20232ef723 100644 (file)
@@ -35,7 +35,7 @@
 #include <iostream>
 #include <vector>
 
 #include <iostream>
 #include <vector>
 
-#include "stg/ia_auth_c.h"
+#include "stg/ia.h"
 #include "stg/common.h"
 #include "web.h"
 #include "settings_impl.h"
 #include "stg/common.h"
 #include "web.h"
 #include "settings_impl.h"
index a4dfcb48d31305581466683b2d30799a27f06530..aa2227ee98a2d6d9f476e9d81a1d7cba0e15b3c7 100644 (file)
@@ -39,7 +39,7 @@
 #include <string>
 #include <list>
 
 #include <string>
 #include <list>
 
-#include "stg/stg_const.h"
+#include "stg/const.h"
 #include "stg/ia_packets.h"
 
 using namespace std;
 #include "stg/ia_packets.h"
 
 using namespace std;
index 4a0514125b1eb3ac7fa17e9b5cbb234a845d7b33..991355565f633aacbc52655f83df14464940a023 100644 (file)
@@ -9,10 +9,10 @@ PROG = sgconf
 SRCS = ./main.cpp \
        ./common_sg.cpp
 
 SRCS = ./main.cpp \
        ./common_sg.cpp
 
-STGLIBS =  -lconffiles \
-           -lstg_common \
-          -lstg_crypto \
-           -lsrvconf
+STGLIBS =  -lstgconffiles \
+           -lstgcommon \
+          -lstgcrypto \
+           -lstgsrvconf
 
 LIBS += -lexpat \
        $(LIB_THREAD)
 
 LIBS += -lexpat \
        $(LIB_THREAD)
index c80986614fcea6a376a3586e480fb1a9d5a2912b..daddec1d3401f6d2eec33d1a2678a98823bd922a 100644 (file)
@@ -34,7 +34,7 @@
 #include <string>
 
 #include "stg/resetable.h"
 #include <string>
 
 #include "stg/resetable.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 #include "stg/os_int.h"
 
 #define TARIFF_NOW  (0)
 #include "stg/os_int.h"
 
 #define TARIFF_NOW  (0)
index 33989ae2c4a3225e70744438a39983593239f7ef..752f05a5f6c4a43a419c499c76f3675481e29bd5 100644 (file)
@@ -9,10 +9,10 @@ PROG = sgconf_xml
 SRCS = ./main.cpp \
        ./parser.cpp
 
 SRCS = ./main.cpp \
        ./parser.cpp
 
-LIBS =  -lconffiles \
-        -lstg_crypto \
-        -lstg_common \
-        -lsrvconf
+LIBS =  -lstgconffiles \
+        -lstgcrypto \
+        -lstgcommon \
+        -lstgsrvconf
 
 LIBS += -lexpat \
        $(LIB_THREAD)
 
 LIBS += -lexpat \
        $(LIB_THREAD)
index bbd46325eb936ba5d7d890d9bdbfb4290453141f..004f89b0844b9deadcc8ce3a1aa375d9d6d24db6 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "stg/resetable.h"
 #include "stg/os_int.h"
 
 #include "stg/resetable.h"
 #include "stg/os_int.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 
 #ifndef ENODATA
 #define ENODATA 61
 
 #ifndef ENODATA
 #define ENODATA 61
index beac6fc6c062667bb70c0e5897d0487dddc58ffc..56a1ebf9e855723d17422a0c842dc60318ae3082 100644 (file)
@@ -22,10 +22,10 @@ SRCS = ./admin_impl.cpp \
        ./user_property.cpp \
        ./users_impl.cpp
 
        ./user_property.cpp \
        ./users_impl.cpp
 
-STGLIBS =  -lstg_logger \
-          -lstg_locker \
-           -lstg_common \
-           -lscript_executer \
+STGLIBS =  -lstglogger \
+          -lstglocker \
+           -lstgcommon \
+           -lstgscriptexecuter \
            -ldotconfpp
 
 LIBS += -lexpat
            -ldotconfpp
 
 LIBS += -lexpat
index 29dce606502711d63b6c69797727fc323a8e61a0..d7874373e949b2dc753f01ec12b5b5ff2782fa89 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <algorithm>
 
 
 #include <algorithm>
 
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 
 // Polymorphick action invocation
 template <class ACTIVE_CLASS, typename DATA_TYPE>
 
 // Polymorphick action invocation
 template <class ACTIVE_CLASS, typename DATA_TYPE>
index 69f384201f9a9440f31539c025b8f74075c8e9e1..6d58336e2e091083749819ee243cef1b7307fffa 100644 (file)
@@ -36,7 +36,7 @@
 #include "stg/admin.h"
 #include "stg/os_int.h"
 #include "stg/admin_conf.h"
 #include "stg/admin.h"
 #include "stg/os_int.h"
 #include "stg/admin_conf.h"
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 
 class ADMIN_IMPL : public ADMIN {
 public:
 
 class ADMIN_IMPL : public ADMIN {
 public:
index 9ca571e38b979a242c265d05ba53b0cebc7b3da7..170f3a4f3cb74a01ea9fcbb648fc5b94fe4ab6a7 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "stg/admins.h"
 #include "stg/admin.h"
 
 #include "stg/admins.h"
 #include "stg/admin.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "stg/store.h"
 #include "stg/noncopyable.h"
 #include "admin_impl.h"
 #include "stg/store.h"
 #include "stg/noncopyable.h"
 #include "admin_impl.h"
index 36f2f7339bd1ca61c08f7da48928ecab0ab3d856..1779160b5f504f9915c145e6b9e158e4de621f74 100755 (executable)
@@ -112,11 +112,11 @@ echo "##########################################################################
 echo "       Building STG 2.4 for $sys $release"
 echo "#############################################################################"
 
 echo "       Building STG 2.4 for $sys $release"
 echo "#############################################################################"
 
-STG_LIBS="stg_logger.lib 
-          stg_locker.lib
+STG_LIBS="logger.lib 
+          locker.lib
          crypto.lib 
          common.lib 
          crypto.lib 
          common.lib 
-         script_executer.lib 
+         scriptexecuter.lib 
          conffiles.lib
          pinger.lib 
          dotconfpp.lib"
          conffiles.lib
          pinger.lib 
          dotconfpp.lib"
index 96c1ca4ff0fe9ccaf8dfe7d42be00612835bd6a0..1d1a209d9bc9e574bcac360d2a8b4d95e4fb8838 100644 (file)
@@ -1,7 +1,7 @@
 #include <cerrno>
 #include <cstring>
 
 #include <cerrno>
 #include <cstring>
 
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "stg/common.h"
 #include "eventloop.h"
 
 #include "stg/common.h"
 #include "eventloop.h"
 
index 3ba9ccf376aa93406b72ce3eee75f20480af0845..46ea717de0f319eee36f738a14454d2bbc354381 100644 (file)
@@ -43,7 +43,7 @@
 #include "stg/user.h"
 #include "stg/common.h"
 #include "stg/plugin.h"
 #include "stg/user.h"
 #include "stg/common.h"
 #include "stg/plugin.h"
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 #include "stg/script_executer.h"
 #include "stg/conffiles.h"
 #include "stg/version.h"
 #include "stg/script_executer.h"
 #include "stg/conffiles.h"
 #include "stg/version.h"
index a47cea239842e88e8bfe61446d716d5ddcc4f4d3..a8651d64a10f2059a8f7233d3ac4d01e1377762c 100644 (file)
@@ -8,7 +8,7 @@ PROG = mod_auth_ao.so
 
 SRCS = ./ao.cpp
 
 
 SRCS = ./ao.cpp
 
-STGLIBS = -lstg_common
+STGLIBS = -lstgcommon
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 629977156428621b5888b0aff9e21f96bdaab7f0..15fd52878c6c75884835a7e13ff84d0f047c3de5 100644 (file)
@@ -10,7 +10,7 @@ PROG = mod_auth_ia.so
 
 SRCS = ./inetaccess.cpp
 
 
 SRCS = ./inetaccess.cpp
 
-STGLIBS = -lstg_common -lstg_crypto
+STGLIBS = -lstgcommon -lstgcrypto
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index c58e8db1fad0d6272f32873f491c590d3576be69..8e44ed5ed276289fd93941d51b85960c2b093d53 100644 (file)
@@ -40,7 +40,7 @@
 #include <algorithm>
 
 #include "stg/common.h"
 #include <algorithm>
 
 #include "stg/common.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "stg/tariff.h"
 #include "stg/user_property.h"
 #include "stg/settings.h"
 #include "stg/tariff.h"
 #include "stg/user_property.h"
 #include "stg/settings.h"
index 707ed96811453796e2f4f5c3ae9d2ff282e4e1d5..e16c02574c95d45aa6c8516c4062f85ffdff42cf 100644 (file)
@@ -47,7 +47,7 @@
 #include "stg/users.h"
 #include "stg/ia_packets.h"
 #include "stg/blowfish.h"
 #include "stg/users.h"
 #include "stg/ia_packets.h"
 #include "stg/blowfish.h"
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 #include "stg/utime.h"
 
 extern "C" PLUGIN * GetPlugin();
 #include "stg/utime.h"
 
 extern "C" PLUGIN * GetPlugin();
index ade37382bcc7eff5d6398695fd8a14d0de4372ce..916ae175591691ce6e5f95b6169b97511aeeda72 100644 (file)
@@ -16,7 +16,7 @@ SRCS = ./debug_cap.cpp \
        ./tcp.c \
        ./udp.c
 
        ./tcp.c \
        ./udp.c
 
-STGLIBS = -lstg_common
+STGLIBS = -lstgcommon
 
 LIBS += $(LIB_THREAD)
 
 
 LIBS += $(LIB_THREAD)
 
index 3eddb29e864630274a095aa4e1a27c40739339b4..b0f7713d8a68ee6b69a2f2e217d1fa1bf8166898 100644 (file)
@@ -9,7 +9,7 @@ PROG = mod_cap_nf.so
 SRCS = ./cap_nf.cpp
 
 LIBS += $(LIB_THREAD)
 SRCS = ./cap_nf.cpp
 
 LIBS += $(LIB_THREAD)
-STGLIBS = -lstg_common
+STGLIBS = -lstgcommon
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index cd7824a72be4b6496e771deca1665a3b9b779cdd..2fbc97d62a1d509ab507b295d0bdefa4bb66f58d 100644 (file)
@@ -8,7 +8,7 @@ PROG = mod_cap_divert.so
 
 SRCS = ./divert_cap.cpp 
 
 
 SRCS = ./divert_cap.cpp 
 
-STGLIBS = -lstg_common
+STGLIBS = -lstgcommon
 
 LIBS += $(LIB_THREAD)
 
 
 LIBS += $(LIB_THREAD)
 
index 4ab0480c4807b5f2c6f1e5afe043a62d6142d9dc..f4b86e211e0f71156145c4c3bdb9f6dff77b3b6c 100644 (file)
@@ -8,7 +8,7 @@ PROG = mod_cap_bpf.so
 
 SRCS = ./ether_cap.cpp 
 
 
 SRCS = ./ether_cap.cpp 
 
-STGLIBS = -lstg_common
+STGLIBS = -lstgcommon
 
 LIBS += $(LIB_THREAD)
 
 
 LIBS += $(LIB_THREAD)
 
index f10886c6a97da4be13103a88c316e9e19dc75971..4cd78a3c5b9df83360f2d9cc4cc028924ff93768 100644 (file)
@@ -9,7 +9,7 @@ PROG = mod_cap_ether.so
 SRCS = ./ether_cap.cpp 
 
 LIBS += $(LIB_THREAD)
 SRCS = ./ether_cap.cpp 
 
 LIBS += $(LIB_THREAD)
-STGLIBS = -lstg_common
+STGLIBS = -lstgcommon
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 7cf9299619f57507753d83467b5ba329d647bce8..988cd9485107a88e12b1a7895d287984bc549b0e 100644 (file)
@@ -10,7 +10,7 @@ SRCS = ./ipq_cap.cpp \
        ./libipq.c
 
 LIBS += $(LIB_THREAD)
        ./libipq.c
 
 LIBS += $(LIB_THREAD)
-STGLIBS = -lstg_common
+STGLIBS = -lstgcommon
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index c2fb03d63f9bf21ec5e50bf00cd58b3ae252078c..e0e090521fe206422834957a51f22d6efad30a9c 100644 (file)
@@ -24,7 +24,7 @@ ifneq ($(OS),linux)
 LIBS += -liconv
 endif
 
 LIBS += -liconv
 endif
 
-STGLIBS = -lstg_common -lstg_logger
+STGLIBS = -lstgcommon -lstglogger
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 695da284a52af3739ce041cd3a48589aa87a3783..14319aa19e2490cae5746da31bdcbac3bd597bed 100644 (file)
@@ -1,4 +1,4 @@
-#include "stg/stg_message.h"
+#include "stg/message.h"
 #include "stg/common.h"
 #include "utils.h"
 #include "messages_methods.h"
 #include "stg/common.h"
 #include "utils.h"
 #include "messages_methods.h"
index 13bf54845a2c88472a7ed0a0b46115216404ded3..6d1a7a7bb99d5a0f1af9db4f03587af0cbe99d21 100644 (file)
@@ -18,6 +18,6 @@ SRCS = ./stgconfig.cpp \
 LIBS += -lexpat \
        -lboost_thread-mt
 
 LIBS += -lexpat \
        -lboost_thread-mt
 
-STGLIBS = -lstg_common -lstg_logger -lcrypto
+STGLIBS = -lstgcommon -lstglogger -lcrypto
 
 include ../../Makefile.in
 
 include ../../Makefile.in
index 8f065d1609aeb29bfe693692856b58801a1ee464..f49ed0189bbed5bfae25b950c5a3b267f3d055ef 100644 (file)
@@ -16,7 +16,7 @@ SRCS = ./stgconfig.cpp \
 LIBS += -lexpat \
        $(LIB_THREAD)
 
 LIBS += -lexpat \
        $(LIB_THREAD)
 
-STGLIBS = -lstg_common -lstg_logger -lstg_crypto
+STGLIBS = -lstgcommon -lstglogger -lstgcrypto
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 8c5aa3c59a5a4b900eb17fd2ea32a4acb43bc043..efecd121458f8e8214e07f8a11b1be56b8f129cf 100644 (file)
@@ -38,7 +38,7 @@
 #include "stg/users.h"
 #include "stg/admins.h"
 #include "stg/tariffs.h"
 #include "stg/users.h"
 #include "stg/admins.h"
 #include "stg/tariffs.h"
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 #include "parser.h"
 
 #define  STG_HEADER     "SG04"
 #include "parser.h"
 
 #define  STG_HEADER     "SG04"
index af85b7102f98e72cc5e88d24f0a1b2b218c1e58e..da62dcb4ad165bc691f6bfa9a465a3eeed14d9df 100644 (file)
 #include <vector>
 
 #include "stg/resetable.h"
 #include <vector>
 
 #include "stg/resetable.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 #include "stg/store.h"
 #include "stg/admins.h"
 #include "stg/admin.h"
 #include "stg/users.h"
 #include "stg/store.h"
 #include "stg/admins.h"
 #include "stg/admin.h"
 #include "stg/users.h"
-#include "stg/stg_message.h"
+#include "stg/message.h"
 
 class TARIFFS;
 class SETTINGS;
 
 class TARIFFS;
 class SETTINGS;
index ab02cdff90f03187b9c9032a4727d4a993bbe89f..290a616bfb09ea79e6dad536465ea7194a6f32d2 100644 (file)
@@ -16,7 +16,7 @@ SRCS = ./stgconfig.cpp \
 LIBS += -lexpat \
        $(LIB_THREAD)
 
 LIBS += -lexpat \
        $(LIB_THREAD)
 
-STGLIBS = -lstg_common -lstg_logger
+STGLIBS = -lstgcommon -lstglogger
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 7bdfb21f5f9dd15ddff3779222f6558235ff5cf1..5aea5499845369744a5b22e721da47cec8e19e65 100644 (file)
@@ -39,7 +39,7 @@
 #include "users.h"
 #include "admins.h"
 #include "tariffs.h"
 #include "users.h"
 #include "admins.h"
 #include "tariffs.h"
-#include "stg_logger.h"
+#include "logger.h"
 
 using namespace std;
 
 
 using namespace std;
 
index 9e8a8bd94884f0d2223eb112c095b9f25c21176d..7deac3345e36ccd628fcf2e71a94da04ac866116 100644 (file)
 using namespace std;
 
 #include "resetable.h"
 using namespace std;
 
 #include "resetable.h"
-#include "stg_const.h"
+#include "const.h"
 #include "store.h"
 #include "admins.h"
 #include "users.h"
 #include "store.h"
 #include "admins.h"
 #include "users.h"
-#include "stg_message.h"
+#include "message.h"
 
 //-----------------------------------------------------------------------------
 class BASE_PARSER {
 
 //-----------------------------------------------------------------------------
 class BASE_PARSER {
index 3e4d36d56e7b65c11851fccf5fee36993bfbe89b..212bd2889b1d7132c0861b16531908e38cf17dc9 100644 (file)
@@ -10,7 +10,7 @@ PROG = mod_ping.so
 
 SRCS = ./ping.cpp
 
 
 SRCS = ./ping.cpp
 
-STGLIBS = -lstg_pinger -lstg_common
+STGLIBS = -lstgpinger -lstgcommon
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 5f87a99fcf76dcb69c39538d58a905b823ff5d9d..0fb5d30bda075db38a5e69840bd6b1553fd66715 100644 (file)
@@ -5,7 +5,7 @@
 #include <algorithm>
 
 #include "stg/user.h"
 #include <algorithm>
 
 #include "stg/user.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "stg/user_property.h"
 #include "ping.h"
 
 #include "stg/user_property.h"
 #include "ping.h"
 
index 68be76188f0b3f87968a4033b68830a9895aee9f..9735fb67d9d52493b2e20e2bdfe3e5efde9c7b87 100644 (file)
@@ -10,7 +10,7 @@ PROG = mod_radius.so
 
 SRCS = ./radius.cpp
 
 
 SRCS = ./radius.cpp
 
-STGLIBS = -lstg_common -lstg_crypto
+STGLIBS = -lstgcommon -lstgcrypto
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index cad853c7e4a782d8f0bd77f3553ccf3ac3e2f698..343d1150db8dbf106bebf17b1cdd9ee4229e7a5b 100644 (file)
@@ -11,7 +11,7 @@ PROG = mod_remote_script.so
 SRCS = ./rscript.cpp \
        ./nrmap_parser.cpp
 
 SRCS = ./rscript.cpp \
        ./nrmap_parser.cpp
 
-STGLIBS = -lstg_common -lstg_crypto
+STGLIBS = -lstgcommon -lstgcrypto
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index df172364bc03c6b34b94ee303ae572b46ce1d8f2..12c00a402b5c9407253c85742bb50d7494d5fecf 100644 (file)
@@ -32,7 +32,7 @@
 #include <algorithm>
 
 #include "stg/common.h"
 #include <algorithm>
 
 #include "stg/common.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "stg/user_property.h"
 #include "rscript.h"
 #include "ur_functor.h"
 #include "stg/user_property.h"
 #include "rscript.h"
 #include "ur_functor.h"
index 0046e2cf160c3f0b6931a46b4c2ca6e2ad9856da..ccc637274ebb2a3f6e4e1d8bf332c031d983b173 100644 (file)
@@ -23,8 +23,8 @@ PROG = mod_userstat.so
 SRCS = ./userstat.cpp \
        ./datathread.cpp
 
 SRCS = ./userstat.cpp \
        ./datathread.cpp
 
-LIBS += -lstg_common \
-       -lstg_crypto
+LIBS += -lstgcommon \
+       -lstgcrypto
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 3357a50142fa3c5252a5abbda1feaebe0fa4f91f..8bf5777a39fa1f7a095efa7f0bd3fbfc4e45df75 100644 (file)
@@ -8,7 +8,7 @@ PROG = mod_store_files.so
 
 SRCS = ./file_store.cpp
 
 
 SRCS = ./file_store.cpp
 
-STGLIBS = -lconffiles -lstg_common -lstg_locker -lstg_crypto
+STGLIBS = -lstgconffiles -lstgcommon -lstglocker -lstgcrypto
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 555020b7ad37a339b5c6de3952ec8e117a5adb90..a0c3f9156d00c20fed4a017bb420e8c5ac477808 100644 (file)
 #include "stg/user_ips.h"
 #include "stg/user_conf.h"
 #include "stg/user_stat.h"
 #include "stg/user_ips.h"
 #include "stg/user_conf.h"
 #include "stg/user_stat.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 #include "stg/blowfish.h"
 #include "stg/blowfish.h"
-#include "stg/stg_logger.h"
-#include "stg/stg_locker.h"
+#include "stg/logger.h"
+#include "stg/locker.h"
 #include "file_store.h"
 
 #define DELETED_USERS_DIR   "deleted_users"
 #include "file_store.h"
 
 #define DELETED_USERS_DIR   "deleted_users"
index 7304d4de703f6982f42bb665f6153c73418ecce7..8b175fd99e32de2f263bea242710778bf811108b 100644 (file)
@@ -17,7 +17,7 @@ SRCS =        ./firebird_store.cpp \
        ./firebird_store_users.cpp \
        ./firebird_store_utils.cpp
 
        ./firebird_store_users.cpp \
        ./firebird_store_utils.cpp
 
-STGLIBS = -libpp -lstg_common -lstg_locker -lstg_crypto
+STGLIBS = -libpp -lstgcommon -lstglocker -lstgcrypto
 
 include ../../Makefile.in
 
 
 include ../../Makefile.in
 
index 73c2f19e1bfb2227efc1bb0cc9a6aa738ce41baf..69815fe57215fd7967bc6f8190fc066f380cc573 100644 (file)
@@ -35,7 +35,7 @@
 #include <map>
 
 #include "stg/store.h"
 #include <map>
 
 #include "stg/store.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "stg/ibpp.h"
 
 struct ToLower {
 #include "stg/ibpp.h"
 
 struct ToLower {
index 5e959abde550259e61f9a2b69826feaff693d0c1..a31ca3f80c5c9921c77d1fadc5ed5bb667f2c63b 100644 (file)
@@ -26,7 +26,7 @@
  *
  */
 
  *
  */
 
-#include "stg/stg_const.h"
+#include "stg/const.h"
 #include "firebird_store.h"
 #include "stg/ibpp.h"
 
 #include "firebird_store.h"
 #include "stg/ibpp.h"
 
index 0c01bd5ae365b9c62fce2aaf5213d678c12ff428..81196222db5bbff9beec8c32b19e276d4f6e1535 100644 (file)
@@ -8,7 +8,7 @@ PROG = mod_store_mysql.so
 
 SRCS = ./mysql_store.cpp
 
 
 SRCS = ./mysql_store.cpp
 
-STGLIBS = -lstg_common -lstg_crypto
+STGLIBS = -lstgcommon -lstgcrypto
 
 MYSQL_CFLAGS = $(shell mysql_config --cflags)
 MYSQL_LDFLAGS = $(shell mysql_config --libs_r)
 
 MYSQL_CFLAGS = $(shell mysql_config --cflags)
 MYSQL_LDFLAGS = $(shell mysql_config --libs_r)
index 522058dda5bbefe9a03ebfc27fae17d2af0e846f..fa6ebf0d38a1d89990223ffaa04f2bb3d25f7363 100644 (file)
@@ -15,7 +15,7 @@ SRCS =        ./postgresql_store.cpp \
        ./postgresql_store_users.cpp \
        ./postgresql_store_utils.cpp
 
        ./postgresql_store_users.cpp \
        ./postgresql_store_utils.cpp
 
-STGLIBS = -lstg_common -lstg_crypto
+STGLIBS = -lstgcommon -lstgcrypto
 
 PG_CFLAGS = $(shell pg_config --includedir)
 PG_LDFLAGS = $(shell pg_config --libdir)
 
 PG_CFLAGS = $(shell pg_config --includedir)
 PG_LDFLAGS = $(shell pg_config --libdir)
index 9670ce83888cd042a52f9a1eef184c1f3cee4da5..5b27cb8034cb7996b5c2cecfc3d76e0fbe85064c 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <libpq-fe.h>
 
 
 #include <libpq-fe.h>
 
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "stg/admin_conf.h"
 #include "stg/blowfish.h"
 #include "postgresql_store.h"
 #include "stg/admin_conf.h"
 #include "stg/blowfish.h"
 #include "postgresql_store.h"
index 08848ea49cb26b0e946bbcead31569c1dcde59a8..c358a4c5fb7364e0c4f1b9ff9d97e21a96bdef0e 100644 (file)
@@ -33,7 +33,7 @@
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::GetCorpsList(vector<string> * corpsList) const
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::GetCorpsList(vector<string> * corpsList) const
index e4c87cdd7b2bfea94aac8e70f81064aa521583f0..4260c3b4493551da4c0aef7e674b7c5e11a7839a 100644 (file)
@@ -34,8 +34,8 @@
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
-#include "stg/stg_locker.h"
-#include "stg/stg_message.h"
+#include "stg/locker.h"
+#include "stg/message.h"
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::AddMessage(STG_MSG * msg, const string & login) const
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::AddMessage(STG_MSG * msg, const string & login) const
index 82a999f7058a3ab1b110d2e8d7d6804365c8d744..b509c0f0202b7fdb88621dc931f744f2385f7f09 100644 (file)
@@ -34,7 +34,7 @@
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::GetServicesList(vector<string> * servicesList) const
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::GetServicesList(vector<string> * servicesList) const
index fc35f7889092e7141207dce4e8a173b80b07d64c..bb64756369d712a801347f06d913d0eb35fc1f7c 100644 (file)
@@ -33,7 +33,7 @@
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::GetTariffsList(vector<string> * tariffsList) const
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::GetTariffsList(vector<string> * tariffsList) const
index c1c48e250673c141f816cec40c0e77c087fa5363..11c757f263b13043bda75dc54280fda34b3618b8 100644 (file)
@@ -33,8 +33,8 @@
 
 #include <libpq-fe.h>
 
 
 #include <libpq-fe.h>
 
-#include "stg/stg_const.h"
-#include "stg/stg_locker.h"
+#include "stg/const.h"
+#include "stg/locker.h"
 #include "../../../stg_timer.h"
 #include "postgresql_store.h"
 
 #include "../../../stg_timer.h"
 #include "postgresql_store.h"
 
index 361993c9fe8acaba1365362e081e5947b5da7b7d..e0eb46399b79dd2eafeaf4538e4aa29e3ede36ec 100644 (file)
@@ -32,7 +32,7 @@ $Author: faust $
 #include <cerrno>
 #include <string>
 
 #include <cerrno>
 #include <string>
 
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 #include "stg/dotconfpp.h"
 #include "settings_impl.h"
 
 #include "stg/dotconfpp.h"
 #include "settings_impl.h"
 
index f7ded85385cad37d4ec5ad848cd54e49429a8977..c7829b274be1f35912f897b5012bca0e0dd07a90 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "stg/settings.h"
 #include "stg/common.h"
 
 #include "stg/settings.h"
 #include "stg/common.h"
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 #include "stg/module_settings.h"
 
 //-----------------------------------------------------------------------------
 #include "stg/module_settings.h"
 
 //-----------------------------------------------------------------------------
index c244cb692ac8907bd73c4ff5f37403467282be1b..61e3e12c88ac5a69e3c9c2e81b617838f339f2f3 100644 (file)
@@ -32,8 +32,8 @@
 #include <algorithm>
 #include <vector>
 
 #include <algorithm>
 #include <vector>
 
-#include "stg/stg_locker.h"
-#include "stg/stg_logger.h"
+#include "stg/locker.h"
+#include "stg/logger.h"
 #include "stg/store.h"
 #include "stg/admin.h"
 #include "tariffs_impl.h"
 #include "stg/store.h"
 #include "stg/admin.h"
 #include "tariffs_impl.h"
index 45ba883e93da3dc955fdab1bacf20c0058a1e2f6..3f6eb0c0f9980e4486ab04284a686b4b11a4fad1 100644 (file)
@@ -39,7 +39,7 @@
 #include <cstdio> // fopen and similar
 
 #include "stg/common.h"
 #include <cstdio> // fopen and similar
 
 #include "stg/common.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 #include "traffcounter_impl.h"
 #include "stg_timer.h"
 
 #include "traffcounter_impl.h"
 #include "stg_timer.h"
 
index 27e7c03c637ee48fc5a03c9b9d57c810e050833b..c30f6be4f01754b3dcc45a4873f4bf07b5b92390 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "stg/traffcounter.h"
 #include "stg/os_int.h"
 
 #include "stg/traffcounter.h"
 #include "stg/os_int.h"
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 #include "stg/raw_ip_packet.h"
 #include "stg/users.h"
 #include "stg/noncopyable.h"
 #include "stg/raw_ip_packet.h"
 #include "stg/users.h"
 #include "stg/noncopyable.h"
index 935dcd0e0a90368c8c0f897667df0f963af189bf..be28cc96d2aabdf41d33d33619e5fbd3cb126580 100644 (file)
 
 #include "stg/user.h"
 #include "stg/os_int.h"
 
 #include "stg/user.h"
 #include "stg/os_int.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 #include "stg/user_stat.h"
 #include "stg/user_conf.h"
 #include "stg/user_ips.h"
 #include "stg/user_property.h"
 #include "stg/auth.h"
 #include "stg/user_stat.h"
 #include "stg/user_conf.h"
 #include "stg/user_ips.h"
 #include "stg/user_property.h"
 #include "stg/auth.h"
-#include "stg/stg_message.h"
+#include "stg/message.h"
 #include "stg/noncopyable.h"
 
 //-----------------------------------------------------------------------------
 #include "stg/noncopyable.h"
 
 //-----------------------------------------------------------------------------
index 37edef7a22483ef0a3d78bb878a6562cdfbcdca2..f0b8ae25f73fdc7ecf3b57a6ec3ad9128958b166 100644 (file)
@@ -41,7 +41,7 @@ $Author: faust $
 #include "stg/users.h"
 #include "stg/user.h"
 #include "stg/tariffs.h"
 #include "stg/users.h"
 #include "stg/user.h"
 #include "stg/tariffs.h"
-#include "stg/stg_logger.h"
+#include "stg/logger.h"
 #include "stg/notifer.h"
 #include "stg/noncopyable.h"
 #include "actions.h"
 #include "stg/notifer.h"
 #include "stg/noncopyable.h"
 #include "actions.h"
index eb0959b78aaeb62b3d652371fe4e92b0e5af857a..3e52ad8d32006480269b66194f1b68d9ab68c2b7 100644 (file)
@@ -4,11 +4,11 @@
 
 include ../../Makefile.conf
 
 
 include ../../Makefile.conf
 
-LIB_NAME = stg_common
+LIB_NAME = stgcommon
 PROG = lib$(LIB_NAME)
 
 SRCS = common.cpp \
 PROG = lib$(LIB_NAME)
 
 SRCS = common.cpp \
-       stg_strptime.cpp
+       strptime.cpp
 
 INCS = common.h
 
 
 INCS = common.h
 
index beba4508dd96b2070087a51b019fca4e3210bc1e..3752822aa728a067481c810d3c9ed3fa99a0314a 100644 (file)
@@ -35,7 +35,7 @@
 #include <string>
 
 #include "stg/os_int.h"
 #include <string>
 
 #include "stg/os_int.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 
 #define STAT_TIME_3         (1)
 #define STAT_TIME_2         (2)
 
 #define STAT_TIME_3         (1)
 #define STAT_TIME_2         (2)
diff --git a/stglibs/common.lib/stg_strptime.cpp b/stglibs/common.lib/stg_strptime.cpp
deleted file mode 100644 (file)
index 0e1fde2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * $Revision: 1.1 $
- * $Date: 2007/05/17 08:25:58 $
- *
- * This file contain a replacement of commonly used function strptime
- * Under some OS's it appears only with _XOPEN_SOURCE definition
- *
- */
-
-#define _XOPEN_SOURCE
-#include <time.h>
-
-char * stg_strptime(const char * a, const char * b, struct tm * tm)
-{
-return strptime(a, b, tm);
-}
-
diff --git a/stglibs/common.lib/strptime.cpp b/stglibs/common.lib/strptime.cpp
new file mode 100644 (file)
index 0000000..0e1fde2
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * $Revision: 1.1 $
+ * $Date: 2007/05/17 08:25:58 $
+ *
+ * This file contain a replacement of commonly used function strptime
+ * Under some OS's it appears only with _XOPEN_SOURCE definition
+ *
+ */
+
+#define _XOPEN_SOURCE
+#include <time.h>
+
+char * stg_strptime(const char * a, const char * b, struct tm * tm)
+{
+return strptime(a, b, tm);
+}
+
index 2cd4fb3ddaeba6e87ce28c9d40b358f054733b96..28505b6f1a62eeeff428421ea238642571c29cfc 100644 (file)
@@ -2,7 +2,7 @@
 # $Id: Makefile,v 1.4 2007/05/08 14:29:19 faust Exp $
 ###############################################################################
 
 # $Id: Makefile,v 1.4 2007/05/08 14:29:19 faust Exp $
 ###############################################################################
 
-LIB_NAME = conffiles
+LIB_NAME = stgconffiles
 PROG = lib$(LIB_NAME)
 
 SRCS = conffiles.cpp
 PROG = lib$(LIB_NAME)
 
 SRCS = conffiles.cpp
index 6fe383ad3f72f5e8f5db80efcb0394e07db49cd0..36ef7ee6052b30e8b6b608c31f8e74989d934944 100644 (file)
@@ -2,7 +2,7 @@
 # $Id: Makefile,v 1.5 2009/10/09 07:15:48 nobunaga Exp $
 ###############################################################################
 
 # $Id: Makefile,v 1.5 2009/10/09 07:15:48 nobunaga Exp $
 ###############################################################################
 
-LIB_NAME = stg_crypto
+LIB_NAME = stgcrypto
 PROG = lib$(LIB_NAME)
 
 SRCS = ag_md5.cpp \
 PROG = lib$(LIB_NAME)
 
 SRCS = ag_md5.cpp \
index e9d2bde41159678c4157839d0f40a9eec82d7a9d..ad482b7925d9805c8104803d0b5a26b3513a1423 100644 (file)
@@ -8,7 +8,7 @@
 #include <cstring>
 
 #include "blowfish.h"
 #include <cstring>
 
 #include "blowfish.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 
 /*typedef struct _BCoptions
     {
 
 /*typedef struct _BCoptions
     {
diff --git a/stglibs/ia.lib/Makefile b/stglibs/ia.lib/Makefile
new file mode 100644 (file)
index 0000000..f6638bc
--- /dev/null
@@ -0,0 +1,16 @@
+###############################################################################
+# $Id: Makefile,v 1.11 2010/08/18 07:47:03 faust Exp $
+###############################################################################
+
+LIB_NAME = stgia
+PROG = lib$(LIB_NAME)
+
+SRCS = ia.cpp
+
+INCS = ia.h
+
+STGLIBS = -lstgcommon \
+         -lstgcrypto
+LIBS = $(LIB_THREAD)
+
+include ../Makefile.in
diff --git a/stglibs/ia.lib/ia.bpf b/stglibs/ia.lib/ia.bpf
new file mode 100644 (file)
index 0000000..e3c42ce
--- /dev/null
@@ -0,0 +1,9 @@
+//---------------------------------------------------------------------------
+
+#include <vcl.h>
+#pragma hdrstop
+#define Library
+
+// To add a file to the library use the Project menu 'Add to Project'.
+
\ No newline at end of file
diff --git a/stglibs/ia.lib/ia.bpr b/stglibs/ia.lib/ia.bpr
new file mode 100644 (file)
index 0000000..c80bf51
--- /dev/null
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+  <MACROS>
+    <VERSION value="BCB.06.00"/>
+    <PROJECT value="..\..\lib\ia_auth_c.lib"/>
+    <OBJFILES value="ia_auth_c.obj"/>
+    <RESFILES value=""/>
+    <IDLFILES value=""/>
+    <IDLGENFILES value=""/>
+    <DEFFILE value=""/>
+    <RESDEPEN value="$(RESFILES)"/>
+    <LIBFILES value=""/>
+    <LIBRARIES value=""/>
+    <PACKAGES value=""/>
+    <PATHCPP value=".;"/>
+    <PATHPAS value=".;"/>
+    <PATHRC value=".;"/>
+    <PATHASM value=".;"/>
+    <LINKER value="TLib"/>
+    <USERDEFINES value="_DEBUG;WIN32"/>
+    <SYSDEFINES value="_RTLDLL;NO_STRICT"/>
+    <MAINSOURCE value="ia_auth_c.bpf"/>
+    <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;..\..\include"/>
+    <LIBPATH value="$(BCB)\lib\obj;$(BCB)\lib"/>
+    <WARNINGS value="-w-par"/>
+    <LISTFILE value=""/>
+    <OTHERFILES value=""/>
+  </MACROS>
+  <OPTIONS>
+    <IDLCFLAGS value="-I$(BCB)\include -I$(BCB)\include\vcl -I..\..\include -src_suffix cpp 
+      -D_DEBUG -DWIN32 -boa"/>
+    <CFLAG1 value="-Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c 
+      -tW -tWM"/>
+    <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/>
+    <AFLAGS value="/mx /w2 /zd"/>
+    <LFLAGS value=""/>
+    <OTHERFILES value=""/>
+  </OPTIONS>
+  <LINKER>
+    <ALLOBJ value="$(OBJFILES)"/>
+    <ALLLIB value=""/>
+    <OTHERFILES value=""/>
+  </LINKER>
+  <FILELIST>
+      <FILE FILENAME="ia_auth_c.bpf" FORMNAME="" UNITNAME="ia_auth_c" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/>
+      <FILE FILENAME="packet.h" FORMNAME="" UNITNAME="packet.h" CONTAINERID="" DESIGNCLASS="" LOCALCOMMAND=""/>
+      <FILE FILENAME="ia_auth_c.h" FORMNAME="" UNITNAME="ia_auth_c.h" CONTAINERID="" DESIGNCLASS="" LOCALCOMMAND=""/>
+      <FILE FILENAME="ia_auth_c.cpp" FORMNAME="" UNITNAME="ia_auth_c.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
+  </FILELIST>
+  <BUILDTOOLS>
+  </BUILDTOOLS>
+
+  <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1049
+CodePage=1251
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=$(BCB)\include;$(BCB)\include\vcl;..\..\include
+Item1=$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=2
+Item0=_DEBUG;WIN32
+Item1=_DEBUG
+
+[HistoryLists\hlFinalOutputDir]
+Count=1
+Item0=..\..\lib
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+Launcher=
+UseLauncher=0
+DebugCWD=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteLauncher=
+RemoteCWD=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[CORBA]
+AddServerUnit=1
+AddClientUnit=1
+PrecompiledHeaders=1
+  </IDEOPTIONS>
+</PROJECT>
\ No newline at end of file
diff --git a/stglibs/ia.lib/ia.cpp b/stglibs/ia.lib/ia.cpp
new file mode 100644 (file)
index 0000000..f08c461
--- /dev/null
@@ -0,0 +1,840 @@
+/*
+** 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 1, 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, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*
+ $Author: faust $
+ $Revision: 1.15 $
+ $Date: 2010/04/16 11:28:03 $
+*/
+
+/*
+* Author :
+* Boris Mikhailenko <stg34@stargazer.dp.ua>
+* Maxim Mamontov <faust@stargazer.dp.ua>
+* Andrey Rakhmanov <andrey_rakhmanov@yahoo.com> - bugfixes.
+*/
+
+//---------------------------------------------------------------------------
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <cassert>
+
+#ifdef WIN32
+    #include <winsock2.h>
+    #include <windows.h>
+    #include <winbase.h>
+    #include <winnt.h>
+#else
+    #include <fcntl.h>
+    #include <sys/types.h>
+    #include <sys/socket.h>
+    #include <netdb.h>
+    #include <netinet/in.h>
+    #include <arpa/inet.h>
+    #include <unistd.h>
+#endif
+
+#include "stg/common.h"
+#include "ia.h"
+
+#define IA_NONE            (0)
+#define IA_CONNECT         (1)
+#define IA_DISCONNECT      (2)
+
+#define IA_DEBUGPROTO   1
+
+#define IA_ID "00100"
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+#ifndef WIN32
+#include <sys/time.h>
+void * RunL(void * data)
+{
+
+IA_CLIENT_PROT * c = (IA_CLIENT_PROT *)data;
+static int a = 0;
+
+if (a == 0)
+    {
+    usleep(50000);
+    a = 1;
+    }
+
+while (c->GetNonstop())
+    {
+    c->Run();
+    }
+return NULL;
+}
+//---------------------------------------------------------------------------
+void Sleep(int ms)
+{
+usleep(ms * 1000);
+}
+//---------------------------------------------------------------------------
+long GetTickCount()
+{
+struct timeval tv;
+gettimeofday(&tv, NULL);
+return tv.tv_sec*1000 + tv.tv_usec/1000;
+}
+#else
+//---------------------------------------------------------------------------
+unsigned long WINAPI RunW(void * data)
+{
+IA_CLIENT_PROT * c = (IA_CLIENT_PROT *)data;
+while (c->GetNonstop())
+    c->Run();
+return 0;
+}
+//---------------------------------------------------------------------------
+#endif
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+IA_CLIENT_PROT::IA_CLIENT_PROT(const string & sn, unsigned short p, uint16_t localPort)
+    : action(IA_NONE),
+      phase(1),
+      phaseTime(0),
+      codeError(0),
+      nonstop(false),
+      isNetPrepared(false),
+      proxyMode(false),
+      serverName(sn),
+      port(p),
+      ip(0),
+      localPort(localPort),
+      firstConnect(true),
+      reconnect(0),
+      sockr(0),
+      protNum(0),
+      userTimeout(60),
+      aliveTimeout(5),
+      rnd(0),
+      pStatusChangedCb(NULL),
+      pStatChangedCb(NULL),
+      pInfoCb(NULL),
+      pErrorCb(NULL),
+      pDirNameCb(NULL),
+      statusChangedCbData(NULL),
+      statChangedCbData(NULL),
+      infoCbData(NULL),
+      errorCbData(NULL),
+      dirNameCbData(NULL),
+      connSyn8(NULL),
+      connSynAck8(NULL),
+      connAck8(NULL),
+      aliveSyn8(NULL),
+      aliveAck8(NULL),
+      disconnSyn8(NULL),
+      disconnSynAck8(NULL),
+      disconnAck8(NULL),
+      info(NULL)
+{
+memset(&stat, 0, sizeof(stat));
+
+#ifdef WIN32
+WSAStartup(MAKEWORD(2, 0), &wsaData);
+#endif
+
+packetTypes["CONN_SYN"] = CONN_SYN_N;
+packetTypes["CONN_SYN_ACK"] = CONN_SYN_ACK_N;
+packetTypes["CONN_ACK"] = CONN_ACK_N;
+packetTypes["ALIVE_SYN"] = ALIVE_SYN_N;
+packetTypes["ALIVE_ACK"] = ALIVE_ACK_N;
+packetTypes["DISCONN_SYN"] = DISCONN_SYN_N;
+packetTypes["DISCONN_SYN_ACK"] = DISCONN_SYN_ACK_N;
+packetTypes["DISCONN_ACK"] = DISCONN_ACK_N;
+packetTypes["FIN"] = FIN_N;
+packetTypes["ERR"] = ERROR_N;
+packetTypes["INFO"] = INFO_N;
+packetTypes["INFO_7"] = INFO_7_N;
+packetTypes["INFO_8"] = INFO_8_N;
+
+unsigned char key[IA_PASSWD_LEN];
+memset(key, 0, IA_PASSWD_LEN);
+strncpy((char *)key, "pr7Hhen", 8);
+Blowfish_Init(&ctxHdr, key, IA_PASSWD_LEN);
+
+memset(key, 0, IA_PASSWD_LEN);
+Blowfish_Init(&ctxPass, key, IA_PASSWD_LEN);
+
+for (size_t i = 0; i < DIR_NUM; ++i)
+    {
+    selectedDirs[i] = false;
+    }
+
+servAddr.sin_family = AF_INET;
+servAddr.sin_port = htons(port);
+servAddr.sin_addr.s_addr = ip;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::PrepareNet()
+{
+struct hostent * phe;
+unsigned long ip;
+
+ip = inet_addr(serverName.c_str());
+if (ip == INADDR_NONE)
+    {
+    phe = gethostbyname(serverName.c_str());
+    if (phe)
+        {
+        ip = *((unsigned long*)phe->h_addr_list[0]);
+        }
+    else
+        {
+        strError = string("Unknown host ") + "\'" + serverName + "\'";
+        codeError = IA_GETHOSTBYNAME_ERROR;
+        if (pErrorCb != NULL)
+            pErrorCb(strError, IA_GETHOSTBYNAME_ERROR, errorCbData);
+        }
+    }
+
+#ifndef WIN32
+close(sockr);
+#else
+closesocket(sockr);
+#endif
+
+sockr = socket(AF_INET, SOCK_DGRAM, 0);
+
+struct sockaddr_in  localAddrR;
+localAddrR.sin_family = AF_INET;
+
+if (localPort)
+    localAddrR.sin_port = htons(localPort);
+else
+    localAddrR.sin_port = htons(port);
+localAddrR.sin_addr.s_addr = inet_addr("0.0.0.0");
+
+servAddr.sin_family = AF_INET;
+servAddr.sin_port = htons(port);
+servAddr.sin_addr.s_addr = ip;
+
+int res = bind(sockr, (struct sockaddr*)&localAddrR, sizeof(localAddrR));
+if (res == -1)
+    {
+    strError = "bind error";
+    codeError = IA_BIND_ERROR;
+    if (pErrorCb != NULL)
+        pErrorCb(strError, IA_BIND_ERROR, errorCbData);
+    return;
+    }
+
+#ifdef WIN32
+unsigned long arg = 1;
+res = ioctlsocket(sockr, FIONBIO, &arg);
+#else
+if (0 != fcntl(sockr, F_SETFL, O_NONBLOCK))
+    {
+    strError = "fcntl error";
+    codeError = IA_FCNTL_ERROR;
+    if (pErrorCb != NULL)
+        pErrorCb(strError, IA_FCNTL_ERROR, errorCbData);
+    }
+#endif
+
+}
+//---------------------------------------------------------------------------
+IA_CLIENT_PROT::~IA_CLIENT_PROT()
+{
+#ifndef WIN32
+close(sockr);
+#else
+closesocket(sockr);
+WSACleanup();
+#endif
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::DeterminatePacketType(const char * buffer)
+{
+map<string, int>::iterator pi;
+pi = packetTypes.find(buffer);
+if (pi == packetTypes.end())
+    {
+    return -1;
+    }
+else
+    {
+    return pi->second;
+    }
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::FillHdr8(char * buffer, unsigned long)
+{
+strncpy(buffer, IA_ID, 6);
+buffer[IA_MAGIC_LEN] = 0;
+buffer[IA_MAGIC_LEN + 1] = IA_PROTO_VER;
+strncpy(buffer + sizeof(HDR_8), login.c_str(), IA_LOGIN_LEN);
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Send(char * buffer, int len)
+{
+if (!isNetPrepared)
+    {
+    PrepareNet();
+    isNetPrepared = true;
+    }
+
+int db = sizeof(HDR_8);
+for (int i = 0; i < IA_LOGIN_LEN/8; i++)
+    {
+    Blowfish_Encrypt(&ctxHdr, (uint32_t*)(buffer + db + i*8), (uint32_t*)(buffer + db + i*8 + 4));
+    }
+
+db += IA_LOGIN_LEN;
+int encLen = (len - sizeof(HDR_8) - IA_LOGIN_LEN)/8;
+for (int i = 0; i < encLen; i++)
+    {
+    Blowfish_Encrypt(&ctxPass, (uint32_t*)(buffer + db), (uint32_t*)(buffer + db + 4));
+    db += 8;
+    }
+
+return sendto(sockr, buffer, len, 0, (struct sockaddr*)&servAddr, sizeof(servAddr));
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Recv(char * buffer, int len)
+{
+#ifdef WIN32
+int fromLen;
+#else
+socklen_t fromLen;
+#endif
+
+struct sockaddr_in addr;
+fromLen = sizeof(addr);
+int res = recvfrom(sockr, buffer, len, 0, (struct sockaddr*)&addr, &fromLen);
+
+if (res == -1)
+    return res;
+
+if (strcmp(buffer + 4 + sizeof(HDR_8), "ERR"))
+    {
+    for (int i = 0; i < len/8; i++)
+        Blowfish_Decrypt(&ctxPass, (uint32_t*)(buffer + i*8), (uint32_t*)(buffer + i*8 + 4));
+    }
+
+return 0;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::NetSend(int n)
+{
+char buffer[2048];
+int msgLen;
+
+memset(buffer, 0, 2048);
+
+switch (n)
+    {
+    case CONN_SYN_N:
+        msgLen = Prepare_CONN_SYN_8(buffer);
+        break;
+
+    case CONN_ACK_N:
+        msgLen = Prepare_CONN_ACK_8(buffer);
+        break;
+
+    case ALIVE_ACK_N:
+        msgLen = Prepare_ALIVE_ACK_8(buffer);
+        break;
+
+    case DISCONN_SYN_N:
+        msgLen = Prepare_DISCONN_SYN_8(buffer);
+        break;
+
+    case DISCONN_ACK_N:
+        msgLen = Prepare_DISCONN_ACK_8(buffer);
+        break;
+
+    default:
+        return -1;
+    }
+
+FillHdr8(buffer, 0);
+Send(buffer, msgLen);
+
+return 0;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::NetRecv()
+{
+char buffer[2048];
+
+if (Recv(buffer, sizeof(buffer)) < 0)
+    return -1;
+
+char packetName[20];
+strncpy(packetName, buffer + 12, sizeof(packetName));
+packetName[sizeof(packetName) - 1] = 0;
+int pn = DeterminatePacketType(buffer + 12);
+
+int ret;
+switch (pn)
+    {
+    case CONN_SYN_ACK_N:
+        ret = Process_CONN_SYN_ACK_8(buffer);
+        break;
+
+    case ALIVE_SYN_N:
+        ret = Process_ALIVE_SYN_8(buffer);
+        break;
+
+    case DISCONN_SYN_ACK_N:
+        ret = Process_DISCONN_SYN_ACK_8(buffer);
+        break;
+
+    case FIN_N:
+        ret = Process_FIN_8(buffer);
+        break;
+
+    case INFO_8_N:
+        ret = Process_INFO_8(buffer);
+        break;
+
+    case ERROR_N:
+        ret = Process_ERROR(buffer);
+        break;
+
+    default:
+        ret = -1;
+    }
+return ret;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::Start()
+{
+nonstop = true;
+#ifdef WIN32
+unsigned long pt;
+CreateThread(NULL, 16384, RunW, this, 0, &pt);
+#else
+pthread_create(&thread, NULL, RunL, this);
+#endif
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::Stop()
+{
+nonstop = false;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::Run()
+{
+NetRecv();
+
+switch (phase)
+    {
+    case 1:
+        if (action == IA_CONNECT)
+            {
+            action = IA_NONE;
+            NetSend(CONN_SYN_N);
+            phase = 2;
+            phaseTime = GetTickCount();
+            }
+        if (reconnect && !firstConnect)
+            {
+            action = IA_CONNECT;
+            }
+        break;
+
+    case 2:
+        if ((int)(GetTickCount() - phaseTime)/1000 > aliveTimeout)
+            {
+            phase = 1;
+            phaseTime = GetTickCount();
+            if (pStatusChangedCb != NULL)
+                pStatusChangedCb(0, statusChangedCbData);
+            }
+
+        if (action == IA_DISCONNECT)
+            {
+            action = IA_NONE;
+            NetSend(DISCONN_SYN_N);
+            phase = 4;
+            phaseTime = GetTickCount();
+            }
+
+        break;
+
+    case 3:
+        if ((int)(GetTickCount() - phaseTime)/1000 > userTimeout)
+            {
+            phase = 1;
+            phaseTime = GetTickCount();
+            if (pStatusChangedCb != NULL)
+                pStatusChangedCb(0, statusChangedCbData);
+            firstConnect = false;
+            }
+
+        if (action == IA_DISCONNECT)
+            {
+            action = IA_NONE;
+            NetSend(DISCONN_SYN_N);
+            phase = 4;
+            phaseTime = GetTickCount();
+            }
+
+        break;
+
+    case 4:
+        if ((int)(GetTickCount() - phaseTime)/1000 > aliveTimeout)
+            {
+            phase=1;
+            phaseTime = GetTickCount();
+            if (pStatusChangedCb != NULL)
+                pStatusChangedCb(0, statusChangedCbData);
+            }
+
+        if (action == IA_CONNECT)
+            {
+            action = IA_NONE;
+            NetSend(CONN_SYN_N);
+            phase = 2;
+            phaseTime = GetTickCount();
+            }
+
+        break;
+
+    case 5:
+        if ((int)(GetTickCount() - phaseTime)/1000 > aliveTimeout)
+            {
+            phase = 1;
+            phaseTime = GetTickCount();
+            if (pStatusChangedCb != NULL)
+                pStatusChangedCb(0, statusChangedCbData);
+            }
+
+        if (action == IA_CONNECT)
+            {
+            action = IA_NONE;
+            NetSend(CONN_SYN_N);
+            phase = 2;
+            phaseTime = GetTickCount();
+            }
+
+        break;
+    }
+Sleep(20);
+return;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::GetStat(LOADSTAT * ls)
+{
+memcpy(ls, &stat, sizeof(stat));
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetServer(const string & sn, unsigned short p)
+{
+serverName = sn;
+port = p;
+PrepareNet();
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetLogin(const string & l)
+{
+login = l;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetPassword(const string & p)
+{
+password = p;
+
+unsigned char keyL[IA_PASSWD_LEN];
+memset(keyL, 0, IA_PASSWD_LEN);
+strncpy((char *)keyL, password.c_str(), IA_PASSWD_LEN);
+Blowfish_Init(&ctxPass, keyL, IA_PASSWD_LEN);
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetEnabledDirs(const bool * selectedDirs)
+{
+memcpy(IA_CLIENT_PROT::selectedDirs, selectedDirs, sizeof(bool) * DIR_NUM);
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Connect()
+{
+action = IA_CONNECT;
+return 0;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Disconnect()
+{
+firstConnect = true;
+action = IA_DISCONNECT;
+return 0;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::GetStrError(string * error) const
+{
+int ret = codeError;
+*error = strError;
+strError = "";
+codeError = 0;
+return ret;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Process_CONN_SYN_ACK_8(const char * buffer)
+{
+vector<string> dirNames;
+connSynAck8 = (CONN_SYN_ACK_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(connSynAck8->len);
+SwapBytes(connSynAck8->rnd);
+SwapBytes(connSynAck8->userTimeOut);
+SwapBytes(connSynAck8->aliveDelay);
+#endif
+
+rnd = connSynAck8->rnd;
+userTimeout = connSynAck8->userTimeOut;
+aliveTimeout = connSynAck8->aliveDelay;
+
+for (int i = 0; i < DIR_NUM; i++)
+    {
+    dirNames.push_back((const char*)connSynAck8->dirName[i]);
+    }
+
+if (pDirNameCb != NULL)
+    pDirNameCb(dirNames, dirNameCbData);
+
+NetSend(CONN_ACK_N);
+phase = 3;
+phaseTime = GetTickCount();
+
+return CONN_SYN_ACK_N;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Process_ALIVE_SYN_8(const char * buffer)
+{
+aliveSyn8 = (ALIVE_SYN_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(aliveSyn8->len);
+SwapBytes(aliveSyn8->rnd);
+SwapBytes(aliveSyn8->cash);
+SwapBytes(aliveSyn8->status);
+for (int i = 0; i < DIR_NUM; ++i)
+    {
+    SwapBytes(aliveSyn8->mu[i]);
+    SwapBytes(aliveSyn8->md[i]);
+    SwapBytes(aliveSyn8->su[i]);
+    SwapBytes(aliveSyn8->sd[i]);
+    }
+#endif
+
+rnd = aliveSyn8->rnd;
+memcpy(&stat, (char*)aliveSyn8->mu, sizeof(stat));
+
+if (pStatChangedCb != NULL)
+    pStatChangedCb(stat, statChangedCbData);
+
+if (pStatusChangedCb != NULL)
+    pStatusChangedCb(1, statusChangedCbData);
+NetSend(ALIVE_ACK_N);
+phaseTime = GetTickCount();
+
+return ALIVE_SYN_N;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Process_DISCONN_SYN_ACK_8(const char * buffer)
+{
+disconnSynAck8 = (DISCONN_SYN_ACK_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(disconnSynAck8->len);
+SwapBytes(disconnSynAck8->rnd);
+#endif
+
+rnd = disconnSynAck8->rnd;
+
+NetSend(DISCONN_ACK_N);
+phase = 5;
+phaseTime = GetTickCount();
+
+return DISCONN_SYN_ACK_N;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Process_FIN_8(const char *)
+{
+phase = 1;
+phaseTime = GetTickCount();
+if (pStatusChangedCb != NULL)
+    pStatusChangedCb(0, statusChangedCbData);
+
+return FIN_N;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Process_INFO_8(const char * buffer)
+{
+info = (INFO_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(info->len);
+SwapBytes(info->sendTime);
+#endif
+
+if (pInfoCb != NULL)
+    pInfoCb((char*)info->text, info->infoType, info->showTime, info->sendTime, infoCbData);
+return INFO_8_N;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Process_ERROR(const char * buffer)
+{
+ERR_8 err;
+memcpy(&err, buffer, sizeof(err));
+
+#ifdef ARCH_BE
+SwapBytes(err.len);
+#endif
+
+KOIToWin((const char*)err.text, &messageText);
+if (pErrorCb != NULL)
+    pErrorCb(messageText, IA_SERVER_ERROR, errorCbData);
+phase = 1;
+phaseTime = GetTickCount();
+codeError = IA_SERVER_ERROR;
+
+return ERROR_N;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Prepare_CONN_SYN_8(char * buffer)
+{
+connSyn8 = (CONN_SYN_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(connSyn8->len);
+#endif
+
+assert(sizeof(CONN_SYN_8) == Min8(sizeof(CONN_SYN_8)) && "CONN_SYN_8 is not aligned to 8 bytes");
+
+connSyn8->len = sizeof(CONN_SYN_8);
+strncpy((char*)connSyn8->type, "CONN_SYN", IA_MAX_TYPE_LEN);
+strncpy((char*)connSyn8->login, login.c_str(), IA_LOGIN_LEN);
+connSyn8->dirs = 0;
+for (int i = 0; i < DIR_NUM; i++)
+    {
+    connSyn8->dirs |= (selectedDirs[i] << i);
+    }
+return connSyn8->len;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Prepare_CONN_ACK_8(char * buffer)
+{
+connAck8 = (CONN_ACK_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(connAck8->len);
+SwapBytes(connAck8->rnd);
+#endif
+
+assert(sizeof(CONN_ACK_8) == Min8(sizeof(CONN_ACK_8)) && "CONN_ACK_8 is not aligned to 8 bytes");
+
+connAck8->len = sizeof(CONN_ACK_8);
+strncpy((char*)connAck8->loginS, login.c_str(), IA_LOGIN_LEN);
+strncpy((char*)connAck8->type, "CONN_ACK", IA_MAX_TYPE_LEN);
+rnd++;
+connAck8->rnd = rnd;
+
+return connAck8->len;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Prepare_ALIVE_ACK_8(char * buffer)
+{
+aliveAck8 = (ALIVE_ACK_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(aliveAck8->len);
+SwapBytes(aliveAck8->rnd);
+#endif
+
+assert(Min8(sizeof(ALIVE_ACK_8)) == sizeof(ALIVE_ACK_8) && "ALIVE_ACK_8 is not aligned to 8 bytes");
+
+aliveAck8 = (ALIVE_ACK_8*)buffer;
+aliveAck8->len = sizeof(ALIVE_ACK_8);
+strncpy((char*)aliveAck8->loginS, login.c_str(), IA_LOGIN_LEN);
+strncpy((char*)aliveAck8->type, "ALIVE_ACK", IA_MAX_TYPE_LEN);
+aliveAck8->rnd = ++rnd;
+return aliveAck8->len;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Prepare_DISCONN_SYN_8(char * buffer)
+{
+disconnSyn8 = (DISCONN_SYN_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(disconnSyn8->len);
+#endif
+
+assert(Min8(sizeof(DISCONN_SYN_8)) == sizeof(DISCONN_SYN_8) && "DISCONN_SYN_8 is not aligned to 8 bytes");
+
+disconnSyn8->len = sizeof(DISCONN_SYN_8);
+strncpy((char*)disconnSyn8->loginS, login.c_str(), IA_LOGIN_LEN);
+strncpy((char*)disconnSyn8->type, "DISCONN_SYN", IA_MAX_TYPE_LEN);
+strncpy((char*)disconnSyn8->login, login.c_str(), IA_LOGIN_LEN);
+return disconnSyn8->len;
+}
+//---------------------------------------------------------------------------
+int IA_CLIENT_PROT::Prepare_DISCONN_ACK_8(char * buffer)
+{
+disconnAck8 = (DISCONN_ACK_8*)buffer;
+
+#ifdef ARCH_BE
+SwapBytes(disconnAck8->len);
+SwapBytes(disconnAck8->rnd);
+#endif
+
+assert(Min8(sizeof(DISCONN_ACK_8)) == sizeof(DISCONN_ACK_8) && "DISCONN_ACK_8 is not aligned to 8 bytes");
+
+disconnAck8->len = Min8(sizeof(DISCONN_ACK_8));
+disconnAck8->rnd = rnd + 1;
+strncpy((char*)disconnAck8->loginS, login.c_str(), IA_LOGIN_LEN);
+strncpy((char*)disconnAck8->type, "DISCONN_ACK", IA_MAX_TYPE_LEN);
+return disconnAck8->len;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetStatusChangedCb(tpStatusChangedCb p, void * data)
+{
+pStatusChangedCb = p;
+statusChangedCbData = data;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetStatChangedCb(tpStatChangedCb p, void * data)
+{
+pStatChangedCb = p;
+statChangedCbData = data;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetInfoCb(tpCallBackInfoFn p, void * data)
+{
+pInfoCb = p;
+infoCbData = data;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetDirNameCb(tpCallBackDirNameFn p, void * data)
+{
+pDirNameCb = p;
+dirNameCbData = data;
+}
+//---------------------------------------------------------------------------
+void IA_CLIENT_PROT::SetErrorCb(tpCallBackErrorFn p, void * data)
+{
+pErrorCb = p;
+errorCbData = data;
+}
+//---------------------------------------------------------------------------
diff --git a/stglibs/ia.lib/ia.h b/stglibs/ia.lib/ia.h
new file mode 100644 (file)
index 0000000..0a916f4
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+** 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 1, 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, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*
+ $Author: faust $
+ $Revision: 1.10 $
+ $Date: 2010/03/15 12:57:24 $
+*/
+
+/*
+* Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+*/
+//---------------------------------------------------------------------------
+#ifndef IA_AUTH_C_H
+#define IA_AUTH_C_H
+
+#ifndef WIN32
+#include <netinet/in.h>
+#include <pthread.h>
+#else
+#include <winsock2.h>
+#endif
+
+#include <string>
+#include <vector>
+#include <map>
+
+#include "stg/blowfish.h"
+#include "stg/ia_packets.h"
+
+#define IA_BIND_ERROR           (1)
+#define IA_SERVER_ERROR         (2)
+#define IA_FCNTL_ERROR          (3)
+#define IA_GETHOSTBYNAME_ERROR  (4)
+
+#define IA_PROTO_VER            (8)
+#define IA_PROTO_PROXY_VER      (101)
+
+using namespace std;
+
+typedef void (*tpStatusChangedCb)(int status, void * data);
+typedef void (*tpStatChangedCb)(const LOADSTAT & stat, void * data);
+typedef void (*tpCallBackInfoFn)(const string & message, int infoType, int showTime, int sendTime, void * data);
+typedef void (*tpCallBackErrorFn)(const string & message, int netError, void * data);
+typedef void (*tpCallBackDirNameFn)(const vector<string> & dirName, void * data);
+
+//---------------------------------------------------------------------------
+class IA_CLIENT_PROT
+{
+#ifdef WIN32
+friend unsigned long WINAPI RunW(void * data);
+#else
+friend void * RunL(void * data);
+#endif
+
+public:
+    IA_CLIENT_PROT(const string & sn, uint16_t p, uint16_t localPort = 0);
+    ~IA_CLIENT_PROT();
+
+    void        Start();
+    void        Stop();
+    void        GetStat(LOADSTAT * ls);
+
+    void        SetServer(const string & sn, unsigned short port);
+    void        SetLogin(const string & login);
+    void        SetPassword(const string & password);
+    void        SetEnabledDirs(const bool * selectedDirs);
+
+    void        SetStatusChangedCb(tpStatusChangedCb p, void * data);
+    void        SetStatChangedCb(tpStatChangedCb p, void * data);
+    void        SetInfoCb(tpCallBackInfoFn p, void * data);
+    void        SetErrorCb(tpCallBackErrorFn p, void * data);
+    void        SetDirNameCb(tpCallBackDirNameFn p, void * data);
+
+    int         Connect();
+    int         Disconnect();
+    int         GetAuthorized() const { return phase == 3 || phase == 4; };
+    int         GetPhase() const { return phase; };
+    int         GetStatus() const;
+    int         GetReconnect() const { return reconnect; };
+    void        SetReconnect(int r) { reconnect = r; };
+    char        GetProtoVer() const { return proxyMode ? IA_PROTO_PROXY_VER : IA_PROTO_VER; };
+    void        GetMessageText(string * text) const { *text = messageText; };
+    void        GetInfoText(string * text) const { *text = infoText; };
+    int         GetStrError(string * error) const;
+
+    void        SetProxyMode(bool on) { proxyMode = on; };
+    bool        GetProxyMode() const { return proxyMode; };
+
+    void        SetIP(uint32_t ip) { IA_CLIENT_PROT::ip = ip; };
+    uint32_t    GetIP() const { return ip; };
+
+private:
+    void            Run();
+    int             NetRecv();
+    int             NetSend(int n);
+    bool            GetNonstop() const { return nonstop; };
+    void            PrepareNet();
+    int             DeterminatePacketType(const char * buffer);
+
+    int             Process_CONN_SYN_ACK_8(const char * buffer);
+    int             Process_ALIVE_SYN_8(const char * buffer);
+    int             Process_DISCONN_SYN_ACK_8(const char * buffer);
+    int             Process_FIN_8(const char * buffer);
+    int             Process_INFO_8(const char * buffer);
+    int             Process_ERROR(const char * buffer);
+
+    int             Prepare_CONN_SYN_8(char * buffer);
+    int             Prepare_CONN_ACK_8(char * buffer);
+    int             Prepare_ALIVE_ACK_8(char * buffer);
+    int             Prepare_DISCONN_SYN_8(char * buffer);
+    int             Prepare_DISCONN_ACK_8(char * buffer);
+
+    void            FillHdr8(char * buffer, unsigned long ip);
+    int             Send(char * buffer, int len);
+    int             Recv(char * buffer, int len);
+
+    LOADSTAT        stat;
+    int             action;
+    int             phase;
+    int             phaseTime;
+    string          messageText;
+    string          infoText;
+    mutable string  strError;
+    mutable int     codeError;
+    bool            nonstop;
+    bool            isNetPrepared;
+    bool            proxyMode;
+
+    BLOWFISH_CTX    ctxPass;
+    BLOWFISH_CTX    ctxHdr;
+
+    bool            selectedDirs[DIR_NUM];
+
+    string          password;
+    string          login;
+
+    #ifdef WIN32
+    WSADATA wsaData;
+    #else
+    pthread_t thread;
+    #endif
+
+    string          serverName;
+    uint16_t        port;
+    uint32_t        ip;
+    uint32_t        localPort;
+
+    struct sockaddr_in  servAddr;
+
+    bool            firstConnect;
+    int             reconnect;
+    int             sockr;
+    int             protNum;
+    int             userTimeout;
+    int             aliveTimeout;
+    unsigned int    rnd;
+
+    tpStatusChangedCb   pStatusChangedCb;
+    tpStatChangedCb     pStatChangedCb;
+    tpCallBackInfoFn    pInfoCb;
+    tpCallBackErrorFn   pErrorCb;
+    tpCallBackDirNameFn pDirNameCb;
+
+    void              * statusChangedCbData;
+    void              * statChangedCbData;
+    void              * infoCbData;
+    void              * errorCbData;
+    void              * dirNameCbData;
+
+    map<string, int>    packetTypes;
+
+    CONN_SYN_8        * connSyn8;
+    CONN_SYN_ACK_8    * connSynAck8;
+    CONN_ACK_8        * connAck8;
+    ALIVE_SYN_8       * aliveSyn8;
+    ALIVE_ACK_8       * aliveAck8;
+    DISCONN_SYN_8     * disconnSyn8;
+    DISCONN_SYN_ACK_8 * disconnSynAck8;
+    DISCONN_ACK_8     * disconnAck8;
+    INFO_8            * info;
+};
+//---------------------------------------------------------------------------
+#ifdef WIN32
+unsigned long WINAPI RunW(void *);
+#else
+void * RunW(void *);
+#endif
+
+//---------------------------------------------------------------------------
+#endif //IA_AUTH_C_H
diff --git a/stglibs/ia_auth_c.lib/Makefile b/stglibs/ia_auth_c.lib/Makefile
deleted file mode 100644 (file)
index fb49f94..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# $Id: Makefile,v 1.11 2010/08/18 07:47:03 faust Exp $
-###############################################################################
-
-LIB_NAME = ia_auth_c
-PROG = lib$(LIB_NAME)
-
-SRCS = ia_auth_c.cpp
-
-INCS = ia_auth_c.h
-
-STGLIBS = -lstg_common \
-         -lstg_crypto
-LIBS = $(LIB_THREAD)
-
-include ../Makefile.in
diff --git a/stglibs/ia_auth_c.lib/ia_auth_c.bpf b/stglibs/ia_auth_c.lib/ia_auth_c.bpf
deleted file mode 100644 (file)
index e3c42ce..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-//---------------------------------------------------------------------------
-
-#include <vcl.h>
-#pragma hdrstop
-#define Library
-
-// To add a file to the library use the Project menu 'Add to Project'.
-
\ No newline at end of file
diff --git a/stglibs/ia_auth_c.lib/ia_auth_c.bpr b/stglibs/ia_auth_c.lib/ia_auth_c.bpr
deleted file mode 100644 (file)
index c80bf51..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!-- C++Builder XML Project -->
-<PROJECT>
-  <MACROS>
-    <VERSION value="BCB.06.00"/>
-    <PROJECT value="..\..\lib\ia_auth_c.lib"/>
-    <OBJFILES value="ia_auth_c.obj"/>
-    <RESFILES value=""/>
-    <IDLFILES value=""/>
-    <IDLGENFILES value=""/>
-    <DEFFILE value=""/>
-    <RESDEPEN value="$(RESFILES)"/>
-    <LIBFILES value=""/>
-    <LIBRARIES value=""/>
-    <PACKAGES value=""/>
-    <PATHCPP value=".;"/>
-    <PATHPAS value=".;"/>
-    <PATHRC value=".;"/>
-    <PATHASM value=".;"/>
-    <LINKER value="TLib"/>
-    <USERDEFINES value="_DEBUG;WIN32"/>
-    <SYSDEFINES value="_RTLDLL;NO_STRICT"/>
-    <MAINSOURCE value="ia_auth_c.bpf"/>
-    <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;..\..\include"/>
-    <LIBPATH value="$(BCB)\lib\obj;$(BCB)\lib"/>
-    <WARNINGS value="-w-par"/>
-    <LISTFILE value=""/>
-    <OTHERFILES value=""/>
-  </MACROS>
-  <OPTIONS>
-    <IDLCFLAGS value="-I$(BCB)\include -I$(BCB)\include\vcl -I..\..\include -src_suffix cpp 
-      -D_DEBUG -DWIN32 -boa"/>
-    <CFLAG1 value="-Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c 
-      -tW -tWM"/>
-    <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/>
-    <AFLAGS value="/mx /w2 /zd"/>
-    <LFLAGS value=""/>
-    <OTHERFILES value=""/>
-  </OPTIONS>
-  <LINKER>
-    <ALLOBJ value="$(OBJFILES)"/>
-    <ALLLIB value=""/>
-    <OTHERFILES value=""/>
-  </LINKER>
-  <FILELIST>
-      <FILE FILENAME="ia_auth_c.bpf" FORMNAME="" UNITNAME="ia_auth_c" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/>
-      <FILE FILENAME="packet.h" FORMNAME="" UNITNAME="packet.h" CONTAINERID="" DESIGNCLASS="" LOCALCOMMAND=""/>
-      <FILE FILENAME="ia_auth_c.h" FORMNAME="" UNITNAME="ia_auth_c.h" CONTAINERID="" DESIGNCLASS="" LOCALCOMMAND=""/>
-      <FILE FILENAME="ia_auth_c.cpp" FORMNAME="" UNITNAME="ia_auth_c.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
-  </FILELIST>
-  <BUILDTOOLS>
-  </BUILDTOOLS>
-
-  <IDEOPTIONS>
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1049
-CodePage=1251
-
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[HistoryLists\hlIncludePath]
-Count=2
-Item0=$(BCB)\include;$(BCB)\include\vcl;..\..\include
-Item1=$(BCB)\include;$(BCB)\include\vcl
-
-[HistoryLists\hlLibraryPath]
-Count=1
-Item0=$(BCB)\lib\obj;$(BCB)\lib
-
-[HistoryLists\hlDebugSourcePath]
-Count=1
-Item0=$(BCB)\source\vcl
-
-[HistoryLists\hlConditionals]
-Count=2
-Item0=_DEBUG;WIN32
-Item1=_DEBUG
-
-[HistoryLists\hlFinalOutputDir]
-Count=1
-Item0=..\..\lib
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-Launcher=
-UseLauncher=0
-DebugCWD=
-HostApplication=
-RemoteHost=
-RemotePath=
-RemoteLauncher=
-RemoteCWD=
-RemoteDebug=0
-
-[Compiler]
-ShowInfoMsgs=0
-LinkDebugVcl=0
-LinkCGLIB=0
-
-[CORBA]
-AddServerUnit=1
-AddClientUnit=1
-PrecompiledHeaders=1
-  </IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
diff --git a/stglibs/ia_auth_c.lib/ia_auth_c.cpp b/stglibs/ia_auth_c.lib/ia_auth_c.cpp
deleted file mode 100644 (file)
index 075a191..0000000
+++ /dev/null
@@ -1,840 +0,0 @@
-/*
-** 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 1, 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, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/*
- $Author: faust $
- $Revision: 1.15 $
- $Date: 2010/04/16 11:28:03 $
-*/
-
-/*
-* Author :
-* Boris Mikhailenko <stg34@stargazer.dp.ua>
-* Maxim Mamontov <faust@stargazer.dp.ua>
-* Andrey Rakhmanov <andrey_rakhmanov@yahoo.com> - bugfixes.
-*/
-
-//---------------------------------------------------------------------------
-
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <cassert>
-
-#ifdef WIN32
-    #include <winsock2.h>
-    #include <windows.h>
-    #include <winbase.h>
-    #include <winnt.h>
-#else
-    #include <fcntl.h>
-    #include <sys/types.h>
-    #include <sys/socket.h>
-    #include <netdb.h>
-    #include <netinet/in.h>
-    #include <arpa/inet.h>
-    #include <unistd.h>
-#endif
-
-#include "stg/common.h"
-#include "ia_auth_c.h"
-
-#define IA_NONE            (0)
-#define IA_CONNECT         (1)
-#define IA_DISCONNECT      (2)
-
-#define IA_DEBUGPROTO   1
-
-#define IA_ID "00100"
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-#ifndef WIN32
-#include <sys/time.h>
-void * RunL(void * data)
-{
-
-IA_CLIENT_PROT * c = (IA_CLIENT_PROT *)data;
-static int a = 0;
-
-if (a == 0)
-    {
-    usleep(50000);
-    a = 1;
-    }
-
-while (c->GetNonstop())
-    {
-    c->Run();
-    }
-return NULL;
-}
-//---------------------------------------------------------------------------
-void Sleep(int ms)
-{
-usleep(ms * 1000);
-}
-//---------------------------------------------------------------------------
-long GetTickCount()
-{
-struct timeval tv;
-gettimeofday(&tv, NULL);
-return tv.tv_sec*1000 + tv.tv_usec/1000;
-}
-#else
-//---------------------------------------------------------------------------
-unsigned long WINAPI RunW(void * data)
-{
-IA_CLIENT_PROT * c = (IA_CLIENT_PROT *)data;
-while (c->GetNonstop())
-    c->Run();
-return 0;
-}
-//---------------------------------------------------------------------------
-#endif
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-IA_CLIENT_PROT::IA_CLIENT_PROT(const string & sn, unsigned short p, uint16_t localPort)
-    : action(IA_NONE),
-      phase(1),
-      phaseTime(0),
-      codeError(0),
-      nonstop(false),
-      isNetPrepared(false),
-      proxyMode(false),
-      serverName(sn),
-      port(p),
-      ip(0),
-      localPort(localPort),
-      firstConnect(true),
-      reconnect(0),
-      sockr(0),
-      protNum(0),
-      userTimeout(60),
-      aliveTimeout(5),
-      rnd(0),
-      pStatusChangedCb(NULL),
-      pStatChangedCb(NULL),
-      pInfoCb(NULL),
-      pErrorCb(NULL),
-      pDirNameCb(NULL),
-      statusChangedCbData(NULL),
-      statChangedCbData(NULL),
-      infoCbData(NULL),
-      errorCbData(NULL),
-      dirNameCbData(NULL),
-      connSyn8(NULL),
-      connSynAck8(NULL),
-      connAck8(NULL),
-      aliveSyn8(NULL),
-      aliveAck8(NULL),
-      disconnSyn8(NULL),
-      disconnSynAck8(NULL),
-      disconnAck8(NULL),
-      info(NULL)
-{
-memset(&stat, 0, sizeof(stat));
-
-#ifdef WIN32
-WSAStartup(MAKEWORD(2, 0), &wsaData);
-#endif
-
-packetTypes["CONN_SYN"] = CONN_SYN_N;
-packetTypes["CONN_SYN_ACK"] = CONN_SYN_ACK_N;
-packetTypes["CONN_ACK"] = CONN_ACK_N;
-packetTypes["ALIVE_SYN"] = ALIVE_SYN_N;
-packetTypes["ALIVE_ACK"] = ALIVE_ACK_N;
-packetTypes["DISCONN_SYN"] = DISCONN_SYN_N;
-packetTypes["DISCONN_SYN_ACK"] = DISCONN_SYN_ACK_N;
-packetTypes["DISCONN_ACK"] = DISCONN_ACK_N;
-packetTypes["FIN"] = FIN_N;
-packetTypes["ERR"] = ERROR_N;
-packetTypes["INFO"] = INFO_N;
-packetTypes["INFO_7"] = INFO_7_N;
-packetTypes["INFO_8"] = INFO_8_N;
-
-unsigned char key[IA_PASSWD_LEN];
-memset(key, 0, IA_PASSWD_LEN);
-strncpy((char *)key, "pr7Hhen", 8);
-Blowfish_Init(&ctxHdr, key, IA_PASSWD_LEN);
-
-memset(key, 0, IA_PASSWD_LEN);
-Blowfish_Init(&ctxPass, key, IA_PASSWD_LEN);
-
-for (size_t i = 0; i < DIR_NUM; ++i)
-    {
-    selectedDirs[i] = false;
-    }
-
-servAddr.sin_family = AF_INET;
-servAddr.sin_port = htons(port);
-servAddr.sin_addr.s_addr = ip;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::PrepareNet()
-{
-struct hostent * phe;
-unsigned long ip;
-
-ip = inet_addr(serverName.c_str());
-if (ip == INADDR_NONE)
-    {
-    phe = gethostbyname(serverName.c_str());
-    if (phe)
-        {
-        ip = *((unsigned long*)phe->h_addr_list[0]);
-        }
-    else
-        {
-        strError = string("Unknown host ") + "\'" + serverName + "\'";
-        codeError = IA_GETHOSTBYNAME_ERROR;
-        if (pErrorCb != NULL)
-            pErrorCb(strError, IA_GETHOSTBYNAME_ERROR, errorCbData);
-        }
-    }
-
-#ifndef WIN32
-close(sockr);
-#else
-closesocket(sockr);
-#endif
-
-sockr = socket(AF_INET, SOCK_DGRAM, 0);
-
-struct sockaddr_in  localAddrR;
-localAddrR.sin_family = AF_INET;
-
-if (localPort)
-    localAddrR.sin_port = htons(localPort);
-else
-    localAddrR.sin_port = htons(port);
-localAddrR.sin_addr.s_addr = inet_addr("0.0.0.0");
-
-servAddr.sin_family = AF_INET;
-servAddr.sin_port = htons(port);
-servAddr.sin_addr.s_addr = ip;
-
-int res = bind(sockr, (struct sockaddr*)&localAddrR, sizeof(localAddrR));
-if (res == -1)
-    {
-    strError = "bind error";
-    codeError = IA_BIND_ERROR;
-    if (pErrorCb != NULL)
-        pErrorCb(strError, IA_BIND_ERROR, errorCbData);
-    return;
-    }
-
-#ifdef WIN32
-unsigned long arg = 1;
-res = ioctlsocket(sockr, FIONBIO, &arg);
-#else
-if (0 != fcntl(sockr, F_SETFL, O_NONBLOCK))
-    {
-    strError = "fcntl error";
-    codeError = IA_FCNTL_ERROR;
-    if (pErrorCb != NULL)
-        pErrorCb(strError, IA_FCNTL_ERROR, errorCbData);
-    }
-#endif
-
-}
-//---------------------------------------------------------------------------
-IA_CLIENT_PROT::~IA_CLIENT_PROT()
-{
-#ifndef WIN32
-close(sockr);
-#else
-closesocket(sockr);
-WSACleanup();
-#endif
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::DeterminatePacketType(const char * buffer)
-{
-map<string, int>::iterator pi;
-pi = packetTypes.find(buffer);
-if (pi == packetTypes.end())
-    {
-    return -1;
-    }
-else
-    {
-    return pi->second;
-    }
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::FillHdr8(char * buffer, unsigned long)
-{
-strncpy(buffer, IA_ID, 6);
-buffer[IA_MAGIC_LEN] = 0;
-buffer[IA_MAGIC_LEN + 1] = IA_PROTO_VER;
-strncpy(buffer + sizeof(HDR_8), login.c_str(), IA_LOGIN_LEN);
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Send(char * buffer, int len)
-{
-if (!isNetPrepared)
-    {
-    PrepareNet();
-    isNetPrepared = true;
-    }
-
-int db = sizeof(HDR_8);
-for (int i = 0; i < IA_LOGIN_LEN/8; i++)
-    {
-    Blowfish_Encrypt(&ctxHdr, (uint32_t*)(buffer + db + i*8), (uint32_t*)(buffer + db + i*8 + 4));
-    }
-
-db += IA_LOGIN_LEN;
-int encLen = (len - sizeof(HDR_8) - IA_LOGIN_LEN)/8;
-for (int i = 0; i < encLen; i++)
-    {
-    Blowfish_Encrypt(&ctxPass, (uint32_t*)(buffer + db), (uint32_t*)(buffer + db + 4));
-    db += 8;
-    }
-
-return sendto(sockr, buffer, len, 0, (struct sockaddr*)&servAddr, sizeof(servAddr));
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Recv(char * buffer, int len)
-{
-#ifdef WIN32
-int fromLen;
-#else
-socklen_t fromLen;
-#endif
-
-struct sockaddr_in addr;
-fromLen = sizeof(addr);
-int res = recvfrom(sockr, buffer, len, 0, (struct sockaddr*)&addr, &fromLen);
-
-if (res == -1)
-    return res;
-
-if (strcmp(buffer + 4 + sizeof(HDR_8), "ERR"))
-    {
-    for (int i = 0; i < len/8; i++)
-        Blowfish_Decrypt(&ctxPass, (uint32_t*)(buffer + i*8), (uint32_t*)(buffer + i*8 + 4));
-    }
-
-return 0;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::NetSend(int n)
-{
-char buffer[2048];
-int msgLen;
-
-memset(buffer, 0, 2048);
-
-switch (n)
-    {
-    case CONN_SYN_N:
-        msgLen = Prepare_CONN_SYN_8(buffer);
-        break;
-
-    case CONN_ACK_N:
-        msgLen = Prepare_CONN_ACK_8(buffer);
-        break;
-
-    case ALIVE_ACK_N:
-        msgLen = Prepare_ALIVE_ACK_8(buffer);
-        break;
-
-    case DISCONN_SYN_N:
-        msgLen = Prepare_DISCONN_SYN_8(buffer);
-        break;
-
-    case DISCONN_ACK_N:
-        msgLen = Prepare_DISCONN_ACK_8(buffer);
-        break;
-
-    default:
-        return -1;
-    }
-
-FillHdr8(buffer, 0);
-Send(buffer, msgLen);
-
-return 0;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::NetRecv()
-{
-char buffer[2048];
-
-if (Recv(buffer, sizeof(buffer)) < 0)
-    return -1;
-
-char packetName[20];
-strncpy(packetName, buffer + 12, sizeof(packetName));
-packetName[sizeof(packetName) - 1] = 0;
-int pn = DeterminatePacketType(buffer + 12);
-
-int ret;
-switch (pn)
-    {
-    case CONN_SYN_ACK_N:
-        ret = Process_CONN_SYN_ACK_8(buffer);
-        break;
-
-    case ALIVE_SYN_N:
-        ret = Process_ALIVE_SYN_8(buffer);
-        break;
-
-    case DISCONN_SYN_ACK_N:
-        ret = Process_DISCONN_SYN_ACK_8(buffer);
-        break;
-
-    case FIN_N:
-        ret = Process_FIN_8(buffer);
-        break;
-
-    case INFO_8_N:
-        ret = Process_INFO_8(buffer);
-        break;
-
-    case ERROR_N:
-        ret = Process_ERROR(buffer);
-        break;
-
-    default:
-        ret = -1;
-    }
-return ret;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::Start()
-{
-nonstop = true;
-#ifdef WIN32
-unsigned long pt;
-CreateThread(NULL, 16384, RunW, this, 0, &pt);
-#else
-pthread_create(&thread, NULL, RunL, this);
-#endif
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::Stop()
-{
-nonstop = false;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::Run()
-{
-NetRecv();
-
-switch (phase)
-    {
-    case 1:
-        if (action == IA_CONNECT)
-            {
-            action = IA_NONE;
-            NetSend(CONN_SYN_N);
-            phase = 2;
-            phaseTime = GetTickCount();
-            }
-        if (reconnect && !firstConnect)
-            {
-            action = IA_CONNECT;
-            }
-        break;
-
-    case 2:
-        if ((int)(GetTickCount() - phaseTime)/1000 > aliveTimeout)
-            {
-            phase = 1;
-            phaseTime = GetTickCount();
-            if (pStatusChangedCb != NULL)
-                pStatusChangedCb(0, statusChangedCbData);
-            }
-
-        if (action == IA_DISCONNECT)
-            {
-            action = IA_NONE;
-            NetSend(DISCONN_SYN_N);
-            phase = 4;
-            phaseTime = GetTickCount();
-            }
-
-        break;
-
-    case 3:
-        if ((int)(GetTickCount() - phaseTime)/1000 > userTimeout)
-            {
-            phase = 1;
-            phaseTime = GetTickCount();
-            if (pStatusChangedCb != NULL)
-                pStatusChangedCb(0, statusChangedCbData);
-            firstConnect = false;
-            }
-
-        if (action == IA_DISCONNECT)
-            {
-            action = IA_NONE;
-            NetSend(DISCONN_SYN_N);
-            phase = 4;
-            phaseTime = GetTickCount();
-            }
-
-        break;
-
-    case 4:
-        if ((int)(GetTickCount() - phaseTime)/1000 > aliveTimeout)
-            {
-            phase=1;
-            phaseTime = GetTickCount();
-            if (pStatusChangedCb != NULL)
-                pStatusChangedCb(0, statusChangedCbData);
-            }
-
-        if (action == IA_CONNECT)
-            {
-            action = IA_NONE;
-            NetSend(CONN_SYN_N);
-            phase = 2;
-            phaseTime = GetTickCount();
-            }
-
-        break;
-
-    case 5:
-        if ((int)(GetTickCount() - phaseTime)/1000 > aliveTimeout)
-            {
-            phase = 1;
-            phaseTime = GetTickCount();
-            if (pStatusChangedCb != NULL)
-                pStatusChangedCb(0, statusChangedCbData);
-            }
-
-        if (action == IA_CONNECT)
-            {
-            action = IA_NONE;
-            NetSend(CONN_SYN_N);
-            phase = 2;
-            phaseTime = GetTickCount();
-            }
-
-        break;
-    }
-Sleep(20);
-return;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::GetStat(LOADSTAT * ls)
-{
-memcpy(ls, &stat, sizeof(stat));
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetServer(const string & sn, unsigned short p)
-{
-serverName = sn;
-port = p;
-PrepareNet();
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetLogin(const string & l)
-{
-login = l;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetPassword(const string & p)
-{
-password = p;
-
-unsigned char keyL[IA_PASSWD_LEN];
-memset(keyL, 0, IA_PASSWD_LEN);
-strncpy((char *)keyL, password.c_str(), IA_PASSWD_LEN);
-Blowfish_Init(&ctxPass, keyL, IA_PASSWD_LEN);
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetEnabledDirs(const bool * selectedDirs)
-{
-memcpy(IA_CLIENT_PROT::selectedDirs, selectedDirs, sizeof(bool) * DIR_NUM);
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Connect()
-{
-action = IA_CONNECT;
-return 0;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Disconnect()
-{
-firstConnect = true;
-action = IA_DISCONNECT;
-return 0;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::GetStrError(string * error) const
-{
-int ret = codeError;
-*error = strError;
-strError = "";
-codeError = 0;
-return ret;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Process_CONN_SYN_ACK_8(const char * buffer)
-{
-vector<string> dirNames;
-connSynAck8 = (CONN_SYN_ACK_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(connSynAck8->len);
-SwapBytes(connSynAck8->rnd);
-SwapBytes(connSynAck8->userTimeOut);
-SwapBytes(connSynAck8->aliveDelay);
-#endif
-
-rnd = connSynAck8->rnd;
-userTimeout = connSynAck8->userTimeOut;
-aliveTimeout = connSynAck8->aliveDelay;
-
-for (int i = 0; i < DIR_NUM; i++)
-    {
-    dirNames.push_back((const char*)connSynAck8->dirName[i]);
-    }
-
-if (pDirNameCb != NULL)
-    pDirNameCb(dirNames, dirNameCbData);
-
-NetSend(CONN_ACK_N);
-phase = 3;
-phaseTime = GetTickCount();
-
-return CONN_SYN_ACK_N;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Process_ALIVE_SYN_8(const char * buffer)
-{
-aliveSyn8 = (ALIVE_SYN_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(aliveSyn8->len);
-SwapBytes(aliveSyn8->rnd);
-SwapBytes(aliveSyn8->cash);
-SwapBytes(aliveSyn8->status);
-for (int i = 0; i < DIR_NUM; ++i)
-    {
-    SwapBytes(aliveSyn8->mu[i]);
-    SwapBytes(aliveSyn8->md[i]);
-    SwapBytes(aliveSyn8->su[i]);
-    SwapBytes(aliveSyn8->sd[i]);
-    }
-#endif
-
-rnd = aliveSyn8->rnd;
-memcpy(&stat, (char*)aliveSyn8->mu, sizeof(stat));
-
-if (pStatChangedCb != NULL)
-    pStatChangedCb(stat, statChangedCbData);
-
-if (pStatusChangedCb != NULL)
-    pStatusChangedCb(1, statusChangedCbData);
-NetSend(ALIVE_ACK_N);
-phaseTime = GetTickCount();
-
-return ALIVE_SYN_N;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Process_DISCONN_SYN_ACK_8(const char * buffer)
-{
-disconnSynAck8 = (DISCONN_SYN_ACK_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(disconnSynAck8->len);
-SwapBytes(disconnSynAck8->rnd);
-#endif
-
-rnd = disconnSynAck8->rnd;
-
-NetSend(DISCONN_ACK_N);
-phase = 5;
-phaseTime = GetTickCount();
-
-return DISCONN_SYN_ACK_N;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Process_FIN_8(const char *)
-{
-phase = 1;
-phaseTime = GetTickCount();
-if (pStatusChangedCb != NULL)
-    pStatusChangedCb(0, statusChangedCbData);
-
-return FIN_N;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Process_INFO_8(const char * buffer)
-{
-info = (INFO_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(info->len);
-SwapBytes(info->sendTime);
-#endif
-
-if (pInfoCb != NULL)
-    pInfoCb((char*)info->text, info->infoType, info->showTime, info->sendTime, infoCbData);
-return INFO_8_N;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Process_ERROR(const char * buffer)
-{
-ERR_8 err;
-memcpy(&err, buffer, sizeof(err));
-
-#ifdef ARCH_BE
-SwapBytes(err.len);
-#endif
-
-KOIToWin((const char*)err.text, &messageText);
-if (pErrorCb != NULL)
-    pErrorCb(messageText, IA_SERVER_ERROR, errorCbData);
-phase = 1;
-phaseTime = GetTickCount();
-codeError = IA_SERVER_ERROR;
-
-return ERROR_N;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Prepare_CONN_SYN_8(char * buffer)
-{
-connSyn8 = (CONN_SYN_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(connSyn8->len);
-#endif
-
-assert(sizeof(CONN_SYN_8) == Min8(sizeof(CONN_SYN_8)) && "CONN_SYN_8 is not aligned to 8 bytes");
-
-connSyn8->len = sizeof(CONN_SYN_8);
-strncpy((char*)connSyn8->type, "CONN_SYN", IA_MAX_TYPE_LEN);
-strncpy((char*)connSyn8->login, login.c_str(), IA_LOGIN_LEN);
-connSyn8->dirs = 0;
-for (int i = 0; i < DIR_NUM; i++)
-    {
-    connSyn8->dirs |= (selectedDirs[i] << i);
-    }
-return connSyn8->len;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Prepare_CONN_ACK_8(char * buffer)
-{
-connAck8 = (CONN_ACK_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(connAck8->len);
-SwapBytes(connAck8->rnd);
-#endif
-
-assert(sizeof(CONN_ACK_8) == Min8(sizeof(CONN_ACK_8)) && "CONN_ACK_8 is not aligned to 8 bytes");
-
-connAck8->len = sizeof(CONN_ACK_8);
-strncpy((char*)connAck8->loginS, login.c_str(), IA_LOGIN_LEN);
-strncpy((char*)connAck8->type, "CONN_ACK", IA_MAX_TYPE_LEN);
-rnd++;
-connAck8->rnd = rnd;
-
-return connAck8->len;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Prepare_ALIVE_ACK_8(char * buffer)
-{
-aliveAck8 = (ALIVE_ACK_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(aliveAck8->len);
-SwapBytes(aliveAck8->rnd);
-#endif
-
-assert(Min8(sizeof(ALIVE_ACK_8)) == sizeof(ALIVE_ACK_8) && "ALIVE_ACK_8 is not aligned to 8 bytes");
-
-aliveAck8 = (ALIVE_ACK_8*)buffer;
-aliveAck8->len = sizeof(ALIVE_ACK_8);
-strncpy((char*)aliveAck8->loginS, login.c_str(), IA_LOGIN_LEN);
-strncpy((char*)aliveAck8->type, "ALIVE_ACK", IA_MAX_TYPE_LEN);
-aliveAck8->rnd = ++rnd;
-return aliveAck8->len;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Prepare_DISCONN_SYN_8(char * buffer)
-{
-disconnSyn8 = (DISCONN_SYN_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(disconnSyn8->len);
-#endif
-
-assert(Min8(sizeof(DISCONN_SYN_8)) == sizeof(DISCONN_SYN_8) && "DISCONN_SYN_8 is not aligned to 8 bytes");
-
-disconnSyn8->len = sizeof(DISCONN_SYN_8);
-strncpy((char*)disconnSyn8->loginS, login.c_str(), IA_LOGIN_LEN);
-strncpy((char*)disconnSyn8->type, "DISCONN_SYN", IA_MAX_TYPE_LEN);
-strncpy((char*)disconnSyn8->login, login.c_str(), IA_LOGIN_LEN);
-return disconnSyn8->len;
-}
-//---------------------------------------------------------------------------
-int IA_CLIENT_PROT::Prepare_DISCONN_ACK_8(char * buffer)
-{
-disconnAck8 = (DISCONN_ACK_8*)buffer;
-
-#ifdef ARCH_BE
-SwapBytes(disconnAck8->len);
-SwapBytes(disconnAck8->rnd);
-#endif
-
-assert(Min8(sizeof(DISCONN_ACK_8)) == sizeof(DISCONN_ACK_8) && "DISCONN_ACK_8 is not aligned to 8 bytes");
-
-disconnAck8->len = Min8(sizeof(DISCONN_ACK_8));
-disconnAck8->rnd = rnd + 1;
-strncpy((char*)disconnAck8->loginS, login.c_str(), IA_LOGIN_LEN);
-strncpy((char*)disconnAck8->type, "DISCONN_ACK", IA_MAX_TYPE_LEN);
-return disconnAck8->len;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetStatusChangedCb(tpStatusChangedCb p, void * data)
-{
-pStatusChangedCb = p;
-statusChangedCbData = data;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetStatChangedCb(tpStatChangedCb p, void * data)
-{
-pStatChangedCb = p;
-statChangedCbData = data;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetInfoCb(tpCallBackInfoFn p, void * data)
-{
-pInfoCb = p;
-infoCbData = data;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetDirNameCb(tpCallBackDirNameFn p, void * data)
-{
-pDirNameCb = p;
-dirNameCbData = data;
-}
-//---------------------------------------------------------------------------
-void IA_CLIENT_PROT::SetErrorCb(tpCallBackErrorFn p, void * data)
-{
-pErrorCb = p;
-errorCbData = data;
-}
-//---------------------------------------------------------------------------
diff --git a/stglibs/ia_auth_c.lib/ia_auth_c.h b/stglibs/ia_auth_c.lib/ia_auth_c.h
deleted file mode 100644 (file)
index 0a916f4..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-** 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 1, 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, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/*
- $Author: faust $
- $Revision: 1.10 $
- $Date: 2010/03/15 12:57:24 $
-*/
-
-/*
-* Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
-*/
-//---------------------------------------------------------------------------
-#ifndef IA_AUTH_C_H
-#define IA_AUTH_C_H
-
-#ifndef WIN32
-#include <netinet/in.h>
-#include <pthread.h>
-#else
-#include <winsock2.h>
-#endif
-
-#include <string>
-#include <vector>
-#include <map>
-
-#include "stg/blowfish.h"
-#include "stg/ia_packets.h"
-
-#define IA_BIND_ERROR           (1)
-#define IA_SERVER_ERROR         (2)
-#define IA_FCNTL_ERROR          (3)
-#define IA_GETHOSTBYNAME_ERROR  (4)
-
-#define IA_PROTO_VER            (8)
-#define IA_PROTO_PROXY_VER      (101)
-
-using namespace std;
-
-typedef void (*tpStatusChangedCb)(int status, void * data);
-typedef void (*tpStatChangedCb)(const LOADSTAT & stat, void * data);
-typedef void (*tpCallBackInfoFn)(const string & message, int infoType, int showTime, int sendTime, void * data);
-typedef void (*tpCallBackErrorFn)(const string & message, int netError, void * data);
-typedef void (*tpCallBackDirNameFn)(const vector<string> & dirName, void * data);
-
-//---------------------------------------------------------------------------
-class IA_CLIENT_PROT
-{
-#ifdef WIN32
-friend unsigned long WINAPI RunW(void * data);
-#else
-friend void * RunL(void * data);
-#endif
-
-public:
-    IA_CLIENT_PROT(const string & sn, uint16_t p, uint16_t localPort = 0);
-    ~IA_CLIENT_PROT();
-
-    void        Start();
-    void        Stop();
-    void        GetStat(LOADSTAT * ls);
-
-    void        SetServer(const string & sn, unsigned short port);
-    void        SetLogin(const string & login);
-    void        SetPassword(const string & password);
-    void        SetEnabledDirs(const bool * selectedDirs);
-
-    void        SetStatusChangedCb(tpStatusChangedCb p, void * data);
-    void        SetStatChangedCb(tpStatChangedCb p, void * data);
-    void        SetInfoCb(tpCallBackInfoFn p, void * data);
-    void        SetErrorCb(tpCallBackErrorFn p, void * data);
-    void        SetDirNameCb(tpCallBackDirNameFn p, void * data);
-
-    int         Connect();
-    int         Disconnect();
-    int         GetAuthorized() const { return phase == 3 || phase == 4; };
-    int         GetPhase() const { return phase; };
-    int         GetStatus() const;
-    int         GetReconnect() const { return reconnect; };
-    void        SetReconnect(int r) { reconnect = r; };
-    char        GetProtoVer() const { return proxyMode ? IA_PROTO_PROXY_VER : IA_PROTO_VER; };
-    void        GetMessageText(string * text) const { *text = messageText; };
-    void        GetInfoText(string * text) const { *text = infoText; };
-    int         GetStrError(string * error) const;
-
-    void        SetProxyMode(bool on) { proxyMode = on; };
-    bool        GetProxyMode() const { return proxyMode; };
-
-    void        SetIP(uint32_t ip) { IA_CLIENT_PROT::ip = ip; };
-    uint32_t    GetIP() const { return ip; };
-
-private:
-    void            Run();
-    int             NetRecv();
-    int             NetSend(int n);
-    bool            GetNonstop() const { return nonstop; };
-    void            PrepareNet();
-    int             DeterminatePacketType(const char * buffer);
-
-    int             Process_CONN_SYN_ACK_8(const char * buffer);
-    int             Process_ALIVE_SYN_8(const char * buffer);
-    int             Process_DISCONN_SYN_ACK_8(const char * buffer);
-    int             Process_FIN_8(const char * buffer);
-    int             Process_INFO_8(const char * buffer);
-    int             Process_ERROR(const char * buffer);
-
-    int             Prepare_CONN_SYN_8(char * buffer);
-    int             Prepare_CONN_ACK_8(char * buffer);
-    int             Prepare_ALIVE_ACK_8(char * buffer);
-    int             Prepare_DISCONN_SYN_8(char * buffer);
-    int             Prepare_DISCONN_ACK_8(char * buffer);
-
-    void            FillHdr8(char * buffer, unsigned long ip);
-    int             Send(char * buffer, int len);
-    int             Recv(char * buffer, int len);
-
-    LOADSTAT        stat;
-    int             action;
-    int             phase;
-    int             phaseTime;
-    string          messageText;
-    string          infoText;
-    mutable string  strError;
-    mutable int     codeError;
-    bool            nonstop;
-    bool            isNetPrepared;
-    bool            proxyMode;
-
-    BLOWFISH_CTX    ctxPass;
-    BLOWFISH_CTX    ctxHdr;
-
-    bool            selectedDirs[DIR_NUM];
-
-    string          password;
-    string          login;
-
-    #ifdef WIN32
-    WSADATA wsaData;
-    #else
-    pthread_t thread;
-    #endif
-
-    string          serverName;
-    uint16_t        port;
-    uint32_t        ip;
-    uint32_t        localPort;
-
-    struct sockaddr_in  servAddr;
-
-    bool            firstConnect;
-    int             reconnect;
-    int             sockr;
-    int             protNum;
-    int             userTimeout;
-    int             aliveTimeout;
-    unsigned int    rnd;
-
-    tpStatusChangedCb   pStatusChangedCb;
-    tpStatChangedCb     pStatChangedCb;
-    tpCallBackInfoFn    pInfoCb;
-    tpCallBackErrorFn   pErrorCb;
-    tpCallBackDirNameFn pDirNameCb;
-
-    void              * statusChangedCbData;
-    void              * statChangedCbData;
-    void              * infoCbData;
-    void              * errorCbData;
-    void              * dirNameCbData;
-
-    map<string, int>    packetTypes;
-
-    CONN_SYN_8        * connSyn8;
-    CONN_SYN_ACK_8    * connSynAck8;
-    CONN_ACK_8        * connAck8;
-    ALIVE_SYN_8       * aliveSyn8;
-    ALIVE_ACK_8       * aliveAck8;
-    DISCONN_SYN_8     * disconnSyn8;
-    DISCONN_SYN_ACK_8 * disconnSynAck8;
-    DISCONN_ACK_8     * disconnAck8;
-    INFO_8            * info;
-};
-//---------------------------------------------------------------------------
-#ifdef WIN32
-unsigned long WINAPI RunW(void *);
-#else
-void * RunW(void *);
-#endif
-
-//---------------------------------------------------------------------------
-#endif //IA_AUTH_C_H
diff --git a/stglibs/locker.lib/Makefile b/stglibs/locker.lib/Makefile
new file mode 100644 (file)
index 0000000..c490ce6
--- /dev/null
@@ -0,0 +1,14 @@
+###############################################################################
+# $Id: Makefile,v 1.2 2008/12/04 17:11:55 faust Exp $
+###############################################################################
+
+LIB_NAME = stglocker
+PROG = lib$(LIB_NAME)
+
+SRCS = locker.cpp
+
+INCS = locker.h
+
+LIBS = $(LIB_THREAD)
+
+include ../Makefile.in
diff --git a/stglibs/locker.lib/locker.cpp b/stglibs/locker.lib/locker.cpp
new file mode 100644 (file)
index 0000000..0d97fcb
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ *    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 2 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, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ */
+
+/*
+ $Revision: 1.2 $
+ $Date: 2007/11/30 08:57:49 $
+ $Author: nobunaga $
+*/
+
+
+
+#include <pthread.h>
+
+#include "locker.h"
+
+#ifdef DEBUG_LOCKER
+
+long long STG_LOCKER::id = 0;
+pthread_mutex_t STG_LOCKER::lockerMutex = PTHREAD_MUTEX_INITIALIZER;
+
+#endif
+
diff --git a/stglibs/locker.lib/locker.h b/stglibs/locker.lib/locker.h
new file mode 100644 (file)
index 0000000..4621388
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ *    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 2 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, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ */
+
+/*
+ $Revision: 1.5 $
+ $Date: 2010/03/04 11:57:11 $
+ $Author: faust $
+*/
+
+
+#ifndef STG_LOCKER_H
+#define STG_LOCKER_H
+
+#include <pthread.h>
+
+#ifdef DEBUG_LOCKER
+
+#include <iostream>
+#include <string>
+#include <pthread.h>
+
+#endif
+
+#include "stg/noncopyable.h"
+//-----------------------------------------------------------------------------
+class STG_LOCKER : private NONCOPYABLE
+{
+public:
+    #ifdef DEBUG_LOCKER
+    STG_LOCKER(pthread_mutex_t * m, const char * __file__, int __line__)
+        : mutex(m),
+          file(__file__),
+          line(__line__),
+          lockID(0)
+    #else
+    STG_LOCKER(pthread_mutex_t * m, const char *, int)
+        : mutex(m)
+    #endif
+        {
+        mutex = m;
+        #ifdef DEBUG_LOCKER
+        pthread_mutex_lock(&lockerMutex);
+        file = __file__;
+        line = __line__;
+        if (id == 0)
+            pthread_mutex_init(&lockerMutex, NULL);
+
+        lockID = ++id;
+        std::cout << "Lock: " << lockID << " " << file << ":" << line << " " << mutex << " " << pthread_self() << std::endl;
+        pthread_mutex_unlock(&lockerMutex);
+        #endif
+        pthread_mutex_lock(mutex);
+        };
+
+    ~STG_LOCKER()
+        {
+        pthread_mutex_unlock(mutex);
+        #ifdef DEBUG_LOCKER
+        pthread_mutex_lock(&lockerMutex);
+        std::cout << "Unlock: " << lockID << " " << file << ":" << line << " " << mutex << " " << pthread_self() << std::endl;
+        pthread_mutex_unlock(&lockerMutex);
+        #endif
+        };
+private:
+    pthread_mutex_t * mutex;
+    #ifdef DEBUG_LOCKER
+    std::string file;
+    int line;
+    static pthread_mutex_t lockerMutex;
+    static long long id;
+    long long lockID;
+    #endif
+};
+//-----------------------------------------------------------------------------
+
+#endif //STG_LOCKER_H
diff --git a/stglibs/logger.lib/Makefile b/stglibs/logger.lib/Makefile
new file mode 100644 (file)
index 0000000..95aca37
--- /dev/null
@@ -0,0 +1,12 @@
+###############################################################################
+# $Id: Makefile,v 1.3 2007/05/08 14:29:21 faust Exp $
+###############################################################################
+
+LIB_NAME = stglogger
+PROG = lib$(LIB_NAME)
+
+SRCS = logger.cpp
+
+INCS = logger.h
+
+include ../Makefile.in
diff --git a/stglibs/logger.lib/logger.cpp b/stglibs/logger.lib/logger.cpp
new file mode 100644 (file)
index 0000000..18c9de7
--- /dev/null
@@ -0,0 +1,94 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include <syslog.h>
+
+#include "logger.h"
+
+#ifdef STG_TIME
+extern const volatile time_t stgTime;
+#endif
+//-----------------------------------------------------------------------------
+STG_LOGGER & GetStgLogger()
+{
+static STG_LOGGER logger;
+return logger;
+}
+//-----------------------------------------------------------------------------
+STG_LOGGER::STG_LOGGER()
+    : fileName()
+{
+pthread_mutex_init(&mutex, NULL);
+}
+//-----------------------------------------------------------------------------
+STG_LOGGER::~STG_LOGGER()
+{
+pthread_mutex_destroy(&mutex);
+}
+//-----------------------------------------------------------------------------
+void STG_LOGGER::SetLogFileName(const std::string & fn)
+{
+STG_LOGGER_LOCKER lock(&mutex);
+fileName = fn;
+}
+//-----------------------------------------------------------------------------
+void STG_LOGGER::operator()(const char * fmt, ...)
+{
+STG_LOGGER_LOCKER lock(&mutex);
+
+char buff[2048];
+
+va_list vl;
+va_start(vl, fmt);
+vsnprintf(buff, sizeof(buff), fmt, vl);
+va_end(vl);
+
+FILE * f;
+if (!fileName.empty())
+    {
+    f = fopen(fileName.c_str(), "at");
+    if (f)
+        {
+        #ifdef STG_TIME
+        fprintf(f, "%s", LogDate(stgTime));
+        #else
+        fprintf(f, "%s", LogDate(time(NULL)));
+        #endif
+        fprintf(f, " -- ");
+        fprintf(f, "%s", buff);
+        fprintf(f, "\n");
+        fclose(f);
+        }
+    else
+        {
+        openlog("stg", LOG_NDELAY, LOG_USER);
+        syslog(LOG_CRIT, "%s", buff);
+        closelog();
+        }
+    }
+else
+    {
+    openlog("stg", LOG_NDELAY, LOG_USER);
+    syslog(LOG_CRIT, "%s", buff);
+    closelog();
+    }
+}
+//-----------------------------------------------------------------------------
+const char * STG_LOGGER::LogDate(time_t t)
+{
+static char s[32];
+if (t == 0)
+    t = time(NULL);
+
+struct tm * tt = localtime(&t);
+
+snprintf(s, 32, "%d-%s%d-%s%d %s%d:%s%d:%s%d",
+         tt->tm_year + 1900,
+         tt->tm_mon + 1 < 10 ? "0" : "", tt->tm_mon + 1,
+         tt->tm_mday    < 10 ? "0" : "", tt->tm_mday,
+         tt->tm_hour    < 10 ? "0" : "", tt->tm_hour,
+         tt->tm_min     < 10 ? "0" : "", tt->tm_min,
+         tt->tm_sec     < 10 ? "0" : "", tt->tm_sec);
+
+return s;
+}
+//-----------------------------------------------------------------------------
diff --git a/stglibs/logger.lib/logger.h b/stglibs/logger.lib/logger.h
new file mode 100644 (file)
index 0000000..f8375b0
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef STG_LOGGER_H
+#define STG_LOGGER_H
+
+#include <pthread.h>
+
+#include <string>
+
+#include "stg/noncopyable.h"
+
+const char * LogDate(time_t t);
+//-----------------------------------------------------------------------------
+class STG_LOGGER;
+STG_LOGGER & GetStgLogger();
+//-----------------------------------------------------------------------------
+class STG_LOGGER_LOCKER : private NONCOPYABLE
+{
+public:
+    STG_LOGGER_LOCKER(pthread_mutex_t * m) : mutex(m) { pthread_mutex_lock(mutex); };
+    ~STG_LOGGER_LOCKER() { pthread_mutex_unlock(mutex); };
+private:
+    pthread_mutex_t * mutex;
+};
+//-----------------------------------------------------------------------------
+class STG_LOGGER
+{
+friend STG_LOGGER & GetStgLogger();
+
+public:
+    ~STG_LOGGER();
+    void SetLogFileName(const std::string & fn);
+    void operator()(const char * fmt, ...);
+
+private:
+    STG_LOGGER();
+    const char * LogDate(time_t t);
+
+    std::string fileName;
+    pthread_mutex_t mutex;
+};
+//-----------------------------------------------------------------------------
+
+#endif //STG_LOGGER_H
index 5f368b64b76f75e7eb91456af376807d3fa555aa..91f6322dab10042c0000abac44893b649c7f1bd2 100644 (file)
@@ -2,7 +2,7 @@
 # $Id: Makefile,v 1.5 2008/12/04 17:13:14 faust Exp $
 ###############################################################################
 
 # $Id: Makefile,v 1.5 2008/12/04 17:13:14 faust Exp $
 ###############################################################################
 
-LIB_NAME = stg_pinger
+LIB_NAME = stgpinger
 PROG = lib$(LIB_NAME)
 
 SRCS = pinger.cpp
 PROG = lib$(LIB_NAME)
 
 SRCS = pinger.cpp
@@ -15,4 +15,4 @@ include ../Makefile.in
 
 test: all
        g++ -c test.cpp
 
 test: all
        g++ -c test.cpp
-       g++ -o test test.o ./libstg_pinger.a -lpthread
+       g++ -o test test.o ./libstgpinger.a -lpthread
index 68137d7cbd71486abbcb59ad3f80c64cf3262ad4..216b5977e5b7efbf3ddb4dc4a56be20972fcf3b9 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "pinger.h"
 #include "stg/common.h"
 
 #include "pinger.h"
 #include "stg/common.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 
 #ifdef STG_TIME
 extern volatile time_t stgTime;
 
 #ifdef STG_TIME
 extern volatile time_t stgTime;
diff --git a/stglibs/script_executer.lib/Makefile b/stglibs/script_executer.lib/Makefile
deleted file mode 100644 (file)
index 90691ab..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# $Id: Makefile,v 1.6 2010/01/21 13:02:12 faust Exp $
-###############################################################################
-
-LIB_NAME = script_executer
-PROG = lib$(LIB_NAME)
-
-SRCS = script_executer.cpp
-
-INCS = script_executer.h
-
-include ../Makefile.in
diff --git a/stglibs/script_executer.lib/script_executer.cpp b/stglibs/script_executer.lib/script_executer.cpp
deleted file mode 100644 (file)
index 00ff094..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <cstring>
-#include <cerrno>
-#include <csignal>
-
-#include "script_executer.h"
-
-using namespace std;
-
-#define MAX_SCRIPT_LEN  (1100)
-
-static int msgid;
-static bool nonstop;
-
-//-----------------------------------------------------------------------------
-struct SCRIPT_DATA
-{
-    long    mtype;
-    char    script[MAX_SCRIPT_LEN];
-} sd;
-//-----------------------------------------------------------------------------
-static void CatchUSR1Executer(int)
-{
-nonstop = false;
-}
-//-----------------------------------------------------------------------------
-int ScriptExec(const string & str)
-{
-if (str.length() >= MAX_SCRIPT_LEN)
-    return -1;
-
-int ret;
-strncpy(sd.script, str.c_str(), MAX_SCRIPT_LEN);
-sd.mtype = 1;
-ret = msgsnd(msgid, (void *)&sd, MAX_SCRIPT_LEN, 0);
-if (ret < 0)
-    {
-    return -1;
-    }
-return 0;
-}
-//-----------------------------------------------------------------------------
-#ifdef LINUX
-void Executer(int, int msgID, pid_t pid, char * procName)
-#else
-void Executer(int, int msgID, pid_t pid, char *)
-#endif
-{
-msgid = msgID;
-if (pid)
-    return;
-nonstop = true;
-
-#ifdef LINUX
-memset(procName, 0, strlen(procName));
-strcpy(procName, "stg-exec");
-#else
-setproctitle("stg-exec");
-#endif
-
-struct sigaction newsa, oldsa;
-sigset_t sigmask;
-
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGTERM);
-newsa.sa_handler = SIG_IGN;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGTERM, &newsa, &oldsa);
-
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGINT);
-newsa.sa_handler = SIG_IGN;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGINT, &newsa, &oldsa);
-
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGHUP);
-newsa.sa_handler = SIG_IGN;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGHUP, &newsa, &oldsa);
-
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGUSR1);
-newsa.sa_handler = CatchUSR1Executer;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGUSR1, &newsa, &oldsa);
-
-int ret;
-
-SCRIPT_DATA sd;
-
-while (nonstop)
-    {
-    sd.mtype = 1;
-    ret = msgrcv(msgid, &sd, MAX_SCRIPT_LEN, 0, 0);
-
-    if (ret < 0)
-        {
-        usleep(20000);
-        continue;
-        }
-    int ret = system(sd.script);
-    if (ret == -1)
-        {
-        // Fork failed
-        }
-    }
-}
-//-----------------------------------------------------------------------------
-
-
diff --git a/stglibs/script_executer.lib/script_executer.h b/stglibs/script_executer.lib/script_executer.h
deleted file mode 100644 (file)
index 12ba099..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef SCRIPT_EXECUTER_H
-#define SCRIPT_EXECUTER_H
-
-#include <string>
-
-int ScriptExec(const std::string & str);
-void Executer(int msgKey, int msgID, pid_t pid, char * procName);
-
-#endif //SCRIPT_EXECUTER_H
-
-
diff --git a/stglibs/scriptexecuter.lib/Makefile b/stglibs/scriptexecuter.lib/Makefile
new file mode 100644 (file)
index 0000000..52f8259
--- /dev/null
@@ -0,0 +1,12 @@
+###############################################################################
+# $Id: Makefile,v 1.6 2010/01/21 13:02:12 faust Exp $
+###############################################################################
+
+LIB_NAME = stgscriptexecuter
+PROG = lib$(LIB_NAME)
+
+SRCS = scriptexecuter.cpp
+
+INCS = scriptexecuter.h
+
+include ../Makefile.in
diff --git a/stglibs/scriptexecuter.lib/scriptexecuter.cpp b/stglibs/scriptexecuter.lib/scriptexecuter.cpp
new file mode 100644 (file)
index 0000000..6e21a28
--- /dev/null
@@ -0,0 +1,120 @@
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <cstring>
+#include <cerrno>
+#include <csignal>
+
+#include "scriptexecuter.h"
+
+using namespace std;
+
+#define MAX_SCRIPT_LEN  (1100)
+
+static int msgid;
+static bool nonstop;
+
+//-----------------------------------------------------------------------------
+struct SCRIPT_DATA
+{
+    long    mtype;
+    char    script[MAX_SCRIPT_LEN];
+} sd;
+//-----------------------------------------------------------------------------
+static void CatchUSR1Executer(int)
+{
+nonstop = false;
+}
+//-----------------------------------------------------------------------------
+int ScriptExec(const string & str)
+{
+if (str.length() >= MAX_SCRIPT_LEN)
+    return -1;
+
+int ret;
+strncpy(sd.script, str.c_str(), MAX_SCRIPT_LEN);
+sd.mtype = 1;
+ret = msgsnd(msgid, (void *)&sd, MAX_SCRIPT_LEN, 0);
+if (ret < 0)
+    {
+    return -1;
+    }
+return 0;
+}
+//-----------------------------------------------------------------------------
+#ifdef LINUX
+void Executer(int, int msgID, pid_t pid, char * procName)
+#else
+void Executer(int, int msgID, pid_t pid, char *)
+#endif
+{
+msgid = msgID;
+if (pid)
+    return;
+nonstop = true;
+
+#ifdef LINUX
+memset(procName, 0, strlen(procName));
+strcpy(procName, "stg-exec");
+#else
+setproctitle("stg-exec");
+#endif
+
+struct sigaction newsa, oldsa;
+sigset_t sigmask;
+
+sigemptyset(&sigmask);
+sigaddset(&sigmask, SIGTERM);
+newsa.sa_handler = SIG_IGN;
+newsa.sa_mask = sigmask;
+newsa.sa_flags = 0;
+sigaction(SIGTERM, &newsa, &oldsa);
+
+sigemptyset(&sigmask);
+sigaddset(&sigmask, SIGINT);
+newsa.sa_handler = SIG_IGN;
+newsa.sa_mask = sigmask;
+newsa.sa_flags = 0;
+sigaction(SIGINT, &newsa, &oldsa);
+
+sigemptyset(&sigmask);
+sigaddset(&sigmask, SIGHUP);
+newsa.sa_handler = SIG_IGN;
+newsa.sa_mask = sigmask;
+newsa.sa_flags = 0;
+sigaction(SIGHUP, &newsa, &oldsa);
+
+sigemptyset(&sigmask);
+sigaddset(&sigmask, SIGUSR1);
+newsa.sa_handler = CatchUSR1Executer;
+newsa.sa_mask = sigmask;
+newsa.sa_flags = 0;
+sigaction(SIGUSR1, &newsa, &oldsa);
+
+int ret;
+
+SCRIPT_DATA sd;
+
+while (nonstop)
+    {
+    sd.mtype = 1;
+    ret = msgrcv(msgid, &sd, MAX_SCRIPT_LEN, 0, 0);
+
+    if (ret < 0)
+        {
+        usleep(20000);
+        continue;
+        }
+    int ret = system(sd.script);
+    if (ret == -1)
+        {
+        // Fork failed
+        }
+    }
+}
+//-----------------------------------------------------------------------------
+
+
diff --git a/stglibs/scriptexecuter.lib/scriptexecuter.h b/stglibs/scriptexecuter.lib/scriptexecuter.h
new file mode 100644 (file)
index 0000000..12ba099
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef SCRIPT_EXECUTER_H
+#define SCRIPT_EXECUTER_H
+
+#include <string>
+
+int ScriptExec(const std::string & str);
+void Executer(int msgKey, int msgID, pid_t pid, char * procName);
+
+#endif //SCRIPT_EXECUTER_H
+
+
index 96ad48c20992fc216497c627f5feebde8427f64d..f2f379d0e4ee8f625ed6c778b0317278f54cdecb 100644 (file)
@@ -2,11 +2,11 @@
 # $Id: Makefile,v 1.9 2010/08/18 07:47:03 faust Exp $
 ###############################################################################
 
 # $Id: Makefile,v 1.9 2010/08/18 07:47:03 faust Exp $
 ###############################################################################
 
-LIB_NAME = srvconf
+LIB_NAME = stgsrvconf
 PROG = lib$(LIB_NAME)
 
 PROG = lib$(LIB_NAME)
 
-STGLIBS = -lstg_common \
-          -lstg_crypto
+STGLIBS = -lstgcommon \
+          -lstgcrypto
 LIBS = -lexpat
 
 SRCS =         netunit.cpp \
 LIBS = -lexpat
 
 SRCS =         netunit.cpp \
index d7c7568f848aaf63fc2f9b1c3198dc274090621a..0038f03da27dcb1ee9c25d3278090febe9728f5e 100644 (file)
@@ -34,7 +34,7 @@
 #include <string>
 
 #include "stg/common.h"
 #include <string>
 
 #include "stg/common.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 #include "servconf.h"
 
 using namespace std;
 #include "servconf.h"
 
 using namespace std;
index a2a74081396aa516853263444645395ad6c0f9d1..67c2f248dbae85c49b08fb1cf7f4eaa0189170e2 100644 (file)
@@ -33,7 +33,7 @@
 #include <string>
 
 #include "stg/os_int.h"
 #include <string>
 
 #include "stg/os_int.h"
-#include "stg/stg_const.h"
+#include "stg/const.h"
 #include "netunit.h"
 
 void Start(void *data, const char *el, const char **attr);
 #include "netunit.h"
 
 void Start(void *data, const char *el, const char **attr);
diff --git a/stglibs/stg_locker.lib/Makefile b/stglibs/stg_locker.lib/Makefile
deleted file mode 100644 (file)
index 5f99d5c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# $Id: Makefile,v 1.2 2008/12/04 17:11:55 faust Exp $
-###############################################################################
-
-LIB_NAME = stg_locker
-PROG = lib$(LIB_NAME)
-
-SRCS = stg_locker.cpp
-
-INCS = stg_locker.h
-
-LIBS=$(LIB_THREAD)
-
-include ../Makefile.in
diff --git a/stglibs/stg_locker.lib/stg_locker.cpp b/stglibs/stg_locker.lib/stg_locker.cpp
deleted file mode 100644 (file)
index 0f4007c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *    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 2 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, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- */
-
-/*
- $Revision: 1.2 $
- $Date: 2007/11/30 08:57:49 $
- $Author: nobunaga $
-*/
-
-
-
-#include <pthread.h>
-
-#include "stg_locker.h"
-
-#ifdef DEBUG_LOCKER
-
-long long STG_LOCKER::id = 0;
-pthread_mutex_t STG_LOCKER::lockerMutex = PTHREAD_MUTEX_INITIALIZER;
-
-#endif
-
diff --git a/stglibs/stg_locker.lib/stg_locker.h b/stglibs/stg_locker.lib/stg_locker.h
deleted file mode 100644 (file)
index 4621388..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *    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 2 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, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- */
-
-/*
- $Revision: 1.5 $
- $Date: 2010/03/04 11:57:11 $
- $Author: faust $
-*/
-
-
-#ifndef STG_LOCKER_H
-#define STG_LOCKER_H
-
-#include <pthread.h>
-
-#ifdef DEBUG_LOCKER
-
-#include <iostream>
-#include <string>
-#include <pthread.h>
-
-#endif
-
-#include "stg/noncopyable.h"
-//-----------------------------------------------------------------------------
-class STG_LOCKER : private NONCOPYABLE
-{
-public:
-    #ifdef DEBUG_LOCKER
-    STG_LOCKER(pthread_mutex_t * m, const char * __file__, int __line__)
-        : mutex(m),
-          file(__file__),
-          line(__line__),
-          lockID(0)
-    #else
-    STG_LOCKER(pthread_mutex_t * m, const char *, int)
-        : mutex(m)
-    #endif
-        {
-        mutex = m;
-        #ifdef DEBUG_LOCKER
-        pthread_mutex_lock(&lockerMutex);
-        file = __file__;
-        line = __line__;
-        if (id == 0)
-            pthread_mutex_init(&lockerMutex, NULL);
-
-        lockID = ++id;
-        std::cout << "Lock: " << lockID << " " << file << ":" << line << " " << mutex << " " << pthread_self() << std::endl;
-        pthread_mutex_unlock(&lockerMutex);
-        #endif
-        pthread_mutex_lock(mutex);
-        };
-
-    ~STG_LOCKER()
-        {
-        pthread_mutex_unlock(mutex);
-        #ifdef DEBUG_LOCKER
-        pthread_mutex_lock(&lockerMutex);
-        std::cout << "Unlock: " << lockID << " " << file << ":" << line << " " << mutex << " " << pthread_self() << std::endl;
-        pthread_mutex_unlock(&lockerMutex);
-        #endif
-        };
-private:
-    pthread_mutex_t * mutex;
-    #ifdef DEBUG_LOCKER
-    std::string file;
-    int line;
-    static pthread_mutex_t lockerMutex;
-    static long long id;
-    long long lockID;
-    #endif
-};
-//-----------------------------------------------------------------------------
-
-#endif //STG_LOCKER_H
diff --git a/stglibs/stg_logger.lib/Makefile b/stglibs/stg_logger.lib/Makefile
deleted file mode 100644 (file)
index e19b892..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# $Id: Makefile,v 1.3 2007/05/08 14:29:21 faust Exp $
-###############################################################################
-
-LIB_NAME = stg_logger
-PROG = lib$(LIB_NAME)
-
-SRCS = stg_logger.cpp
-
-INCS = stg_logger.h
-
-include ../Makefile.in
diff --git a/stglibs/stg_logger.lib/stg_logger.cpp b/stglibs/stg_logger.lib/stg_logger.cpp
deleted file mode 100644 (file)
index cb96e50..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include <syslog.h>
-
-#include "stg_logger.h"
-
-#ifdef STG_TIME
-extern const volatile time_t stgTime;
-#endif
-//-----------------------------------------------------------------------------
-STG_LOGGER & GetStgLogger()
-{
-static STG_LOGGER logger;
-return logger;
-}
-//-----------------------------------------------------------------------------
-STG_LOGGER::STG_LOGGER()
-    : fileName()
-{
-pthread_mutex_init(&mutex, NULL);
-}
-//-----------------------------------------------------------------------------
-STG_LOGGER::~STG_LOGGER()
-{
-pthread_mutex_destroy(&mutex);
-}
-//-----------------------------------------------------------------------------
-void STG_LOGGER::SetLogFileName(const std::string & fn)
-{
-STG_LOGGER_LOCKER lock(&mutex);
-fileName = fn;
-}
-//-----------------------------------------------------------------------------
-void STG_LOGGER::operator()(const char * fmt, ...)
-{
-STG_LOGGER_LOCKER lock(&mutex);
-
-char buff[2048];
-
-va_list vl;
-va_start(vl, fmt);
-vsnprintf(buff, sizeof(buff), fmt, vl);
-va_end(vl);
-
-FILE * f;
-if (!fileName.empty())
-    {
-    f = fopen(fileName.c_str(), "at");
-    if (f)
-        {
-        #ifdef STG_TIME
-        fprintf(f, "%s", LogDate(stgTime));
-        #else
-        fprintf(f, "%s", LogDate(time(NULL)));
-        #endif
-        fprintf(f, " -- ");
-        fprintf(f, "%s", buff);
-        fprintf(f, "\n");
-        fclose(f);
-        }
-    else
-        {
-        openlog("stg", LOG_NDELAY, LOG_USER);
-        syslog(LOG_CRIT, "%s", buff);
-        closelog();
-        }
-    }
-else
-    {
-    openlog("stg", LOG_NDELAY, LOG_USER);
-    syslog(LOG_CRIT, "%s", buff);
-    closelog();
-    }
-}
-//-----------------------------------------------------------------------------
-const char * STG_LOGGER::LogDate(time_t t)
-{
-static char s[32];
-if (t == 0)
-    t = time(NULL);
-
-struct tm * tt = localtime(&t);
-
-snprintf(s, 32, "%d-%s%d-%s%d %s%d:%s%d:%s%d",
-         tt->tm_year + 1900,
-         tt->tm_mon + 1 < 10 ? "0" : "", tt->tm_mon + 1,
-         tt->tm_mday    < 10 ? "0" : "", tt->tm_mday,
-         tt->tm_hour    < 10 ? "0" : "", tt->tm_hour,
-         tt->tm_min     < 10 ? "0" : "", tt->tm_min,
-         tt->tm_sec     < 10 ? "0" : "", tt->tm_sec);
-
-return s;
-}
-//-----------------------------------------------------------------------------
diff --git a/stglibs/stg_logger.lib/stg_logger.h b/stglibs/stg_logger.lib/stg_logger.h
deleted file mode 100644 (file)
index f8375b0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef STG_LOGGER_H
-#define STG_LOGGER_H
-
-#include <pthread.h>
-
-#include <string>
-
-#include "stg/noncopyable.h"
-
-const char * LogDate(time_t t);
-//-----------------------------------------------------------------------------
-class STG_LOGGER;
-STG_LOGGER & GetStgLogger();
-//-----------------------------------------------------------------------------
-class STG_LOGGER_LOCKER : private NONCOPYABLE
-{
-public:
-    STG_LOGGER_LOCKER(pthread_mutex_t * m) : mutex(m) { pthread_mutex_lock(mutex); };
-    ~STG_LOGGER_LOCKER() { pthread_mutex_unlock(mutex); };
-private:
-    pthread_mutex_t * mutex;
-};
-//-----------------------------------------------------------------------------
-class STG_LOGGER
-{
-friend STG_LOGGER & GetStgLogger();
-
-public:
-    ~STG_LOGGER();
-    void SetLogFileName(const std::string & fn);
-    void operator()(const char * fmt, ...);
-
-private:
-    STG_LOGGER();
-    const char * LogDate(time_t t);
-
-    std::string fileName;
-    pthread_mutex_t mutex;
-};
-//-----------------------------------------------------------------------------
-
-#endif //STG_LOGGER_H
index ecb054abe3c37d98eb48b9d5006d537528018bc8..2364db7487a8acab5a4f868e414ff2b08de8b6ea 100644 (file)
@@ -1,4 +1,4 @@
-CXXFLAGS+=-g3 -Wall -W -Wextra -DLINUX -I../include -I../projects/stargazer -I../stglibs/conffiles.lib -I.
+CXXFLAGS+=-g3 -Wall -W -Wextra -DLINUX -I../include -I../projects/stargazer -I../stglibs/stgconffiles.lib -I.
 LIBS=-lpthread
 PROG=tests
 
 LIBS=-lpthread
 PROG=tests
 
@@ -6,9 +6,9 @@ SOURCES=main.cpp \
        test_raw_ip.cpp \
        test_admin_conf.cpp \
        test_tariff.cpp \
        test_raw_ip.cpp \
        test_admin_conf.cpp \
        test_tariff.cpp \
-       test_conffiles.cpp \
+       test_stgconffiles.cpp \
        ../projects/stargazer/tariff.cpp \
        ../projects/stargazer/tariff.cpp \
-       ../stglibs/conffiles.lib/conffiles.cpp
+       ../stglibs/stgconffiles.lib/stgconffiles.cpp
 
 all: $(PROG) 
 
 
 all: $(PROG) 
 
index 60af8ace276c0f880b84a00d72df9d3262736bc2..1fbfe5f369adc6e2fcd0f0c1bdc5047216dcef28 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <cstring>
 
 
 #include <cstring>
 
-#include "stg_const.h"
+#include "const.h"
 
 #define IPv4 (2)
 
 
 #define IPv4 (2)