├── Hive
├── .gitignore
├── Source
│ ├── .gitignore
│ ├── HiveLib
│ │ ├── .gitignore
│ │ ├── Version.cpp.template
│ │ ├── HiveLib.vcxproj.user
│ │ ├── version_gen.sh
│ │ ├── Version.h
│ │ ├── DataSource
│ │ │ ├── DataSource.h
│ │ │ ├── SqlDataSource.h
│ │ │ ├── CharDataSource.h
│ │ │ ├── ObjDataSource.h
│ │ │ ├── SqlCharDataSource.h
│ │ │ ├── SqlObjDataSource.h
│ │ │ └── CharDataSource.cpp
│ │ ├── ExtStartup.h
│ │ ├── Sqf.h
│ │ ├── HiveLib.vcxproj.filters
│ │ ├── HiveExtApp.h
│ │ └── ExtStartup.cpp
│ ├── HiveExt
│ │ ├── Resource.rc
│ │ ├── resource.h
│ │ ├── HiveExt.vcxproj.filters
│ │ ├── HiveExt.vcxproj.user
│ │ ├── DirectHiveApp.h
│ │ ├── DirectHiveApp.cpp
│ │ └── Main.cpp
│ ├── Database
│ │ ├── Implementation
│ │ │ ├── DatabaseMySql
│ │ │ │ ├── Resource.rc
│ │ │ │ ├── resource.h
│ │ │ │ ├── DatabaseMySql.vcxproj.filters
│ │ │ │ ├── Manifest.cpp
│ │ │ │ ├── QueryResultMySql.h
│ │ │ │ ├── QueryResultMySql.cpp
│ │ │ │ ├── DatabaseMySql.h
│ │ │ │ └── DatabaseMySql.vcxproj
│ │ │ ├── DatabasePostgre
│ │ │ │ ├── Resource.rc
│ │ │ │ ├── postgre.h
│ │ │ │ ├── resource.h
│ │ │ │ ├── DatabasePostgre.vcxproj.filters
│ │ │ │ ├── Manifest.cpp
│ │ │ │ ├── QueryResultPostgre.h
│ │ │ │ ├── DatabasePostgre.h
│ │ │ │ └── DatabasePostgre.vcxproj
│ │ │ ├── QueryResultImpl.h
│ │ │ ├── SqlDelayThread.h
│ │ │ ├── SqlStatementImpl.cpp
│ │ │ ├── SqlDelayThread.cpp
│ │ │ ├── SqlStatementImpl.h
│ │ │ ├── RetrySqlOp.h
│ │ │ ├── SqlPreparedStatement.h
│ │ │ ├── SqlOperations.h
│ │ │ ├── SqlConnection.h
│ │ │ ├── SqlPreparedStatement.cpp
│ │ │ ├── SqlOperations.cpp
│ │ │ └── SqlConnection.cpp
│ │ ├── Database.vcxproj.user
│ │ ├── Callback.h
│ │ ├── Database.vcxproj.filters
│ │ ├── Field.h
│ │ ├── QueryResult.h
│ │ └── Database.h
│ ├── Shared
│ │ ├── Shared.vcxproj.user
│ │ ├── Common
│ │ │ ├── Singleton.h
│ │ │ ├── SingletonImpl.h
│ │ │ ├── Pimpl.h
│ │ │ ├── Timer.h
│ │ │ ├── PimplImpl.h
│ │ │ ├── Types.h
│ │ │ ├── Timer.cpp
│ │ │ └── Exception.h
│ │ ├── Server
│ │ │ ├── Log
│ │ │ │ ├── ArmaConsoleChannel.h
│ │ │ │ ├── HiveConsoleChannel.h
│ │ │ │ ├── CustomLevelChannel.h
│ │ │ │ └── HiveConsoleChannel.cpp
│ │ │ ├── AppServer.h
│ │ │ └── AppServer.cpp
│ │ ├── Library
│ │ │ ├── SharedLibraryLoader.h
│ │ │ └── Database
│ │ │ │ ├── DatabaseLoader.h
│ │ │ │ └── DatabaseLoader.cpp
│ │ ├── Policy
│ │ │ └── Allocator.cpp
│ │ ├── Shared.vcxproj.filters
│ │ └── Shared.vcxproj
│ ├── Restarter
│ │ ├── Restarter.vcxproj.filters
│ │ ├── Restarter.vcxproj.user
│ │ └── Restarter.vcxproj
│ ├── StaticLib.Debug.props
│ ├── ConsoleApp.Debug.props
│ ├── Executable.Debug.props
│ ├── Executable.Release.props
│ ├── StaticLib.Release.props
│ ├── ConsoleApp.Release.props
│ ├── ConsoleApp.Generic.props
│ ├── StaticLib.Common.props
│ ├── DynamicLib.Common.props
│ ├── Generic.Debug.props
│ ├── Generic.Release.props
│ ├── DynamicLib.Debug.props
│ ├── DynamicLib.Release.props
│ ├── Executable.Common.props
│ ├── Generic.Common.props
│ └── Hive.sln
├── Binaries
│ ├── .gitignore
│ ├── Restarter.ini
│ ├── README.txt
│ └── HiveExt.ini
└── SQL
│ ├── obj_tables.sql
│ └── char_tables.sql
├── .gitignore
└── Dependencies
├── TBB.props
├── MySQL.props
├── Poco.props
├── Detours.props
└── PostgreSQL.props
/Hive/.gitignore:
--------------------------------------------------------------------------------
1 | Build
2 | Out
--------------------------------------------------------------------------------
/Hive/Source/.gitignore:
--------------------------------------------------------------------------------
1 | ipch
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/.gitignore:
--------------------------------------------------------------------------------
1 | Version.cpp
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.suo
2 | *.sdf
3 | *.opensdf
4 | *.aps
5 |
--------------------------------------------------------------------------------
/Hive/Binaries/.gitignore:
--------------------------------------------------------------------------------
1 | *.log
2 | *.log.*
3 | *.exe
4 | *.dll
5 | *.pdb
--------------------------------------------------------------------------------
/Hive/Source/HiveExt/Resource.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rajkosto/hive/HEAD/Hive/Source/HiveExt/Resource.rc
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/Version.cpp.template:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Version.h"
3 |
4 | const std::string GIT_VERSION = "%GIT_VERSION%";
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabaseMySql/Resource.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rajkosto/hive/HEAD/Hive/Source/Database/Implementation/DatabaseMySql/Resource.rc
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabasePostgre/Resource.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rajkosto/hive/HEAD/Hive/Source/Database/Implementation/DatabasePostgre/Resource.rc
--------------------------------------------------------------------------------
/Hive/Source/Database/Database.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/HiveLib.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Hive/Source/Shared/Shared.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/version_gen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | gitVer=`git rev-list HEAD | head -n 1`
4 | sedCommand="s/%GIT_VERSION%/${gitVer}/g"
5 | echo "Generating Git version file"
6 | sed "$sedCommand" $1 > $2
--------------------------------------------------------------------------------
/Hive/Source/Restarter/Restarter.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Dependencies/TBB.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Dependencies/MySQL.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Dependencies/Poco.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Dependencies/Detours.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabasePostgre/postgre.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef WIN32
4 | #ifdef FD_SETSIZE
5 | #undef FD_SETSIZE
6 | #endif
7 | #define FD_SETSIZE 1024
8 | #include
9 | #include
10 | #else
11 | #include
12 | #endif
--------------------------------------------------------------------------------
/Dependencies/PostgreSQL.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Hive/Source/StaticLib.Debug.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Hive/Source/ConsoleApp.Debug.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Hive/Source/Executable.Debug.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Hive/Source/Executable.Release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Hive/Source/StaticLib.Release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Hive/Source/ConsoleApp.Release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Hive/Source/HiveExt/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Resource.rc
4 |
5 | // Next default values for new objects
6 | //
7 | #ifdef APSTUDIO_INVOKED
8 | #ifndef APSTUDIO_READONLY_SYMBOLS
9 | #define _APS_NEXT_RESOURCE_VALUE 101
10 | #define _APS_NEXT_COMMAND_VALUE 40001
11 | #define _APS_NEXT_CONTROL_VALUE 1001
12 | #define _APS_NEXT_SYMED_VALUE 101
13 | #endif
14 | #endif
15 |
--------------------------------------------------------------------------------
/Hive/Source/ConsoleApp.Generic.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | _CONSOLE;%(PreprocessorDefinitions)
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabaseMySql/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Resource.rc
4 |
5 | // Next default values for new objects
6 | //
7 | #ifdef APSTUDIO_INVOKED
8 | #ifndef APSTUDIO_READONLY_SYMBOLS
9 | #define _APS_NEXT_RESOURCE_VALUE 101
10 | #define _APS_NEXT_COMMAND_VALUE 40001
11 | #define _APS_NEXT_CONTROL_VALUE 1001
12 | #define _APS_NEXT_SYMED_VALUE 101
13 | #endif
14 | #endif
15 |
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabasePostgre/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Resource.rc
4 |
5 | // Next default values for new objects
6 | //
7 | #ifdef APSTUDIO_INVOKED
8 | #ifndef APSTUDIO_READONLY_SYMBOLS
9 | #define _APS_NEXT_RESOURCE_VALUE 101
10 | #define _APS_NEXT_COMMAND_VALUE 40001
11 | #define _APS_NEXT_CONTROL_VALUE 1001
12 | #define _APS_NEXT_SYMED_VALUE 101
13 | #endif
14 | #endif
15 |
--------------------------------------------------------------------------------
/Hive/Source/StaticLib.Common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | _LIB;%(PreprocessorDefinitions)
9 | $(TargetDir)$(TargetName).pdb
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Hive/Source/DynamicLib.Common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | _USRDLL;%(PreprocessorDefinitions)
9 |
10 |
11 | $(TargetDir)$(TargetName).lib
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Hive/Source/Generic.Debug.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | $(ProjectName)d
9 |
10 |
11 |
12 | _DEBUG;_SECURE_SCL=0;%(PreprocessorDefinitions)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Hive/Source/Generic.Release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | $(ProjectName)
9 |
10 |
11 |
12 | NDEBUG;%(PreprocessorDefinitions)
13 | true
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Hive/Source/DynamicLib.Debug.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | $(ProjectName)d
10 | .dll
11 |
12 |
13 |
14 | _USRDLL;%(PreprocessorDefinitions)
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Hive/Source/DynamicLib.Release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | $(ProjectName)
10 | .dll
11 |
12 |
13 |
14 | _USRDLL;%(PreprocessorDefinitions)
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Hive/Source/HiveExt/HiveExt.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Resource
11 |
12 |
13 |
14 |
15 | {5effb2b5-ada7-4b17-a444-3ad3c6cdccd2}
16 |
17 |
18 |
19 |
20 | Resource
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Hive/Source/Restarter/Restarter.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(BinariesDir)$(TargetFileName)
5 | WindowsLocalDebugger
6 | $(BinariesDir)
7 |
8 |
9 | $(BinariesDir)$(TargetFileName)
10 | WindowsLocalDebugger
11 | $(BinariesDir)
12 |
13 |
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/Version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 | #include
21 |
22 | extern const std::string GIT_VERSION;
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabaseMySql/DatabaseMySql.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Resource
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | {c245e7ad-2011-4774-9609-3d51523ede87}
18 |
19 |
20 |
21 |
22 | Resource
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabasePostgre/DatabasePostgre.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Resource
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | {A2A36450-1171-4A55-9502-6978E46BB5FC}
18 |
19 |
20 |
21 |
22 | Resource
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Hive/SQL/obj_tables.sql:
--------------------------------------------------------------------------------
1 | SET FOREIGN_KEY_CHECKS=0;
2 |
3 | -- ----------------------------
4 | -- Table structure for `Object_DATA`
5 | -- ----------------------------
6 | CREATE TABLE `Object_DATA` (
7 | `ObjectID` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
8 | `ObjectUID` bigint(20) NOT NULL DEFAULT '0',
9 | `Instance` int(11) NOT NULL,
10 | `Classname` varchar(64) DEFAULT NULL,
11 | `Datestamp` datetime NOT NULL,
12 | `CharacterID` int(11) UNSIGNED NOT NULL DEFAULT '0',
13 | `Worldspace` varchar(128) NOT NULL DEFAULT '[]',
14 | `Inventory` text,
15 | `Hitpoints` varchar(512) NOT NULL DEFAULT '[]',
16 | `Fuel` double(13,5) NOT NULL DEFAULT '1.00000',
17 | `Damage` double(13,5) NOT NULL DEFAULT '0.00000',
18 | `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
19 | PRIMARY KEY (`ObjectID`),
20 | KEY `ObjectUID` (`ObjectUID`),
21 | KEY `Instance` (`Instance`)
22 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
23 |
--------------------------------------------------------------------------------
/Hive/Source/HiveExt/HiveExt.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(BinariesDir)$(TargetFileName)
5 |
6 |
7 |
8 |
9 | WindowsLocalDebugger
10 | $(BinariesDir)
11 |
12 |
13 | $(BinariesDir)$(TargetFileName)
14 | WindowsLocalDebugger
15 | $(BinariesDir)
16 |
17 |
--------------------------------------------------------------------------------
/Hive/Source/Shared/Common/Singleton.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | template
22 | class Singleton
23 | {
24 | protected:
25 | Singleton() {};
26 | public:
27 | static RealType& instance();
28 | };
--------------------------------------------------------------------------------
/Hive/Source/Executable.Common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $(SolutionDir)..\Binaries\
6 |
7 |
8 |
9 |
10 | $(OutDir);%(AdditionalLibraryDirectories)
11 | $(IntDir)$(TargetName).lib
12 | Version.lib;%(AdditionalDependencies)
13 |
14 |
15 | copy /Y "$(TargetPath)" "$(BinariesDir)"
16 |
17 |
18 | Copy Binary Artifact
19 |
20 |
21 |
22 |
23 | $(BinariesDir)
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabaseMySql/Manifest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2013 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #include
20 | #include "Database/Database.h"
21 |
22 | #include "DatabaseMySql.h"
23 |
24 | POCO_BEGIN_MANIFEST(Database)
25 | POCO_EXPORT_CLASS(DatabaseMySql)
26 | POCO_END_MANIFEST
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabasePostgre/Manifest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2013 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #include
20 | #include "Database/Database.h"
21 |
22 | #include "DatabasePostgre.h"
23 |
24 | POCO_BEGIN_MANIFEST(Database)
25 | POCO_EXPORT_CLASS(DatabasePostgre)
26 | POCO_END_MANIFEST
--------------------------------------------------------------------------------
/Hive/Source/Shared/Common/SingletonImpl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #include "Singleton.h"
20 | #include
21 |
22 | #define DEFINE_SINGLETON(SingletonType) namespace { Poco::SingletonHolder sh; }; \
23 | SingletonType& Singleton::instance() { return *sh.get(); }
24 |
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/DataSource/DataSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "../Sqf.h"
22 |
23 | namespace Poco { class Logger; };
24 | class DataSource
25 | {
26 | public:
27 | DataSource(Poco::Logger& logger) : _logger(logger) {}
28 | virtual ~DataSource() {}
29 | protected:
30 | Poco::Logger& _logger;
31 | };
--------------------------------------------------------------------------------
/Hive/Source/HiveExt/DirectHiveApp.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Shared/Common/Types.h"
22 | #include "HiveLib/HiveExtApp.h"
23 |
24 | class Database;
25 | class DirectHiveApp: public HiveExtApp
26 | {
27 | public:
28 | DirectHiveApp(string suffixDir);
29 | protected:
30 | bool initialiseService() override;
31 | private:
32 | shared_ptr _charDb, _objDb;
33 | };
--------------------------------------------------------------------------------
/Hive/Source/Shared/Server/Log/ArmaConsoleChannel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "CustomLevelChannel.h"
22 | #include "Poco/UnWindows.h"
23 |
24 | class ArmaConsoleChannel: public CustomLevelChannel
25 | {
26 | public:
27 | ArmaConsoleChannel();
28 | void log(const Poco::Message& msg);
29 | protected:
30 | ~ArmaConsoleChannel();
31 | private:
32 | HWND _wndRich;
33 | };
34 |
35 |
--------------------------------------------------------------------------------
/Hive/Source/Generic.Common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | $(SolutionDir)..\Out\$(Platform)\$(PlatformToolset)\
7 |
8 |
9 | $(SolutionDir)..\Build\$(ProjectName)\$(Platform)\$(PlatformToolset)\$(Configuration)\
10 |
11 |
12 | $(IntDir)\$(MSBuildProjectName).log
13 |
14 |
15 |
16 | WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
17 | $(SolutionDir);%(AdditionalIncludeDirectories)
18 | $(OutDir)$(TargetName).pdb
19 |
20 |
21 | true
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/DataSource/SqlDataSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "DataSource.h"
22 |
23 | class Database;
24 | class SqlDataSource : public DataSource
25 | {
26 | public:
27 | SqlDataSource(Poco::Logger& logger, shared_ptr db) : DataSource(logger), _db(db) {}
28 | ~SqlDataSource() {}
29 | protected:
30 | Database* getDB() const { return _db.get(); }
31 | private:
32 | shared_ptr _db;
33 | };
--------------------------------------------------------------------------------
/Hive/Source/Shared/Server/Log/HiveConsoleChannel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "CustomLevelChannel.h"
22 | #include "Poco/UnWindows.h"
23 |
24 | class HiveConsoleChannel: public CustomLevelChannel
25 | {
26 | public:
27 | HiveConsoleChannel(std::string windowTitle = "");
28 |
29 | void log(const Poco::Message& msg);
30 | protected:
31 | ~HiveConsoleChannel();
32 | private:
33 | bool _consoleCreated;
34 | HANDLE _hConsole;
35 | };
36 |
37 |
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/ExtStartup.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "HiveExtApp.h"
22 | #include
23 |
24 | namespace ExtStartup
25 | {
26 | typedef boost::function MakeAppFunction;
27 |
28 | void InitModule(MakeAppFunction makeAppFunc);
29 | void ProcessShutdown();
30 | };
31 |
32 | #define WIN32_LEAN_AND_MEAN
33 | #include
34 | #include
35 |
36 | extern "C"
37 | {
38 | __declspec(dllexport) void CALLBACK RVExtension(char* output, int outputSize, const char* function);
39 | };
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabaseMySql/QueryResultMySql.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2013 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Shared/Common/Types.h"
22 | #include "../QueryResultImpl.h"
23 | #include "DatabaseMySql.h"
24 |
25 | class QueryResultMySql : public QueryResultImpl
26 | {
27 | public:
28 | QueryResultMySql(MySQLConnection* theConn, const char* sql);
29 | ~QueryResultMySql();
30 |
31 | bool fetchRow() override;
32 | QueryFieldNames fetchFieldNames() const override;
33 |
34 | bool nextResult() override;
35 | private:
36 | vector _results;
37 | int _currRes;
38 | };
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/DatabasePostgre/QueryResultPostgre.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2013 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "../QueryResultImpl.h"
22 | #include "DatabasePostgre.h"
23 |
24 | class QueryResultPostgre : public QueryResultImpl
25 | {
26 | public:
27 | QueryResultPostgre(PostgreSQLConnection* theConn, const char* sql);
28 | ~QueryResultPostgre();
29 |
30 | bool fetchRow() override;
31 | QueryFieldNames fetchFieldNames() const override;
32 |
33 | bool nextResult() override;
34 | private:
35 | vector _results;
36 | int _currRes;
37 | size_t _tblIdx;
38 | };
39 |
--------------------------------------------------------------------------------
/Hive/Source/Shared/Common/Pimpl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include
22 |
23 | template
24 | class Pimpl
25 | {
26 | private:
27 | std::unique_ptr m;
28 | public:
29 | Pimpl();
30 | template
31 | Pimpl( Arg1&& arg1 );
32 |
33 | template
34 | Pimpl( Arg1&& arg1, Arg2&& arg2 );
35 |
36 | template
37 | Pimpl( Arg1&& arg1, Arg2&& arg2, Arg3&& arg3 );
38 |
39 | ~Pimpl();
40 |
41 | T* operator->();
42 | T* operator->() const;
43 | T& operator*();
44 | T& operator*() const;
45 | };
--------------------------------------------------------------------------------
/Hive/Source/Shared/Server/AppServer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Shared/Common/Types.h"
22 | #include
23 |
24 | class AppServer: public Poco::Util::ServerApplication
25 | {
26 | public:
27 | AppServer(std::string appName = "", std::string suffixDir = "") : appName(appName), appDir(suffixDir) {}
28 | std::string getAppDir() { return appDir; }
29 | void enableAsyncLogging();
30 | protected:
31 | void initialize(Application& self) override;
32 | void uninitialize() override;
33 | private:
34 | void initConfig();
35 | void initLogger();
36 | std::string appName;
37 | std::string appDir;
38 | };
39 |
--------------------------------------------------------------------------------
/Hive/Binaries/Restarter.ini:
--------------------------------------------------------------------------------
1 | [Global]
2 | ;if not specified, will look in currently working directory for beta, then normal, if running as service, cwd = dir exe is in
3 | exePath = d:\Program Files\Steam\steamapps\common\arma 2 operation arrowhead\Expansion\beta\arma2oaserver.exe
4 |
5 | [EUDAYZPRIV]
6 | ;maxMem = 2047
7 | ;if not specified, uses your physical cpu count from windows
8 | ;cpuCount = 4
9 | exThreads = 1
10 | ;if not specified, uses the section name
11 | ;name = EUDAYZPRIV
12 | ;if not specified, uses the server name (either section, or name=) as a subfolder
13 | ;profiles = EUDAYZPRIV
14 | ;if not specified, tries profiles/[arma2.cfg,basic.cfg,arma2oa.cfg]
15 | ;cfg = EUDAYZPRIV\arma2.cfg
16 | ;if not specified, tries profiles/server.cfg
17 | config = EUDAYZPRIV\server_666.cfg
18 | ;must be specified if you run mods
19 | mod = @dayz;@hive
20 | ;world = Chernarus
21 | ;ip = 0.0.0.0
22 | port = 3000
23 |
24 | [EUDAYZPRIV2]
25 | maxMem = 2047
26 | ;if not specified, uses your physical cpu count from windows
27 | cpuCount = 3
28 | exThreads = 1
29 | ;if not specified, uses the section name
30 | ;name = EUDAYZPRIV
31 | ;if not specified, uses the server name (either section, or name=) as a subfolder
32 | ;profiles = EUDAYZPRIV
33 | ;if not specified, tries profiles/[arma2.cfg,basic.cfg,arma2oa.cfg]
34 | ;cfg = EUDAYZPRIV\arma2.cfg
35 | ;if not specified, tries profiles/server.cfg
36 | config = EUDAYZPRIV2\server_666.cfg
37 | ;must be specified if you run mods
38 | mod = @dayz;@hive
39 | world = Chernarus
40 | ;ip = 0.0.0.0
41 | port = 4000
--------------------------------------------------------------------------------
/Hive/Source/Shared/Server/Log/CustomLevelChannel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Poco/Foundation.h"
22 | #include "Poco/Channel.h"
23 | #include "Poco/Mutex.h"
24 |
25 | #include
26 |
27 | class CustomLevelChannel: public Poco::Channel
28 | {
29 | public:
30 | CustomLevelChannel() {};
31 |
32 | void overrideLevel(int newLevel) { _level = newLevel; }
33 | void removeLevelOverride() { _level.reset(); }
34 | protected:
35 | bool shouldLog(int theLevel) const
36 | {
37 | if (!_level.is_initialized())
38 | return true;
39 |
40 | if (theLevel <= _level.get())
41 | return true;
42 |
43 | return false;
44 | }
45 |
46 | ~CustomLevelChannel() {};
47 | private:
48 | boost::optional _level;
49 | };
50 |
51 |
--------------------------------------------------------------------------------
/Hive/Source/Database/Callback.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Shared/Common/Types.h"
22 | #include
23 |
24 | class QueryResult;
25 | struct QueryCallback
26 | {
27 | typedef unique_ptr& ResType;
28 | typedef boost::function FuncType;
29 |
30 | QueryCallback() : res(nullptr) {}
31 | QueryCallback(FuncType fun, QueryResult* res = nullptr) : fun(fun), res(res) {}
32 |
33 | void invoke()
34 | {
35 | unique_ptr pRes(res);
36 | res = nullptr;
37 |
38 | //transfer ownership to callback function so that it can stash it or use it later
39 | if (!fun.empty())
40 | fun(pRes);
41 | }
42 | void setResult(QueryResult* res) { this->res = res; }
43 | protected:
44 | FuncType fun;
45 | QueryResult* res;
46 | };
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/QueryResultImpl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Database/QueryResult.h"
22 |
23 | class QueryResultImpl : public QueryResult
24 | {
25 | public:
26 | QueryResultImpl() {}
27 | QueryResultImpl(UInt64 rowCount, size_t fieldCount) : _row(fieldCount), _numFields(fieldCount), _numRows(rowCount) {}
28 | ~QueryResultImpl() {}
29 |
30 | const vector& fields() const override { return _row; }
31 |
32 | size_t numFields() const override { return _numFields; }
33 | UInt64 numRows() const override { return _numRows; }
34 |
35 | protected:
36 | void setNumFields(size_t numFields) { _numFields = numFields; }
37 | void setNumRows(UInt64 numRows) { _numRows = numRows; }
38 |
39 | vector _row;
40 | private:
41 | size_t _numFields;
42 | UInt64 _numRows;
43 | };
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/DataSource/CharDataSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "DataSource.h"
22 |
23 | class CharDataSource
24 | {
25 | public:
26 | virtual ~CharDataSource() {}
27 |
28 | virtual Sqf::Value fetchCharacterInitial( string playerId, int serverId, const string& playerName ) = 0;
29 | virtual Sqf::Value fetchCharacterDetails( int characterId ) = 0;
30 | typedef map FieldsType;
31 | virtual bool updateCharacter( int characterId, const FieldsType& fields ) = 0;
32 | virtual bool initCharacter( int characterId, const Sqf::Value& inventory, const Sqf::Value& backpack ) = 0;
33 | virtual bool killCharacter( int characterId, int duration ) = 0;
34 | virtual bool recordLogin( string playerId, int characterId, int action ) = 0;
35 | protected:
36 | static int SanitiseInv(Sqf::Parameters& origInv);
37 | };
--------------------------------------------------------------------------------
/Hive/Source/Shared/Common/Timer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Shared/Common/Types.h"
22 |
23 | #ifdef min
24 | #undef min
25 | #endif
26 | #ifdef max
27 | #undef max
28 | #endif
29 |
30 | class GlobalTimer
31 | {
32 | public:
33 | //get current server time
34 | static UInt64 getMSTime64();
35 | static UInt32 getMSTime();
36 |
37 | //get time difference between two timestamps
38 | static inline UInt32 getMSTimeDiff(UInt32 oldMSTime, UInt32 newMSTime)
39 | {
40 | if (oldMSTime > newMSTime)
41 | {
42 | const UInt32 diff_1 = (UInt32(0xFFFFFFFF) - oldMSTime) + newMSTime;
43 | const UInt32 diff_2 = oldMSTime - newMSTime;
44 |
45 | return std::min(diff_1, diff_2);
46 | }
47 |
48 | return newMSTime - oldMSTime;
49 | }
50 |
51 | //get unix time
52 | static Int32 getTime();
53 | private:
54 | GlobalTimer();
55 | GlobalTimer(const GlobalTimer& );
56 | };
--------------------------------------------------------------------------------
/Hive/Binaries/README.txt:
--------------------------------------------------------------------------------
1 | HiveExt persistence layer for DayzMod
2 |
3 | Contents:
4 | @hive
5 | - HiveExt.dll HiveExt ArmA2 native extension
6 | cfgdayz
7 | - HiveExt.ini Sample ini file with explanations
8 | DatabaseMySql.dll Required module for proper HiveExt operation
9 | DatabasePostgre.dll Optional module for proper HiveExt operation
10 | tbb.dll Required module for proper HiveExt operation
11 | tbbmalloc.dll Required module for proper HiveExt operation
12 |
13 | README.txt This file
14 |
15 | The contents are displayed as relative to the archive root, and should be extracted as such into the OA game folder
16 | (the folder where the non-beta-patch ArmA2OA.exe resides, as well as other files like _runA2CO.cmd if you have CO)
17 |
18 | Microsoft Visual C++ 2010 SP1 x86 redistributable is required for HiveExt to start
19 | If you do not already have it, get it from http://www.microsoft.com/en-us/download/details.aspx?id=8328
20 |
21 | If you want to specify any options other than the defaults in the .ini file, you must place it into your PROFILES folder
22 | (this is the folder which you specify using the -profiles command line option to arma2oaserver.exe, the same one where the .rpt will go)
23 | It is highly advised to have this folder OUTSIDE of the Arma2OA root, otherwise hackers running modified scripts MIGHT be able to read it
24 | (the same recommendation should be followed for the folders that house your server.cfg and BEServer.cfg files)
25 |
26 | HiveExt.ini file changelog
27 | 0.9.6.13 - Changed [Time] section, when running a private server, you can now specify a static date as well as hour
28 | 0.9.6.10 - Added [Logger] section with explanations and defaults, added explanation for Hostname = . named-pipe option in [Database]
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/SqlDelayThread.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include
22 | #include
23 |
24 | class Database;
25 | class SqlOperation;
26 | class SqlConnection;
27 |
28 | class SqlDelayThread : public Poco::Runnable
29 | {
30 | protected:
31 | typedef tbb::concurrent_queue SqlQueue;
32 |
33 | SqlQueue _sqlQueue; //Queue of SQL statements
34 | Database& _dbEngine; //Pointer to used Database engine
35 | SqlConnection& _dbConn; //Pointer to DB connection
36 | volatile bool _isRunning;
37 |
38 | //process all enqueued requests
39 | virtual void processRequests();
40 | public:
41 | SqlDelayThread(Database& db, SqlConnection& conn);
42 | virtual ~SqlDelayThread();
43 |
44 | //Put sql statement to delay queue
45 | bool queueOperation(SqlOperation* sql)
46 | {
47 | _sqlQueue.push(sql);
48 | return true;
49 | }
50 |
51 | //Send stop event
52 | virtual void stop();
53 | //Main Thread loop
54 | void run() override;
55 | };
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/DataSource/ObjDataSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "DataSource.h"
22 |
23 | class ObjDataSource
24 | {
25 | public:
26 | virtual ~ObjDataSource() {}
27 |
28 | typedef std::queue ServerObjectsQueue;
29 | virtual void populateObjects( int serverId, ServerObjectsQueue& queue ) = 0;
30 |
31 | virtual bool updateObjectInventory( int serverId, Int64 objectIdent, bool byUID, const Sqf::Value& inventory ) = 0;
32 | virtual bool deleteObject( int serverId, Int64 objectIdent, bool byUID ) = 0;
33 | virtual bool updateVehicleMovement( int serverId, Int64 objectIdent, const Sqf::Value& worldspace, double fuel ) = 0;
34 | virtual bool updateVehicleStatus( int serverId, Int64 objectIdent, const Sqf::Value& hitPoints, double damage ) = 0;
35 | virtual bool createObject( int serverId, const string& className, double damage, int characterId,
36 | const Sqf::Value& worldSpace, const Sqf::Value& inventory, const Sqf::Value& hitPoints, double fuel, Int64 uniqueId ) = 0;
37 | };
--------------------------------------------------------------------------------
/Hive/Source/HiveLib/Sqf.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Shared/Common/Types.h"
22 | #include
23 |
24 | namespace Sqf
25 | {
26 | typedef boost::make_recursive_variant< double, int, Int64, bool, string, void*, vector >::type Value;
27 | typedef vector Parameters;
28 |
29 | bool IsNull(const Value& val);
30 | bool IsAny(const Value& val);
31 | double GetDouble(const Value& val);
32 | int GetIntAny(const Value& val);
33 | Int64 GetBigInt(const Value& val);
34 | string GetStringAny(const Value& val);
35 | bool GetBoolAny(const Value& val);
36 |
37 | void runTest();
38 | }
39 |
40 | namespace boost
41 | {
42 | std::istream& operator >> (std::istream& src, Sqf::Value& out);
43 | std::ostream& operator << (std::ostream& out, const Sqf::Value& val);
44 | };
45 |
46 | namespace std
47 | {
48 | std::istream& operator >> (std::istream& src, Sqf::Parameters& out);
49 | std::ostream& operator << (std::ostream& out, const Sqf::Parameters& params);
50 | };
--------------------------------------------------------------------------------
/Hive/Source/Shared/Library/SharedLibraryLoader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2013 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Shared/Common/Types.h"
22 |
23 | #include
24 | #include
25 |
26 | template
27 | class SharedLibraryLoader
28 | {
29 | public:
30 | void loadLibrary(const string& libName)
31 | {
32 | string fileName = libName + Poco::SharedLibrary::suffix();
33 | _loader.loadLibrary(fileName);
34 | }
35 |
36 | Base* create(const std::string& className) const { return _loader.create(className); }
37 | Base& instance(const std::string& className) const { return _loader.instance(className); }
38 | bool canCreate(const std::string& className) const { return _loader.canCreate(className); }
39 | void destroy(const std::string& className, Base* pObject) const { _loader.destroy(className,pObject); }
40 | bool isAutoDelete(const std::string& className, Base* pObject) const { return _loader.isAutoDelete(className, pObject); }
41 | private:
42 | typedef Poco::ClassLoader LibraryLoader;
43 | LibraryLoader _loader;
44 | };
--------------------------------------------------------------------------------
/Hive/Source/Database/Implementation/SqlStatementImpl.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #include "SqlStatementImpl.h"
20 | #include "ConcreteDatabase.h"
21 |
22 | #include
23 |
24 | //////////////////////////////////////////////////////////////////////////
25 |
26 | void SqlStatementImpl::verifyNumBoundParams( const SqlStmtParameters& args )
27 | {
28 | //verify amount of bound parameters
29 | if(args.boundParams() != this->numArgs())
30 | {
31 | string errMsg = Poco::format("SQL ERROR: wrong amount of parameters (%d instead of %d) in statement %s",
32 | args.boundParams(),this->numArgs(),_dbEngine->getStmtString(this->getId()));
33 | poco_bugcheck_msg(errMsg.c_str());
34 | }
35 | }
36 |
37 | bool SqlStatementImpl::execute()
38 | {
39 | SqlStmtParameters args = detach();
40 | verifyNumBoundParams(args);
41 | return _dbEngine->executeStmt(_stmtId, args);
42 | }
43 |
44 | bool SqlStatementImpl::directExecute()
45 | {
46 | SqlStmtParameters args = detach();
47 | verifyNumBoundParams(args);
48 | return _dbEngine->directExecuteStmt(_stmtId, args);
49 | }
--------------------------------------------------------------------------------
/Hive/Source/Shared/Library/Database/DatabaseLoader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2013 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "Shared/Common/Types.h"
22 | #include "Database/Database.h"
23 | #include
24 |
25 | static const UInt32 REQUIRED_DB_VERSION_NUM[4] = {0,9,14,0};
26 |
27 | class DatabaseLoader
28 | {
29 | public:
30 | static string GetDbTypeFromConfig(Poco::Util::AbstractConfiguration* dbConfig);
31 | static string GetDbModuleName(string dbType, bool physicalName = false);
32 |
33 | static bool GetVersionOfModule(const string& moduleName, UInt32& outMajor, UInt32& outMinor, UInt32& outRev, UInt32& outBld);
34 | static bool IsVersionCompatible(const UInt32* wantedVer, const UInt32* gotVer);
35 |
36 | static shared_ptr Create(const string& dbType);
37 | static shared_ptr Create(Poco::Util::AbstractConfiguration* dbConfig);
38 |
39 | static Database::KeyValueColl MakeConnParams(Poco::Util::AbstractConfiguration* dbConfig);
40 |
41 | POCO_DEFINE_EXCEPTION(,CreationError,Poco::LogicException,"Cannot create database");
42 | };
--------------------------------------------------------------------------------
/Hive/Source/Shared/Common/PimplImpl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #include "Pimpl.h"
20 |
21 | #include
22 |
23 | template
24 | Pimpl::Pimpl() : m(new T()) { }
25 |
26 | template
27 | template
28 | Pimpl::Pimpl( Arg1&& arg1 )
29 | : m( new T( std::forward(arg1) ) ) { }
30 |
31 | template
32 | template
33 | Pimpl::Pimpl( Arg1&& arg1, Arg2&& arg2 )
34 | : m( new T( std::forward(arg1), std::forward(arg2) ) ) { }
35 |
36 | template
37 | template
38 | Pimpl::Pimpl( Arg1&& arg1, Arg2&& arg2, Arg3&& arg3 )
39 | : m( new T( std::forward(arg1), std::forward(arg2), std::forward(arg3) ) ) { }
40 |
41 | template
42 | Pimpl::~Pimpl() { }
43 |
44 | template
45 | T* Pimpl::operator->() { return m.get(); }
46 |
47 | template
48 | T* Pimpl::operator->() const { return m.get(); }
49 |
50 | template
51 | T& Pimpl::operator*() { return *m.get(); }
52 |
53 | template
54 | T& Pimpl::operator*() const { return *m.get(); }
--------------------------------------------------------------------------------
/Hive/Source/Shared/Common/Types.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009-2012 Rajko Stojadinovic
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #define NOMINMAX
22 |
23 | #include
24 |
25 | using Poco::Int8;
26 | using Poco::Int16;
27 | using Poco::Int32;
28 | using Poco::Int64;
29 | using Poco::UInt8;
30 | using Poco::UInt16;
31 | using Poco::UInt32;
32 | using Poco::UInt64;
33 | using Poco::IntPtr;
34 | using Poco::UIntPtr;
35 |
36 | #include
37 | using std::unique_ptr;
38 | #include
39 | using boost::shared_ptr;
40 | #include
41 | using boost::weak_ptr;
42 | #include
43 | using boost::make_shared;
44 | #include
45 | using boost::scoped_ptr;
46 |
47 | #include
48 | using std::string;
49 | #include
50 | using std::vector;
51 | typedef std::vector ByteVector;
52 | #include