mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-14 23:07:48 -04:00
Merge branch 'testing'
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
cmake-build*
|
||||
*.geany
|
||||
PVS*
|
||||
*.cfg
|
||||
|
||||
+57
-33
@@ -31,56 +31,80 @@ find_package(Threads)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(CURL REQUIRED)
|
||||
|
||||
# c++14 yeah!
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# shame on you cmake for auto-setting optimization flags!
|
||||
set(CMAKE_CXX_FLAGS "")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "")
|
||||
|
||||
# I'll be honest, win32 is probably very very broken and won't build - it will need worked on so that MSVC uses
|
||||
# the vs2013+ STL instead of stlport, and probably will thus need removal/modification/addition of TONS of the ifdef blocks for WIN32
|
||||
if(WIN32)
|
||||
find_package(Iconv REQUIRED)
|
||||
|
||||
#Dont-Build-PDB RELEASE build use the following (by either commenting---uncommenting the line as needed)
|
||||
# Dont-Build-PDB RELEASE build use the following (by either commenting---uncommenting the line as needed)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:libc.lib /SAFESEH:NO")
|
||||
|
||||
####################################
|
||||
#Do-Build-PDB RELEASE build use the following (by either commenting---uncommenting the line as needed)
|
||||
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DWIN32 -Dwin32 -DUDP_LIBRARY -DDEBUG_LEVEL=0 -DPRODUCTION=1 /Oi /Ot /Oy /O2 /GF /Gy /Zi /MT -D_USE_32BIT_TIME_T=1 -D_MBCS -DPLATFORM_BASE_SINGLE_THREAD -D_CRT_SECURE_NO_WARNINGS /MP /wd4244 /wd4996 /wd4018 /wd4351 /Zc:wchar_t- /Ob1 /FC")
|
||||
#Dont-Build-PDB RELEASE build use the following (by either commenting---uncommenting the line as needed)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DWIN32 -Dwin32 -DUDP_LIBRARY -DDEBUG_LEVEL=0 -DPRODUCTION=1 /Oi /Ot /Oy /O2 /GF /Gy /MT -D_USE_32BIT_TIME_T=1 -D_MBCS -DPLATFORM_BASE_SINGLE_THREAD -D_CRT_SECURE_NO_WARNINGS /MP /wd4244 /wd4996 /wd4018 /wd4351 /Zc:wchar_t- /Ob1 /FC")
|
||||
# Do-Build-PDB RELEASE build use the following (by either commenting---uncommenting the line as needed)
|
||||
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DWIN32 -Dwin32 -DUDP_LIBRARY -DDEBUG_LEVEL=0 \
|
||||
# -DPRODUCTION=1 /Oi /Ot /Oy /O2 /GF /Gy /Zi /MT -D_USE_32BIT_TIME_T=1 -D_MBCS \
|
||||
# -DPLATFORM_BASE_SINGLE_THREAD -D_CRT_SECURE_NO_WARNINGS /MP /wd4244 /wd4996 /wd4018 /wd4351 \
|
||||
# /Zc:wchar_t- /Ob1 /FC")
|
||||
|
||||
# Dont-Build-PDB RELEASE build use the following (by either commenting---uncommenting the line as needed)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DWIN32 -Dwin32 -DUDP_LIBRARY -DDEBUG_LEVEL=0 -DPRODUCTION=1 \
|
||||
/Oi /Ot /Oy /O2 /GF /Gy /MT -D_USE_32BIT_TIME_T=1 -D_MBCS -DPLATFORM_BASE_SINGLE_THREAD -D_CRT_SECURE_NO_WARNINGS \
|
||||
/MP /wd4244 /wd4996 /wd4018 /wd4351 /Zc:wchar_t- /Ob1 /FC")
|
||||
|
||||
####################################
|
||||
#Standard DEBUG build use the following (by either commenting---uncommenting the line as needed)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DWIN32 -Dwin32 -D_DEBUG -DUDP_LIBRARY -DDEBUG_LEVEL=2 -DPRODUCTION=0 /MTd -D_USE_32BIT_TIME_T=1 -D_MBCS -DPLATFORM_BASE_SINGLE_THREAD -D_CRT_SECURE_NO_WARNINGS /MP /wd4244 /wd4996 /wd4018 /wd4351 /Zc:wchar_t- /Ob1 /FC")
|
||||
# Standard DEBUG build use the following (by either commenting---uncommenting the line as needed)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DWIN32 -Dwin32 -D_DEBUG -DUDP_LIBRARY -DDEBUG_LEVEL=2 -DPRODUCTION=0 /MTd \
|
||||
-D_USE_32BIT_TIME_T=1 -D_MBCS -DPLATFORM_BASE_SINGLE_THREAD -D_CRT_SECURE_NO_WARNINGS /MP /wd4244 /wd4996 /wd4018 /wd4351 \
|
||||
/Zc:wchar_t- /Ob1 /FC")
|
||||
elseif(UNIX)
|
||||
find_package(Curses REQUIRED)
|
||||
#find_package(MULODI REQUIRED)
|
||||
set(BUILD_MULODI_LIB FALSE)
|
||||
|
||||
# linker flags
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-O1,--sort-common,--as-needed,-z,relro")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
|
||||
# don't put anything too crazy in debug...and any common flags go into CMAKE_CXX_FLAGS
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -O0 -g3")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -O0 -g3")
|
||||
|
||||
# funroll loops and everything else potentially crazy for performance here
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -Ofast -funroll-loops")
|
||||
|
||||
# TODO: The below flags will enhance security but at the cost of performance, arguably...
|
||||
# currently with them SWG cluster idles at ~17-18% of 24 cpus, and ata round ~14-17% without
|
||||
# there is likely also a latency/speed impact as well
|
||||
# not sure if needed or not - https://wiki.debian.org/Hardening
|
||||
# ============================================================================================
|
||||
# -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fPIE -ftrapv
|
||||
# -D_FORTIFY_SOURCE=2 is generally considered safe but crashes datatabletool when built with gcc
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0 \
|
||||
-m32 -pipe -march=native -mtune=native \
|
||||
# release specific cflags - optimizations beyond the default for both types is mostly just -O flags
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-DDEBUG_LEVEL=0 -DPRODUCTION=1")
|
||||
|
||||
# Ofast doesn't work with gcc builds
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast \
|
||||
-fno-signed-zeros -freciprocal-math -ffp-contract=fast \
|
||||
-fno-threadsafe-statics -fslp-vectorize-aggressive -fslp-vectorize \
|
||||
-fno-stack-protector -fstrict-enums -fstrict-vtable-pointers \
|
||||
-fno-coverage-mapping -fno-spell-checking -fshort-enums -finline-functions \
|
||||
-finline-hint-functions -fno-unroll-loops")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# O3 and Ofast include one or more flags that cause java to crash when using gcc6
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||
endif()
|
||||
|
||||
# our "always on" flags - build by default for the system we're on but include all instruction sets
|
||||
set(CMAKE_CXX_FLAGS "-m32 -pipe -march=native -mtune=native \
|
||||
-msse -msse2 -msse3 -mmmx -m3dnow \
|
||||
-Wformat -Wno-overloaded-virtual -Wno-missing-braces -Wno-format \
|
||||
-Wno-write-strings -Wno-unknown-pragmas \
|
||||
-Wno-uninitialized -Wno-reorder")
|
||||
-Wno-uninitialized -Wno-reorder -Wno-tautological-constant-out-of-range-compare")
|
||||
|
||||
# we could use libc++ with gcc too but let's roll with default there
|
||||
#if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
#endif()
|
||||
|
||||
add_definitions(-DLINUX -D_REENTRANT -Dlinux -DSTELLA_INTERNAL -D_GNU_SOURCE -D_XOPEN_SOURCE=500)
|
||||
add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE)
|
||||
endif()
|
||||
|
||||
add_subdirectory(external)
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# when using clang with m32, mulodi4 is missing...this checks for it/not
|
||||
# if we're using linux/not
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(BUILD_MULODI_LIB FALSE)
|
||||
|
||||
set(find_mulodi_test_program
|
||||
"#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int64_t x = ((int64_t)atoi(argv[1])) * (int64_t)atoi(argv[2])
|
||||
* (int64_t)atoi(argv[3]);
|
||||
return x == 9;
|
||||
}")
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "-Wl,-O1,--sort-common,--as-needed,-z,relro,-flto -ftrapv -m32")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "")
|
||||
CHECK_CXX_SOURCE_COMPILES(
|
||||
"${find_mulodi_test_program}"
|
||||
mulodi_found
|
||||
)
|
||||
|
||||
if(NOT mulodi_found)
|
||||
set(BUILD_MULODI_LIB TRUE)
|
||||
endif()
|
||||
+1
-3
@@ -29,7 +29,6 @@ namespace Base
|
||||
#endif
|
||||
|
||||
#if defined (PASCAL_STRING)
|
||||
#pragma message ("--- Packing pascal style strings ---")
|
||||
void get(Base::ByteStream::ReadIterator& source, std::string& target)
|
||||
{
|
||||
unsigned int size = 0;
|
||||
@@ -48,10 +47,9 @@ namespace Base
|
||||
const unsigned int size = source.size();
|
||||
put(target, size);
|
||||
target.put(source.data(), size * sizeof (char));
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#pragma message ("--- Packing c style strings ---")
|
||||
void get(ByteStream::ReadIterator & source, std::string & target)
|
||||
{
|
||||
target = reinterpret_cast<const char *>(source.getBuffer());
|
||||
|
||||
@@ -81,7 +81,3 @@ target_link_libraries(LogServer
|
||||
${CURL_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
)
|
||||
|
||||
if(${BUILD_MULODI_LIB})
|
||||
target_link_libraries(LogServer mulodi)
|
||||
endif()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
set(SHARED_SOURCES
|
||||
shared/CentralServerConnection.cpp
|
||||
shared/CentralServerConnection.h
|
||||
@@ -49,6 +48,8 @@ set(SHARED_SOURCES
|
||||
shared/TaskGetClusterList.h
|
||||
shared/TaskGetValidationData.cpp
|
||||
shared/TaskGetValidationData.h
|
||||
shared/TaskMapAccount.h
|
||||
shared/TaskMapAccount.cpp
|
||||
shared/TaskRegisterNewCluster.cpp
|
||||
shared/TaskRegisterNewCluster.h
|
||||
shared/TaskRenameCharacter.cpp
|
||||
@@ -75,7 +76,7 @@ if(WIN32)
|
||||
else()
|
||||
set(PLATFORM_SOURCES
|
||||
linux/main.cpp
|
||||
)
|
||||
shared/TaskMapAccount.h shared/TaskMapAccount.cpp)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
|
||||
@@ -8,13 +8,9 @@
|
||||
#include "FirstLoginServer.h"
|
||||
#include "ClientConnection.h"
|
||||
|
||||
#include "Archive/ByteStream.h"
|
||||
#include "ConfigLoginServer.h"
|
||||
#include "DatabaseConnection.h"
|
||||
#include "LoginServer.h"
|
||||
#include "ConfigLoginServer.h"
|
||||
#include "SessionApiClient.h"
|
||||
#include "serverKeyShare/KeyShare.h"
|
||||
#include "sharedFoundation/ApplicationVersion.h"
|
||||
#include "sharedLog/Log.h"
|
||||
#include "sharedNetworkMessages/ClientLoginMessages.h"
|
||||
#include "sharedNetworkMessages/DeleteCharacterMessage.h"
|
||||
@@ -25,233 +21,230 @@
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webAPI.h"
|
||||
|
||||
using namespace StellaBellum;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
ClientConnection::ClientConnection(UdpConnectionMT * u, TcpClient * t) :
|
||||
ServerConnection(u, t),
|
||||
m_clientId(0),
|
||||
m_isValidated(false),
|
||||
m_isSecure(false),
|
||||
m_adminLevel(-1),
|
||||
m_stationId(0),
|
||||
m_requestedAdminSuid(0),
|
||||
m_gameBits(0),
|
||||
m_subscriptionBits(0),
|
||||
m_waitingForCharacterLoginDeletion(false),
|
||||
m_waitingForCharacterClusterDeletion(false)
|
||||
{
|
||||
ClientConnection::ClientConnection(UdpConnectionMT *u, TcpClient *t) :
|
||||
ServerConnection(u, t),
|
||||
m_clientId(0),
|
||||
m_isValidated(false),
|
||||
m_isSecure(false),
|
||||
m_adminLevel(-1),
|
||||
m_stationId(0),
|
||||
m_requestedAdminSuid(0),
|
||||
m_gameBits(0),
|
||||
m_subscriptionBits(0),
|
||||
m_waitingForCharacterLoginDeletion(false),
|
||||
m_waitingForCharacterClusterDeletion(false) {
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
ClientConnection::~ClientConnection()
|
||||
{
|
||||
ClientConnection::~ClientConnection() {
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
void ClientConnection::onConnectionClosed()
|
||||
{
|
||||
// client has disconnected
|
||||
if (m_stationId)
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Client %lu disconnected\n", m_stationId));
|
||||
LOG("LoginClientConnection", ("onConnectionClosed() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
void ClientConnection::onConnectionClosed() {
|
||||
// client has disconnected
|
||||
if (m_stationId) {
|
||||
DEBUG_REPORT_LOG(true, ("Client %lu disconnected\n", m_stationId));
|
||||
LOG("LoginClientConnection",
|
||||
("onConnectionClosed() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
|
||||
LoginServer::getInstance().removeClient(m_clientId);
|
||||
LoginServer::getInstance().removeClient(m_clientId);
|
||||
|
||||
if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated)
|
||||
{
|
||||
SessionApiClient *session = LoginServer::getInstance().getSessionApiClient();
|
||||
if (session)
|
||||
{
|
||||
session->dropClient(this);
|
||||
}
|
||||
}
|
||||
if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated) {
|
||||
SessionApiClient *session = LoginServer::getInstance().getSessionApiClient();
|
||||
if (session) {
|
||||
session->dropClient(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
void ClientConnection::onConnectionOpened()
|
||||
{
|
||||
m_clientId = LoginServer::getInstance().addClient(*this);
|
||||
setOverflowLimit(ConfigLoginServer::getClientOverflowLimit());
|
||||
void ClientConnection::onConnectionOpened() {
|
||||
m_clientId = LoginServer::getInstance().addClient(*this);
|
||||
setOverflowLimit(ConfigLoginServer::getClientOverflowLimit());
|
||||
|
||||
LOG("LoginClientConnection", ("onConnectionOpened() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
LOG("LoginClientConnection",
|
||||
("onConnectionOpened() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
void ClientConnection::onReceive(const Archive::ByteStream & message)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Handle all client messages here. Do not forward out.
|
||||
Archive::ReadIterator ri = message.begin();
|
||||
GameNetworkMessage m(ri);
|
||||
ri = message.begin();
|
||||
|
||||
const uint32 messageType = m.getType();
|
||||
void ClientConnection::onReceive(const Archive::ByteStream &message) {
|
||||
try {
|
||||
//Handle all client messages here. Do not forward out.
|
||||
Archive::ReadIterator ri = message.begin();
|
||||
GameNetworkMessage m(ri);
|
||||
ri = message.begin();
|
||||
|
||||
//Validation check
|
||||
if (!getIsValidated() && messageType != constcrc("LoginClientId")) {
|
||||
//Receiving message from unvalidated client. Pitch it.
|
||||
DEBUG_WARNING(true, ("Received %s message from unknown, unvalidated client", m.getCmdName().c_str()));
|
||||
return;
|
||||
}
|
||||
const uint32 messageType = m.getType();
|
||||
|
||||
switch (messageType) {
|
||||
case constcrc("LoginClientId") :
|
||||
{
|
||||
// send the client the server "now" Epoch time so that the
|
||||
// client has an idea of how much difference there is between
|
||||
// the client's Epoch time and the server Epoch time
|
||||
GenericValueTypeMessage<int32> const serverNowEpochTime(
|
||||
"ServerNowEpochTime", static_cast<int32>(::time(nullptr)));
|
||||
send(serverNowEpochTime, true);
|
||||
//Validation check
|
||||
if (!getIsValidated() && messageType != constcrc("LoginClientId")) {
|
||||
//Receiving message from unvalidated client. Pitch it.
|
||||
DEBUG_WARNING(true, ("Received %s message from unknown, unvalidated client", m.getCmdName().c_str()));
|
||||
return;
|
||||
}
|
||||
|
||||
LoginClientId id(ri);
|
||||
|
||||
// verify version
|
||||
#if PRODUCTION == 1
|
||||
if(!ConfigLoginServer::getValidateClientVersion() || id.getVersion() == GameNetworkMessage::NetworkVersionId)
|
||||
{
|
||||
validateClient(id.getId(), id.getKey());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("CustomerService", ("Login:LoginServer dropping client (stationId=[%lu], ip=[%s], id=[%s], key=[%s], version=[%s]) because of network version mismatch (required version=[%s])", m_stationId, getRemoteAddress().c_str(), id.getId().c_str(), id.getKey().c_str(), id.getVersion().c_str(), GameNetworkMessage::NetworkVersionId.c_str()));
|
||||
// disconnect is handled on the client side, as soon as it recieves this message
|
||||
#if _DEBUG
|
||||
LoginIncorrectClientId incorrectId(GameNetworkMessage::NetworkVersionId, ApplicationVersion::getInternalVersion());
|
||||
#else
|
||||
LoginIncorrectClientId incorrectId("", "");
|
||||
#endif // _DEBUG
|
||||
send(incorrectId, true);
|
||||
}
|
||||
#else
|
||||
validateClient( id.getId(), id.getKey() );
|
||||
#endif // PRODUCTION == 1
|
||||
|
||||
break;
|
||||
}
|
||||
case constcrc("RequestExtendedClusterInfo" ) :
|
||||
{
|
||||
LoginServer::getInstance().sendExtendedClusterInfo( *this );
|
||||
break;
|
||||
}
|
||||
case constcrc("DeleteCharacterMessage") :
|
||||
{
|
||||
DeleteCharacterMessage msg(ri);
|
||||
std::vector<NetworkId>::const_iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), msg.getCharacterId());
|
||||
if ((m_waitingForCharacterLoginDeletion || m_waitingForCharacterClusterDeletion) && f != m_charactersPendingDeletion.end())
|
||||
{
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_ALREADY_IN_PROGRESS);
|
||||
send(reply,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LoginServer::getInstance().deleteCharacter(msg.getClusterId(), msg.getCharacterId(), getStationId()))
|
||||
{
|
||||
m_waitingForCharacterLoginDeletion=true;
|
||||
m_waitingForCharacterClusterDeletion=true;
|
||||
m_charactersPendingDeletion.push_back(msg.getCharacterId());
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_CLUSTER_DOWN);
|
||||
send(reply,true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(const Archive::ReadException & readException)
|
||||
{
|
||||
WARNING(true, ("Archive read error (%s) on message from client. Disconnecting client.", readException.what()));
|
||||
disconnect();
|
||||
}
|
||||
switch (messageType) {
|
||||
case constcrc("LoginClientId") : {
|
||||
// send the client the server "now" Epoch time so that the
|
||||
// client has an idea of how much difference there is between
|
||||
// the client's Epoch time and the server Epoch time
|
||||
GenericValueTypeMessage<int32> const serverNowEpochTime(
|
||||
"ServerNowEpochTime", static_cast<int32>(::time(nullptr)));
|
||||
send(serverNowEpochTime, true);
|
||||
|
||||
LoginClientId id(ri);
|
||||
|
||||
// verify version
|
||||
#if PRODUCTION == 1
|
||||
if(!ConfigLoginServer::getValidateClientVersion() || id.getVersion() == GameNetworkMessage::NetworkVersionId)
|
||||
{
|
||||
validateClient(id.getId(), id.getKey());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("CustomerService", ("Login:LoginServer dropping client (stationId=[%lu], ip=[%s], id=[%s], key=[%s], version=[%s]) because of network version mismatch (required version=[%s])", m_stationId, getRemoteAddress().c_str(), id.getId().c_str(), id.getKey().c_str(), id.getVersion().c_str(), GameNetworkMessage::NetworkVersionId.c_str()));
|
||||
// disconnect is handled on the client side, as soon as it recieves this message
|
||||
#if _DEBUG
|
||||
LoginIncorrectClientId incorrectId(GameNetworkMessage::NetworkVersionId, ApplicationVersion::getInternalVersion());
|
||||
#else
|
||||
LoginIncorrectClientId incorrectId("", "");
|
||||
#endif // _DEBUG
|
||||
send(incorrectId, true);
|
||||
}
|
||||
#else
|
||||
validateClient(id.getId(), id.getKey());
|
||||
#endif // PRODUCTION == 1
|
||||
|
||||
break;
|
||||
}
|
||||
case constcrc("RequestExtendedClusterInfo") : {
|
||||
LoginServer::getInstance().sendExtendedClusterInfo(*this);
|
||||
break;
|
||||
}
|
||||
case constcrc("DeleteCharacterMessage") : {
|
||||
DeleteCharacterMessage msg(ri);
|
||||
std::vector<NetworkId>::const_iterator f = std::find(m_charactersPendingDeletion.begin(),
|
||||
m_charactersPendingDeletion.end(),
|
||||
msg.getCharacterId());
|
||||
if ((m_waitingForCharacterLoginDeletion || m_waitingForCharacterClusterDeletion) &&
|
||||
f != m_charactersPendingDeletion.end()) {
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_ALREADY_IN_PROGRESS);
|
||||
send(reply, true);
|
||||
} else {
|
||||
if (LoginServer::getInstance().deleteCharacter(msg.getClusterId(), msg.getCharacterId(),
|
||||
getStationId())) {
|
||||
m_waitingForCharacterLoginDeletion = true;
|
||||
m_waitingForCharacterClusterDeletion = true;
|
||||
m_charactersPendingDeletion.push_back(msg.getCharacterId());
|
||||
} else {
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_CLUSTER_DOWN);
|
||||
send(reply, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const Archive::ReadException &readException) {
|
||||
WARNING(true, ("Archive read error (%s) on message from client. Disconnecting client.", readException.what()));
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// originally was used to validate station API credentials, now uses our custom api
|
||||
void ClientConnection::validateClient(const std::string & id, const std::string & key)
|
||||
{
|
||||
bool authOK = false;
|
||||
StationId suid = atoi(id.c_str());
|
||||
static const std::string authURL(ConfigLoginServer::getExternalAuthUrl());
|
||||
std::string uname;
|
||||
|
||||
if (!authURL.empty())
|
||||
{
|
||||
// create the object
|
||||
webAPI api(authURL); // TODO: is loginserver single threaded? if so then let's make this static, and clear/reset it each run
|
||||
|
||||
// add our data
|
||||
api.addJsonData<std::string>("user_name", id);
|
||||
api.addJsonData<std::string>("user_password", key);
|
||||
api.addJsonData<std::string>("ip", getRemoteAddress());
|
||||
|
||||
if (api.submit())
|
||||
{
|
||||
bool status = api.getNullableValue<bool>("status");
|
||||
uname = api.getString("username");
|
||||
void ClientConnection::validateClient(const std::string &id, const std::string &key) {
|
||||
bool authOK = false;
|
||||
StationId suid = atoi(id.c_str());
|
||||
static const std::string authURL(ConfigLoginServer::getExternalAuthUrl());
|
||||
std::string uname;
|
||||
|
||||
if (status && !uname.empty())
|
||||
{
|
||||
authOK = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string msg = api.getString("message");
|
||||
if (msg.empty())
|
||||
{
|
||||
msg = "Invalid username or password.";
|
||||
}
|
||||
|
||||
ErrorMessage err("Login Failed", msg);
|
||||
this->send(err, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessage err("Login Failed", "Could not connect to remote.");
|
||||
this->send(err, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// test mode
|
||||
authOK = true;
|
||||
uname = id;
|
||||
}
|
||||
std::string parentAccount;
|
||||
std::vector<std::string> childAccounts;
|
||||
|
||||
if (authOK)
|
||||
{
|
||||
if (suid == 0)
|
||||
{
|
||||
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH)
|
||||
{
|
||||
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
if (!authURL.empty()) {
|
||||
// create the object
|
||||
webAPI api(
|
||||
authURL); // TODO: is loginserver single threaded? if so then let's make this static, and clear/reset it each run
|
||||
|
||||
std::hash<std::string> h;
|
||||
suid = h(uname.c_str());
|
||||
}
|
||||
// add our data
|
||||
api.addJsonData<std::string>("user_name", id);
|
||||
api.addJsonData<std::string>("user_password", key);
|
||||
api.addJsonData<std::string>("ip", getRemoteAddress());
|
||||
|
||||
LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), uname.c_str()));
|
||||
|
||||
LoginServer::getInstance().onValidateClient(suid, uname, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
}
|
||||
if (api.submit()) {
|
||||
bool status = api.getNullableValue<bool>("status");
|
||||
uname = api.getString("username");
|
||||
|
||||
if (status && !uname.empty()) {
|
||||
authOK = true;
|
||||
|
||||
parentAccount = api.getString("mainAccount");
|
||||
childAccounts = api.getStringVector("subAccounts");
|
||||
} else {
|
||||
std::string msg = api.getString("message");
|
||||
if (msg.empty()) {
|
||||
msg = "Invalid username or password.";
|
||||
}
|
||||
|
||||
ErrorMessage err("Login Failed", msg);
|
||||
this->send(err, true);
|
||||
}
|
||||
} else {
|
||||
ErrorMessage err("Login Failed", "Could not connect to remote.");
|
||||
this->send(err, true);
|
||||
}
|
||||
} else {
|
||||
// test mode
|
||||
authOK = true;
|
||||
uname = id;
|
||||
}
|
||||
|
||||
if (authOK) {
|
||||
if (suid == 0) {
|
||||
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
std::hash<std::string> h;
|
||||
suid = h(uname.c_str());
|
||||
}
|
||||
|
||||
std::hash<std::string> h;
|
||||
StationId parent = h(parentAccount);
|
||||
|
||||
REPORT_LOG(true,
|
||||
("Client connected. Station Id: %llu, Username: %s, Parent %s\n", suid, uname.c_str(), parentAccount.c_str()));
|
||||
|
||||
for (auto i : childAccounts) {
|
||||
if (i.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
i.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
StationId childID = h(i);
|
||||
REPORT_LOG(true, ("\tA child account for %s is %s (%llu)\n", parentAccount.c_str(), i.c_str(), childID));
|
||||
|
||||
// insert all related accounts, if not already there, into the db
|
||||
DatabaseConnection::getInstance().upsertAccountRelationship(parent, childID);
|
||||
}
|
||||
|
||||
LOG("LoginClientConnection",
|
||||
("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), uname.c_str()));
|
||||
|
||||
LoginServer::getInstance().onValidateClient(suid, uname, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -261,49 +254,46 @@ void ClientConnection::validateClient(const std::string & id, const std::string
|
||||
* required for character deletion. If the character has already been deleted
|
||||
* from the cluster, send the reply message to the client.
|
||||
*/
|
||||
void ClientConnection::onCharacterDeletedFromLoginDatabase(const NetworkId & characterId)
|
||||
{
|
||||
m_waitingForCharacterLoginDeletion = false;
|
||||
if (!m_waitingForCharacterClusterDeletion)
|
||||
{
|
||||
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), characterId);
|
||||
if(f != m_charactersPendingDeletion.end())
|
||||
{
|
||||
m_charactersPendingDeletion.erase(f);
|
||||
}
|
||||
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
|
||||
send(reply,true);
|
||||
LOG("CustomerService", ("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
void ClientConnection::onCharacterDeletedFromLoginDatabase(const NetworkId &characterId) {
|
||||
m_waitingForCharacterLoginDeletion = false;
|
||||
if (!m_waitingForCharacterClusterDeletion) {
|
||||
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(),
|
||||
m_charactersPendingDeletion.end(), characterId);
|
||||
if (f != m_charactersPendingDeletion.end()) {
|
||||
m_charactersPendingDeletion.erase(f);
|
||||
}
|
||||
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
|
||||
send(reply, true);
|
||||
LOG("CustomerService",
|
||||
("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void ClientConnection::onCharacterDeletedFromCluster(const NetworkId & characterId)
|
||||
{
|
||||
m_waitingForCharacterClusterDeletion = false;
|
||||
if (!m_waitingForCharacterLoginDeletion)
|
||||
{
|
||||
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), characterId);
|
||||
if(f != m_charactersPendingDeletion.end())
|
||||
{
|
||||
m_charactersPendingDeletion.erase(f);
|
||||
void ClientConnection::onCharacterDeletedFromCluster(const NetworkId &characterId) {
|
||||
m_waitingForCharacterClusterDeletion = false;
|
||||
if (!m_waitingForCharacterLoginDeletion) {
|
||||
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(),
|
||||
m_charactersPendingDeletion.end(), characterId);
|
||||
if (f != m_charactersPendingDeletion.end()) {
|
||||
m_charactersPendingDeletion.erase(f);
|
||||
|
||||
// TODO: send api request and decrement # characters on this account/subaccount
|
||||
}
|
||||
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
|
||||
send(reply,true);
|
||||
LOG("CustomerService", ("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
// TODO: send api request and decrement # characters on this account/subaccount
|
||||
}
|
||||
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
|
||||
send(reply, true);
|
||||
LOG("CustomerService",
|
||||
("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
StationId ClientConnection::getRequestedAdminSuid() const
|
||||
{
|
||||
return m_requestedAdminSuid;
|
||||
StationId ClientConnection::getRequestedAdminSuid() const {
|
||||
return m_requestedAdminSuid;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "TaskGetCharactersForDelete.h"
|
||||
#include "TaskGetClusterList.h"
|
||||
#include "TaskGetValidationData.h"
|
||||
#include "TaskMapAccount.h"
|
||||
#include "TaskRegisterNewCluster.h"
|
||||
#include "TaskRenameCharacter.h"
|
||||
#include "TaskRestoreCharacter.h"
|
||||
@@ -163,6 +164,12 @@ void DatabaseConnection::getAccountValidationData(const TransferRequestMoveValid
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void DatabaseConnection::upsertAccountRelationship(StationId parentID, StationId childID) {
|
||||
m_taskQueue->asyncRequest(new TaskMapAccount(parentID, childID));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void DatabaseConnection::deleteCharacter(uint32 clusterId, const NetworkId &characterId, StationId stationId)
|
||||
{
|
||||
NOT_NULL(m_taskQueue);
|
||||
|
||||
@@ -47,6 +47,7 @@ class DatabaseConnection : public Singleton<DatabaseConnection>
|
||||
void update ();
|
||||
void getAccountValidationData (StationId stationId, uint32 clusterId, unsigned int track, uint32 subscriptionBits);
|
||||
void getAccountValidationData (const TransferRequestMoveValidation & request, uint32 clusterId);
|
||||
void upsertAccountRelationship (StationId parentID, StationId childID);
|
||||
void deleteCharacter (uint32 clusterId, const NetworkId &characterId, StationId stationId);
|
||||
void deleteAllCharacters (StationId stationId);
|
||||
void renameCharacter (uint32 clusterId, const NetworkId &characterId, const Unicode::String &newName, const TransferCharacterData * requestData);
|
||||
|
||||
@@ -1484,7 +1484,6 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username,
|
||||
|
||||
//Send off request for the avatar list from the database.
|
||||
DatabaseConnection::getInstance().requestAvatarListForAccount(suid, 0);
|
||||
REPORT_LOG(true, ("Client connected. Station Id: %lu, Username: %s\n", suid, username.c_str()));
|
||||
LOG("LoginClientConnection", ("onValidateClient() for stationId (%lu) at IP (%s), id (%s), requesting avatar list for account", suid, conn->getRemoteAddress().c_str(), username.c_str()));
|
||||
|
||||
//Set up the connection as being validated with this suid.
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// ======================================================================
|
||||
//
|
||||
// TaskMapAccount.cpp
|
||||
// copyright (c) 2016 StellaBellum
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#include "FirstLoginServer.h"
|
||||
#include "TaskMapAccount.h"
|
||||
|
||||
#include "ClientConnection.h"
|
||||
#include "DatabaseConnection.h"
|
||||
#include "sharedDatabaseInterface/DbSession.h"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
TaskMapAccount::TaskMapAccount(StationId parentID, StationId childID) :
|
||||
TaskRequest(),
|
||||
m_parentID(parentID),
|
||||
m_childID(childID) {
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool TaskMapAccount::process(DB::Session *session) {
|
||||
MapAccountQuery qry;
|
||||
qry.parentID = m_parentID;
|
||||
qry.childID = m_childID;
|
||||
|
||||
bool rval = session->exec(&qry);
|
||||
|
||||
qry.done();
|
||||
return rval;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void TaskMapAccount::onComplete() {
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
TaskMapAccount::MapAccountQuery::MapAccountQuery() :
|
||||
Query(),
|
||||
parentID(),
|
||||
childID() {
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void TaskMapAccount::MapAccountQuery::getSQL(std::string &sql) {
|
||||
sql = std::string("begin ") + DatabaseConnection::getInstance().getSchemaQualifier() +
|
||||
"merge into account_map am using (select :parentID parent_id, :childID child_id from dual) v on (am.parent_id = v.parent_id and am.child_id = v.child_id) when not matched then insert (parent_id, child_id) values (v.parent_id, v.child_id); end;";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool TaskMapAccount::MapAccountQuery::bindParameters() {
|
||||
if (!bindParameter(parentID)) return false;
|
||||
if (!bindParameter(childID)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool TaskMapAccount::MapAccountQuery::bindColumns() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
DB::Query::QueryMode TaskMapAccount::MapAccountQuery::getExecutionMode() const {
|
||||
return MODE_PROCEXEC;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
@@ -0,0 +1,57 @@
|
||||
// ======================================================================
|
||||
//
|
||||
// TaskMapAccount.h
|
||||
// copyright (c) 2016 StellaBellum
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#ifndef INCLUDED_TaskMapAccount_H
|
||||
#define INCLUDED_TaskMapAccount_H
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#include "sharedDatabaseInterface/Bindable.h"
|
||||
#include "sharedDatabaseInterface/BindableNetworkId.h"
|
||||
#include "sharedDatabaseInterface/DbQuery.h"
|
||||
#include "sharedDatabaseInterface/DbTaskRequest.h"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
class TaskMapAccount : public DB::TaskRequest
|
||||
{
|
||||
public:
|
||||
TaskMapAccount(StationId parentID, StationId childID);
|
||||
|
||||
public:
|
||||
virtual bool process (DB::Session *session);
|
||||
virtual void onComplete ();
|
||||
|
||||
private:
|
||||
TaskMapAccount(); // disabled default constructor
|
||||
|
||||
class MapAccountQuery : public DB::Query
|
||||
{
|
||||
public:
|
||||
MapAccountQuery();
|
||||
|
||||
DB::BindableLong parentID; //lint !e1925 // public data member
|
||||
DB::BindableLong childID; //lint !e1925 // public data member
|
||||
|
||||
virtual void getSQL(std::string &sql);
|
||||
virtual bool bindParameters();
|
||||
virtual bool bindColumns();
|
||||
virtual QueryMode getExecutionMode() const;
|
||||
|
||||
private: //disable
|
||||
MapAccountQuery(const MapAccountQuery&);
|
||||
MapAccountQuery &operator=(const MapAccountQuery&);
|
||||
};
|
||||
|
||||
private:
|
||||
StationId m_parentID;
|
||||
StationId m_childID;
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#endif
|
||||
@@ -34,12 +34,12 @@ void ConfigServerDatabase::install(void)
|
||||
ConfigServerUtility::install();
|
||||
data = &staticData;
|
||||
|
||||
KEY_INT (objvarNameCleanupTime, 0);
|
||||
KEY_INT (orphanedObjectCleanupTime, 0);
|
||||
KEY_INT (marketAttributesCleanupTime, 0);
|
||||
KEY_INT (messagesCleanupTime, 0);
|
||||
KEY_INT (brokenObjectCleanupTime, 0);
|
||||
KEY_INT (vendorObjectCleanupTime, 0);
|
||||
KEY_INT (objvarNameCleanupTime, 60);
|
||||
KEY_INT (orphanedObjectCleanupTime, 60);
|
||||
KEY_INT (marketAttributesCleanupTime, 60);
|
||||
KEY_INT (messagesCleanupTime, 60);
|
||||
KEY_INT (brokenObjectCleanupTime, 60);
|
||||
KEY_INT (vendorObjectCleanupTime, 60);
|
||||
KEY_STRING (customSQLFilename,"");
|
||||
KEY_BOOL (enableFixBadCells, false);
|
||||
KEY_STRING (objectTemplateListUpdateFilename,"");
|
||||
|
||||
@@ -230,7 +230,7 @@ void Persister::onFrameBarrierReached()
|
||||
for (ObjectSnapshotMap::iterator obj=m_objectSnapshotMap.begin(); obj!=m_objectSnapshotMap.end();)
|
||||
{
|
||||
if (obj->second == i->second)
|
||||
m_objectSnapshotMap.erase(obj++);
|
||||
obj = m_objectSnapshotMap.erase(obj);
|
||||
else
|
||||
++obj;
|
||||
}
|
||||
|
||||
@@ -786,10 +786,6 @@ add_library(serverGame STATIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/shared/generated/Packager.cpp
|
||||
)
|
||||
|
||||
if(NOT WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
target_link_libraries(mulodi)
|
||||
endif()
|
||||
|
||||
target_link_libraries(serverGame
|
||||
sharedCommandParser
|
||||
sharedPathfinding
|
||||
@@ -797,6 +793,3 @@ target_link_libraries(serverGame
|
||||
sharedTerrain
|
||||
)
|
||||
|
||||
if(${BUILD_MULODI_LIB})
|
||||
target_link_libraries(serverGame mulodi)
|
||||
endif()
|
||||
|
||||
@@ -52,7 +52,13 @@ void AiLogManager::setLogging(NetworkId const & networkId, bool const enabled)
|
||||
// ----------------------------------------------------------------------
|
||||
bool AiLogManager::isLogging(NetworkId const & networkId)
|
||||
{
|
||||
return ConfigServerGame::isAiLoggingEnabled() || (s_aiList.find(networkId) != s_aiList.end());
|
||||
bool result = (ConfigServerGame::isAiLoggingEnabled() && (s_aiList.find(networkId) != s_aiList.end()));
|
||||
|
||||
if (!result) {
|
||||
s_aiList.erase(networkId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -167,8 +167,7 @@ AICreatureController::~AICreatureController()
|
||||
if (owner != nullptr && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0)
|
||||
ObjectTracker::removeDelayedHibernatingAI();
|
||||
|
||||
if ( (owner != nullptr)
|
||||
&& AiLogManager::isLogging(owner->getNetworkId()))
|
||||
if ((owner != nullptr) && AiLogManager::isLogging(owner->getNetworkId()))
|
||||
{
|
||||
AiLogManager::setLogging(owner->getNetworkId(), false);
|
||||
}
|
||||
|
||||
@@ -1007,12 +1007,18 @@ void Client::receiveClientMessage(const GameNetworkMessage & message)
|
||||
// check to make sure the controller message is allowed from the client
|
||||
bool allowFromClient = ControllerMessageFactory::allowFromClient(o.getMessage());
|
||||
|
||||
// log as a possible hack
|
||||
if (!allowFromClient)
|
||||
LOG("CustomerService", ("UnauthorizedControllerMessage: Player %s sent an unauthorized controller message %d for object %s.", PlayerObject::getAccountDescription(getCharacterObjectId()).c_str(), o.getMessage(), o.getNetworkId().getValueString().c_str()));
|
||||
|
||||
// do we allow the controller message to get executed?
|
||||
if (allowFromClient || isGod() || !ConfigServerGame::getEnableClientControllerMessageCheck())
|
||||
// we default this to true so that unless
|
||||
// a controller message is explicitly marked as being allowed
|
||||
// from the client, or the client is a GM, it will be dropped when the game server
|
||||
// receives it; this will have the effect of forcing the
|
||||
// programmer to make a conscious decision to mark the
|
||||
// controller message as allowable from the client; because
|
||||
// controller message coming from the client is not secured,
|
||||
// the mechanism to prevent a hacked client from sending the
|
||||
// game server any controller message is to explicity "mark"
|
||||
// those controller messages that are allowed from the client
|
||||
|
||||
if (allowFromClient || isGod())
|
||||
{
|
||||
ServerObject * target = findControlledObject(o.getNetworkId());
|
||||
if(target !=0)
|
||||
@@ -1045,9 +1051,14 @@ void Client::receiveClientMessage(const GameNetworkMessage & message)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// log as a likely hack
|
||||
LOG("CustomerService", ("UnauthorizedControllerMessage: Player %s sent an unauthorized controller message %d for object %s.", PlayerObject::getAccountDescription(getCharacterObjectId()).c_str(), o.getMessage(), o.getNetworkId().getValueString().c_str()));
|
||||
}
|
||||
if (!appended)
|
||||
|
||||
if (!appended) {
|
||||
delete o.getData();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void ConfigServerGame::install(void)
|
||||
KEY_BOOL (adminPersistAllCreates, false);
|
||||
KEY_BOOL (buildCluster, false);
|
||||
KEY_INT (requestSceneWarpTimeoutSeconds, 60);
|
||||
KEY_BOOL (moveValidationEnabled, false);
|
||||
KEY_BOOL (moveValidationEnabled, true);
|
||||
KEY_FLOAT (moveSpeedTolerance, 1.03f);
|
||||
KEY_INT (moveSpeedCheckFrequencyMs, 10000);
|
||||
KEY_INT (moveSpeedCheckFailureLeewaySeconds, 5);
|
||||
@@ -148,7 +148,7 @@ void ConfigServerGame::install(void)
|
||||
KEY_INT (moveValidationPastTimestampThresholdMs, 10000);
|
||||
KEY_INT (moveValidationFutureTimestampThresholdMs, 10000);
|
||||
KEY_INT (moveValidationTimestampDriftThresholdMs, 10000);
|
||||
KEY_FLOAT (moveMaxDistanceLeewayPerUpdate, 2.0f);
|
||||
KEY_FLOAT (moveMaxDistanceLeewayPerUpdate, 2.5f);
|
||||
KEY_BOOL (nameValidationAcceptAll, false);
|
||||
KEY_FLOAT (tangiblePvpRegionCheckTime, 20.0f);
|
||||
KEY_FLOAT (creaturePvpRegionCheckTime, 5.0f);
|
||||
@@ -239,7 +239,7 @@ void ConfigServerGame::install(void)
|
||||
KEY_BOOL (enforcePlayerTriggerVolumesOnly, true);
|
||||
KEY_FLOAT (locationTargetCheckIntervalSec, 5.0f);
|
||||
KEY_STRING (gameServiceBindInterface, "");
|
||||
KEY_BOOL (logPvpUpdates, false);
|
||||
KEY_BOOL (logPvpUpdates, true);
|
||||
KEY_FLOAT (npcConversationDistance, 6.0f);
|
||||
KEY_INT (serverSpawnLimit, 1200);
|
||||
KEY_INT (spawnQueueSize, 1);
|
||||
@@ -304,11 +304,11 @@ void ConfigServerGame::install(void)
|
||||
KEY_BOOL (debugPvp, false);
|
||||
KEY_BOOL (allowMasterObjectCreation, true);
|
||||
KEY_BOOL (mountsEnabled, true);
|
||||
KEY_BOOL (mountsSanityCheckerEnabled, false);
|
||||
KEY_BOOL (mountsSanityCheckerEnabled, false); // need to investigate
|
||||
KEY_BOOL (mountsSanityCheckerBroadcastEnabled, false);
|
||||
KEY_INT (mountsSanityCheckerBroadcastLimit, 5);
|
||||
KEY_INT (universeCheckFrequencySeconds, 60 * 60);
|
||||
KEY_BOOL (moveSimEnabled, false);
|
||||
KEY_BOOL (moveSimEnabled, true);
|
||||
KEY_BOOL (exceptionOnObjVarZeroLengthArray, false);
|
||||
KEY_BOOL (trackNonAuthoritativeObjvarSets, false);
|
||||
KEY_FLOAT (triggerVolumeWarpDistance, 128.0f);
|
||||
@@ -339,23 +339,6 @@ void ConfigServerGame::install(void)
|
||||
KEY_FLOAT (lineOfSightCacheMinHeight, 0.8f);
|
||||
KEY_FLOAT (lineOfSightLocationRoundValue, 5.0f);
|
||||
|
||||
#ifdef _DEBUG
|
||||
// in debug mode, we default this to true so that unless
|
||||
// a controller message is explicitly marked as being allowed
|
||||
// from the client, it will be dropped when the game server
|
||||
// receives it; this will have the effect of forcing the
|
||||
// programmer to make a conscious decision to mark the
|
||||
// controller message as allowable from the client; because
|
||||
// controller message coming from the client is not secured,
|
||||
// the mechanism to prevent a hacked client from sending the
|
||||
// game server any controller message is to explicity "mark"
|
||||
// those controller messages that are allowed from the client
|
||||
KEY_BOOL (enableClientControllerMessageCheck, true);
|
||||
#else
|
||||
// for live, the this option will be set to true in the config file
|
||||
KEY_BOOL (enableClientControllerMessageCheck, false);
|
||||
#endif
|
||||
|
||||
KEY_INT (maxWaypointsPerCharacter,100); // Keep this in sync with the maxWaypoints value in ConfigClientGame.cpp
|
||||
KEY_FLOAT (maxSmallCreatureHeight, 0.7f);
|
||||
KEY_FLOAT (smallCreatureUpdateRadius, 64.0f);
|
||||
@@ -382,11 +365,11 @@ void ConfigServerGame::install(void)
|
||||
KEY_INT (groundFrameRateLimit, 5);
|
||||
KEY_INT (spaceFrameRateLimit, 12);
|
||||
KEY_BOOL (aiLoggingEnabled, false);
|
||||
KEY_BOOL (shipShotValidationEnabled, false);
|
||||
KEY_BOOL (shipShotValidationEnabled, true);
|
||||
KEY_INT (spaceAiEnemySearchesPerFrame, 15);
|
||||
KEY_BOOL (groundShouldSleep, true);
|
||||
KEY_BOOL (spaceShouldSleep, true);
|
||||
KEY_BOOL (shipMoveValidationEnabled, false);
|
||||
KEY_BOOL (shipMoveValidationEnabled, true);
|
||||
KEY_INT (shipMoveCheckIntervalMs, 1000);
|
||||
KEY_INT (shipMoveCheckFudgeTimeMs, 5000);
|
||||
KEY_FLOAT (shipMoveCheckTolerance, 1.03f);
|
||||
|
||||
@@ -393,7 +393,6 @@ class ConfigServerGame
|
||||
|
||||
bool fatalOnGoldPobChange;
|
||||
|
||||
bool enableClientControllerMessageCheck;
|
||||
int maxWaypointsPerCharacter;
|
||||
|
||||
float maxSmallCreatureHeight;
|
||||
@@ -916,8 +915,6 @@ class ConfigServerGame
|
||||
|
||||
static bool getFatalOnGoldPobChange();
|
||||
|
||||
static bool getEnableClientControllerMessageCheck();
|
||||
|
||||
static int getMaxWaypointsPerCharacter();
|
||||
|
||||
static float getMaxSmallCreatureHeight();
|
||||
@@ -2829,13 +2826,6 @@ inline bool ConfigServerGame::getFatalOnGoldPobChange()
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
inline bool ConfigServerGame::getEnableClientControllerMessageCheck()
|
||||
{
|
||||
return data->enableClientControllerMessageCheck;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline float ConfigServerGame::getMaxSmallCreatureHeight()
|
||||
{
|
||||
return data->maxSmallCreatureHeight;
|
||||
|
||||
@@ -643,7 +643,11 @@ void GameServer::connectToDatabaseProcess(std::string const &address, uint16 por
|
||||
void GameServer::createRemoteProxy(uint32 remoteProcessId, ServerObject *object)
|
||||
{
|
||||
|
||||
WARNING_STRICT_FATAL(!object, ("Told to create an object on %d we know nothing about!\n", remoteProcessId));
|
||||
if (!object) {
|
||||
WARNING(!object, ("Told to create an object on %d we know nothing about!\n", remoteProcessId));
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkId objectId = object->getNetworkId();
|
||||
|
||||
DEBUG_REPORT_LOG(ConfigServerGame::getLogObjectLoading(),("createRemoteProxy(%lu,%s)\n",remoteProcessId, objectId.getValueString().c_str()));
|
||||
@@ -1340,11 +1344,11 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M
|
||||
LoadObjectMessage const t(ri);
|
||||
|
||||
ServerObject *const target = ServerWorld::findObjectByNetworkId(t.getId());
|
||||
if (target)
|
||||
if (target) {
|
||||
createRemoteProxy(t.getProcess(), target);
|
||||
else
|
||||
WARNING(true, ("Told to create object %s on %d we know nothing about (received LoadObjectMessage for an object not on this server, PlanetServer is probably confused)", t
|
||||
.getId().getValueString().c_str(), t.getProcess()));
|
||||
} else {
|
||||
WARNING(true, ("Told to create object %s on %d we know nothing about", t.getId().getValueString().c_str(), t.getProcess()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case constcrc("UnloadObjectMessage") : {
|
||||
@@ -4787,7 +4791,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse
|
||||
Object* appearanceInventory = itemId.getObject();
|
||||
if(appearanceInventory == nullptr)
|
||||
{
|
||||
WARNING(true, ("Player %s has lost their appearance inventory", newCharacterObject->getNetworkId().getValueString().c_str()));
|
||||
DEBUG_WARNING(true, ("Player %s has lost their appearance inventory", newCharacterObject->getNetworkId().getValueString().c_str()));
|
||||
appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *newCharacterObject, slot, false);
|
||||
if(!appearanceInventory)
|
||||
{
|
||||
|
||||
@@ -320,7 +320,7 @@ void ServerWorldNamespace::issueCollisionNearWarpWarning(Object const &object, V
|
||||
|
||||
//-- Only issue these for authoritative server objects. Proxy server objects will hit this condition after an intra-planet teleport.
|
||||
// @todo allow proxies to know about a teleport and inform CollisionWorld so that we can always report these.
|
||||
WARNING(!serverObject || serverObject->isAuthoritative(),
|
||||
DEBUG_WARNING(!serverObject || serverObject->isAuthoritative(),
|
||||
("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], authority=[%s], game sever id=[%d], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], object probably should have warped but collision system is not warping it.",
|
||||
segmentCount,
|
||||
object.getNetworkId().getValueString().c_str(),
|
||||
@@ -344,7 +344,7 @@ void ServerWorldNamespace::issueCollisionFarWarpWarning(Object const &object, Ve
|
||||
|
||||
//-- Only issue these for authoritative server objects. Proxy server objects will hit this condition after an intra-planet teleport.
|
||||
// @todo allow proxies to know about a teleport and inform CollisionWorld so that we can always report these.
|
||||
WARNING(!serverObject || serverObject->isAuthoritative(),
|
||||
DEBUG_WARNING(!serverObject || serverObject->isAuthoritative(),
|
||||
("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], authority=[%s], game sever id=[%d], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], collision system will consider this a warp and adjust accordingly.",
|
||||
segmentCount,
|
||||
object.getNetworkId().getValueString().c_str(),
|
||||
@@ -3547,4 +3547,4 @@ void ServerWorldNamespace::updatePlanetServer()
|
||||
}
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
// ======================================================================
|
||||
|
||||
@@ -1837,7 +1837,7 @@ void CreatureObject::onLoadedFromDatabase()
|
||||
Object* appearanceInventory = itemId.getObject();
|
||||
if(appearanceInventory == nullptr)
|
||||
{
|
||||
WARNING(true, ("Player %s has lost their appearance inventory", getNetworkId().getValueString().c_str()));
|
||||
DEBUG_WARNING(true, ("Player %s has lost their appearance inventory", getNetworkId().getValueString().c_str()));
|
||||
appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *this, slot, false);
|
||||
if(!appearanceInventory)
|
||||
{
|
||||
@@ -4251,7 +4251,7 @@ static const int internalTagBufLen = strlen(internalTagBuf);
|
||||
// check if we're making a potentially dangerous mod
|
||||
if (!Attributes::isAttribPool(mod.attrib))
|
||||
{
|
||||
WARNING(true, ("Creature %s is having non-pool attribute %d instantly "
|
||||
DEBUG_WARNING(true, ("Creature %s is having non-pool attribute %d instantly "
|
||||
"modified! This change will be permanent!",
|
||||
getNetworkId().getValueString().c_str(), mod.attrib));
|
||||
}
|
||||
@@ -6688,7 +6688,7 @@ void CreatureObject::setAttribute(Attributes::Enumerator attribute, Attributes::
|
||||
}
|
||||
if (!Attributes::isAttribPool(attribute))
|
||||
{
|
||||
WARNING(true, ("CreatureObject::setAttribute called with non-pool attribute %d on creature %s. If this is a regeneration value, call setRegenRate() instead.",
|
||||
DEBUG_WARNING(true, ("CreatureObject::setAttribute called with non-pool attribute %d on creature %s. If this is a regeneration value, call setRegenRate() instead.",
|
||||
attribute, getNetworkId().getValueString().c_str()));
|
||||
return;
|
||||
}
|
||||
@@ -6716,7 +6716,7 @@ void CreatureObject::setMaxAttribute(Attributes::Enumerator attribute, Attribute
|
||||
}
|
||||
if (!Attributes::isAttribPool(attribute))
|
||||
{
|
||||
WARNING(true, ("CreatureObject::setMaxAttribute called with non-pool attribute %d on creature %s. If this is a regeneration value, call setRegenRate() instead.",
|
||||
DEBUG_WARNING(true, ("CreatureObject::setMaxAttribute called with non-pool attribute %d on creature %s. If this is a regeneration value, call setRegenRate() instead.",
|
||||
attribute, getNetworkId().getValueString().c_str()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ void IntangibleObject::onPermanentlyDestroyed()
|
||||
* Persists this object in the database. Will also persist all the objects it
|
||||
* is keeping track of.
|
||||
*/
|
||||
bool IntangibleObject::persist()
|
||||
void IntangibleObject::persist()
|
||||
{
|
||||
if (isAuthoritative() && isTheater())
|
||||
{
|
||||
@@ -413,11 +413,11 @@ bool IntangibleObject::persist()
|
||||
{
|
||||
// we are not finished creating our objects, prevent persistance
|
||||
WARNING(true, ("IntangibleObject::persist called before all objects created"));
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPersisted())
|
||||
return true;
|
||||
return;
|
||||
|
||||
ServerObject::persist();
|
||||
|
||||
@@ -471,15 +471,9 @@ bool IntangibleObject::persist()
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
else
|
||||
ServerObject::persist();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} // IntangibleObject::persist
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
virtual float alter(float time);
|
||||
virtual void onPermanentlyDestroyed();
|
||||
virtual bool persist();
|
||||
virtual void persist();
|
||||
virtual bool isVisibleOnClient (const Client & client) const;
|
||||
virtual void getAttributes (std::vector<std::pair<std::string, Unicode::String> > &data) const;
|
||||
virtual bool onContainerAboutToTransfer(ServerObject * destination, ServerObject* transferer);
|
||||
|
||||
@@ -763,12 +763,12 @@ int PlayerObject::getExperienceLimit(const std::string & experienceType) const
|
||||
{
|
||||
// use the default limit
|
||||
limit = SkillManager::getInstance().getDefaultXpLimit(experienceType);
|
||||
WARNING(limit == static_cast<uint32>(-1), ("No default xp limit defined "
|
||||
DEBUG_WARNING(limit == static_cast<uint32>(-1), ("No default xp limit defined "
|
||||
"for xp type %s for player object %s", experienceType.c_str(), getNetworkId().getValueString().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
WARNING(limit == static_cast<uint32>(-1), ("No xp limit defined "
|
||||
DEBUG_WARNING(limit == static_cast<uint32>(-1), ("No xp limit defined "
|
||||
"for xp type %s for player object %s", experienceType.c_str(), getNetworkId().getValueString().c_str()));
|
||||
|
||||
return limit;
|
||||
|
||||
@@ -3203,11 +3203,11 @@ void ServerObject::onRemovedFromTriggerVolume(TriggerVolume & triggerVolume)
|
||||
* After this function is called, changes to this object will be sent to the database.
|
||||
*/
|
||||
|
||||
bool ServerObject::persist()
|
||||
void ServerObject::persist()
|
||||
{
|
||||
// Do not persist buildout objects (buildout objects have negative networkIds)
|
||||
if (getNetworkId() < NetworkId::cms_invalid)
|
||||
return false;
|
||||
return;
|
||||
|
||||
if (isAuthoritative())
|
||||
{
|
||||
@@ -3221,7 +3221,7 @@ bool ServerObject::persist()
|
||||
if (!contained && !isPlayerControlled() && getPosition_p() != Vector::zero)
|
||||
{
|
||||
WARNING_STRICT_FATAL(true, ("Tried to persist non-player object %s in a space scene away from the origin (not persisting).", getDebugInformation().c_str()));
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3244,15 +3244,11 @@ bool ServerObject::persist()
|
||||
|
||||
PositionUpdateTracker::sendPositionUpdate(*this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendControllerMessageToAuthServer(CM_persistObject, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -4128,7 +4124,7 @@ void ServerObject::performCombatSpam (const MessageQueueCombatSpam & spamMsg, bo
|
||||
{
|
||||
if (!isAuthoritative ())
|
||||
{
|
||||
WARNING_STRICT_FATAL (true, ("Do not call performCombatSpam on non-authoritative objects"));
|
||||
DEBUG_WARNING (true, ("Do not call performCombatSpam on non-authoritative objects"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4143,7 +4139,7 @@ void ServerObject::performCombatSpam (const MessageQueueCombatSpam & spamMsg, bo
|
||||
target->seeCombatSpam (spamMsg);
|
||||
}
|
||||
} else {
|
||||
WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("nullptr target_obj in commandFuncCombatSpam, when sendToTarget was set true"));
|
||||
DEBUG_WARNING (!sendToSelf && !sendToBystanders, ("nullptr target_obj in commandFuncCombatSpam, when sendToTarget was set true"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8104,7 +8100,7 @@ void ServerObject::removePatrolPathObserver()
|
||||
getNetworkId().getValueString().c_str(), pprp->getObserverCount()));
|
||||
if (pprp->getObserverCount() < 0)
|
||||
{
|
||||
WARNING(true, ("ServerObject::removePatrolPathObserver %s has negative patrol path observer count of %d",
|
||||
DEBUG_WARNING(true, ("ServerObject::removePatrolPathObserver %s has negative patrol path observer count of %d",
|
||||
getNetworkId().getValueString().c_str(), pprp->getObserverCount()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
bool isInEndBaselines() const;
|
||||
bool isNeedingPobFixup() const;
|
||||
bool permanentlyDestroy (DeleteReasons::Enumerator reason);
|
||||
virtual bool persist ();
|
||||
virtual void persist ();
|
||||
virtual void onRemovingFromWorld ();
|
||||
virtual void unload ();
|
||||
void moveToPlayerAndUnload (const NetworkId &player);
|
||||
|
||||
@@ -1582,14 +1582,14 @@ bool ShipObject::validateShot(int const weaponIndex, Transform const & transform
|
||||
//-- Is our angle too far out of sync?
|
||||
if (acos(transform_p.getLocalFrameK_p().dot(testDirection_p)) > testOrientationTolerance)
|
||||
{
|
||||
//-- LOG("cheater", ("firing guns in wrong direction"));
|
||||
LOG("cheater", ("firing guns in wrong direction"));
|
||||
return false;
|
||||
}
|
||||
|
||||
//-- Is our gun position too far from where we are? (max ship speed * ms_shotValidationTolerance)
|
||||
if (transform_p.getPosition_p().magnitudeBetweenSquared(testPosition_p) > sqr(getShipActualSpeedMaximum() * ms_shotValidationTolerance))
|
||||
{
|
||||
//-- LOG("cheater", ("firing guns too far from current position"));
|
||||
LOG("cheater", ("firing guns too far from current position"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ void TangibleObject::endNpcConversation()
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-nullptr m_npcConversation pointer %p but is not a player-controlled object!",
|
||||
DEBUG_WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-nullptr m_npcConversation pointer %p but is not a player-controlled object!",
|
||||
getNetworkId().getValueString().c_str(), m_npcConversation));
|
||||
m_conversations.clear();
|
||||
}
|
||||
|
||||
@@ -855,7 +855,7 @@ LocalRefParam::~LocalRefParam()
|
||||
jobject LocalRefParam::getReturnValue(void)
|
||||
{
|
||||
jobject return_val = m_ref;
|
||||
m_ref = 0;
|
||||
m_ref = nullptr;
|
||||
return return_val;
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ jobject LocalRefParam::getReturnValue(void)
|
||||
*/
|
||||
void LocalRefParam::emergencyClear()
|
||||
{
|
||||
m_ref = 0;
|
||||
m_ref = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -902,9 +902,9 @@ LocalRef::LocalRef(jobject src) :
|
||||
|
||||
LocalRef::~LocalRef()
|
||||
{
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteLocalRef(m_ref);
|
||||
m_ref = 0;
|
||||
m_ref = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -917,9 +917,9 @@ LocalArrayRef::LocalArrayRef(jarray src) :
|
||||
|
||||
LocalArrayRef::~LocalArrayRef()
|
||||
{
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteLocalRef(m_ref);
|
||||
m_ref = 0;
|
||||
m_ref = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -932,9 +932,9 @@ LocalObjectArrayRef::LocalObjectArrayRef(jobjectArray src) :
|
||||
|
||||
LocalObjectArrayRef::~LocalObjectArrayRef()
|
||||
{
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteLocalRef(m_ref);
|
||||
m_ref = 0;
|
||||
m_ref = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1008,9 +1008,9 @@ GlobalRef::GlobalRef(const LocalRefParam & src) :
|
||||
|
||||
GlobalRef::~GlobalRef()
|
||||
{
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteGlobalRef(m_ref);
|
||||
m_ref = 0;
|
||||
m_ref = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1025,9 +1025,9 @@ GlobalArrayRef::GlobalArrayRef(const LocalObjectArrayRefParam & src) :
|
||||
|
||||
GlobalArrayRef::~GlobalArrayRef()
|
||||
{
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteGlobalRef(m_ref);
|
||||
m_ref = 0;
|
||||
m_ref = nullptr;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
@@ -1048,7 +1048,7 @@ JavaStringParam::~JavaStringParam()
|
||||
|
||||
int JavaStringParam::fillBuffer(char * buffer, int size) const
|
||||
{
|
||||
if (m_ref > 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref != nullptr && buffer != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
{
|
||||
// Get the number of storage bytes required to convert this Java string into a UTF-8 string.
|
||||
// Include the terminating nullptr byte in the required buffer size.
|
||||
@@ -1093,9 +1093,9 @@ JavaString::JavaString(const Unicode::String & src) :
|
||||
|
||||
JavaString::~JavaString()
|
||||
{
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteLocalRef(m_ref);
|
||||
m_ref = 0;
|
||||
m_ref = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -514,15 +514,16 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e
|
||||
JavaStringParam localName(name);
|
||||
if (localName.fillBuffer(buffer, bufferSize) > 1)
|
||||
{
|
||||
if (!JavaLibrary::getObject(objId, object) && !ConfigServerGame::getDisableObjvarNullCheck())
|
||||
if (!JavaLibrary::getObject(objId, object))
|
||||
{
|
||||
fprintf(stderr, "WARNING: Could not get object for objvar %s call\n", buffer);
|
||||
WARNING((!ConfigServerGame::getDisableObjvarNullCheck()), ("WARNING: Could not get object for objvar %s call\n", buffer));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "WARNING: Could not get objvar name\n");
|
||||
WARNING(true, ("Could not get objvar name."));
|
||||
}
|
||||
|
||||
if (object == nullptr && !ConfigServerGame::getDisableObjvarNullCheck())
|
||||
JavaLibrary::printJavaStack();
|
||||
|
||||
|
||||
@@ -1125,11 +1125,8 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::persistObject(JNIEnv *env,
|
||||
ServerObject* object = nullptr;
|
||||
if (!JavaLibrary::getObject(target, object))
|
||||
return JNI_FALSE;
|
||||
if (object->persist()) {
|
||||
return JNI_TRUE;
|
||||
} else {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
object->persist();
|
||||
return JNI_TRUE;
|
||||
} // JavaLibrary::persistObject
|
||||
|
||||
/**
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace ScriptMethodsObjectInfoNamespace
|
||||
jboolean JNICALL hasCondition(JNIEnv *env, jobject self, jlong target, jint condition);
|
||||
jboolean JNICALL setCondition(JNIEnv *env, jobject self, jlong target, jint condition);
|
||||
jboolean JNICALL clearCondition(JNIEnv *env, jobject self, jlong target, jint condition);
|
||||
void JNICALL sendScriptVarsToProxies(JNIEnv * env, jobject self, jlong obj, jbyteArray buffer);
|
||||
jboolean JNICALL sendScriptVarsToProxies(JNIEnv * env, jobject self, jlong obj, jbyteArray buffer);
|
||||
jstring JNICALL getAppearance(JNIEnv * env, jobject self, jlong target);
|
||||
jboolean JNICALL isInsured(JNIEnv * env, jobject self, jlong target);
|
||||
jboolean JNICALL isAutoInsured(JNIEnv * env, jobject self, jlong target);
|
||||
@@ -512,7 +512,7 @@ const JNINativeMethod NATIVES[] = {
|
||||
JF("getCtsDestinationClusters", "()[Ljava/lang/String;", getCtsDestinationClusters),
|
||||
JF("getCurrentSceneName", "()Ljava/lang/String;", getCurrentSceneName),
|
||||
JF("getClusterName", "()Ljava/lang/String;", getClusterName),
|
||||
JF("_sendScriptVarsToProxies", "(J[B)V", sendScriptVarsToProxies),
|
||||
JF("_sendScriptVarsToProxies", "(J[B)Z", sendScriptVarsToProxies),
|
||||
JF("_canEquipWearable", "(JJ)Z", canEquipWearable),
|
||||
JF("_openCustomizationWindow", "(JJLjava/lang/String;IILjava/lang/String;IILjava/lang/String;IILjava/lang/String;II)V", openCustomizationWindow),
|
||||
JF("_getHologramType", "(J)I", getHologramType),
|
||||
@@ -3363,50 +3363,66 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::canEquipWearable(JNIEnv * env
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
void JNICALL ScriptMethodsObjectInfoNamespace::sendScriptVarsToProxies(JNIEnv * env, jobject self, jlong obj, jbyteArray buffer)
|
||||
jboolean JNICALL ScriptMethodsObjectInfoNamespace::sendScriptVarsToProxies(JNIEnv * env, jobject self, jlong obj, jbyteArray buffer)
|
||||
{
|
||||
PROFILER_AUTO_BLOCK_DEFINE("JNI::sendScriptVarsToProxies");
|
||||
PROFILER_AUTO_BLOCK_DEFINE("JNI::sendScriptVarsToProxies");
|
||||
|
||||
jboolean res = JNI_FALSE;
|
||||
|
||||
if (obj != 0 && buffer != 0)
|
||||
{
|
||||
ServerObject * object = 0;
|
||||
if (obj != 0 && buffer != 0)
|
||||
{
|
||||
if (JavaLibrary::getObject(obj, object))
|
||||
{
|
||||
ProxyList const &proxyList = object->getExposedProxyList();
|
||||
if (!proxyList.empty())
|
||||
{
|
||||
std::vector<int8> data;
|
||||
if (ScriptConversion::convert(buffer, data))
|
||||
{
|
||||
if(data.size() > 0)
|
||||
{
|
||||
WARNING(data.size() > 60000, ("JavaLibrary::sendScriptVarsToProxies: "
|
||||
"Packing scriptvars for object %s, packed data size = %d",
|
||||
object->getNetworkId().getValueString().c_str(),
|
||||
static_cast<int>(data.size())));
|
||||
if (JavaLibrary::getObject(obj, object))
|
||||
{
|
||||
ProxyList const &proxyList = object->getExposedProxyList();
|
||||
if (!proxyList.empty())
|
||||
{
|
||||
std::vector<int8> data;
|
||||
if (ScriptConversion::convert(buffer, data))
|
||||
{
|
||||
if(data.size() > 0)
|
||||
{
|
||||
WARNING(data.size() > 60000, ("JavaLibrary::sendScriptVarsToProxies: "
|
||||
"Packing scriptvars for object %s, packed data size = %d",
|
||||
object->getNetworkId().getValueString().c_str(),
|
||||
static_cast<int>(data.size())
|
||||
)
|
||||
);
|
||||
|
||||
uint32 const myProcessId = GameServer::getInstance().getProcessId();
|
||||
uint32 const authProcessId = object->getAuthServerProcessId();
|
||||
ProxyList syncServers(proxyList);
|
||||
if (myProcessId != authProcessId)
|
||||
{
|
||||
syncServers.erase(myProcessId);
|
||||
syncServers.insert(authProcessId);
|
||||
}
|
||||
uint32 const myProcessId = GameServer::getInstance().getProcessId();
|
||||
uint32 const authProcessId = object->getAuthServerProcessId();
|
||||
|
||||
ServerMessageForwarding::begin(std::vector<uint32>(syncServers.begin(), syncServers.end()));
|
||||
|
||||
SynchronizeScriptVarDeltasMessage const deltasMessage(object->getNetworkId(), data);
|
||||
ServerMessageForwarding::send(deltasMessage);
|
||||
|
||||
ServerMessageForwarding::end();
|
||||
ProxyList syncServers;
|
||||
|
||||
for (auto i = proxyList.begin(); i!=proxyList.end(); ++i) {
|
||||
if (myProcessId != authProcessId) {
|
||||
if (*i != myProcessId) {
|
||||
syncServers.insert(*i);
|
||||
}
|
||||
} else {
|
||||
syncServers.insert(*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (myProcessId != authProcessId && syncServers.find(authProcessId) == syncServers.end())
|
||||
syncServers.insert(authProcessId);
|
||||
|
||||
ServerMessageForwarding::begin(std::vector<uint32>(syncServers.begin(), syncServers.end()));
|
||||
|
||||
SynchronizeScriptVarDeltasMessage const deltasMessage(object->getNetworkId(), data);
|
||||
ServerMessageForwarding::send(deltasMessage);
|
||||
|
||||
ServerMessageForwarding::end();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
res = JNI_TRUE;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
void JavaLibrary::unpackScriptVars(const ServerObject & target, const std::vector<int8> & buffer)
|
||||
|
||||
+11
-5
@@ -118,10 +118,13 @@ File fp;
|
||||
return;
|
||||
|
||||
File temp_fp;
|
||||
if (!temp_fp.open(tmpnam(nullptr), "wt"))
|
||||
char tmpname[] = "/tmp/templatecompXXXXXX";
|
||||
int tmpfd = mkstemp(tmpname);
|
||||
|
||||
if (tmpfd >= 0 && temp_fp.open(tmpname, "wt"))
|
||||
{
|
||||
fprintf(stderr, "error opening temp file for template header "
|
||||
"replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str());
|
||||
"replacement [%s]\n", fp.getFilename().getFullFilename().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -172,7 +175,7 @@ File fp;
|
||||
}
|
||||
else if (temp_fp.puts(buffer) < 0)
|
||||
{
|
||||
fprintf(stderr, "error writing to temp header file [%s]\n", temp_fp.getFilename().getFullFilename().c_str());
|
||||
fprintf(stderr, "error writing to temp header file [%s]\n", fp.getFilename().getFullFilename().c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -243,8 +246,11 @@ int result;
|
||||
return -1;
|
||||
}
|
||||
|
||||
File temp_fp;
|
||||
if (!temp_fp.open(tmpnam(nullptr), "wt"))
|
||||
File temp_fp;
|
||||
char tmpname[] = "/tmp/templatecompXXXXXX";
|
||||
int tmpfd = mkstemp(tmpname);
|
||||
|
||||
if (tmpfd >= 0 && temp_fp.open(tmpname, "wt"))
|
||||
{
|
||||
fprintf(stderr, "error opening temp file for template source "
|
||||
"replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str());
|
||||
|
||||
@@ -233,7 +233,7 @@ void terrainChangedCallback(Rectangle2d const & rect)
|
||||
|
||||
void CollisionWorldNamespace::defaultNearWarpWarning(Object const &object, Vector const &oldPosition_w, Vector const &newPosition_w, int segmentCount)
|
||||
{
|
||||
WARNING(ConfigSharedCollision::getReportWarnings(),
|
||||
DEBUG_WARNING(ConfigSharedCollision::getReportWarnings(),
|
||||
("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], object probably should have warped but collision system is not warping it.",
|
||||
segmentCount,
|
||||
object.getNetworkId().getValueString().c_str(),
|
||||
@@ -251,7 +251,7 @@ void CollisionWorldNamespace::defaultNearWarpWarning(Object const &object, Vecto
|
||||
|
||||
void CollisionWorldNamespace::defaultFarWarpWarning(Object const &object, Vector const &oldPosition_w, Vector const &newPosition_w, int segmentCount)
|
||||
{
|
||||
WARNING(ConfigSharedCollision::getReportWarnings(),
|
||||
DEBUG_WARNING(ConfigSharedCollision::getReportWarnings(),
|
||||
("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], collision system will consider this a warp and adjust accordingly.",
|
||||
segmentCount,
|
||||
object.getNetworkId().getValueString().c_str(),
|
||||
@@ -327,7 +327,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL
|
||||
if (!collisionObject)
|
||||
{
|
||||
// We had a collision on a floor, but the floor had a nullptr owner. Consider this a non-collision.
|
||||
WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a nullptr owner. Calling this a non-collision."));
|
||||
DEBUG_WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a nullptr owner. Calling this a non-collision."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2776,4 +2776,4 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object)
|
||||
return resultFloor;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wundefined-var-template"
|
||||
|
||||
#ifndef _INCLUDED_DataResourceList_H
|
||||
#define _INCLUDED_DataResourceList_H
|
||||
|
||||
@@ -419,5 +422,5 @@ void DataResourceList<T>::garbageCollect ()
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
#endif // _INCLUDED_DataResourceList_H
|
||||
|
||||
@@ -373,7 +373,7 @@ void TcpClient::queryConnect ()
|
||||
pfd.fd = m_socket;
|
||||
pfd.events = POLLOUT;
|
||||
pfd.revents = 0;
|
||||
int pollResult = poll(&pfd, 1, 3000);
|
||||
int pollResult = poll(&pfd, 1, 0);
|
||||
if(pollResult > 0)
|
||||
{
|
||||
if (pfd.revents & POLLERR)
|
||||
@@ -483,7 +483,7 @@ void TcpClient::update()
|
||||
pfd.fd = m_socket;
|
||||
pfd.events = POLLIN|POLLHUP;
|
||||
pfd.revents = 0;
|
||||
int pollResult = poll (&pfd, 1, 3000);
|
||||
int pollResult = poll (&pfd, 1, 0);
|
||||
// POLLERR is mutually exclusive with POLLIN and POLLHUP.
|
||||
// POLLIN and POLLHUP are not consistent cross-platform. Additionally,
|
||||
// a POLLHUP doesn't mean that there's not data available. The best,
|
||||
|
||||
Vendored
-4
@@ -3,8 +3,4 @@ add_subdirectory(platform)
|
||||
add_subdirectory(soePlatform)
|
||||
add_subdirectory(udplibrary)
|
||||
|
||||
if(${BUILD_MULODI_LIB})
|
||||
add_subdirectory(mulodi)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/webAPI)
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ template<uint32_t N>
|
||||
template<> struct vxCplIndexes<0> { typedef vxCplIndexList<> Result; };
|
||||
|
||||
// Compile-time string encryption of a single character
|
||||
const char vxCplEncryptCharKey = vxRANDOM(0, 0xFF);
|
||||
const int vxCplEncryptCharKey = vxRANDOM(0, 0xFF);
|
||||
|
||||
constexpr char vxCplEncryptChar(const char Ch, uint32_t Idx) { return Ch ^ (vxCplEncryptCharKey + Idx); }
|
||||
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(mulodi)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_library(mulodi
|
||||
mulodi4.c
|
||||
)
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
==============================================================================
|
||||
compiler_rt License
|
||||
==============================================================================
|
||||
|
||||
The compiler_rt library is dual licensed under both the University of Illinois
|
||||
"BSD-Like" license and the MIT license. As a user of this code you may choose
|
||||
to use it under either license. As a contributor, you agree to allow your code
|
||||
to be used under both.
|
||||
|
||||
Full text of the relevant licenses is included below.
|
||||
|
||||
==============================================================================
|
||||
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2009-2016 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
Copyrights and Licenses for Third Party Software Distributed with LLVM:
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
/* ===-- int_endianness.h - configuration header for compiler-rt ------------===
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is dual licensed under the MIT and the University of Illinois Open
|
||||
* Source Licenses. See LICENSE.TXT for details.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*
|
||||
* This file is a configuration header for compiler-rt.
|
||||
* This file is not part of the interface of this library.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef INT_ENDIANNESS_H
|
||||
#define INT_ENDIANNESS_H
|
||||
|
||||
#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
|
||||
defined(__ORDER_LITTLE_ENDIAN__)
|
||||
|
||||
/* Clang and GCC provide built-in endianness definitions. */
|
||||
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#define _YUGA_LITTLE_ENDIAN 0
|
||||
#define _YUGA_BIG_ENDIAN 1
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
#define _YUGA_LITTLE_ENDIAN 1
|
||||
#define _YUGA_BIG_ENDIAN 0
|
||||
#endif /* __BYTE_ORDER__ */
|
||||
|
||||
#else /* Compilers other than Clang or GCC. */
|
||||
|
||||
#if defined(__SVR4) && defined(__sun)
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
#if defined(_BIG_ENDIAN)
|
||||
#define _YUGA_LITTLE_ENDIAN 0
|
||||
#define _YUGA_BIG_ENDIAN 1
|
||||
#elif defined(_LITTLE_ENDIAN)
|
||||
#define _YUGA_LITTLE_ENDIAN 1
|
||||
#define _YUGA_BIG_ENDIAN 0
|
||||
#else /* !_LITTLE_ENDIAN */
|
||||
#error "unknown endianness"
|
||||
#endif /* !_LITTLE_ENDIAN */
|
||||
|
||||
#endif /* Solaris and AuroraUX. */
|
||||
|
||||
/* .. */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
|
||||
defined(__minix)
|
||||
#include <sys/endian.h>
|
||||
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
#define _YUGA_LITTLE_ENDIAN 0
|
||||
#define _YUGA_BIG_ENDIAN 1
|
||||
#elif _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#define _YUGA_LITTLE_ENDIAN 1
|
||||
#define _YUGA_BIG_ENDIAN 0
|
||||
#endif /* _BYTE_ORDER */
|
||||
|
||||
#endif /* *BSD */
|
||||
|
||||
#if defined(__OpenBSD__) || defined(__Bitrig__)
|
||||
#include <machine/endian.h>
|
||||
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
#define _YUGA_LITTLE_ENDIAN 0
|
||||
#define _YUGA_BIG_ENDIAN 1
|
||||
#elif _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#define _YUGA_LITTLE_ENDIAN 1
|
||||
#define _YUGA_BIG_ENDIAN 0
|
||||
#endif /* _BYTE_ORDER */
|
||||
|
||||
#endif /* OpenBSD and Bitrig. */
|
||||
|
||||
/* .. */
|
||||
|
||||
/* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the
|
||||
* compiler (at least with GCC) */
|
||||
#if defined(__APPLE__) || defined(__ellcc__ )
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#if __BIG_ENDIAN__
|
||||
#define _YUGA_LITTLE_ENDIAN 0
|
||||
#define _YUGA_BIG_ENDIAN 1
|
||||
#endif
|
||||
#endif /* __BIG_ENDIAN__ */
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#if __LITTLE_ENDIAN__
|
||||
#define _YUGA_LITTLE_ENDIAN 1
|
||||
#define _YUGA_BIG_ENDIAN 0
|
||||
#endif
|
||||
#endif /* __LITTLE_ENDIAN__ */
|
||||
|
||||
#endif /* Mac OSX */
|
||||
|
||||
/* .. */
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#define _YUGA_LITTLE_ENDIAN 1
|
||||
#define _YUGA_BIG_ENDIAN 0
|
||||
|
||||
#endif /* Windows */
|
||||
|
||||
#endif /* Clang or GCC. */
|
||||
|
||||
/* . */
|
||||
|
||||
#if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN)
|
||||
#error Unable to determine endian
|
||||
#endif /* Check we found an endianness correctly. */
|
||||
|
||||
#endif /* INT_ENDIANNESS_H */
|
||||
-129
@@ -1,129 +0,0 @@
|
||||
/* ===-- int_lib.h - configuration header for compiler-rt -----------------===
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is dual licensed under the MIT and the University of Illinois Open
|
||||
* Source Licenses. See LICENSE.TXT for details.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*
|
||||
* This file is a configuration header for compiler-rt.
|
||||
* This file is not part of the interface of this library.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef INT_LIB_H
|
||||
#define INT_LIB_H
|
||||
|
||||
/* Assumption: Signed integral is 2's complement. */
|
||||
/* Assumption: Right shift of signed negative is arithmetic shift. */
|
||||
/* Assumption: Endianness is little or big (not mixed). */
|
||||
|
||||
#if defined(__ELF__)
|
||||
#define FNALIAS(alias_name, original_name) \
|
||||
void alias_name() __attribute__((alias(#original_name)))
|
||||
#else
|
||||
#define FNALIAS(alias, name) _Pragma("GCC error(\"alias unsupported on this file format\")")
|
||||
#endif
|
||||
|
||||
/* ABI macro definitions */
|
||||
|
||||
#if __ARM_EABI__
|
||||
# define ARM_EABI_FNALIAS(aeabi_name, name) \
|
||||
void __aeabi_##aeabi_name() __attribute__((alias("__" #name)));
|
||||
# define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
|
||||
#else
|
||||
# define ARM_EABI_FNALIAS(aeabi_name, name)
|
||||
# define COMPILER_RT_ABI
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define ALWAYS_INLINE __forceinline
|
||||
#define NOINLINE __declspec(noinline)
|
||||
#define NORETURN __declspec(noreturn)
|
||||
#define UNUSED
|
||||
#else
|
||||
#define ALWAYS_INLINE __attribute__((always_inline))
|
||||
#define NOINLINE __attribute__((noinline))
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#define UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE))
|
||||
/*
|
||||
* Kernel and boot environment can't use normal headers,
|
||||
* so use the equivalent system headers.
|
||||
*/
|
||||
# include <machine/limits.h>
|
||||
# include <sys/stdint.h>
|
||||
# include <sys/types.h>
|
||||
#else
|
||||
/* Include the standard compiler builtin headers we use functionality from. */
|
||||
# include <limits.h>
|
||||
# include <stdint.h>
|
||||
# include <stdbool.h>
|
||||
# include <float.h>
|
||||
#endif
|
||||
|
||||
/* Include the commonly used internal type definitions. */
|
||||
#include "int_types.h"
|
||||
|
||||
/* Include internal utility function declarations. */
|
||||
#include "int_util.h"
|
||||
|
||||
COMPILER_RT_ABI si_int __paritysi2(si_int a);
|
||||
COMPILER_RT_ABI si_int __paritydi2(di_int a);
|
||||
|
||||
COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b);
|
||||
COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b);
|
||||
COMPILER_RT_ABI su_int __udivsi3(su_int n, su_int d);
|
||||
|
||||
COMPILER_RT_ABI su_int __udivmodsi4(su_int a, su_int b, su_int* rem);
|
||||
COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int* rem);
|
||||
#ifdef CRT_HAS_128BIT
|
||||
COMPILER_RT_ABI si_int __clzti2(ti_int a);
|
||||
COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
|
||||
#endif
|
||||
|
||||
/* Definitions for builtins unavailable on MSVC */
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#include <intrin.h>
|
||||
|
||||
uint32_t __inline __builtin_ctz(uint32_t value) {
|
||||
unsigned long trailing_zero = 0;
|
||||
if (_BitScanForward(&trailing_zero, value))
|
||||
return trailing_zero;
|
||||
return 32;
|
||||
}
|
||||
|
||||
uint32_t __inline __builtin_clz(uint32_t value) {
|
||||
unsigned long leading_zero = 0;
|
||||
if (_BitScanReverse(&leading_zero, value))
|
||||
return 31 - leading_zero;
|
||||
return 32;
|
||||
}
|
||||
|
||||
#if defined(_M_ARM) || defined(_M_X64)
|
||||
uint32_t __inline __builtin_clzll(uint64_t value) {
|
||||
unsigned long leading_zero = 0;
|
||||
if (_BitScanReverse64(&leading_zero, value))
|
||||
return 63 - leading_zero;
|
||||
return 64;
|
||||
}
|
||||
#else
|
||||
uint32_t __inline __builtin_clzll(uint64_t value) {
|
||||
if (value == 0)
|
||||
return 64;
|
||||
uint32_t msh = (uint32_t)(value >> 32);
|
||||
uint32_t lsh = (uint32_t)(value & 0xFFFFFFFF);
|
||||
if (msh != 0)
|
||||
return __builtin_clz(msh);
|
||||
return 32 + __builtin_clz(lsh);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define __builtin_clzl __builtin_clzll
|
||||
#endif /* defined(_MSC_VER) && !defined(__clang__) */
|
||||
|
||||
#endif /* INT_LIB_H */
|
||||
-114
@@ -1,114 +0,0 @@
|
||||
/* ===-- int_math.h - internal math inlines ---------------------------------===
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is dual licensed under the MIT and the University of Illinois Open
|
||||
* Source Licenses. See LICENSE.TXT for details.
|
||||
*
|
||||
* ===-----------------------------------------------------------------------===
|
||||
*
|
||||
* This file is not part of the interface of this library.
|
||||
*
|
||||
* This file defines substitutes for the libm functions used in some of the
|
||||
* compiler-rt implementations, defined in such a way that there is not a direct
|
||||
* dependency on libm or math.h. Instead, we use the compiler builtin versions
|
||||
* where available. This reduces our dependencies on the system SDK by foisting
|
||||
* the responsibility onto the compiler.
|
||||
*
|
||||
* ===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef INT_MATH_H
|
||||
#define INT_MATH_H
|
||||
|
||||
#ifndef __has_builtin
|
||||
# define __has_builtin(x) 0
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <ymath.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define CRT_INFINITY INFINITY
|
||||
#else
|
||||
#define CRT_INFINITY __builtin_huge_valf()
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define crt_isfinite(x) _finite((x))
|
||||
#define crt_isinf(x) !_finite((x))
|
||||
#define crt_isnan(x) _isnan((x))
|
||||
#else
|
||||
/* Define crt_isfinite in terms of the builtin if available, otherwise provide
|
||||
* an alternate version in terms of our other functions. This supports some
|
||||
* versions of GCC which didn't have __builtin_isfinite.
|
||||
*/
|
||||
#if __has_builtin(__builtin_isfinite)
|
||||
# define crt_isfinite(x) __builtin_isfinite((x))
|
||||
#elif defined(__GNUC__)
|
||||
# define crt_isfinite(x) \
|
||||
__extension__(({ \
|
||||
__typeof((x)) x_ = (x); \
|
||||
!crt_isinf(x_) && !crt_isnan(x_); \
|
||||
}))
|
||||
#else
|
||||
# error "Do not know how to check for infinity"
|
||||
#endif /* __has_builtin(__builtin_isfinite) */
|
||||
#define crt_isinf(x) __builtin_isinf((x))
|
||||
#define crt_isnan(x) __builtin_isnan((x))
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define crt_copysign(x, y) copysign((x), (y))
|
||||
#define crt_copysignf(x, y) copysignf((x), (y))
|
||||
#define crt_copysignl(x, y) copysignl((x), (y))
|
||||
#else
|
||||
#define crt_copysign(x, y) __builtin_copysign((x), (y))
|
||||
#define crt_copysignf(x, y) __builtin_copysignf((x), (y))
|
||||
#define crt_copysignl(x, y) __builtin_copysignl((x), (y))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define crt_fabs(x) fabs((x))
|
||||
#define crt_fabsf(x) fabsf((x))
|
||||
#define crt_fabsl(x) fabs((x))
|
||||
#else
|
||||
#define crt_fabs(x) __builtin_fabs((x))
|
||||
#define crt_fabsf(x) __builtin_fabsf((x))
|
||||
#define crt_fabsl(x) __builtin_fabsl((x))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define crt_fmax(x, y) __max((x), (y))
|
||||
#define crt_fmaxf(x, y) __max((x), (y))
|
||||
#define crt_fmaxl(x, y) __max((x), (y))
|
||||
#else
|
||||
#define crt_fmax(x, y) __builtin_fmax((x), (y))
|
||||
#define crt_fmaxf(x, y) __builtin_fmaxf((x), (y))
|
||||
#define crt_fmaxl(x, y) __builtin_fmaxl((x), (y))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define crt_logb(x) logb((x))
|
||||
#define crt_logbf(x) logbf((x))
|
||||
#define crt_logbl(x) logbl((x))
|
||||
#else
|
||||
#define crt_logb(x) __builtin_logb((x))
|
||||
#define crt_logbf(x) __builtin_logbf((x))
|
||||
#define crt_logbl(x) __builtin_logbl((x))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define crt_scalbn(x, y) scalbn((x), (y))
|
||||
#define crt_scalbnf(x, y) scalbnf((x), (y))
|
||||
#define crt_scalbnl(x, y) scalbnl((x), (y))
|
||||
#else
|
||||
#define crt_scalbn(x, y) __builtin_scalbn((x), (y))
|
||||
#define crt_scalbnf(x, y) __builtin_scalbnf((x), (y))
|
||||
#define crt_scalbnl(x, y) __builtin_scalbnl((x), (y))
|
||||
#endif
|
||||
|
||||
#endif /* INT_MATH_H */
|
||||
-166
@@ -1,166 +0,0 @@
|
||||
/* ===-- int_lib.h - configuration header for compiler-rt -----------------===
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is dual licensed under the MIT and the University of Illinois Open
|
||||
* Source Licenses. See LICENSE.TXT for details.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*
|
||||
* This file is not part of the interface of this library.
|
||||
*
|
||||
* This file defines various standard types, most importantly a number of unions
|
||||
* used to access parts of larger types.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef INT_TYPES_H
|
||||
#define INT_TYPES_H
|
||||
|
||||
#include "int_endianness.h"
|
||||
|
||||
/* si_int is defined in Linux sysroot's asm-generic/siginfo.h */
|
||||
#ifdef si_int
|
||||
#undef si_int
|
||||
#endif
|
||||
typedef int si_int;
|
||||
typedef unsigned su_int;
|
||||
|
||||
typedef long long di_int;
|
||||
typedef unsigned long long du_int;
|
||||
|
||||
typedef union
|
||||
{
|
||||
di_int all;
|
||||
struct
|
||||
{
|
||||
#if _YUGA_LITTLE_ENDIAN
|
||||
su_int low;
|
||||
si_int high;
|
||||
#else
|
||||
si_int high;
|
||||
su_int low;
|
||||
#endif /* _YUGA_LITTLE_ENDIAN */
|
||||
}s;
|
||||
} dwords;
|
||||
|
||||
typedef union
|
||||
{
|
||||
du_int all;
|
||||
struct
|
||||
{
|
||||
#if _YUGA_LITTLE_ENDIAN
|
||||
su_int low;
|
||||
su_int high;
|
||||
#else
|
||||
su_int high;
|
||||
su_int low;
|
||||
#endif /* _YUGA_LITTLE_ENDIAN */
|
||||
}s;
|
||||
} udwords;
|
||||
|
||||
/* MIPS64 issue: PR 20098 */
|
||||
#if (defined(__LP64__) || defined(__wasm__)) && \
|
||||
!(defined(__mips__) && defined(__clang__))
|
||||
#define CRT_HAS_128BIT
|
||||
#endif
|
||||
|
||||
#ifdef CRT_HAS_128BIT
|
||||
typedef int ti_int __attribute__ ((mode (TI)));
|
||||
typedef unsigned tu_int __attribute__ ((mode (TI)));
|
||||
|
||||
typedef union
|
||||
{
|
||||
ti_int all;
|
||||
struct
|
||||
{
|
||||
#if _YUGA_LITTLE_ENDIAN
|
||||
du_int low;
|
||||
di_int high;
|
||||
#else
|
||||
di_int high;
|
||||
du_int low;
|
||||
#endif /* _YUGA_LITTLE_ENDIAN */
|
||||
}s;
|
||||
} twords;
|
||||
|
||||
typedef union
|
||||
{
|
||||
tu_int all;
|
||||
struct
|
||||
{
|
||||
#if _YUGA_LITTLE_ENDIAN
|
||||
du_int low;
|
||||
du_int high;
|
||||
#else
|
||||
du_int high;
|
||||
du_int low;
|
||||
#endif /* _YUGA_LITTLE_ENDIAN */
|
||||
}s;
|
||||
} utwords;
|
||||
|
||||
static __inline ti_int make_ti(di_int h, di_int l) {
|
||||
twords r;
|
||||
r.s.high = h;
|
||||
r.s.low = l;
|
||||
return r.all;
|
||||
}
|
||||
|
||||
static __inline tu_int make_tu(du_int h, du_int l) {
|
||||
utwords r;
|
||||
r.s.high = h;
|
||||
r.s.low = l;
|
||||
return r.all;
|
||||
}
|
||||
|
||||
#endif /* CRT_HAS_128BIT */
|
||||
|
||||
typedef union
|
||||
{
|
||||
su_int u;
|
||||
float f;
|
||||
} float_bits;
|
||||
|
||||
typedef union
|
||||
{
|
||||
udwords u;
|
||||
double f;
|
||||
} double_bits;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#if _YUGA_LITTLE_ENDIAN
|
||||
udwords low;
|
||||
udwords high;
|
||||
#else
|
||||
udwords high;
|
||||
udwords low;
|
||||
#endif /* _YUGA_LITTLE_ENDIAN */
|
||||
} uqwords;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uqwords u;
|
||||
long double f;
|
||||
} long_double_bits;
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
typedef float _Complex Fcomplex;
|
||||
typedef double _Complex Dcomplex;
|
||||
typedef long double _Complex Lcomplex;
|
||||
|
||||
#define COMPLEX_REAL(x) __real__(x)
|
||||
#define COMPLEX_IMAGINARY(x) __imag__(x)
|
||||
#else
|
||||
typedef struct { float real, imaginary; } Fcomplex;
|
||||
|
||||
typedef struct { double real, imaginary; } Dcomplex;
|
||||
|
||||
typedef struct { long double real, imaginary; } Lcomplex;
|
||||
|
||||
#define COMPLEX_REAL(x) (x).real
|
||||
#define COMPLEX_IMAGINARY(x) (x).imaginary
|
||||
#endif
|
||||
#endif /* INT_TYPES_H */
|
||||
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
/* ===-- int_util.c - Implement internal utilities --------------------------===
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is dual licensed under the MIT and the University of Illinois Open
|
||||
* Source Licenses. See LICENSE.TXT for details.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#include "int_lib.h"
|
||||
#include "int_util.h"
|
||||
|
||||
/* NOTE: The definitions in this file are declared weak because we clients to be
|
||||
* able to arbitrarily package individual functions into separate .a files. If
|
||||
* we did not declare these weak, some link situations might end up seeing
|
||||
* duplicate strong definitions of the same symbol.
|
||||
*
|
||||
* We can't use this solution for kernel use (which may not support weak), but
|
||||
* currently expect that when built for kernel use all the functionality is
|
||||
* packaged into a single library.
|
||||
*/
|
||||
|
||||
#ifdef KERNEL_USE
|
||||
|
||||
NORETURN extern void panic(const char *, ...);
|
||||
#ifndef _WIN32
|
||||
__attribute__((visibility("hidden")))
|
||||
#endif
|
||||
void compilerrt_abort_impl(const char *file, int line, const char *function) {
|
||||
panic("%s:%d: abort in %s", file, line, function);
|
||||
}
|
||||
|
||||
#elif __APPLE__
|
||||
|
||||
/* from libSystem.dylib */
|
||||
NORETURN extern void __assert_rtn(const char *func, const char *file, int line,
|
||||
const char *message);
|
||||
|
||||
#ifndef _WIN32
|
||||
__attribute__((weak))
|
||||
__attribute__((visibility("hidden")))
|
||||
#endif
|
||||
void compilerrt_abort_impl(const char *file, int line, const char *function) {
|
||||
__assert_rtn(function, file, line, "libcompiler_rt abort");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Get the system definition of abort() */
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
__attribute__((weak))
|
||||
__attribute__((visibility("hidden")))
|
||||
#endif
|
||||
void compilerrt_abort_impl(const char *file, int line, const char *function) {
|
||||
abort();
|
||||
}
|
||||
|
||||
#endif
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
/* ===-- int_util.h - internal utility functions ----------------------------===
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is dual licensed under the MIT and the University of Illinois Open
|
||||
* Source Licenses. See LICENSE.TXT for details.
|
||||
*
|
||||
* ===-----------------------------------------------------------------------===
|
||||
*
|
||||
* This file is not part of the interface of this library.
|
||||
*
|
||||
* This file defines non-inline utilities which are available for use in the
|
||||
* library. The function definitions themselves are all contained in int_util.c
|
||||
* which will always be compiled into any compiler-rt library.
|
||||
*
|
||||
* ===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef INT_UTIL_H
|
||||
#define INT_UTIL_H
|
||||
|
||||
/** \brief Trigger a program abort (or panic for kernel code). */
|
||||
#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, __func__)
|
||||
|
||||
NORETURN void compilerrt_abort_impl(const char *file, int line,
|
||||
const char *function);
|
||||
|
||||
#define COMPILE_TIME_ASSERT(expr) COMPILE_TIME_ASSERT1(expr, __COUNTER__)
|
||||
#define COMPILE_TIME_ASSERT1(expr, cnt) COMPILE_TIME_ASSERT2(expr, cnt)
|
||||
#define COMPILE_TIME_ASSERT2(expr, cnt) \
|
||||
typedef char ct_assert_##cnt[(expr) ? 1 : -1] UNUSED
|
||||
|
||||
#endif /* INT_UTIL_H */
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
/*===-- mulodi4.c - Implement __mulodi4 -----------------------------------===
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is dual licensed under the MIT and the University of Illinois Open
|
||||
* Source Licenses. See LICENSE.TXT for details.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*
|
||||
* This file implements __mulodi4 for the compiler_rt library.
|
||||
*
|
||||
* ===----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#include "int_lib.h"
|
||||
|
||||
/* Returns: a * b */
|
||||
|
||||
/* Effects: sets *overflow to 1 if a * b overflows */
|
||||
|
||||
COMPILER_RT_ABI di_int
|
||||
__mulodi4(di_int a, di_int b, int* overflow)
|
||||
{
|
||||
const int N = (int)(sizeof(di_int) * CHAR_BIT);
|
||||
const di_int MIN = (di_int)1 << (N-1);
|
||||
const di_int MAX = ~MIN;
|
||||
*overflow = 0;
|
||||
di_int result = a * b;
|
||||
if (a == MIN)
|
||||
{
|
||||
if (b != 0 && b != 1)
|
||||
*overflow = 1;
|
||||
return result;
|
||||
}
|
||||
if (b == MIN)
|
||||
{
|
||||
if (a != 0 && a != 1)
|
||||
*overflow = 1;
|
||||
return result;
|
||||
}
|
||||
di_int sa = a >> (N - 1);
|
||||
di_int abs_a = (a ^ sa) - sa;
|
||||
di_int sb = b >> (N - 1);
|
||||
di_int abs_b = (b ^ sb) - sb;
|
||||
if (abs_a < 2 || abs_b < 2)
|
||||
return result;
|
||||
if (sa == sb)
|
||||
{
|
||||
if (abs_a > MAX / abs_b)
|
||||
*overflow = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs_a > MIN / -abs_b)
|
||||
*overflow = 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -29,7 +29,6 @@ namespace Base
|
||||
#endif
|
||||
|
||||
#if defined (PASCAL_STRING)
|
||||
#pragma message ("--- Packing pascal style strings ---")
|
||||
void get(Base::ByteStream::ReadIterator& source, std::string& target)
|
||||
{
|
||||
unsigned int size = 0;
|
||||
@@ -51,7 +50,6 @@ namespace Base
|
||||
}
|
||||
|
||||
#else
|
||||
#pragma message ("--- Packing c style strings ---")
|
||||
void get(ByteStream::ReadIterator & source, std::string & target)
|
||||
{
|
||||
target = reinterpret_cast<const char *>(source.getBuffer());
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace Base
|
||||
bool ByteStream::ms_reuseData = true;
|
||||
|
||||
#if defined (PASCAL_STRING)
|
||||
#pragma message ("--- Packing pascal style strings ---")
|
||||
void get(Base::ByteStream::ReadIterator& source, std::string& target)
|
||||
{
|
||||
unsigned int size = 0;
|
||||
@@ -54,7 +53,6 @@ namespace Base
|
||||
}
|
||||
|
||||
#else
|
||||
#pragma message ("--- Packing c style strings ---")
|
||||
void get(ByteStream::ReadIterator & source, std::string & target)
|
||||
{
|
||||
target = reinterpret_cast<const char *>(source.getBuffer());
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace Base
|
||||
#endif
|
||||
|
||||
#if defined (PASCAL_STRING)
|
||||
#pragma message ("--- Packing pascal style strings ---")
|
||||
void get(Base::ByteStream::ReadIterator& source, std::string& target)
|
||||
{
|
||||
unsigned int size = 0;
|
||||
@@ -51,7 +50,6 @@ namespace Base
|
||||
}
|
||||
|
||||
#else
|
||||
#pragma message ("--- Packing c style strings ---")
|
||||
void get(ByteStream::ReadIterator & source, std::string & target)
|
||||
{
|
||||
target = reinterpret_cast<const char *>(source.getBuffer());
|
||||
|
||||
+126
-126
@@ -759,398 +759,398 @@ bool ChatAPI::isUID(const ChatUnicodeString &uidNode)
|
||||
|
||||
void ChatAPI::OnConnect()
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnConnect\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnConnect\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnDisconnect()
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnDisconnect\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnDisconnect\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnFailoverBegin()
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFailoverBegin\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFailoverBegin\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnFailoverComplete()
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFailoverComplete\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFailoverComplete\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnLoginAvatar(unsigned track, unsigned result, const ChatAvatar *newAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnLoginAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnLoginAvatar\n");
|
||||
}
|
||||
void ChatAPI::OnLoginAvatar(unsigned track, unsigned result, const ChatAvatar *newAvatar, int requiredLoginPriority, void *user)
|
||||
{
|
||||
// fprintf(stderr, "[ChatAPI.cpp] default OnLoginAvatar(with loginPriority) \n");
|
||||
// //fprintf(stderr, "[ChatAPI.cpp] default OnLoginAvatar(with loginPriority) \n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnTemporaryAvatar(unsigned track, unsigned result, const ChatAvatar *newAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnTemporaryAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnTemporaryAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnLogoutAvatar(unsigned track, unsigned result, const ChatAvatar *oldAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnLogoutAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnLogoutAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnDestroyAvatar(unsigned track, unsigned result, const ChatAvatar *oldAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnDestroyAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnDestroyAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetAvatar(unsigned track, unsigned result, const ChatAvatar *foundAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetAnyAvatar(unsigned track, unsigned result, const ChatAvatar *foundAvatar, bool loggedIn, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetAnyAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetAnyAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAvatarList(unsigned track, unsigned result, unsigned listLength, const AvatarListItem* avatarList, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAvatarList\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAvatarList\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSetAvatarAttributes(unsigned track, unsigned result, const ChatAvatar *changedAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarAttributes\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarAttributes\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSetAvatarStatusMessage(unsigned track, unsigned result, const ChatAvatar *changedAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarStatusMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarStatusMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSetAvatarForwardingEmail(unsigned track, unsigned result, const ChatAvatar *changedAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarForwardingEmail\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarForwardingEmail\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSetAvatarInboxLimit(unsigned track, unsigned result, const ChatAvatar *changedAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarInboxLimit\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarInboxLimit\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnTransferAvatar(unsigned track, unsigned result, unsigned oldUserID, unsigned newUserID, const ChatUnicodeString &oldName, const ChatUnicodeString &newName, const ChatUnicodeString &oldAddress, const ChatUnicodeString &newAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnTransferAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnTransferAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnFanClubHandle(unsigned track, unsigned result, const ChatUnicodeString &handle, unsigned stationID, unsigned fanClubCode, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFanClubHandle\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFanClubHandle\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnCreateRoom(unsigned track, unsigned result, const ChatRoom *newRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnCreateRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnCreateRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnDestroyRoom(unsigned track, unsigned result, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnDestroyRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnDestroyRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetRoom(unsigned track, unsigned result, const ChatRoom *room, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetRoomSummaries(unsigned track, unsigned result, unsigned numFoundRooms, RoomSummary *foundRooms, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetRoomSummaries\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetRoomSummaries\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSendInstantMessage(unsigned track, unsigned result, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSendInstantMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSendInstantMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSendRoomMessage(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSendRoomMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSendRoomMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSendBroadcastMessage(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &address, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSendBroadcastMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSendBroadcastMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnFilterMessage(unsigned track, unsigned result, const ChatUnicodeString &filteredMsg, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFilterMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFilterMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnFilterMessageEx(unsigned track, unsigned result, const ChatUnicodeString &filteredMsg, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFilterMessageEx\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFilterMessageEx\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAddFriend(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAddFriend\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAddFriend\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAddFriendReciprocate(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAddFriendReciprocate\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAddFriendReciprocate\n");
|
||||
}
|
||||
|
||||
|
||||
void ChatAPI::OnSetFriendComment(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &friendComment, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSetFriendComment\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSetFriendComment\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnRemoveFriend(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnRemoveFriend\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnRemoveFriend\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnRemoveFriendReciprocate(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnRemoveFriendReciprocate\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnRemoveFriendReciprocate\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnFriendStatus(unsigned track, unsigned result, const ChatAvatar *srcAvatar, unsigned listLength, const ChatFriendStatus *friendList, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFriendStatus\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFriendStatus\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAddIgnore(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAddIgnore\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAddIgnore\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnRemoveIgnore(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnRemoveIgnore\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnRemoveIgnore\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnIgnoreStatus(unsigned track, unsigned result, const ChatAvatar *srcAvatar, unsigned listLength, const ChatIgnoreStatus *ignoreList, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnIgnoreStatus\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnIgnoreStatus\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnEnterRoom(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnEnterRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnEnterRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAllowRoomEntry(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &roomAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAllowRoomEntry\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAllowRoomEntry\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnLeaveRoom(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnLeaveRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnLeaveRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveDestroyRoom(const ChatAvatar *srcAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveDestroyRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveDestroyRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAddModerator(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAddModerator\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAddModerator\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnRemoveModerator(unsigned track,unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnRemoveModerator\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnRemoveModerator\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAddTemporaryModerator(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAddTemporaryModerator\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAddTemporaryModerator\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnRemoveTemporaryModerator(unsigned track,unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnRemoveTemporaryModerator\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnRemoveTemporaryModerator\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAddBan(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAddBan\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAddBan\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnRemoveBan(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnRemoveBan\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnRemoveBan\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAddInvite(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAddInvite\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAddInvite\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnRemoveInvite(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnRemoveInvite\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnRemoveInvite\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGrantVoice(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGrantVoice\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGrantVoice\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnRevokeVoice(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnRevokeVoice\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnRevokeVoice\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnKickAvatar(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnKickAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnKickAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSetRoomParams(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSetRoomParams\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSetRoomParams\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnChangeRoomOwner(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnChangeRoomOwner\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnChangeRoomOwner\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSendPersistentMessage(unsigned track, unsigned result, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSendPersistentMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSendPersistentMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSendPersistentMessage(unsigned track, unsigned result, const ChatAvatar *srcAvatar, unsigned messageID, void *user)
|
||||
{
|
||||
// fprintf(stderr, "[ChatAPI.cpp] default OnSendPersistentMessage (with message ID) \n");
|
||||
// //fprintf(stderr, "[ChatAPI.cpp] default OnSendPersistentMessage (with message ID) \n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSendMultiplePersistentMessages(unsigned track, unsigned result, unsigned numSubResults, const unsigned *subResults, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSendMultiplePersistentMessages\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSendMultiplePersistentMessages\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSendMultiplePersistentMessages(unsigned track, unsigned result, unsigned numSubResults, const unsigned *subResults, const unsigned *messageIDs, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
// fprintf(stderr, "[ChatAPI.cpp] default OnSendMultiplePersistentMessages (with message IDs)\n");
|
||||
// //fprintf(stderr, "[ChatAPI.cpp] default OnSendMultiplePersistentMessages (with message IDs)\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnAlterPersistentMessage(unsigned track, unsigned result, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, unsigned messageID)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnAlterPersistentMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnAlterPersistentMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetPersistentHeaders(unsigned track, unsigned result, ChatAvatar *destAvatar, unsigned listLength, const PersistentHeader *list, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetPersistentHeaders\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetPersistentHeaders\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetPartialPersistentHeaders(unsigned track, unsigned result, ChatAvatar *destAvatar, unsigned listLength, const PersistentHeader *list, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetPartialPersistentHeaders\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetPartialPersistentHeaders\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnCountPersistentMessages(unsigned track, unsigned result, const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress, unsigned numberOfMessages, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnCountPersistentMessages\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnCountPersistentMessages\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetPersistentMessage(unsigned track, unsigned result, ChatAvatar *destAvatar, const PersistentHeader *header, const ChatUnicodeString &msg, const ChatUnicodeString &oob, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetPersistentMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetPersistentMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetMultiplePersistentMessages(unsigned track, unsigned result, ChatAvatar *destAvatar, unsigned listLength, PersistentMessage ** const list, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetMultiplePersistentMessages\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetMultiplePersistentMessages\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnUpdatePersistentMessage(unsigned track, unsigned result, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnUpdatePersistentMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnUpdatePersistentMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnUpdatePersistentMessages(unsigned track, unsigned result, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnUpdatePersistentMessages\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnUpdatePersistentMessages\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnClassifyPersistentMessages(unsigned track, unsigned result, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnClassifyPersistentMessages\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnClassifyPersistentMessages\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnDeleteAllPersistentMessages(unsigned track, unsigned result, const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress, unsigned numberDeleted, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnDeleteAllPersistentMessages\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnDeleteAllPersistentMessages\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnUnregisterRoom(unsigned track, unsigned result, const ChatRoom *destRoom, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnUnregisterRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnUnregisterRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSetAvatarKeywords(unsigned track, unsigned result, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarKeywords\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSetAvatarKeywords\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetAvatarKeywords(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString *keywordList, unsigned listLength, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetAvatarKeywords\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetAvatarKeywords\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnSearchAvatarKeywords(unsigned track, unsigned result, ChatAvatar **avatarMatches, unsigned numMatches, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnSearchAvatarKeywords\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnSearchAvatarKeywords\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnFriendConfirm(unsigned track, unsigned result, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFriendConfirm\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFriendConfirm\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnFriendConfirmReciprocate(unsigned track, unsigned result, const ChatAvatar *srcAvatar, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFriendConfirmReciprocate\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFriendConfirmReciprocate\n");
|
||||
}
|
||||
|
||||
|
||||
void ChatAPI::OnFindAvatarByUID(unsigned track, unsigned result, unsigned numFoundAvatarsOnline, ChatAvatar **foundAvatars, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnFindAvatarByUID\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnFindAvatarByUID\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnBeginSnoopingAvatar(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnBeginSnoopingAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnBeginSnoopingAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnStopSnoopingAvatar(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnStopSnoopingAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnStopSnoopingAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnBeginSnoopingRoom(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &roomAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnBeginSnoopingRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnBeginSnoopingRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnStopSnoopingRoom(unsigned track, unsigned result, const ChatAvatar *srcAvatar, const ChatUnicodeString &roomAddress, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnStopSnoopingRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnStopSnoopingRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnGetSnoopList(unsigned track, unsigned result, const ChatAvatar *srcAvatar, unsigned avatarSnoopListLength, AvatarSnoopPair **avatarSnoops, unsigned roomSnoopListLength, ChatUnicodeString **roomSnoops, void *user)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnGetSnoopList\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnGetSnoopList\n");
|
||||
}
|
||||
|
||||
ChatUnicodeString ChatAPI::getErrorString(unsigned resultCode)
|
||||
@@ -1160,222 +1160,222 @@ ChatUnicodeString ChatAPI::getErrorString(unsigned resultCode)
|
||||
|
||||
void ChatAPI::OnReceiveInstantMessage(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &msg, const ChatUnicodeString &oob)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveInstantMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveInstantMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRoomMessage(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom, const ChatUnicodeString &msg, const ChatUnicodeString &oob)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRoomMessage(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom, const ChatUnicodeString &msg, const ChatUnicodeString &oob, unsigned messageID)
|
||||
{
|
||||
// fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomMessage (with message ID)\n");
|
||||
// //fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomMessage (with message ID)\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveBroadcastMessage(const ChatAvatar *srcAvatar, const ChatUnicodeString &srcAddress, const ChatAvatar *destAvatar, const ChatUnicodeString &msg, const ChatUnicodeString &oob)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveBroadcastMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveBroadcastMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveFilterMessage(const ChatUnicodeString &msg)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFilterMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFilterMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveFriendLogin(const ChatAvatar *srcAvatar, const ChatUnicodeString &srcAddress, const ChatAvatar *destAvatar)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendLogin\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendLogin\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveFriendLogout(const ChatAvatar *srcAvatar, const ChatUnicodeString &srcAddress, const ChatAvatar *destAvatar)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendLogout\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendLogout\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveFriendStatusChange(const ChatAvatar *srcAvatar, const ChatUnicodeString &srcAddress, const ChatAvatar *destAvatar)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendStatusChange\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendStatusChange\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveKickRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveKickRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveKickRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveKickAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveKickAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveKickAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRoomEntryRequest(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &destRoomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomEntryRequest\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomEntryRequest\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveDelayedRoomEntry(const ChatAvatar *srcAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveDelayedRoomEntry\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveDelayedRoomEntry\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveDeniedRoomEntry(const ChatAvatar *srcAvatar, const ChatUnicodeString &destRoomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveDeniedRoomEntry\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveDeniedRoomEntry\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveEnterRoom(const ChatAvatar *srcAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveEnterRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveEnterRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveLeaveRoom(const ChatAvatar *srcAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveLeaveRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveLeaveRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveAddModeratorRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddModeratorRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddModeratorRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveAddModeratorAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddModeratorAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddModeratorAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRemoveModeratorRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveModeratorRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveModeratorRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRemoveModeratorAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveModeratorAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveModeratorAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveAddTemporaryModeratorRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddTemporaryModeratorRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddTemporaryModeratorRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveAddTemporaryModeratorAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddTemporaryModeratorAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddTemporaryModeratorAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRemoveTemporaryModeratorRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveTemporaryModeratorRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveTemporaryModeratorRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRemoveTemporaryModeratorAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveTemporaryModeratorAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveTemporaryModeratorAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveAddBanRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddBanRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddBanRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveAddBanAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddBanAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddBanAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRemoveBanRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveBanRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveBanRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRemoveBanAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveBanAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveBanAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveAddInviteRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddInviteRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddInviteRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveAddInviteAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddInviteAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveAddInviteAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRemoveInviteRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveInviteRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveInviteRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRemoveInviteAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveInviteAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRemoveInviteAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveGrantVoiceRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveGrantVoiceRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveGrantVoiceRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveGrantVoiceAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveGrantVoiceAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveGrantVoiceAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRevokeVoiceRoom(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRevokeVoiceRoom\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRevokeVoiceRoom\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRevokeVoiceAvatar(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar, const ChatUnicodeString &roomName, const ChatUnicodeString &roomAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRevokeVoiceAvatar\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRevokeVoiceAvatar\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRoomParams(const ChatAvatar *srcAvatar, const ChatRoom *destRoom, const RoomParams *params, const RoomParams *oldParams)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomParams\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomParams\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceivePersistentMessage(const ChatAvatar *destAvatar, const PersistentHeader *header)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceivePersistentMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceivePersistentMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveForcedLogout(const ChatAvatar *oldAvatar)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveForcedLogout\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveForcedLogout\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveUnregisterRoomReady(const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveUnregisterRoomReady\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveUnregisterRoomReady\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveFriendConfirmRequest(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendConfirmRequest\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendConfirmRequest\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveFriendConfirmResponse(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar ,bool confirmed)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendConfirmResponse\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendConfirmResponse\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveFriendConfirmReciprocateRequest(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendConfirmReciprocateRequest\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendConfirmReciprocateRequest\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveFriendConfirmReciprocateResponse(const ChatAvatar *srcAvatar, const ChatAvatar *destAvatar ,bool confirmed)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendConfirmReciprocateResponse\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveFriendConfirmReciprocateResponse\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveRoomOwnerChange(const ChatRoom *destRoom)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomOwnerChange\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveRoomOwnerChange\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveSnoopMessage(unsigned snoopType,
|
||||
@@ -1387,12 +1387,12 @@ void ChatAPI::OnReceiveSnoopMessage(unsigned snoopType,
|
||||
const ChatUnicodeString &destAddress, // dest avatar or room address
|
||||
const ChatUnicodeString &message)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveSnoopMessage\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveSnoopMessage\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveNotifyFriendIsRemoved(ChatAvatar * avatar, const ChatUnicodeString &friendName, const ChatUnicodeString &friendAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveNotifyFriendIsRemoved\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveNotifyFriendIsRemoved\n");
|
||||
}
|
||||
|
||||
void ChatAPI::OnReceiveNotifyFriendsListChange(ChatAvatar * avatar,
|
||||
@@ -1401,7 +1401,7 @@ void ChatAPI::OnReceiveNotifyFriendsListChange(ChatAvatar * avatar,
|
||||
const ChatUnicodeString &newName,
|
||||
const ChatUnicodeString &newAddress)
|
||||
{
|
||||
fprintf(stderr, "[ChatAPI.cpp] default OnReceiveNotifyFriendsListChange\n");
|
||||
//fprintf(stderr, "[ChatAPI.cpp] default OnReceiveNotifyFriendsListChange\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace Base
|
||||
bool ByteStream::ms_reuseData = true;
|
||||
|
||||
#if defined (PASCAL_STRING)
|
||||
#pragma message ("--- Packing pascal style strings ---")
|
||||
unsigned get(Base::ByteStream::ReadIterator& source, std::string& target)
|
||||
{
|
||||
unsigned int size = 0;
|
||||
@@ -61,7 +60,6 @@ namespace Base
|
||||
}
|
||||
|
||||
#else
|
||||
#pragma message ("--- Packing c style strings ---")
|
||||
unsigned get(ByteStream::ReadIterator & source, std::string & target)
|
||||
{
|
||||
target = reinterpret_cast<const char *>(source.getBuffer());
|
||||
|
||||
-77
@@ -157,13 +157,6 @@ char *UdpIpAddress::GetAddress(char *buffer) const
|
||||
return(buffer);
|
||||
}
|
||||
|
||||
char *UdpIpAddress::GetV4Address() const
|
||||
{
|
||||
struct sockaddr_in addr_serverUDP;
|
||||
addr_serverUDP.sin_addr.s_addr = mIp;
|
||||
return inet_ntoa(addr_serverUDP.sin_addr);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UdpManager::Params initializations constructor (ie. default values)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -822,12 +815,6 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive()
|
||||
|
||||
if (res != SOCKET_ERROR)
|
||||
{
|
||||
// no need in creating objects or processing anything if they are a DoS Attacker!
|
||||
if (isBlacklisted(addr_from.sin_addr.s_addr))
|
||||
{
|
||||
return nullptr; // send them to the black hole
|
||||
}
|
||||
|
||||
if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent))
|
||||
return(nullptr); // packet, what packet?
|
||||
|
||||
@@ -1032,14 +1019,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e)
|
||||
// connection establish packet must always be at least 6 bytes long as we must have a version number, no matter how it changes
|
||||
if (e->mBuffer[0] == 0 && e->mBuffer[1] == UdpConnection::cUdpPacketConnect && e->mLen == UdpConnection::cUdpPacketConnectSize)
|
||||
{
|
||||
if (mParams.maxConnectionsPerIP > 0 && (mIpConnectionCount[e->mIp.GetAddress()] >= mParams.maxConnectionsPerIP))
|
||||
{
|
||||
// add a strike if they're over the count
|
||||
addStrike(e->mIp, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (mConnectionListCount >= mParams.maxConnections)
|
||||
{
|
||||
return; // can't handle any more connections, so ignore this request entirely
|
||||
@@ -1096,7 +1075,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// got a packet from somebody and we don't know who they are and the packet we got was not a connection request
|
||||
// just in case they are a previous client who thinks they are still connected, we will send them an internal
|
||||
// packet telling them that we don't know who they are
|
||||
@@ -1114,9 +1092,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e)
|
||||
buf[1] = UdpConnection::cUdpPacketUnreachableConnection;
|
||||
ActualSend(buf, 2, e->mIp, e->mPort);
|
||||
}
|
||||
|
||||
// add a strike in case they're DoSsing junk data
|
||||
addStrike(e->mIp, 2); //TODO: maybe expire the type 2 blacklist, if any, every 5-15 minutes?
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1127,58 +1102,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e)
|
||||
con->Release();
|
||||
}
|
||||
|
||||
bool UdpManager::isBlacklisted(unsigned int clientAddr)
|
||||
{
|
||||
return (blacklist[clientAddr] == strikeOut);
|
||||
}
|
||||
|
||||
void UdpManager::disconnectByIp(unsigned int clientAddr)
|
||||
{
|
||||
while (mConnectionList != nullptr)
|
||||
{
|
||||
if (mConnectionList->mIp.GetAddress() == clientAddr)
|
||||
{
|
||||
mConnectionList->SetSilentDisconnect(true);
|
||||
mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonDosAttack);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UdpManager::addStrike(UdpIpAddress clientIp, int type)
|
||||
{
|
||||
unsigned int clientAddr = clientIp.GetAddress();
|
||||
|
||||
// add a strike - if they hit strikeOut then they're banned til next restart
|
||||
blacklist[clientAddr]++;
|
||||
|
||||
// log it - later parse this, cross reference, and block in iptables
|
||||
extern const char *__progname;
|
||||
const std::string prog(__progname);
|
||||
static const std::string filename = "logs/udpDos-" + prog + ".log";
|
||||
std::string reason;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 1:
|
||||
default:
|
||||
reason = "repeat connect attempts";
|
||||
break;
|
||||
case 2:
|
||||
reason = "junk data";
|
||||
break;
|
||||
}
|
||||
|
||||
std::ofstream log_file(filename, std::ios_base::out | std::ios_base::app );
|
||||
log_file << "Ignoring potential DoS attack (" << reason << ") from " << clientIp.GetV4Address() << " (strike " << blacklist[clientAddr] << " of " << strikeOut << ")\n";
|
||||
log_file.close();
|
||||
|
||||
if (blacklist[clientAddr] == strikeOut)
|
||||
{
|
||||
disconnectByIp(clientAddr);
|
||||
}
|
||||
}
|
||||
|
||||
UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const
|
||||
{
|
||||
UdpConnection *found = static_cast<UdpConnection *>(mAddressHashTable->FindFirst(AddressHashValue(ip, port)));
|
||||
|
||||
-21
@@ -2,7 +2,6 @@
|
||||
#define UDPLIBRARY_HPP
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "UdpHandler.hpp"
|
||||
#include "priority.hpp"
|
||||
@@ -101,7 +100,6 @@ class UdpIpAddress
|
||||
public:
|
||||
UdpIpAddress(unsigned int ip = 0);
|
||||
unsigned int GetAddress() const { return(mIp); }
|
||||
char *GetV4Address() const;
|
||||
char *GetAddress(char *buffer) const;
|
||||
bool operator==(const UdpIpAddress& e) const { return(mIp == e.mIp); }
|
||||
protected:
|
||||
@@ -926,9 +924,6 @@ class UdpManager
|
||||
// to explicitly call this function.
|
||||
LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0);
|
||||
|
||||
// is the given unsigned int expressed ip blacklisted?
|
||||
bool isBlacklisted(unsigned int);
|
||||
|
||||
protected:
|
||||
friend class PooledLogicalPacket;
|
||||
void PoolReturn(PooledLogicalPacket *packet); // so pooled packets can add themselves back to the pool
|
||||
@@ -1045,22 +1040,6 @@ class UdpManager
|
||||
// typically it is recommended that all UdpConnection objects be destroyed before destroying this manager object
|
||||
|
||||
int mRefCount;
|
||||
|
||||
// number of strikes
|
||||
static const int strikeOut = 3;
|
||||
|
||||
// actual count of connections for a given ip
|
||||
std::unordered_map<unsigned int, int> mIpConnectionCount;
|
||||
|
||||
|
||||
// count of strikes against a given ip - 3 successive DoS attempts and they are banned til next restart at best
|
||||
std::unordered_map<unsigned int, int> blacklist;
|
||||
|
||||
// does what it says
|
||||
void disconnectByIp (unsigned int);
|
||||
|
||||
// add a strike
|
||||
void addStrike(UdpIpAddress clientIp, int type);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+12
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Version: 1.3
|
||||
* Version: 1.5
|
||||
*
|
||||
* This code is just a simple wrapper around nlohmann's wonderful json lib
|
||||
* (https://github.com/nlohmann/json) and libcurl. While originally included directly,
|
||||
@@ -55,6 +55,15 @@ std::string webAPI::getString(const std::string &slot) {
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
std::vector<std::string> webAPI::getStringVector(const std::string &slot) {
|
||||
if (!this->responseData.empty() && !slot.empty() && responseData.count(slot) &&
|
||||
!this->responseData[slot].is_null()) {
|
||||
return this->responseData[slot].get<std::vector<std::string>>();
|
||||
}
|
||||
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
bool webAPI::submit(const int &reqType, const int &getPost, const int &respType) {
|
||||
if (reqType == DTYPE::JSON) // json request
|
||||
{
|
||||
@@ -99,7 +108,8 @@ bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for
|
||||
slist = curl_slist_append(slist, "charsets: utf-8");
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); // place the data into readBuffer using writeCallback
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
|
||||
writeCallback); // place the data into readBuffer using writeCallback
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); // specify readBuffer as the container for data
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
|
||||
|
||||
|
||||
Vendored
+12
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Version: 1.4
|
||||
* Version: 1.5
|
||||
*
|
||||
* This code is just a simple wrapper around nlohmann's wonderful json lib
|
||||
* (https://github.com/nlohmann/json) and libcurl. While originally included directly,
|
||||
@@ -23,7 +23,9 @@
|
||||
#ifdef WIN32
|
||||
#include <curl.h>
|
||||
#else
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#endif
|
||||
|
||||
namespace StellaBellum {
|
||||
@@ -45,7 +47,8 @@ namespace StellaBellum {
|
||||
~webAPI();
|
||||
|
||||
// submits the request
|
||||
bool submit(const int &reqType = DTYPE::JSON, const int &getPost = HTTP::POST, const int &respType = DTYPE::JSON);
|
||||
bool
|
||||
submit(const int &reqType = DTYPE::JSON, const int &getPost = HTTP::POST, const int &respType = DTYPE::JSON);
|
||||
|
||||
// set the endpoint after object creation...or change the target if needed
|
||||
bool setEndpoint(const std::string endpoint);
|
||||
@@ -59,8 +62,12 @@ namespace StellaBellum {
|
||||
// get a string from a given slot
|
||||
std::string getString(const std::string &slot);
|
||||
|
||||
// get a vector of strings from a given slot
|
||||
std::vector<std::string> getStringVector(const std::string &slot);
|
||||
|
||||
// set json key and value for request
|
||||
template<typename T> bool addJsonData(const std::string &key, const T &value) {
|
||||
template<typename T>
|
||||
bool addJsonData(const std::string &key, const T &value) {
|
||||
if (!key.empty() &&
|
||||
responseData.count(key) == 0) // only alow one of a given key for now, unless we support nesting later
|
||||
{
|
||||
@@ -72,7 +79,8 @@ namespace StellaBellum {
|
||||
}
|
||||
|
||||
// get json response slot
|
||||
template<typename T> T getNullableValue(const std::string &slot) {
|
||||
template<typename T>
|
||||
T getNullableValue(const std::string &slot) {
|
||||
if (!this->responseData.empty() && !slot.empty() && responseData.count(slot)) {
|
||||
return this->responseData[slot].get<T>();
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
using namespace StellaBellum;
|
||||
|
||||
webAPIHeartbeat::webAPIHeartbeat() {
|
||||
std::string filePath = this->get_selfpath().c_str();
|
||||
std::string filePath = this->get_selfpath();
|
||||
|
||||
webAPI api(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap").decrypt()),
|
||||
std::string(vxENCRYPT("StellaBellum WebAPI Metrics Sender").decrypt()));
|
||||
|
||||
@@ -325,12 +325,8 @@ ObjvarBuffer::updateObjvars(const NetworkId &objectId, const std::vector <Dynami
|
||||
|
||||
void ObjvarBuffer::removeObject(const NetworkId &object) {
|
||||
DataType::iterator i = m_data.lower_bound(IndexKey(object, 0));
|
||||
while (i != m_data.end()) {
|
||||
if (i->first.m_objectId == object) {
|
||||
i = m_data.erase(i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
while (i != m_data.end() && i->first.m_objectId==object) {
|
||||
i = m_data.erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ as
|
||||
select nvl(max(id)+1,1), p_cluster_name,p_address,'N','N','N',1,
|
||||
2500,250,'Y',350
|
||||
from cluster_list;
|
||||
|
||||
|
||||
select id
|
||||
into p_cluster_id
|
||||
from cluster_list
|
||||
@@ -30,7 +30,7 @@ as
|
||||
begin
|
||||
select account_limit into maxCharacterPerAccount
|
||||
from default_char_limits;
|
||||
|
||||
|
||||
open result_cursor for
|
||||
select id, name, address, port, secret, locked, not_recommended, maxCharacterPerAccount,
|
||||
online_player_limit,online_free_trial_limit,free_trial_can_create_char,online_tutorial_limit
|
||||
@@ -74,7 +74,7 @@ as
|
||||
into over_account_limit, over_cluster_limit
|
||||
from
|
||||
(select count(*) num from swg_characters
|
||||
where station_id = p_station_id and enabled ='Y' and cluster_id not in (select id from cluster_list where name in ('Corbantis', 'Europe-Infinity', 'Intrepid', 'Kauri', 'Kettemoor', 'Lowca', 'Naritus', 'Scylla', 'Tarquinas', 'Tempest', 'Valcyn', 'Wanderhome', 'Japan-Katana', 'Japan-Harla'))) account_counter,
|
||||
where (station_id = p_station_id OR station_id IN (SELECT CASE WHEN child_id = p_station_id THEN parent_id ELSE child_id END as station_id FROM account_map WHERE parent_id = p_station_id OR child_id = p_station_id)) and enabled ='Y') account_counter,
|
||||
default_char_limits,
|
||||
cluster_list
|
||||
where
|
||||
@@ -90,7 +90,7 @@ as
|
||||
end if;
|
||||
|
||||
-- if not, return the number of each type of character we're allowed to create
|
||||
|
||||
|
||||
open result_cursor for
|
||||
select limits.character_type_id, limits.limit - nvl(existing.num,0) remaining_slots
|
||||
from
|
||||
@@ -111,7 +111,7 @@ as
|
||||
|
||||
return result_cursor;
|
||||
end;
|
||||
|
||||
|
||||
-- unlike get_open_character_slots, this function ignores account and cluster limits
|
||||
function get_only_open_character_slots(p_station_id number, p_cluster_id number) return refcursor
|
||||
as
|
||||
@@ -139,16 +139,16 @@ as
|
||||
|
||||
return result_cursor;
|
||||
end;
|
||||
|
||||
|
||||
function is_cluster_at_limit(p_cluster_id number) return number
|
||||
as
|
||||
as
|
||||
v_cluster_limit number;
|
||||
v_num_characters number;
|
||||
begin
|
||||
select cluster_limit
|
||||
into v_cluster_limit
|
||||
from default_char_limits;
|
||||
|
||||
|
||||
select num_characters
|
||||
into v_num_characters
|
||||
from cluster_list
|
||||
@@ -164,9 +164,9 @@ as
|
||||
when others then
|
||||
return 0;
|
||||
end;
|
||||
|
||||
|
||||
function is_account_at_limit(p_station_id number) return number
|
||||
as
|
||||
as
|
||||
v_account_limit number;
|
||||
v_num_characters number;
|
||||
begin
|
||||
@@ -218,7 +218,7 @@ as
|
||||
begin
|
||||
insert into swg_characters (station_id, cluster_id, character_name, object_id, template_id, character_type)
|
||||
values (p_station_id, p_cluster_id, p_character_name, p_character_id, p_template_id, p_character_type);
|
||||
|
||||
|
||||
update cluster_list
|
||||
set num_characters = nvl(num_characters,0) + 1
|
||||
where cluster_list.id = p_cluster_id;
|
||||
@@ -231,7 +231,7 @@ as
|
||||
where cluster_id = p_cluster_id
|
||||
and station_id = p_station_id
|
||||
and character_name = p_character_name;
|
||||
end;
|
||||
end;
|
||||
|
||||
function restore_character(p_cluster_id number, p_station_id number, p_character_name varchar2, p_character_id number, p_template_id number, p_character_type number) return number
|
||||
-- Return codes:
|
||||
@@ -245,7 +245,7 @@ as
|
||||
begin
|
||||
insert into swg_characters (station_id, cluster_id, character_name, object_id, template_id, character_type)
|
||||
values (p_station_id, p_cluster_id, p_character_name, p_character_id, p_template_id, p_character_type);
|
||||
|
||||
|
||||
update cluster_list
|
||||
set num_characters = nvl(num_characters,0) + 1
|
||||
where cluster_list.id = p_cluster_id;
|
||||
@@ -282,7 +282,7 @@ as
|
||||
exception
|
||||
when others then
|
||||
return 3;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure set_character_slots(p_cluster_id number, p_station_id number, p_slot_type number, p_num_slots number)
|
||||
as
|
||||
@@ -308,14 +308,14 @@ as
|
||||
and cluster_id = p_cluster_id
|
||||
and object_id = p_character_id;
|
||||
end;
|
||||
|
||||
|
||||
function has_extra_character_slot(p_station_id number, p_character_type number) return number
|
||||
as
|
||||
rows number;
|
||||
total number;
|
||||
begin
|
||||
select count(*), sum(num_extra_slots)
|
||||
into rows, total
|
||||
into rows, total
|
||||
from extra_character_slots
|
||||
where station_id = p_station_id
|
||||
and character_type_id = p_character_type;
|
||||
@@ -399,7 +399,7 @@ as
|
||||
|
||||
return result_cursor;
|
||||
end;
|
||||
|
||||
|
||||
function get_claimed_reward_items(p_station_id number) return refcursor
|
||||
as
|
||||
result_cursor refcursor;
|
||||
@@ -436,7 +436,7 @@ as
|
||||
if ((p_cluster_id=previous_claim_cluster) and (p_character_id=previous_claim_character)) then
|
||||
return 1;
|
||||
end if;
|
||||
|
||||
|
||||
return 0;
|
||||
end;
|
||||
when others then
|
||||
@@ -467,7 +467,7 @@ as
|
||||
if ((p_cluster_id=previous_claim_cluster) and (p_character_id=previous_claim_character)) then
|
||||
return 1;
|
||||
end if;
|
||||
|
||||
|
||||
return 0;
|
||||
exception
|
||||
when others then
|
||||
@@ -476,7 +476,7 @@ as
|
||||
when others then
|
||||
return 0;
|
||||
end;
|
||||
|
||||
|
||||
function get_feature_id_transactions(p_station_id in number, p_cluster_id in number, p_character_id in number) return refcursor
|
||||
as
|
||||
result_cursor refcursor;
|
||||
@@ -488,7 +488,7 @@ as
|
||||
|
||||
return result_cursor;
|
||||
end;
|
||||
|
||||
|
||||
function update_feature_id_transaction(p_station_id in number, p_cluster_id in number, p_character_id in number, p_item_id in varchar2, p_count_adjustment in number) return number
|
||||
as
|
||||
begin
|
||||
@@ -503,12 +503,11 @@ as
|
||||
insert into feature_id_transactions (station_id, cluster_id, character_id, item_id, date_updated, count)
|
||||
values (p_station_id, p_cluster_id, p_character_id, p_item_id, sysdate, p_count_adjustment);
|
||||
end if;
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
exception
|
||||
when others then
|
||||
return 0;
|
||||
end;
|
||||
end;
|
||||
/
|
||||
end;
|
||||
@@ -1 +1,9 @@
|
||||
CREATE TABLE "ACCOUNT_MAP"
|
||||
(
|
||||
"PARENT_ID" NUMBER(38,0) NOT NULL ENABLE,
|
||||
"CHILD_ID" NUMBER(38,0) NOT NULL ENABLE,
|
||||
CONSTRAINT "ACCOUNT_MAP_UK1" UNIQUE ("CHILD_ID", "PARENT_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX2" ON "ACCOUNT_MAP" ("CHILD_ID","PARENT_ID")),
|
||||
CONSTRAINT "ACCOUNT_MAP_UK2" UNIQUE ("CHILD_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX1" ON "ACCOUNT_MAP" ("CHILD_ID"))
|
||||
);
|
||||
|
||||
update version_number set version_number=270, min_version_number=270;
|
||||
|
||||
Reference in New Issue
Block a user