Changeset - b38cc30c440c
[Not reviewed]
Merge
0 12 1
Jan Kaluza - 10 years ago 2016-01-21 18:39:08
jkaluza@redhat.com
Merge branch 'master' of github.com:hanzz/libtransport
12 files changed with 32 insertions and 11 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
@@ -253,63 +253,62 @@ message("-----------------------")
 

	
 
if (SPECTRUM_VERSION)
 
	ADD_DEFINITIONS(-DSPECTRUM_VERSION="${SPECTRUM_VERSION}")
 
else (SPECTRUM_VERSION)
 
	if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
 
		if (NOT GIT_EXECUTABLE)
 
		set (GIT_EXECUTABLE git)
 
		endif()
 
		execute_process(COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git" rev-parse --short HEAD
 
						OUTPUT_VARIABLE GIT_REVISION
 
						OUTPUT_STRIP_TRAILING_WHITESPACE
 
		)
 
		set(SPECTRUM_VERSION 2.0.0-git-${GIT_REVISION})
 
		ADD_DEFINITIONS(-DSPECTRUM_VERSION="${SPECTRUM_VERSION}")
 
	else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
 
		set(SPECTRUM_VERSION 2.0.0)
 
		ADD_DEFINITIONS(-DSPECTRUM_VERSION="${SPECTRUM_VERSION}")
 
	endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
 
endif (SPECTRUM_VERSION)
 

	
 
message("Version           : " ${SPECTRUM_VERSION})
 

	
 
if (SQLITE3_FOUND)
 
	ADD_DEFINITIONS(-DWITH_SQLITE)
 
	include_directories(${SQLITE3_INCLUDE_DIR})
 
	message("SQLite3           : yes")
 
else (SQLITE3_FOUND)
 
if (WIN32)
 
		ADD_DEFINITIONS(-DWITH_SQLITE)
 
	include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/sqlite3")
 
	message("SQLite3           : bundled")
 
	else()
 
else (WIN32)
 
	include_directories(${SQLITE3_INCLUDE_DIR})
 
	message("SQLite3           : yes")
 
endif (WIN32)
 
else (SQLITE3_FOUND)
 
	set(SQLITE3_LIBRARIES "")
 
	if(ENABLE_SQLITE3)
 
		message("SQLite3           : no (install sqlite3)")
 
	else(ENABLE_SQLITE3)
 
		message("SQLite3           : no (user disabled)")
 
	endif()
 
	endif()
 
endif (SQLITE3_FOUND)
 

	
 
if (MYSQL_FOUND)
 
	ADD_DEFINITIONS(-DWITH_MYSQL)
 
	include_directories(${MYSQL_INCLUDE_DIR})
 
	message("MySQL             : yes")
 
else (MYSQL_FOUND)
 
	set(MYSQL_LIBRARIES "")
 
	if(ENABLE_MYSQL)
 
		message("MySQL             : no (install mysql-devel)")
 
	else(ENABLE_MYSQL)
 
		message("MySQL             : no (user disabled)")
 
	endif()
 
endif (MYSQL_FOUND)
 

	
 
if (PQXX_FOUND)
 
	ADD_DEFINITIONS(-DWITH_PQXX)
 
	include_directories(${PQXX_INCLUDE_DIR})
 
	message("PostgreSQL        : yes")
 
else (PQXX_FOUND)
 
	set(PQXX_LIBRARY "")
 
	set(PQ_LIBRARY "")
 
	if(ENABLE_PQXX)
 
		message("PostgreSQL        : no (install libpqxx-devel)")
backends/twitter/libtwitcurl/twitcurl.h
Show inline comments
 
#ifndef _TWITCURL_H_
 
#define _TWITCURL_H_
 

	
 
#include <string>
 
#include <sstream>
 
#include <cstring>
 
#include <vector>
 
#include <algorithm>
 
#include "oauthlib.h"
 
#include "curl/curl.h"
 

	
 
/* Few common types used by twitCurl */
 
namespace twitCurlTypes
 
{
 
    typedef enum _eTwitCurlApiFormatType
 
    {
 
        eTwitCurlApiFormatJson = 0,
 
        eTwitCurlApiFormatXml,
 
        eTwitCurlApiFormatMax
 
    } eTwitCurlApiFormatType;
 

	
 
    typedef enum _eTwitCurlProtocolType
 
    {
 
        eTwitCurlProtocolHttps = 0,
 
        eTwitCurlProtocolHttp,
 
        eTwitCurlProtocolMax
 
    } eTwitCurlProtocolType;
 
};
 

	
 
/* twitCurl class */
 
class twitCurl
 
{
include/transport/Logging.h
Show inline comments
 
@@ -35,30 +35,31 @@
 
#include "log4cxx/helpers/fileinputstream.h"
 
#include "log4cxx/helpers/transcoder.h"
 
#include "log4cxx/logger.h"
 
#include "log4cxx/logmanager.h"
 

	
 
#define DEFINE_LOGGER(VAR, NAME) static log4cxx::LoggerPtr VAR = log4cxx::Logger::getLogger(NAME);
 

	
 
using namespace log4cxx;
 
#else
 
#define DEFINE_LOGGER(VARIABLE, NAME) static const char *VARIABLE = NAME;
 

	
 
#define LOG4CXX_ERROR(LOGGER, DATA) std::cerr << "E: <" << LOGGER << "> " << DATA << "\n";
 
#define LOG4CXX_WARN(LOGGER, DATA) std::cout << "W: <" << LOGGER << "> " << DATA << "\n";
 
#define LOG4CXX_INFO(LOGGER, DATA) std::cout << "I: <" << LOGGER << "> " << DATA << "\n";
 
#endif
 

	
 
namespace Transport {
 

	
 
class Config;
 

	
 
namespace Logging {
 

	
 
void initBackendLogging(Config *config);
 
void initMainLogging(Config *config);
 
void initManagerLogging(Config *config);
 
void shutdownLogging();
 
void redirect_stderr();
 

	
 
}
 

	
 
}
libtransport/CMakeLists.txt
Show inline comments
 
cmake_minimum_required(VERSION 2.6)
 
FILE(GLOB SRC *.cpp *.h)
 
FILE(GLOB_RECURSE SWIFTEN_SRC ../include/Swiften/*.cpp)
 

	
 
# Build without openssl on msvc
 
if (NOT MSVC)
 
if (APPLE)
 
	string(REGEX REPLACE "[^;]+;?/Schannel/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
	string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
else()
 
	string(REGEX REPLACE "[^;]+;?/Schannel/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
	string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") 
 
endif()
 
else()
 
	string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") 
 
	string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
endif()
 

	
 
FILE(GLOB HEADERS ../include/transport/*.h)
 
include_directories(../spectrum/src/frontends/xmpp/)
 

	
 
if (NOT WIN32)
 
include_directories(${POPT_INCLUDE_DIR})
 
endif()
 

	
 
# SOURCE_GROUP(headers FILES ${HEADERS})
 

	
 

	
 
if (PROTOBUF_FOUND)
 
	if (NOT WIN32)
 
		ADD_LIBRARY(transport SHARED ${HEADERS} ${SRC} ${SWIFTEN_SRC})
 
	else()
 
		ADD_LIBRARY(transport STATIC ${HEADERS} ${SRC} ${SWIFTEN_SRC})
 
	endif()
 
#	SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/../include/transport/protocol.pb.cc PROPERTIES GENERATED 1)
 
	ADD_DEPENDENCIES(transport pb) 
 
else(PROTOBUF_FOUND)
 
	ADD_LIBRARY(transport SHARED ${HEADERS} ${SRC} ${SWIFTEN_SRC})
 
endif(PROTOBUF_FOUND)
 

	
 
# if (CMAKE_COMPILER_IS_GNUCXX)
 
	if (NOT WIN32)
 
		ADD_DEFINITIONS(-fPIC)
 
	endif()
 
# endif()
 

	
 
find_package(CURL)
 

	
 
if (WIN32)
 
	include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/sqlite3")
 
	TARGET_LINK_LIBRARIES(transport transport-plugin sqlite3 ${PQXX_LIBRARY} ${CURL_LIBRARIES ${PQ_LIBRARY} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES} ${PROTOBUF_LIBRARY} psapi.lib)
 
	TARGET_LINK_LIBRARIES(transport transport-plugin sqlite3 ${PQXX_LIBRARY} ${CURL_LIBRARIES} ${PQ_LIBRARY} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES} ${PROTOBUF_LIBRARY} psapi.lib)
 
else()
 
	TARGET_LINK_LIBRARIES(transport transport-plugin ${PQXX_LIBRARY} ${CURL_LIBRARIES} ${PQ_LIBRARY} ${SQLITE3_LIBRARIES} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES} ${POPT_LIBRARY} ${PROTOBUF_LIBRARY})
 
endif()
 

	
 
SET_TARGET_PROPERTIES(transport PROPERTIES
 
      VERSION ${TRANSPORT_VERSION} SOVERSION ${TRANSPORT_VERSION}
 
)
 
if (APPLE)
 
	TARGET_LINK_LIBRARIES(transport ${APPLE_FRAMEWORKS})
 
endif()
 

	
 
INSTALL(TARGETS transport LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
 

	
 
#CONFIGURE_FILE(transport.pc.in "${CMAKE_CURRENT_BINARY_DIR}/transport.pc")
 
#INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/transport.pc" DESTINATION lib/pkgconfig)
libtransport/FileTransferManager.cpp
Show inline comments
 
@@ -62,41 +62,41 @@ FileTransferManager::FileTransferManager(Component *component, UserManager *user
 

	
 
	
 

	
 
// WARNING: Swiften crashes when this is uncommented... But we probably need it for working Jingle FT
 
// 	m_connectivityManager->addListeningPort(19645);
 
}
 

	
 
FileTransferManager::~FileTransferManager() {
 
// #if !HAVE_SWIFTEN_3
 
// 	m_bytestreamServer->stop();
 
// 	delete m_remoteCandidateSelectorFactory;
 
// 	delete m_localCandidateGeneratorFactory;
 
// #endif
 
// 	delete m_outgoingFTManager;
 
// 	delete m_jingleSessionManager;
 
// 	delete m_bytestreamRegistry;
 
// #if !HAVE_SWIFTEN_3
 
// 	delete m_bytestreamServer;
 
// 	delete m_bytestreamProxy;
 
// 	delete m_connectivityManager;
 
// #endif
 
}
 

	
 
FileTransferManager::Transfer FileTransferManager::sendFile(User *user, Buddy *buddy, boost::shared_ptr<Swift::ReadBytestream> byteStream, const Swift::StreamInitiationFileInfo &info) {
 
// 	FileTransferManager::Transfer transfer;
 
 	FileTransferManager::Transfer transfer;
 
// 	transfer.from = buddy->getJID();
 
// 	transfer.to = user->getJID();
 
// 	transfer.readByteStream = byteStream;
 
// 
 
// 	LOG4CXX_INFO(logger, "Starting FT from '" << transfer.from << "' to '" << transfer.to << "'")
 
// 
 
// 	transfer.ft = m_outgoingFTManager->createOutgoingFileTransfer(transfer.from, transfer.to, transfer.readByteStream, info);
 
// // 	if (transfer.ft) {
 
// // 		m_filetransfers.push_back(ft);
 
// // 		ft->onStateChange.connect(boost::bind(&User::handleFTStateChanged, this, _1, Buddy::JIDToLegacyName(from), info.getName(), info.getSize(), id));
 
// // 		transfer.ft->start();
 
// // 	}
 
// 	return transfer;
 
 	return transfer;
 
}
 

	
 
}
libtransport/Logging.cpp
Show inline comments
 
@@ -182,48 +182,51 @@ static void initLogging(Config *config, std::string key, bool only_create_dir =
 
			if ((gr = getgrnam(CONFIG_STRING(config, "service.group").c_str())) == NULL) {
 
				std::cerr << "Invalid service.group name " << CONFIG_STRING(config, "service.group") << "\n";
 
			}
 
			struct passwd *pw;
 
			if ((pw = getpwnam(CONFIG_STRING(config, "service.user").c_str())) == NULL) {
 
				std::cerr << "Invalid service.user name " << CONFIG_STRING(config, "service.user") << "\n";
 
			}
 
			chown(dir.c_str(), pw->pw_uid, gr->gr_gid);
 
		}
 
	}
 
#endif
 
	}
 
}
 

	
 
void initBackendLogging(Config *config) {
 
	initLogging(config, "logging.backend_config");
 

	
 
	redirect_stderr();
 
}
 

	
 
void initMainLogging(Config *config) {
 
	initLogging(config, "logging.config");
 
	initLogging(config, "logging.backend_config", true);
 
}
 
void initManagerLogging(Config *config) {
 
        initLogging(config, "logging.config");
 
}
 

	
 
void redirect_stderr() {
 
	 intercepter_cerr = new intercept_stream(std::cerr, "cerr");
 
	 intercepter_cout = new intercept_stream(std::cout, "cout");
 
}
 

	
 
void shutdownLogging() {
 
	delete intercepter_cerr;
 
	delete intercepter_cout;
 
	log4cxx::LogManager::shutdown();
 
}
 

	
 
#else /* WITH_LOG4CXX */
 
void initBackendLogging(Config */*config*/) {
 
}
 

	
 
void initMainLogging(Config */*config*/) {
 
}
 

	
 
void shutdownLogging() {
 
	
 
}
 

	
 
void redirect_stderr() {
spectrum/src/CMakeLists.txt
Show inline comments
 
@@ -28,25 +28,29 @@ endif()
 
INSTALL(TARGETS spectrum2 RUNTIME DESTINATION bin)
 

	
 
INSTALL(FILES
 
	sample2_gateway.cfg
 
	RENAME spectrum.cfg.example
 
	DESTINATION /etc/spectrum2/transports
 
	)
 

	
 
INSTALL(FILES
 
	sample2.cfg
 
	RENAME spectrum_server_mode.cfg.example
 
	DESTINATION /etc/spectrum2/transports
 
	)
 

	
 
INSTALL(FILES
 
	backend-logging.cfg
 
	DESTINATION /etc/spectrum2
 
	)
 

	
 
INSTALL(FILES
 
	logging.cfg
 
	DESTINATION /etc/spectrum2
 
	)
 

	
 
INSTALL(FILES
 
	manager-logging.cfg
 
	DESTINATION /etc/spectrum2
 
	)
 

	
spectrum/src/frontends/xmpp/XMPPFrontend.cpp
Show inline comments
 
@@ -326,49 +326,49 @@ void XMPPFrontend::connectToServer() {
 
			boost::dynamic_pointer_cast<Swift::BoostConnectionServer>(m_server->getConnectionServer())->onStopped.connect(boost::bind(&XMPPFrontend::handleServerStopped, this, _1));
 
		}
 
		
 
		// We're connected right here, because we're in server mode...
 
		handleConnected();
 
	}
 
}
 

	
 
void XMPPFrontend::disconnectFromServer() {
 
	if (m_component) {
 
		// TODO: Call this once swiften will fix assert(!session_);
 
// 		m_component->disconnect();
 
	}
 
	else if (m_server) {
 
		LOG4CXX_INFO(logger, "Stopping component in server mode on port " << CONFIG_INT(m_config, "service.port"));
 
		m_server->stop();
 
	}
 
}
 

	
 
void XMPPFrontend::handleConnected() {
 
	m_transport->handleConnected();
 
}
 

	
 
void XMPPFrontend::handleServerStopped(boost::optional<Swift::BoostConnectionServer::Error> e) {
 
	if(e != NULL ) {
 
	if(e) {
 
		if(*e == Swift::BoostConnectionServer::Conflict) {
 
			LOG4CXX_INFO(logger, "Port "<< CONFIG_INT(m_config, "service.port") << " already in use! Stopping server..");
 
			if (CONFIG_INT(m_config, "service.port") == 5347) {
 
				LOG4CXX_INFO(logger, "Port 5347 is usually used for components. You are using server_mode=1. Are you sure you don't want to use server_mode=0 and run spectrum as component?");
 
			}
 
		}
 
		if(*e == Swift::BoostConnectionServer::UnknownError)
 
			LOG4CXX_INFO(logger, "Unknown error occured! Stopping server..");
 
		exit(1);
 
	}
 
}
 

	
 

	
 
void XMPPFrontend::handleConnectionError(const ComponentError &error) {
 
	std::string str = "Unknown error";
 
	switch (error.getType()) {
 
		case ComponentError::UnknownError: str = "Unknown error"; break;
 
		case ComponentError::ConnectionError: str = "Connection error"; break;
 
		case ComponentError::ConnectionReadError: str = "Connection read error"; break;
 
		case ComponentError::ConnectionWriteError: str = "Connection write error"; break;
 
		case ComponentError::XMLError: str = "XML Error"; break;
 
		case ComponentError::AuthenticationFailedError: str = "Authentication failed error"; break;
 
		case ComponentError::UnexpectedElementError: str = "Unexpected element error"; break;
 
	}
spectrum/src/manager-logging.cfg
Show inline comments
 
new file 100644
 
log4j.rootLogger=debug, R
 

	
 
log4j.appender.R=org.apache.log4j.RollingFileAppender
 
log4j.appender.R.File=/var/log/spectrum2/spectrum_manager.log
 

	
 
log4j.appender.R.MaxFileSize=10000KB
 
# Keep one backup file
 
log4j.appender.R.MaxBackupIndex=1
 

	
 
log4j.appender.R.layout=org.apache.log4j.PatternLayout
 
log4j.appender.R.layout.ConversionPattern=%d %-5p %c: %m%n
spectrum_manager/src/managerconfig.cpp
Show inline comments
 
@@ -23,40 +23,41 @@
 

	
 
using namespace boost::program_options;
 

	
 
bool ManagerConfig::load(const std::string &configfile, boost::program_options::options_description &opts) {
 
	std::ifstream ifs(configfile.c_str());
 
	if (!ifs.is_open())
 
		return false;
 

	
 
	opts.add_options()
 
		("service.admin_username", value<std::string>()->default_value(""), "Administrator username.")
 
		("service.admin_password", value<std::string>()->default_value(""), "Administrator password.")
 
		("service.port", value<int>()->default_value(8081), "Web interface port.")
 
		("service.cert", value<std::string>()->default_value(""), "Web interface certificate in PEM format when TLS should be used.")
 
		("service.config_directory", value<std::string>()->default_value("/etc/spectrum2/transports/"), "Directory with spectrum2 configuration files. One .cfg file per one instance")
 
		("service.data_dir", value<std::string>()->default_value("/var/lib/spectrum2_manager/html"), "Directory to store Spectrum 2 manager data")
 
		("service.base_location", value<std::string>()->default_value("/"), "Base location of the web interface")
 
		("servers.server", value<std::vector<std::string> >()->multitoken(), "Server.")
 
		("database.type", value<std::string>()->default_value("none"), "Database type.")
 
		("database.database", value<std::string>()->default_value("/var/lib/spectrum2/$jid/database.sql"), "Database used to store data")
 
		("database.server", value<std::string>()->default_value("localhost"), "Database server.")
 
		("database.user", value<std::string>()->default_value(""), "Database user.")
 
		("database.password", value<std::string>()->default_value(""), "Database Password.")
 
		("database.port", value<int>()->default_value(0), "Database port.")
 
		("database.prefix", value<std::string>()->default_value(""), "Prefix of tables in database")
 
		("logging.config", value<std::string>()->default_value("/etc/spectrum2/manager_logging.cfg"), "Logging configuration file")
 
	;
 

	
 
	store(parse_config_file(ifs, opts), m_variables);
 
	notify(m_variables);
 

	
 
	m_file = configfile;
 

	
 
	onManagerConfigReloaded();
 

	
 
	return true;
 
}
 

	
 
bool ManagerConfig::load(const std::string &configfile) {
 
	options_description opts("Transport options");
 
	return load(configfile, opts);
 
}
spectrum_manager/src/server.cpp
Show inline comments
 
@@ -85,48 +85,49 @@ Server::Server(ManagerConfig *config, const std::string &config_file) {
 

	
 
	s_http_server_opts.document_root = CONFIG_STRING(m_config, "service.data_dir").c_str();
 

	
 
	std::ifstream header(std::string(CONFIG_STRING(m_config, "service.data_dir") + "/header.html").c_str(), std::ios::in);
 
	if (header) {
 
		header.seekg(0, std::ios::end);
 
		m_header.resize(header.tellg());
 
		header.seekg(0, std::ios::beg);
 
		header.read(&m_header[0], m_header.size());
 
		header.close();
 
	}
 

	
 
	std::ifstream footer(std::string(CONFIG_STRING(m_config, "service.data_dir") + "/footer.html").c_str(), std::ios::in);
 
	if (footer) {
 
		footer.seekg(0, std::ios::end);
 
		m_footer.resize(footer.tellg());
 
		footer.seekg(0, std::ios::beg);
 
		footer.read(&m_footer[0], m_footer.size());
 
		footer.close();
 
	}
 

	
 
	m_storageCfg = new Config();
 
	m_storageCfg->load(config_file);
 
	
 
	Logging::initManagerLogging(m_storageCfg);
 
	std::string error;
 
	m_storage = StorageBackend::createBackend(m_storageCfg, error);
 
	if (m_storage == NULL) {
 
		std::cerr << "Error creating StorageBackend! " << error << "\n";
 
		std::cerr << "Registering new Spectrum 2 manager users won't work" << "\n";
 
	}
 
	else if (!m_storage->connect()) {
 
		delete m_storage;
 
		m_storage = NULL;
 
		std::cerr << "Can't connect to database!\n";
 
	}
 

	
 
	m_apiServer = new APIServer(config, m_storage);
 
}
 

	
 
Server::~Server() {
 
	delete m_apiServer;
 

	
 
	mg_mgr_free(&m_mgr);
 
	if (m_storage) {
 
		delete m_storage;
 
	}
 
	delete m_storageCfg;
 
}
spectrum_manager/src/server.h
Show inline comments
 
@@ -11,48 +11,49 @@
 
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 
 */
 

	
 
#pragma once
 

	
 
#include <boost/program_options.hpp>
 
#include <boost/foreach.hpp>
 
#include <boost/format.hpp>
 
#include <boost/algorithm/string.hpp>
 
#include <boost/assign.hpp>
 
#include <boost/bind.hpp>
 
#include <boost/signal.hpp>
 

	
 
#include "mongoose.h"
 
#include "managerconfig.h"
 

	
 
#include "transport/Config.h"
 
#include "transport/Logging.h"
 
#include "transport/SQLite3Backend.h"
 
#include "transport/MySQLBackend.h"
 
#include "transport/PQXXBackend.h"
 
#include "transport/StorageBackend.h"
 

	
 
using namespace Transport;
 

	
 
class APIServer;
 

	
 
class Server {
 
	public:
 
		struct session {
 
			char session_id[33];      // Session ID, must be unique
 
			char random[20];          // Random data used for extra user validation
 
			char user[255];  // Authenticated user
 
			time_t expire;            // Expiration timestamp, UTC
 
			bool admin;
 
		};
 

	
 
		/// Constructor.
 
		Server(ManagerConfig *config, const std::string &config_file);
 

	
 
		/// Destructor
 
		virtual ~Server();
0 comments (0 inline, 0 general)